text: 
  (function (global, factory) {
      typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
      typeof define === 'function' && define.amd ? define(['exports'], factory) :
      (factory((global.ThreeGeo = {})));
  }(this, (function (exports) { 'use strict';
      var ThreeGeo=function(n){var r={};function i(t){if(r[t])return r[t].exports;var e=r[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,i),e.l=!0,e.exports}return i.m=n,i.c=r,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=71)}([function(t,o,e){"use strict";function a(t,e,n){void 0===n&&(n={});var r={type:"Feature"};return(0===n.id||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function r(t,e,n){return void 0===n&&(n={}),a({type:"Point",coordinates:t},e,n)}function i(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){void 0===e&&(e={});var n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}function l(t,e,n){return void 0===n&&(n={}),a({type:"MultiLineString",coordinates:t},e,n)}function h(t,e,n){return void 0===n&&(n={}),a({type:"MultiPoint",coordinates:t},e,n)}function c(t,e,n){return void 0===n&&(n={}),a({type:"MultiPolygon",coordinates:t},e,n)}function p(t,e){void 0===e&&(e="kilometers");var n=o.factors[e];if(!n)throw new Error(e+" units is invalid");return t*n}function f(t,e){void 0===e&&(e="kilometers");var n=o.factors[e];if(!n)throw new Error(e+" units is invalid");return t/n}function n(t){return 180*(t%(2*Math.PI))/Math.PI}function g(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)&&!/^\s*$/.test(t)}Object.defineProperty(o,"__esModule",{value:!0}),o.earthRadius=6371008.8,o.factors={centimeters:100*o.earthRadius,centimetres:100*o.earthRadius,degrees:o.earthRadius/111325,feet:3.28084*o.earthRadius,inches:39.37*o.earthRadius,kilometers:o.earthRadius/1e3,kilometres:o.earthRadius/1e3,meters:o.earthRadius,metres:o.earthRadius,miles:o.earthRadius/1609.344,millimeters:1e3*o.earthRadius,millimetres:1e3*o.earthRadius,nauticalmiles:o.earthRadius/1852,radians:1,yards:o.earthRadius/1.0936},o.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/o.earthRadius,yards:1/1.0936},o.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046},o.feature=a,o.geometry=function(t,e,n){switch(void 0===n&&(n={}),t){case"Point":return r(e).geometry;case"LineString":return s(e).geometry;case"Polygon":return i(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")}},o.point=r,o.points=function(t,e,n){return void 0===n&&(n={}),u(t.map(function(t){return r(t,e)}),n)},o.polygon=i,o.polygons=function(t,e,n){return void 0===n&&(n={}),u(t.map(function(t){return i(t,e)}),n)},o.lineString=s,o.lineStrings=function(t,e,n){return void 0===n&&(n={}),u(t.map(function(t){return s(t,e)}),n)},o.featureCollection=u,o.multiLineString=l,o.multiPoint=h,o.multiPolygon=c,o.geometryCollection=function(t,e,n){return void 0===n&&(n={}),a({type:"GeometryCollection",geometries:t},e,n)},o.round=function(t,e){if(void 0===e&&(e=0),e&&!(0<=e))throw new Error("precision must be a positive number");var n=Math.pow(10,e||0);return Math.round(t*n)/n},o.radiansToLength=p,o.lengthToRadians=f,o.lengthToDegrees=function(t,e){return n(f(t,e))},o.bearingToAzimuth=function(t){var e=t%360;return e<0&&(e+=360),e},o.radiansToDegrees=n,o.degreesToRadians=function(t){return t%360*Math.PI/180},o.convertLength=function(t,e,n){if(void 0===e&&(e="kilometers"),void 0===n&&(n="kilometers"),!(0<=t))throw new Error("length must be a positive number");return p(f(t,e),n)},o.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");var r=o.areaFactors[e];if(!r)throw new Error("invalid original units");var i=o.areaFactors[n];if(!i)throw new Error("invalid final units");return t/r*i},o.isNumber=g,o.isObject=function(t){return!!t&&t.constructor===Object},o.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")})},o.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")},o.radians2degrees=function(){throw new Error("method has been renamed to `radiansToDegrees`")},o.degrees2radians=function(){throw new Error("method has been renamed to `degreesToRadians`")},o.distanceToDegrees=function(){throw new Error("method has been renamed to `lengthToDegrees`")},o.distanceToRadians=function(){throw new Error("method has been renamed to `lengthToRadians`")},o.radiansToDistance=function(){throw new Error("method has been renamed to `radiansToLength`")},o.bearingToAngle=function(){throw new Error("method has been renamed to `bearingToAzimuth`")},o.convertDistance=function(){throw new Error("method has been renamed to `convertLength`")}},function(Gb,Hb){var Ib;Ib=function(){return this}();try{Ib=Ib||Function("return this")()||eval("this")}catch(t){"object"==typeof window&&(Ib=window)}Gb.exports=Ib},function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();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){var t=a(p);h=!0;for(var e=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(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(t)}}function g(t,e){this.fun=t,this.array=e}function d(){}i.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)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=d,i.addListener=d,i.once=d,i.off=d,i.removeListener=d,i.removeAllListeners=d,i.emit=d,i.prependListener=d,i.prependOnceListener=d,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,n){"use strict";var r=n(8),i=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=c;var o=n(6);o.inherits=n(4);var s=n(26),a=n(14);o.inherits(c,s);for(var u=i(a.prototype),l=0;l<u.length;l++){var h=u[l];c.prototype[h]||(c.prototype[h]=a.prototype[h])}function c(t){if(!(this instanceof c))return new c(t);s.call(this,t),a.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",p)}function p(){this.allowHalfOpen||this._writableState.ended||r.nextTick(f,this)}function f(t){t.end()}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),c.prototype._destroy=function(t,e){this.push(null),this.end(),r.nextTick(e,t)}},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0);e.getCoord=function(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")},e.getCoords=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")},e.containsNumber=function t(e){if(1<e.length&&r.isNumber(e[0])&&r.isNumber(e[1]))return!0;if(Array.isArray(e[0])&&e[0].length)return t(e[0]);throw new Error("coordinates must only contain numbers")},e.geojsonType=function(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)},e.featureOf=function(t,e,n){if(!t)throw new Error("No feature passed");if(!n)throw new Error(".featureOf() requires a name");if(!t||"Feature"!==t.type||!t.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.geometry.type)},e.collectionOf=function(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)}},e.getGeom=function(t){return"Feature"===t.type?t.geometry:t},e.getType=function(t,e){return"FeatureCollection"===t.type?"FeatureCollection":"GeometryCollection"===t.type?"GeometryCollection":"Feature"===t.type&&null!==t.geometry?t.geometry.type:t.type}},function(t,n,e){(function(t){function e(t){return Object.prototype.toString.call(t)}n.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===e(t)},n.isBoolean=function(t){return"boolean"==typeof t},n.isNull=function(t){return null===t},n.isNullOrUndefined=function(t){return null==t},n.isNumber=function(t){return"number"==typeof t},n.isString=function(t){return"string"==typeof t},n.isSymbol=function(t){return"symbol"==typeof t},n.isUndefined=function(t){return void 0===t},n.isRegExp=function(t){return"[object RegExp]"===e(t)},n.isObject=function(t){return"object"==typeof t&&null!==t},n.isDate=function(t){return"[object Date]"===e(t)},n.isError=function(t){return"[object Error]"===e(t)||t instanceof Error},n.isFunction=function(t){return"function"==typeof t},n.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},n.isBuffer=t.isBuffer}).call(this,e(7).Buffer)},function(t,B,e){"use strict";(function(t){
  /*!
   * The buffer module from node.js, for the browser.
   *
   * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
   * @license  MIT
   */
  var r=e(47),o=e(21),s=e(24);function n(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(n()<e)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=c.prototype:(null===t&&(t=new c(e)),t.length=e),t}function c(t,e,n){if(!(c.TYPED_ARRAY_SUPPORT||this instanceof c))return new c(t,e,n);if("number"!=typeof t)return i(this,t,e,n);if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return l(this,t)}function i(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,r){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");e=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r);c.TYPED_ARRAY_SUPPORT?(t=e).__proto__=c.prototype:t=h(t,e);return t}(t,e,n,r):"string"==typeof e?function(t,e,n){"string"==typeof n&&""!==n||(n="utf8");if(!c.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|f(e,n),i=(t=a(t,r)).write(e,n);i!==r&&(t=t.slice(0,i));return t}(t,e,n):function(t,e){if(c.isBuffer(e)){var n=0|p(e.length);return 0===(t=a(t,n)).length||e.copy(t,0,0,n),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(r=e.length)!=r?a(t,0):h(t,e);if("Buffer"===e.type&&s(e.data))return h(t,e.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function u(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function l(t,e){if(u(e),t=a(t,e<0?0:0|p(e)),!c.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function h(t,e){var n=e.length<0?0:0|p(e.length);t=a(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function p(t){if(t>=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|t}function f(t,e){if(c.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return D(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return F(t).length;default:if(r)return D(t).length;e=(""+e).toLowerCase(),r=!0}}function g(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function d(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):2147483647<n?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=c.from(e,r)),c.isBuffer(e))return 0===e.length?-1:y(t,e,n,r,i);if("number"==typeof e)return e&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):y(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function y(t,e,n,r,i){var o,s=1,a=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a/=s=2,u/=2,n/=2}function l(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var h=-1;for(o=n;o<a;o++)if(l(t,o)===l(e,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===u)return h*s}else-1!==h&&(o-=o-h),h=-1}else for(a<n+u&&(n=a-u),o=n;0<=o;o--){for(var c=!0,p=0;p<u;p++)if(l(t,o+p)!==l(e,p)){c=!1;break}if(c)return o}return-1}function _(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?i<(r=Number(r))&&(r=i):r=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");o/2<r&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[n+s]=a}return s}function v(t,e,n,r){return k(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function m(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function b(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o,s,a,u,l=t[i],h=null,c=239<l?4:223<l?3:191<l?2:1;if(i+c<=n)switch(c){case 1:l<128&&(h=l);break;case 2:128==(192&(o=t[i+1]))&&127<(u=(31&l)<<6|63&o)&&(h=u);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&2047<(u=(15&l)<<12|(63&o)<<6|63&s)&&(u<55296||57343<u)&&(h=u);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&65535<(u=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)&&u<1114112&&(h=u)}null===h?(h=65533,c=1):65535<h&&(h-=65536,r.push(h>>>10&1023|55296),h=56320|1023&h),r.push(h),i+=c}return function(t){var e=t.length;if(e<=E)return String.fromCharCode.apply(String,t);var n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=E));return n}(r)}B.Buffer=c,B.SlowBuffer=function(t){+t!=t&&(t=0);return c.alloc(+t)},B.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),B.kMaxLength=n(),c.poolSize=8192,c._augment=function(t){return t.__proto__=c.prototype,t},c.from=function(t,e,n){return i(null,t,e,n)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(t,e,n){return r=null,o=e,s=n,u(i=t),i<=0?a(r,i):void 0!==o?"string"==typeof s?a(r,i).fill(o,s):a(r,i).fill(o):a(r,i);var r,i,o,s},c.allocUnsafe=function(t){return l(null,t)},c.allocUnsafeSlow=function(t){return l(null,t)},c.isBuffer=function(t){return!(null==t||!t._isBuffer)},c.compare=function(t,e){if(!c.isBuffer(t)||!c.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},c.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(t,e){if(!s(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return c.alloc(0);var n;if(void 0===e)for(n=e=0;n<t.length;++n)e+=t[n].length;var r=c.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){var o=t[n];if(!c.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},c.byteLength=f,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)g(this,e,e+1);return this},c.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},c.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},c.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?b(this,0,t):function(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return I(this,e,n);case"utf8":case"utf-8":return b(this,e,n);case"ascii":return w(this,e,n);case"latin1":case"binary":return x(this,e,n);case"base64":return m(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}.apply(this,arguments)},c.prototype.equals=function(t){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===c.compare(this,t)},c.prototype.inspect=function(){var t="",e=B.INSPECT_MAX_BYTES;return 0<this.length&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},c.prototype.compare=function(t,e,n,r,i){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(i<=r&&n<=e)return 0;if(i<=r)return-1;if(n<=e)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0),a=Math.min(o,s),u=this.slice(r,i),l=t.slice(e,n),h=0;h<a;++h)if(u[h]!==l[h]){o=u[h],s=l[h];break}return o<s?-1:s<o?1:0},c.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},c.prototype.indexOf=function(t,e,n){return d(this,t,e,n,!0)},c.prototype.lastIndexOf=function(t,e,n){return d(this,t,e,n,!1)},c.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||i<n)&&(n=i),0<t.length&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o,s,a,u,l,h,c,p,f,g=!1;;)switch(r){case"hex":return _(this,t,e,n);case"utf8":case"utf-8":return p=e,f=n,k(D(t,(c=this).length-p),c,p,f);case"ascii":return v(this,t,e,n);case"latin1":case"binary":return v(this,t,e,n);case"base64":return u=this,l=e,h=n,k(F(t),u,l,h);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s=e,a=n,k(function(t,e){for(var n,r,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)n=t.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(t,(o=this).length-s),o,s,a);default:if(g)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),g=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var E=4096;function w(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function x(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function I(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||r<n)&&(n=r);for(var i="",o=e;o<n;++o)i+=A(t[o]);return i}function N(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function S(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(n<t+e)throw new RangeError("Trying to access beyond buffer length")}function C(t,e,n,r,i,o){if(!c.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(i<e||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function L(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-n,2);i<o;++i)t[n+i]=(e&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function T(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-n,4);i<o;++i)t[n+i]=e>>>8*(r?i:3-i)&255}function R(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function O(t,e,n,r,i){return i||R(t,0,n,4),o.write(t,e,n,r,23,4),n+4}function P(t,e,n,r,i){return i||R(t,0,n,8),o.write(t,e,n,r,52,8),n+8}c.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):r<t&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):r<e&&(e=r),e<t&&(e=t),c.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=c.prototype;else{var i=e-t;n=new c(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+t]}return n},c.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||S(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r},c.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||S(t,e,this.length);for(var r=this[t+--e],i=1;0<e&&(i*=256);)r+=this[t+--e]*i;return r},c.prototype.readUInt8=function(t,e){return e||S(t,1,this.length),this[t]},c.prototype.readUInt16LE=function(t,e){return e||S(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUInt16BE=function(t,e){return e||S(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUInt32LE=function(t,e){return e||S(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUInt32BE=function(t,e){return e||S(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||S(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return(i*=128)<=r&&(r-=Math.pow(2,8*e)),r},c.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||S(t,e,this.length);for(var r=e,i=1,o=this[t+--r];0<r&&(i*=256);)o+=this[t+--r]*i;return(i*=128)<=o&&(o-=Math.pow(2,8*e)),o},c.prototype.readInt8=function(t,e){return e||S(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){e||S(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(t,e){e||S(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(t,e){return e||S(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,e){return e||S(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readFloatLE=function(t,e){return e||S(t,4,this.length),o.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return e||S(t,4,this.length),o.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return e||S(t,8,this.length),o.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return e||S(t,8,this.length),o.read(this,t,!1,52,8)},c.prototype.writeUIntLE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||C(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},c.prototype.writeUIntBE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||C(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[e+i]=255&t;0<=--i&&(o*=256);)this[e+i]=t/o&255;return e+n},c.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,1,255,0),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},c.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):L(this,t,e,!0),e+2},c.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):L(this,t,e,!1),e+2},c.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):T(this,t,e,!0),e+4},c.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):T(this,t,e,!1),e+4},c.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);C(this,t,e,n,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<n&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},c.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);C(this,t,e,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[e+o]=255&t;0<=--o&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},c.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,1,127,-128),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},c.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):L(this,t,e,!0),e+2},c.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):L(this,t,e,!1),e+2},c.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):T(this,t,e,!0),e+4},c.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):T(this,t,e,!1),e+4},c.prototype.writeFloatLE=function(t,e,n){return O(this,t,e,!0,n)},c.prototype.writeFloatBE=function(t,e,n){return O(this,t,e,!1,n)},c.prototype.writeDoubleLE=function(t,e,n){return P(this,t,e,!0,n)},c.prototype.writeDoubleBE=function(t,e,n){return P(this,t,e,!1,n)},c.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),0<r&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i,o=r-n;if(this===t&&n<e&&e<r)for(i=o-1;0<=i;--i)t[i+e]=this[i+n];else if(o<1e3||!c.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+o),e);return o},c.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var o;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o<n;++o)this[o]=t;else{var s=c.isBuffer(t)?t:D(new c(t,r).toString()),a=s.length;for(o=0;o<n-e;++o)this[o+e]=s[o%a]}return this};var M=/[^+\/0-9A-Za-z-_]/g;function A(t){return t<16?"0"+t.toString(16):t.toString(16)}function D(t,e){var n;e=e||1/0;for(var r=t.length,i=null,o=[],s=0;s<r;++s){if(55295<(n=t.charCodeAt(s))&&n<57344){if(!i){if(56319<n){-1<(e-=3)&&o.push(239,191,189);continue}if(s+1===r){-1<(e-=3)&&o.push(239,191,189);continue}i=n;continue}if(n<56320){-1<(e-=3)&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&-1<(e-=3)&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function F(t){return r.toByteArray(function(t){var e;if((t=(e=t,e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")).replace(M,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function k(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}}).call(this,e(1))},function(t,e,n){"use strict";(function(a){!a.version||0===a.version.indexOf("v0.")||0===a.version.indexOf("v1.")&&0!==a.version.indexOf("v1.8.")?t.exports={nextTick:function(t,e,n,r){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var i,o,s=arguments.length;switch(s){case 0:case 1:return a.nextTick(t);case 2:return a.nextTick(function(){t.call(null,e)});case 3:return a.nextTick(function(){t.call(null,e,n)});case 4:return a.nextTick(function(){t.call(null,e,n,r)});default:for(i=new Array(s-1),o=0;o<i.length;)i[o++]=arguments[o];return a.nextTick(function(){t.apply(null,i)})}}}:t.exports=a}).call(this,n(2))},function(t,e,n){var r=n(7),i=r.Buffer;function o(t,e){for(var n in t)e[n]=t[n]}function s(t,e,n){return i(t,e,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=r:(o(r,e),e.Buffer=s),o(i,s),s.from=function(t,e,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,n)},s.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var r=i(t);return void 0!==e?"string"==typeof n?r.fill(e,n):r.fill(e):r.fill(0),r},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}},function(t,e,n){!function(t){"use strict";function e(){}function n(t){this.message=t||""}function r(t){this.message=t||""}function i(t){this.message=t||""}function o(){}function s(t){return null===t?At:t.color}function a(t){return null===t?null:t.parent}function u(t,e){null!==t&&(t.color=e)}function l(t){return null===t?null:t.left}function h(t){return null===t?null:t.right}function c(){this.root_=null,this.size_=0}function p(){}function f(){this.array_=[],arguments[0]instanceof bt&&this.addAll(arguments[0])}function g(){}function d(t){this.message=t||""}function y(){this.array_=[]}"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");var e=Object(this),n=Math.max(Math.min(e.length,9007199254740991),0)||0,r=1 in arguments&&parseInt(Number(arguments[1]),10)||0;r=r<0?Math.max(n+r,0):Math.min(r,n);var i=2 in arguments&&void 0!==arguments[2]?parseInt(Number(arguments[2]),10)||0:n;for(i=i<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)};var _=function(){};_.prototype.interfaces_=function(){return[]},_.prototype.getClass=function(){return _},_.prototype.equalsWithTolerance=function(t,e,n){return Math.abs(t-e)<=n};var v=function(e){function t(t){e.call(this,t),this.name="IllegalArgumentException",this.message=t,this.stack=(new e).stack}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t}(Error),m=function(){},b={MAX_VALUE:{configurable:!0}};m.isNaN=function(t){return Number.isNaN(t)},m.doubleToLongBits=function(t){return t},m.longBitsToDouble=function(t){return t},m.isInfinite=function(t){return!Number.isFinite(t)},b.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(m,b);var E=function(){},w=function(){},x=function(){},I=function t(){if(this.x=null,this.y=null,this.z=null,0===arguments.length)this.x=0,this.y=0,this.z=t.NULL_ORDINATE;else if(1===arguments.length){var e=arguments[0];this.x=e.x,this.y=e.y,this.z=e.z}else 2===arguments.length?(this.x=arguments[0],this.y=arguments[1],this.z=t.NULL_ORDINATE):3===arguments.length&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},N={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};I.prototype.setOrdinate=function(t,e){switch(t){case I.X:this.x=e;break;case I.Y:this.y=e;break;case I.Z:this.z=e;break;default:throw new v("Invalid ordinate index: "+t)}},I.prototype.equals2D=function(){if(1===arguments.length){var t=arguments[0];return this.x===t.x&&this.y===t.y}if(2===arguments.length){var e=arguments[0],n=arguments[1];return!!_.equalsWithTolerance(this.x,e.x,n)&&!!_.equalsWithTolerance(this.y,e.y,n)}},I.prototype.getOrdinate=function(t){switch(t){case I.X:return this.x;case I.Y:return this.y;case I.Z:return this.z}throw new v("Invalid ordinate index: "+t)},I.prototype.equals3D=function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||m.isNaN(this.z))&&m.isNaN(t.z)},I.prototype.equals=function(t){return t instanceof I&&this.equals2D(t)},I.prototype.equalInZ=function(t,e){return _.equalsWithTolerance(this.z,t.z,e)},I.prototype.compareTo=function(t){var e=t;return this.x<e.x?-1:this.x>e.x?1:this.y<e.y?-1:this.y>e.y?1:0},I.prototype.clone=function(){},I.prototype.copy=function(){return new I(this)},I.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},I.prototype.distance3D=function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return Math.sqrt(e*e+n*n+r*r)},I.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)},I.prototype.hashCode=function(){var t=17;return t=37*(t=37*t+I.hashCode(this.x))+I.hashCode(this.y)},I.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},I.prototype.interfaces_=function(){return[E,w,e]},I.prototype.getClass=function(){return I},I.hashCode=function(){if(1===arguments.length){var t=arguments[0],e=m.doubleToLongBits(t);return Math.trunc((e^e)>>>32)}},N.DimensionalComparator.get=function(){return S},N.serialVersionUID.get=function(){return 0x5cbf2c235c7e5800},N.NULL_ORDINATE.get=function(){return m.NaN},N.X.get=function(){return 0},N.Y.get=function(){return 1},N.Z.get=function(){return 2},Object.defineProperties(I,N);var S=function(t){if(this._dimensionsToTest=2,0===arguments.length);else if(1===arguments.length){var e=t;if(2!==e&&3!==e)throw new v("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};S.prototype.compare=function(t,e){var n=t,r=e,i=S.compare(n.x,r.x);if(0!==i)return i;var o=S.compare(n.y,r.y);return 0!==o?o:this._dimensionsToTest<=2?0:S.compare(n.z,r.z)},S.prototype.interfaces_=function(){return[x]},S.prototype.getClass=function(){return S},S.compare=function(t,e){return t<e?-1:e<t?1:m.isNaN(t)?m.isNaN(e)?0:-1:m.isNaN(e)?1:0};var C=function(){};C.prototype.create=function(){},C.prototype.interfaces_=function(){return[]},C.prototype.getClass=function(){return C};var L=function(){},T={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};L.prototype.interfaces_=function(){return[]},L.prototype.getClass=function(){return L},L.toLocationSymbol=function(t){switch(t){case L.EXTERIOR:return"e";case L.BOUNDARY:return"b";case L.INTERIOR:return"i";case L.NONE:return"-"}throw new v("Unknown location value: "+t)},T.INTERIOR.get=function(){return 0},T.BOUNDARY.get=function(){return 1},T.EXTERIOR.get=function(){return 2},T.NONE.get=function(){return-1},Object.defineProperties(L,T);var R=function(t,e){return t.interfaces_&&-1<t.interfaces_().indexOf(e)},O=function(){},P={LOG_10:{configurable:!0}};O.prototype.interfaces_=function(){return[]},O.prototype.getClass=function(){return O},O.log10=function(t){var e=Math.log(t);return m.isInfinite(e)?e:m.isNaN(e)?e:e/O.LOG_10},O.min=function(t,e,n,r){var i=t;return e<i&&(i=e),n<i&&(i=n),r<i&&(i=r),i},O.clamp=function(){if("number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1],n=arguments[2];return t<e?e:n<t?n:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var r=arguments[0],i=arguments[1],o=arguments[2];return r<i?i:o<r?o:r}},O.wrap=function(t,e){return t<0?e- -t%e:t%e},O.max=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2],r=t;return r<e&&(r=e),r<n&&(r=n),r}if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3],u=i;return u<o&&(u=o),u<s&&(u=s),u<a&&(u=a),u}},O.average=function(t,e){return(t+e)/2},P.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(O,P);var M=function(t){this.str=t};M.prototype.append=function(t){this.str+=t},M.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},M.prototype.toString=function(t){return this.str};var A=function(t){this.value=t};A.prototype.intValue=function(){return this.value},A.prototype.compareTo=function(t){return this.value<t?-1:this.value>t?1:0},A.isNaN=function(t){return Number.isNaN(t)};var D=function(){};D.isWhitespace=function(t){return t<=32&&0<=t||127===t},D.toUpperCase=function(t){return t.toUpperCase()};var F=function t(){if(this._hi=0,(this._lo=0)===arguments.length)this.init(0);else if(1===arguments.length){if("number"==typeof arguments[0]){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof t){var n=arguments[0];this.init(n)}else if("string"==typeof arguments[0]){var r=arguments[0];t.call(this,t.parse(r))}}else if(2===arguments.length){var i=arguments[0],o=arguments[1];this.init(i,o)}},k={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};F.prototype.le=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<=t._lo},F.prototype.extractSignificantDigits=function(t,e){var n=this.abs(),r=F.magnitude(n._hi),i=F.TEN.pow(r);(n=n.divide(i)).gt(F.TEN)?(n=n.divide(F.TEN),r+=1):n.lt(F.ONE)&&(n=n.multiply(F.TEN),r-=1);for(var o=r+1,s=new M,a=F.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,s.append(c),n=n.subtract(F.valueOf(l)).multiply(F.TEN),h&&n.selfAdd(F.TEN);var p=!0,f=F.magnitude(n._hi);if(f<0&&Math.abs(f)>=a-u&&(p=!1),!p)break}return e[0]=r,s.toString()},F.prototype.sqr=function(){return this.multiply(this)},F.prototype.doubleValue=function(){return this._hi+this._lo},F.prototype.subtract=function(){if(arguments[0]instanceof F){var t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){var e=arguments[0];return this.add(-e)}},F.prototype.equals=function(){if(1===arguments.length){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},F.prototype.isZero=function(){return 0===this._hi&&0===this._lo},F.prototype.selfSubtract=function(){if(arguments[0]instanceof F){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}},F.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},F.prototype.min=function(t){return this.le(t)?this:t},F.prototype.selfDivide=function(){if(1===arguments.length){if(arguments[0]instanceof F){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfDivide(e,0)}}else if(2===arguments.length){var n=arguments[0],r=arguments[1],i=null,o=null,s=null,a=null,u=null,l=null,h=null,c=null;return u=this._hi/n,c=(i=(l=F.SPLIT*u)-(i=l-u))*(s=(c=F.SPLIT*n)-(s=c-n))-(h=u*n)+i*(a=n-s)+(o=u-i)*s+o*a,l=(this._hi-h-c+this._lo-u*r)/n,c=u+l,this._hi=c,this._lo=u-c+l,this}},F.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},F.prototype.divide=function(){if(arguments[0]instanceof F){var t=arguments[0],e=null,n=null,r=null,i=null,o=null,s=null,a=null,u=null;return n=(o=this._hi/t._hi)-(e=(s=F.SPLIT*o)-(e=s-o)),u=e*(r=(u=F.SPLIT*t._hi)-(r=u-t._hi))-(a=o*t._hi)+e*(i=t._hi-r)+n*r+n*i,s=(this._hi-a-u+this._lo-o*t._lo)/t._hi,new F(u=o+s,o-u+s)}if("number"==typeof arguments[0]){var l=arguments[0];return m.isNaN(l)?F.createNaN():F.copy(this).selfDivide(l,0)}},F.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},F.prototype.pow=function(t){if(0===t)return F.valueOf(1);var e=new F(this),n=F.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},F.prototype.ceil=function(){if(this.isNaN())return F.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new F(t,e)},F.prototype.compareTo=function(t){var e=t;return this._hi<e._hi?-1:this._hi>e._hi?1:this._lo<e._lo?-1:this._lo>e._lo?1:0},F.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},F.prototype.setValue=function(){if(arguments[0]instanceof F){var t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){var e=arguments[0];return this.init(e),this}},F.prototype.max=function(t){return this.ge(t)?this:t},F.prototype.sqrt=function(){if(this.isZero())return F.valueOf(0);if(this.isNegative())return F.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=F.valueOf(e),r=this.subtract(n.sqr())._hi*(.5*t);return n.add(r)},F.prototype.selfAdd=function(){if(1===arguments.length){if(arguments[0]instanceof F){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0],n=null,r=null,i=null,o=null,s=null,a=null;return i=this._hi+e,s=i-this._hi,o=i-s,o=e-s+(this._hi-o),a=o+this._lo,r=a+(i-(n=i+a)),this._hi=n+r,this._lo=r+(n-this._hi),this}}else if(2===arguments.length){var u=arguments[0],l=arguments[1],h=null,c=null,p=null,f=null,g=null,d=null,y=null;f=this._hi+u,c=this._lo+l,g=f-(d=f-this._hi),p=c-(y=c-this._lo);var _=(h=f+(d=(g=u-d+(this._hi-g))+c))+(d=(p=l-y+(this._lo-p))+(d+(f-h))),v=d+(h-_);return this._hi=_,this._lo=v,this}},F.prototype.selfMultiply=function(){if(1===arguments.length){if(arguments[0]instanceof F){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfMultiply(e,0)}}else if(2===arguments.length){var n=arguments[0],r=arguments[1],i=null,o=null,s=null,a=null,u=null,l=null;i=(u=F.SPLIT*this._hi)-this._hi,l=F.SPLIT*n,i=u-i,o=this._hi-i,s=l-n;var h=(u=this._hi*n)+(l=i*(s=l-s)-u+i*(a=n-s)+o*s+o*a+(this._hi*r+this._lo*n)),c=l+(i=u-h);return this._hi=h,this._lo=c,this}},F.prototype.selfSqr=function(){return this.selfMultiply(this)},F.prototype.floor=function(){if(this.isNaN())return F.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new F(t,e)},F.prototype.negate=function(){return this.isNaN()?this:new F(-this._hi,-this._lo)},F.prototype.clone=function(){},F.prototype.multiply=function(){if(arguments[0]instanceof F){var t=arguments[0];return t.isNaN()?F.createNaN():F.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){var e=arguments[0];return m.isNaN(e)?F.createNaN():F.copy(this).selfMultiply(e,0)}},F.prototype.isNaN=function(){return m.isNaN(this._hi)},F.prototype.intValue=function(){return Math.trunc(this._hi)},F.prototype.toString=function(){var t=F.magnitude(this._hi);return-3<=t&&t<=20?this.toStandardNotation():this.toSciNotation()},F.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!0,e),r=e[0]+1,i=n;if("."===n.charAt(0))i="0"+n;else if(r<0)i="0."+F.stringOfChar("0",-r)+n;else if(-1===n.indexOf(".")){var o=r-n.length;i=n+F.stringOfChar("0",o)+".0"}return this.isNegative()?"-"+i:i},F.prototype.reciprocal=function(){var t=null,e=null,n=null,r=null,i=null,o=null,s=null,a=null;e=(i=1/this._hi)-(t=(o=F.SPLIT*i)-(t=o-i)),n=(a=F.SPLIT*this._hi)-this._hi;var u=i+(o=(1-(s=i*this._hi)-(a=t*(n=a-n)-s+t*(r=this._hi-n)+e*n+e*r)-i*this._lo)/this._hi);return new F(u,i-u+o)},F.prototype.toSciNotation=function(){if(this.isZero())return F.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!1,e),r=F.SCI_NOT_EXPONENT_CHAR+e[0];if("0"===n.charAt(0))throw new Error("Found leading zero: "+n);var i="";1<n.length&&(i=n.substring(1));var o=n.charAt(0)+"."+i;return this.isNegative()?"-"+o+r:o+r},F.prototype.abs=function(){return this.isNaN()?F.NaN:this.isNegative()?this.negate():new F(this)},F.prototype.isPositive=function(){return(0<this._hi||0===this._hi)&&0<this._lo},F.prototype.lt=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<t._lo},F.prototype.add=function(){if(arguments[0]instanceof F){var t=arguments[0];return F.copy(this).selfAdd(t)}if("number"==typeof arguments[0]){var e=arguments[0];return F.copy(this).selfAdd(e)}},F.prototype.init=function(){if(1===arguments.length){if("number"==typeof arguments[0]){var t=arguments[0];this._hi=t,this._lo=0}else if(arguments[0]instanceof F){var e=arguments[0];this._hi=e._hi,this._lo=e._lo}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this._hi=n,this._lo=r}},F.prototype.gt=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>t._lo},F.prototype.isNegative=function(){return(this._hi<0||0===this._hi)&&this._lo<0},F.prototype.trunc=function(){return this.isNaN()?F.NaN:this.isPositive()?this.floor():this.ceil()},F.prototype.signum=function(){return 0<this._hi?1:this._hi<0?-1:0<this._lo?1:this._lo<0?-1:0},F.prototype.interfaces_=function(){return[e,E,w]},F.prototype.getClass=function(){return F},F.sqr=function(t){return F.valueOf(t).selfMultiply(t)},F.valueOf=function(){if("string"==typeof arguments[0]){var t=arguments[0];return F.parse(t)}if("number"==typeof arguments[0]){var e=arguments[0];return new F(e)}},F.sqrt=function(t){return F.valueOf(t).sqrt()},F.parse=function(t){for(var e=0,n=t.length;D.isWhitespace(t.charAt(e));)e++;var r=!1;if(e<n){var i=t.charAt(e);"-"!==i&&"+"!==i||(e++,"-"===i&&(r=!0))}for(var o=new F,s=0,a=0,u=0;!(n<=e);){var l=t.charAt(e);if(e++,D.isDigit(l)){var h=l-"0";o.selfMultiply(F.TEN),o.selfAdd(h),s++}else{if("."!==l){if("e"!==l&&"E"!==l)throw new Error("Unexpected character '"+l+"' at position "+e+" in string "+t);var c=t.substring(e);try{u=A.parseInt(c)}catch(e){throw e instanceof Error?new Error("Invalid exponent "+c+" in string "+t):e}break}a=s}}var p=o,f=s-a-u;if(0===f)p=o;else if(0<f){var g=F.TEN.pow(f);p=o.divide(g)}else if(f<0){var d=F.TEN.pow(-f);p=o.multiply(d)}return r?p.negate():p},F.createNaN=function(){return new F(m.NaN,m.NaN)},F.copy=function(t){return new F(t)},F.magnitude=function(t){var e=Math.abs(t),n=Math.log(e)/Math.log(10),r=Math.trunc(Math.floor(n));return 10*Math.pow(10,r)<=e&&(r+=1),r},F.stringOfChar=function(t,e){for(var n=new M,r=0;r<e;r++)n.append(t);return n.toString()},k.PI.get=function(){return new F(3.141592653589793,12246467991473532e-32)},k.TWO_PI.get=function(){return new F(6.283185307179586,24492935982947064e-32)},k.PI_2.get=function(){return new F(1.5707963267948966,6123233995736766e-32)},k.E.get=function(){return new F(2.718281828459045,14456468917292502e-32)},k.NaN.get=function(){return new F(m.NaN,m.NaN)},k.EPS.get=function(){return 123259516440783e-46},k.SPLIT.get=function(){return 134217729},k.MAX_PRINT_DIGITS.get=function(){return 32},k.TEN.get=function(){return F.valueOf(10)},k.ONE.get=function(){return F.valueOf(1)},k.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},k.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(F,k);var B=function(){},G={DP_SAFE_EPSILON:{configurable:!0}};B.prototype.interfaces_=function(){return[]},B.prototype.getClass=function(){return B},B.orientationIndex=function(t,e,n){var r=B.orientationIndexFilter(t,e,n);if(r<=1)return r;var i=F.valueOf(e.x).selfAdd(-t.x),o=F.valueOf(e.y).selfAdd(-t.y),s=F.valueOf(n.x).selfAdd(-e.x),a=F.valueOf(n.y).selfAdd(-e.y);return i.selfMultiply(a).selfSubtract(o.selfMultiply(s)).signum()},B.signOfDet2x2=function(t,e,n,r){return t.multiply(r).selfSubtract(e.multiply(n)).signum()},B.intersection=function(t,e,n,r){var i=F.valueOf(r.y).selfSubtract(n.y).selfMultiply(F.valueOf(e.x).selfSubtract(t.x)),o=F.valueOf(r.x).selfSubtract(n.x).selfMultiply(F.valueOf(e.y).selfSubtract(t.y)),s=i.subtract(o),a=F.valueOf(r.x).selfSubtract(n.x).selfMultiply(F.valueOf(t.y).selfSubtract(n.y)),u=F.valueOf(r.y).selfSubtract(n.y).selfMultiply(F.valueOf(t.x).selfSubtract(n.x)),l=a.subtract(u).selfDivide(s).doubleValue(),h=F.valueOf(t.x).selfAdd(F.valueOf(e.x).selfSubtract(t.x).selfMultiply(l)).doubleValue(),c=F.valueOf(e.x).selfSubtract(t.x).selfMultiply(F.valueOf(t.y).selfSubtract(n.y)),p=F.valueOf(e.y).selfSubtract(t.y).selfMultiply(F.valueOf(t.x).selfSubtract(n.x)),f=c.subtract(p).selfDivide(s).doubleValue(),g=F.valueOf(n.y).selfAdd(F.valueOf(r.y).selfSubtract(n.y).selfMultiply(f)).doubleValue();return new I(h,g)},B.orientationIndexFilter=function(t,e,n){var r=null,i=(t.x-n.x)*(e.y-n.y),o=(t.y-n.y)*(e.x-n.x),s=i-o;if(0<i){if(o<=0)return B.signum(s);r=i+o}else{if(!(i<0))return B.signum(s);if(0<=o)return B.signum(s);r=-i-o}var a=B.DP_SAFE_EPSILON*r;return a<=s||a<=-s?B.signum(s):2},B.signum=function(t){return 0<t?1:t<0?-1:0},G.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(B,G);var j=function(){},U={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};U.X.get=function(){return 0},U.Y.get=function(){return 1},U.Z.get=function(){return 2},U.M.get=function(){return 3},j.prototype.setOrdinate=function(t,e,n){},j.prototype.size=function(){},j.prototype.getOrdinate=function(t,e){},j.prototype.getCoordinate=function(){},j.prototype.getCoordinateCopy=function(t){},j.prototype.getDimension=function(){},j.prototype.getX=function(t){},j.prototype.clone=function(){},j.prototype.expandEnvelope=function(t){},j.prototype.copy=function(){},j.prototype.getY=function(t){},j.prototype.toCoordinateArray=function(){},j.prototype.interfaces_=function(){return[w]},j.prototype.getClass=function(){return j},Object.defineProperties(j,U);var V=function(){},q=function(t){function e(){t.call(this,"Projective point not representable on the Cartesian plane.")}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(V),z=function(){};z.arraycopy=function(t,e,n,r,i){for(var o=0,s=e;s<e+i;s++)n[r+o]=t[s],o++},z.getProperty=function(t){return{"line.separator":"\n"}[t]};var Y=function t(){if(this.x=null,this.y=null,this.w=null,0===arguments.length)this.x=0,this.y=0,this.w=1;else if(1===arguments.length){var e=arguments[0];this.x=e.x,this.y=e.y,this.w=1}else if(2===arguments.length){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var n=arguments[0],r=arguments[1];this.x=n,this.y=r,this.w=1}else if(arguments[0]instanceof t&&arguments[1]instanceof t){var i=arguments[0],o=arguments[1];this.x=i.y*o.w-o.y*i.w,this.y=o.x*i.w-i.x*o.w,this.w=i.x*o.y-o.x*i.y}else if(arguments[0]instanceof I&&arguments[1]instanceof I){var s=arguments[0],a=arguments[1];this.x=s.y-a.y,this.y=a.x-s.x,this.w=s.x*a.y-a.x*s.y}}else if(3===arguments.length){var u=arguments[0],l=arguments[1],h=arguments[2];this.x=u,this.y=l,this.w=h}else if(4===arguments.length){var c=arguments[0],p=arguments[1],f=arguments[2],g=arguments[3],d=c.y-p.y,y=p.x-c.x,_=c.x*p.y-p.x*c.y,v=f.y-g.y,m=g.x-f.x,b=f.x*g.y-g.x*f.y;this.x=y*b-m*_,this.y=v*_-d*b,this.w=d*m-v*y}};Y.prototype.getY=function(){var t=this.y/this.w;if(m.isNaN(t)||m.isInfinite(t))throw new q;return t},Y.prototype.getX=function(){var t=this.x/this.w;if(m.isNaN(t)||m.isInfinite(t))throw new q;return t},Y.prototype.getCoordinate=function(){var t=new I;return t.x=this.getX(),t.y=this.getY(),t},Y.prototype.interfaces_=function(){return[]},Y.prototype.getClass=function(){return Y},Y.intersection=function(t,e,n,r){var i=t.y-e.y,o=e.x-t.x,s=t.x*e.y-e.x*t.y,a=n.y-r.y,u=r.x-n.x,l=n.x*r.y-r.x*n.y,h=i*u-a*o,c=(o*l-u*s)/h,p=(a*s-i*l)/h;if(m.isNaN(c)||m.isInfinite(c)||m.isNaN(p)||m.isInfinite(p))throw new q;return new I(c,p)};var X=function t(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,0===arguments.length)this.init();else if(1===arguments.length){if(arguments[0]instanceof I){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof t){var n=arguments[0];this.init(n)}}else if(2===arguments.length){var r=arguments[0],i=arguments[1];this.init(r.x,i.x,r.y,i.y)}else if(4===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2],u=arguments[3];this.init(o,s,a,u)}},H={serialVersionUID:{configurable:!0}};X.prototype.getArea=function(){return this.getWidth()*this.getHeight()},X.prototype.equals=function(t){if(!(t instanceof X))return!1;var e=t;return this.isNull()?e.isNull():this._maxx===e.getMaxX()&&this._maxy===e.getMaxY()&&this._minx===e.getMinX()&&this._miny===e.getMinY()},X.prototype.intersection=function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new X;var e=this._minx>t._minx?this._minx:t._minx,n=this._miny>t._miny?this._miny:t._miny,r=this._maxx<t._maxx?this._maxx:t._maxx,i=this._maxy<t._maxy?this._maxy:t._maxy;return new X(e,r,n,i)},X.prototype.isNull=function(){return this._maxx<this._minx},X.prototype.getMaxX=function(){return this._maxx},X.prototype.covers=function(){if(1===arguments.length){if(arguments[0]instanceof I){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof X){var e=arguments[0];return!this.isNull()&&!e.isNull()&&e.getMinX()>=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];return!this.isNull()&&n>=this._minx&&n<=this._maxx&&r>=this._miny&&r<=this._maxy}},X.prototype.intersects=function(){if(1===arguments.length){if(arguments[0]instanceof X){var t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)}if(arguments[0]instanceof I){var e=arguments[0];return this.intersects(e.x,e.y)}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];return!this.isNull()&&!(n>this._maxx||n<this._minx||r>this._maxy||r<this._miny)}},X.prototype.getMinY=function(){return this._miny},X.prototype.getMinX=function(){return this._minx},X.prototype.expandToInclude=function(){if(1===arguments.length){if(arguments[0]instanceof I){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof X){var e=arguments[0];if(e.isNull())return null;this.isNull()?(this._minx=e.getMinX(),this._maxx=e.getMaxX(),this._miny=e.getMinY(),this._maxy=e.getMaxY()):(e._minx<this._minx&&(this._minx=e._minx),e._maxx>this._maxx&&(this._maxx=e._maxx),e._miny<this._miny&&(this._miny=e._miny),e._maxy>this._maxy&&(this._maxy=e._maxy))}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=r,this._maxy=r):(n<this._minx&&(this._minx=n),n>this._maxx&&(this._maxx=n),r<this._miny&&(this._miny=r),r>this._maxy&&(this._maxy=r))}},X.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t<e?t:e},X.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},X.prototype.compareTo=function(t){var e=t;return this.isNull()?e.isNull()?0:-1:e.isNull()?1:this._minx<e._minx?-1:this._minx>e._minx?1:this._miny<e._miny?-1:this._miny>e._miny?1:this._maxx<e._maxx?-1:this._maxx>e._maxx?1:this._maxy<e._maxy?-1:this._maxy>e._maxy?1:0},X.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},X.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},X.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},X.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},X.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return e<t?t:e},X.prototype.expandBy=function(){if(1===arguments.length){var t=arguments[0];this.expandBy(t,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=n,this._maxy+=n,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},X.prototype.contains=function(){if(1===arguments.length){if(arguments[0]instanceof X){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof I){var e=arguments[0];return this.covers(e)}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];return this.covers(n,r)}},X.prototype.centre=function(){return this.isNull()?null:new I((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},X.prototype.init=function(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(arguments[0]instanceof I){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof X){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this.init(n.x,r.x,n.y,r.y)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this._maxx=i<o?(this._minx=i,o):(this._minx=o,i),this._maxy=s<a?(this._miny=s,a):(this._miny=a,s)}},X.prototype.getMaxY=function(){return this._maxy},X.prototype.distance=function(t){if(this.intersects(t))return 0;var e=0;this._maxx<t._minx?e=t._minx-this._maxx:this._minx>t._maxx&&(e=this._minx-t._maxx);var n=0;return this._maxy<t._miny?n=t._miny-this._maxy:this._miny>t._maxy&&(n=this._miny-t._maxy),0===e?n:0===n?e:Math.sqrt(e*e+n*n)},X.prototype.hashCode=function(){var t=17;return t=37*(t=37*(t=37*(t=37*t+I.hashCode(this._minx))+I.hashCode(this._maxx))+I.hashCode(this._miny))+I.hashCode(this._maxy)},X.prototype.interfaces_=function(){return[E,e]},X.prototype.getClass=function(){return X},X.intersects=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2];return n.x>=(t.x<e.x?t.x:e.x)&&n.x<=(t.x>e.x?t.x:e.x)&&n.y>=(t.y<e.y?t.y:e.y)&&n.y<=(t.y>e.y?t.y:e.y)}if(4===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=Math.min(o.x,s.x),u=Math.max(o.x,s.x),l=Math.min(r.x,i.x),h=Math.max(r.x,i.x);return!(u<l||h<a||(a=Math.min(o.y,s.y),u=Math.max(o.y,s.y),l=Math.min(r.y,i.y),h=Math.max(r.y,i.y),u<l||h<a))}},H.serialVersionUID.get=function(){return 0x51845cd552189800},Object.defineProperties(X,H);var W={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*$/},J=function(t){this.geometryFactory=t||new _e};J.prototype.read=function(t){var e,n,r;t=t.replace(/[\n\r]/g," ");var i=W.typeStr.exec(t);if(-1!==t.search("EMPTY")&&((i=W.emptyTypeStr.exec(t))[2]=void 0),i&&(n=i[1].toLowerCase(),r=i[2],Z[n]&&(e=Z[n].apply(this,[r]))),void 0===e)throw new Error("Could not parse WKT "+t);return e},J.prototype.write=function(t){return this.extractGeometry(t)},J.prototype.extractGeometry=function(t){var e=t.getGeometryType().toLowerCase();if(!K[e])return null;var n=e.toUpperCase();return t.isEmpty()?n+" EMPTY":n+"("+K[e].apply(this,[t])+")"};var K={coordinate:function(t){return t.x+" "+t.y},point:function(t){return K.coordinate.call(this,t._coordinates._coordinates[0])},multipoint:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push("("+K.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(K.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(K.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("("+K.linestring.apply(this,[t._geometries[n]])+")");return e.join(",")},polygon:function(t){var e=[];e.push("("+K.linestring.apply(this,[t._shell])+")");for(var n=0,r=t._holes.length;n<r;++n)e.push("("+K.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("("+K.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(",")}},Z={point:function(t){if(void 0===t)return this.geometryFactory.createPoint();var e=t.trim().split(W.spaces);return this.geometryFactory.createPoint(new I(Number.parseFloat(e[0]),Number.parseFloat(e[1])))},multipoint:function(t){if(void 0===t)return this.geometryFactory.createMultiPoint();for(var e,n=t.trim().split(","),r=[],i=0,o=n.length;i<o;++i)e=n[i].replace(W.trimParens,"$1"),r.push(Z.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(W.spaces),r.push(new I(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(W.spaces),r.push(new I(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLinearRing(r)},multilinestring:function(t){if(void 0===t)return this.geometryFactory.createMultiLineString();for(var e,n=t.trim().split(W.parenComma),r=[],i=0,o=n.length;i<o;++i)e=n[i].replace(W.trimParens,"$1"),r.push(Z.linestring.apply(this,[e]));return this.geometryFactory.createMultiLineString(r)},polygon:function(t){if(void 0===t)return this.geometryFactory.createPolygon();for(var e,n,r,i,o=t.trim().split(W.parenComma),s=[],a=0,u=o.length;a<u;++a)e=o[a].replace(W.trimParens,"$1"),n=Z.linestring.apply(this,[e]),r=this.geometryFactory.createLinearRing(n._points),0===a?i=r:s.push(r);return this.geometryFactory.createPolygon(i,s)},multipolygon:function(t){if(void 0===t)return this.geometryFactory.createMultiPolygon();for(var e,n=t.trim().split(W.doubleParenComma),r=[],i=0,o=n.length;i<o;++i)e=n[i].replace(W.trimParens,"$1"),r.push(Z.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)}},Q=function(t){this.parser=new J(t)};Q.prototype.write=function(t){return this.parser.write(t)},Q.toLineString=function(t,e){if(2!==arguments.length)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"};var $=function(e){function t(t){e.call(this,t),this.name="RuntimeException",this.message=t,this.stack=(new e).stack}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t}(Error),tt=function(e){function t(){if(e.call(this),0===arguments.length)e.call(this);else if(1===arguments.length){var t=arguments[0];e.call(this,t)}}return e&&(t.__proto__=e),((t.prototype=Object.create(e&&e.prototype)).constructor=t).prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}($),et=function(){};et.prototype.interfaces_=function(){return[]},et.prototype.getClass=function(){return et},et.shouldNeverReachHere=function(){if(0===arguments.length)et.shouldNeverReachHere(null);else if(1===arguments.length){var t=arguments[0];throw new tt("Should never reach here"+(null!==t?": "+t:""))}},et.isTrue=function(){var t,e;if(1===arguments.length)t=arguments[0],et.isTrue(t,null);else if(2===arguments.length&&(t=arguments[0],e=arguments[1],!t))throw null===e?new tt:new tt(e)},et.equals=function(){var t,e,n;if(2===arguments.length)t=arguments[0],e=arguments[1],et.equals(t,e,null);else if(3===arguments.length&&(t=arguments[0],e=arguments[1],n=arguments[2],!e.equals(t)))throw new tt("Expected "+t+" but encountered "+e+(null!==n?": "+n:""))};var nt=function(){this._result=null,this._inputLines=Array(2).fill().map(function(){return Array(2)}),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new I,this._intPt[1]=new I,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},rt={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};nt.prototype.getIndexAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]},nt.prototype.getTopologySummary=function(){var t=new M;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()},nt.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)},nt.prototype.getIntersectionNum=function(){return this._result},nt.prototype.computeIntLineIndex=function(){if(0===arguments.length)null===this._intLineIndex&&(this._intLineIndex=Array(2).fill().map(function(){return Array(2)}),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(1===arguments.length){var t=arguments[0];this.getEdgeDistance(t,0)>this.getEdgeDistance(t,1)?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}},nt.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},nt.prototype.setPrecisionModel=function(t){this._precisionModel=t},nt.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}},nt.prototype.getIntersection=function(t){return this._intPt[t]},nt.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},nt.prototype.hasIntersection=function(){return this._result!==nt.NO_INTERSECTION},nt.prototype.getEdgeDistance=function(t,e){return nt.computeEdgeDistance(this._intPt[e],this._inputLines[t][0],this._inputLines[t][1])},nt.prototype.isCollinear=function(){return this._result===nt.COLLINEAR_INTERSECTION},nt.prototype.toString=function(){return Q.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+Q.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},nt.prototype.getEndpoint=function(t,e){return this._inputLines[t][e]},nt.prototype.isIntersection=function(t){for(var e=0;e<this._result;e++)if(this._intPt[e].equals2D(t))return!0;return!1},nt.prototype.getIntersectionAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][e]]},nt.prototype.interfaces_=function(){return[]},nt.prototype.getClass=function(){return nt},nt.computeEdgeDistance=function(t,e,n){var r=Math.abs(n.x-e.x),i=Math.abs(n.y-e.y),o=-1;if(t.equals(e))o=0;else if(t.equals(n))o=i<r?r:i;else{var s=Math.abs(t.x-e.x),a=Math.abs(t.y-e.y);0!==(o=i<r?s:a)||t.equals(e)||(o=Math.max(s,a))}return et.isTrue(!(0===o&&!t.equals(e)),"Bad distance calculation"),o},nt.nonRobustComputeEdgeDistance=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,o=Math.sqrt(r*r+i*i);return et.isTrue(!(0===o&&!t.equals(e)),"Invalid distance calculation"),o},rt.DONT_INTERSECT.get=function(){return 0},rt.DO_INTERSECT.get=function(){return 1},rt.COLLINEAR.get=function(){return 2},rt.NO_INTERSECTION.get=function(){return 0},rt.POINT_INTERSECTION.get=function(){return 1},rt.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(nt,rt);var it=function(u){function s(){u.apply(this,arguments)}return u&&(s.__proto__=u),((s.prototype=Object.create(u&&u.prototype)).constructor=s).prototype.isInSegmentEnvelopes=function(t){var e=new X(this._inputLines[0][0],this._inputLines[0][1]),n=new X(this._inputLines[1][0],this._inputLines[1][1]);return e.contains(t)&&n.contains(t)},s.prototype.computeIntersection=function(){if(3!==arguments.length)return u.prototype.computeIntersection.apply(this,arguments);var t=arguments[0],e=arguments[1],n=arguments[2];if(this._isProper=!1,X.intersects(e,n,t)&&0===at.orientationIndex(e,n,t)&&0===at.orientationIndex(n,e,t))return this._isProper=!0,(t.equals(e)||t.equals(n))&&(this._isProper=!1),this._result=u.POINT_INTERSECTION,null;this._result=u.NO_INTERSECTION},s.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},s.prototype.safeHCoordinateIntersection=function(e,n,r,i){var o=null;try{o=Y.intersection(e,n,r,i)}catch(t){if(!(t instanceof q))throw t;o=s.nearestEndpoint(e,n,r,i)}return o},s.prototype.intersection=function(t,e,n,r){var i=this.intersectionWithNormalization(t,e,n,r);return this.isInSegmentEnvelopes(i)||(i=new I(s.nearestEndpoint(t,e,n,r))),null!==this._precisionModel&&this._precisionModel.makePrecise(i),i},s.prototype.smallestInAbsValue=function(t,e,n,r){var i=t,o=Math.abs(i);return Math.abs(e)<o&&(i=e,o=Math.abs(e)),Math.abs(n)<o&&(i=n,o=Math.abs(n)),Math.abs(r)<o&&(i=r),i},s.prototype.checkDD=function(t,e,n,r,i){var o=B.intersection(t,e,n,r),s=this.isInSegmentEnvelopes(o);z.out.println("DD in env = "+s+"  --------------------- "+o),1e-4<i.distance(o)&&z.out.println("Distance = "+i.distance(o))},s.prototype.intersectionWithNormalization=function(t,e,n,r){var i=new I(t),o=new I(e),s=new I(n),a=new I(r),u=new I;this.normalizeToEnvCentre(i,o,s,a,u);var l=this.safeHCoordinateIntersection(i,o,s,a);return l.x+=u.x,l.y+=u.y,l},s.prototype.computeCollinearIntersection=function(t,e,n,r){var i=X.intersects(t,e,n),o=X.intersects(t,e,r),s=X.intersects(n,r,t),a=X.intersects(n,r,e);return i&&o?(this._intPt[0]=n,this._intPt[1]=r,u.COLLINEAR_INTERSECTION):s&&a?(this._intPt[0]=t,this._intPt[1]=e,u.COLLINEAR_INTERSECTION):i&&s?(this._intPt[0]=n,this._intPt[1]=t,!n.equals(t)||o||a?u.COLLINEAR_INTERSECTION:u.POINT_INTERSECTION):i&&a?(this._intPt[0]=n,this._intPt[1]=e,!n.equals(e)||o||s?u.COLLINEAR_INTERSECTION:u.POINT_INTERSECTION):o&&s?(this._intPt[0]=r,this._intPt[1]=t,!r.equals(t)||i||a?u.COLLINEAR_INTERSECTION:u.POINT_INTERSECTION):o&&a?(this._intPt[0]=r,this._intPt[1]=e,!r.equals(e)||i||s?u.COLLINEAR_INTERSECTION:u.POINT_INTERSECTION):u.NO_INTERSECTION},s.prototype.normalizeToEnvCentre=function(t,e,n,r,i){var o=t.x<e.x?t.x:e.x,s=t.y<e.y?t.y:e.y,a=t.x>e.x?t.x:e.x,u=t.y>e.y?t.y:e.y,l=n.x<r.x?n.x:r.x,h=n.y<r.y?n.y:r.y,c=n.x>r.x?n.x:r.x,p=n.y>r.y?n.y:r.y,f=((l<o?o:l)+(a<c?a:c))/2,g=((h<s?s:h)+(u<p?u:p))/2;i.x=f,i.y=g,t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,n.x-=i.x,n.y-=i.y,r.x-=i.x,r.y-=i.y},s.prototype.computeIntersect=function(t,e,n,r){if(this._isProper=!1,!X.intersects(t,e,n,r))return u.NO_INTERSECTION;var i=at.orientationIndex(t,e,n),o=at.orientationIndex(t,e,r);if(0<i&&0<o||i<0&&o<0)return u.NO_INTERSECTION;var s=at.orientationIndex(n,r,t),a=at.orientationIndex(n,r,e);return 0<s&&0<a||s<0&&a<0?u.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 I(n):0===o?this._intPt[0]=new I(r):0===s?this._intPt[0]=new I(t):0===a&&(this._intPt[0]=new I(e))):(this._isProper=!0,this._intPt[0]=this.intersection(t,e,n,r)),u.POINT_INTERSECTION)},s.prototype.interfaces_=function(){return[]},s.prototype.getClass=function(){return s},s.nearestEndpoint=function(t,e,n,r){var i=t,o=at.distancePointLine(t,n,r),s=at.distancePointLine(e,n,r);return s<o&&(o=s,i=e),(s=at.distancePointLine(n,t,e))<o&&(o=s,i=n),(s=at.distancePointLine(r,t,e))<o&&(o=s,i=r),i},s}(nt),ot=function(){};ot.prototype.interfaces_=function(){return[]},ot.prototype.getClass=function(){return ot},ot.orientationIndex=function(t,e,n){var r=e.x-t.x,i=e.y-t.y,o=n.x-e.x,s=n.y-e.y;return ot.signOfDet2x2(r,i,o,s)},ot.signOfDet2x2=function(t,e,n,r){var i=null,o=null,s=null;if(i=1,0===t||0===r)return 0===e||0===n?0:0<e?0<n?-i:i:0<n?i:-i;if(0===e||0===n)return 0<r?0<t?i:-i:0<t?-i:i;if(0<e?0<r?e<=r||(i=-i,o=t,t=n,n=o,o=e,e=r,r=o):r=e<=-r?(i=-i,n=-n,-r):(o=t,t=-n,n=o,o=e,e=-r,o):0<r?-e<=r?(i=-i,t=-t,e=-e):(o=-t,t=n,n=o,o=-e,e=r,r=o):r=r<=e?(t=-t,e=-e,n=-n,-r):(i=-i,o=-t,t=-n,n=o,o=-e,e=-r,o),0<t){if(!(0<n))return i;if(!(t<=n))return i}else{if(0<n)return-i;if(!(n<=t))return-i;i=-i,t=-t,n=-n}for(;;){if(s=Math.floor(n/t),n-=s*t,(r-=s*e)<0)return-i;if(e<r)return i;if(n+n<t){if(e<r+r)return i}else{if(r+r<e)return-i;n=t-n,r=e-r,i=-i}if(0===r)return 0===n?0:-i;if(0===n)return i;if(s=Math.floor(t/n),t-=s*n,(e-=s*r)<0)return i;if(r<e)return-i;if(t+t<n){if(r<e+e)return-i}else{if(e+e<r)return i;t=n-t,e=r-e,i=-i}if(0===e)return 0===t?0:i;if(0===t)return-i}};var st=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};st.prototype.countSegment=function(t,e){if(t.x<this._p.x&&e.x<this._p.x)return null;if(this._p.x===e.x&&this._p.y===e.y)return this._isPointOnSegment=!0,null;if(t.y===this._p.y&&e.y===this._p.y){var n=t.x,r=e.x;return r<n&&(n=e.x,r=t.x),this._p.x>=n&&this._p.x<=r&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var i=t.x-this._p.x,o=t.y-this._p.y,s=e.x-this._p.x,a=e.y-this._p.y,u=ot.signOfDet2x2(i,o,s,a);if(0===u)return this._isPointOnSegment=!0,null;a<o&&(u=-u),0<u&&this._crossingCount++}},st.prototype.isPointInPolygon=function(){return this.getLocation()!==L.EXTERIOR},st.prototype.getLocation=function(){return this._isPointOnSegment?L.BOUNDARY:this._crossingCount%2==1?L.INTERIOR:L.EXTERIOR},st.prototype.isOnSegment=function(){return this._isPointOnSegment},st.prototype.interfaces_=function(){return[]},st.prototype.getClass=function(){return st},st.locatePointInRing=function(){if(arguments[0]instanceof I&&R(arguments[1],j)){for(var t=arguments[0],e=arguments[1],n=new st(t),r=new I,i=new I,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 I&&arguments[1]instanceof Array){for(var s=arguments[0],a=arguments[1],u=new st(s),l=1;l<a.length;l++){var h=a[l],c=a[l-1];if(u.countSegment(h,c),u.isOnSegment())return u.getLocation()}return u.getLocation()}};var at=function(){},ut={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};at.prototype.interfaces_=function(){return[]},at.prototype.getClass=function(){return at},at.orientationIndex=function(t,e,n){return B.orientationIndex(t,e,n)},at.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(R(arguments[0],j)){var s=arguments[0],a=s.size();if(a<3)return 0;var u=new I,l=new I,h=new I;s.getCoordinate(0,l),s.getCoordinate(1,h);var c=l.x;h.x-=c;for(var p=0,f=1;f<a-1;f++)u.y=l.y,l.x=h.x,l.y=h.y,s.getCoordinate(f+1,h),h.x-=c,p+=l.x*(u.y-h.y);return p/2}},at.distanceLineLine=function(t,e,n,r){if(t.equals(e))return at.distancePointLine(t,n,r);if(n.equals(r))return at.distancePointLine(r,t,e);var i=!1;if(X.intersects(t,e,n,r)){var o=(e.x-t.x)*(r.y-n.y)-(e.y-t.y)*(r.x-n.x);if(0===o)i=!0;else{var s=(t.y-n.y)*(r.x-n.x)-(t.x-n.x)*(r.y-n.y),a=((t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y))/o,u=s/o;(u<0||1<u||a<0||1<a)&&(i=!0)}}else i=!0;return i?O.min(at.distancePointLine(t,n,r),at.distancePointLine(e,n,r),at.distancePointLine(n,t,e),at.distancePointLine(r,t,e)):0},at.isPointInRing=function(t,e){return at.locatePointInRing(t,e)!==L.EXTERIOR},at.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,r=new I;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},at.isCCW=function(t){var e=t.length-1;if(e<3)throw new v("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;(s-=1)<0&&(s=e),t[s].equals2D(n)&&s!==r;);for(var a=r;t[a=(a+1)%e].equals2D(n)&&a!==r;);var u=t[s],l=t[a];if(u.equals2D(n)||l.equals2D(n)||u.equals2D(l))return!1;var h=at.computeOrientation(u,n,l);return 0===h?u.x>l.x:0<h},at.locatePointInRing=function(t,e){return st.locatePointInRing(t,e)},at.distancePointLinePerpendicular=function(t,e,n){var r=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),i=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/r;return Math.abs(i)*Math.sqrt(r)},at.computeOrientation=function(t,e,n){return at.orientationIndex(t,e,n)},at.distancePointLine=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(0===e.length)throw new v("Line array must contain at least one vertex");for(var n=t.distance(e[0]),r=0;r<e.length-1;r++){var i=at.distancePointLine(t,e[r],e[r+1]);i<n&&(n=i)}return n}if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];if(s.x===a.x&&s.y===a.y)return o.distance(s);var u=(a.x-s.x)*(a.x-s.x)+(a.y-s.y)*(a.y-s.y),l=((o.x-s.x)*(a.x-s.x)+(o.y-s.y)*(a.y-s.y))/u;if(l<=0)return o.distance(s);if(1<=l)return o.distance(a);var h=((s.y-o.y)*(a.x-s.x)-(s.x-o.x)*(a.y-s.y))/u;return Math.abs(h)*Math.sqrt(u)}},at.isOnLine=function(t,e){for(var n=new it,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},ut.CLOCKWISE.get=function(){return-1},ut.RIGHT.get=function(){return at.CLOCKWISE},ut.COUNTERCLOCKWISE.get=function(){return 1},ut.LEFT.get=function(){return at.COUNTERCLOCKWISE},ut.COLLINEAR.get=function(){return 0},ut.STRAIGHT.get=function(){return at.COLLINEAR},Object.defineProperties(at,ut);var lt=function(){};lt.prototype.filter=function(t){},lt.prototype.interfaces_=function(){return[]},lt.prototype.getClass=function(){return lt};var ht=function(){var t=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=t,this._SRID=t.getSRID()},ct={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}};ht.prototype.isGeometryCollection=function(){return this.getSortIndex()===ht.SORTINDEX_GEOMETRYCOLLECTION},ht.prototype.getFactory=function(){return this._factory},ht.prototype.getGeometryN=function(t){return this},ht.prototype.getArea=function(){return 0},ht.prototype.isRectangle=function(){return!1},ht.prototype.equals=function(){if(arguments[0]instanceof ht){var t=arguments[0];return null!==t&&this.equalsTopo(t)}if(arguments[0]instanceof Object){var e=arguments[0];if(!(e instanceof ht))return!1;var n=e;return this.equalsExact(n)}},ht.prototype.equalsExact=function(t){return this===t||this.equalsExact(t,0)},ht.prototype.geometryChanged=function(){this.apply(ht.geometryChangedFilter)},ht.prototype.geometryChangedAction=function(){this._envelope=null},ht.prototype.equalsNorm=function(t){return null!==t&&this.norm().equalsExact(t.norm())},ht.prototype.getLength=function(){return 0},ht.prototype.getNumGeometries=function(){return 1},ht.prototype.compareTo=function(){if(1===arguments.length){var t=arguments[0],e=t;return this.getSortIndex()!==e.getSortIndex()?this.getSortIndex()-e.getSortIndex():this.isEmpty()&&e.isEmpty()?0:this.isEmpty()?-1:e.isEmpty()?1:this.compareToSameClass(t)}if(2===arguments.length){var n=arguments[0],r=arguments[1];return this.getSortIndex()!==n.getSortIndex()?this.getSortIndex()-n.getSortIndex():this.isEmpty()&&n.isEmpty()?0:this.isEmpty()?-1:n.isEmpty()?1:this.compareToSameClass(n,r)}},ht.prototype.getUserData=function(){return this._userData},ht.prototype.getSRID=function(){return this._SRID},ht.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},ht.prototype.checkNotGeometryCollection=function(t){if(t.getSortIndex()===ht.SORTINDEX_GEOMETRYCOLLECTION)throw new v("This method does not support GeometryCollection arguments")},ht.prototype.equal=function(t,e,n){return 0===n?t.equals(e):t.distance(e)<=n},ht.prototype.norm=function(){var t=this.copy();return t.normalize(),t},ht.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},ht.prototype.getEnvelopeInternal=function(){return null===this._envelope&&(this._envelope=this.computeEnvelopeInternal()),new X(this._envelope)},ht.prototype.setSRID=function(t){this._SRID=t},ht.prototype.setUserData=function(t){this._userData=t},ht.prototype.compare=function(t,e){for(var n=t.iterator(),r=e.iterator();n.hasNext()&&r.hasNext();){var i=n.next(),o=r.next(),s=i.compareTo(o);if(0!==s)return s}return n.hasNext()?1:r.hasNext()?-1:0},ht.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},ht.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===ht.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===ht.SORTINDEX_MULTIPOINT||this.getSortIndex()===ht.SORTINDEX_MULTILINESTRING||this.getSortIndex()===ht.SORTINDEX_MULTIPOLYGON},ht.prototype.interfaces_=function(){return[w,E,e]},ht.prototype.getClass=function(){return ht},ht.hasNonEmptyElements=function(t){for(var e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1},ht.hasNullElements=function(t){for(var e=0;e<t.length;e++)if(null===t[e])return!0;return!1},ct.serialVersionUID.get=function(){return 0x799ea46522854c00},ct.SORTINDEX_POINT.get=function(){return 0},ct.SORTINDEX_MULTIPOINT.get=function(){return 1},ct.SORTINDEX_LINESTRING.get=function(){return 2},ct.SORTINDEX_LINEARRING.get=function(){return 3},ct.SORTINDEX_MULTILINESTRING.get=function(){return 4},ct.SORTINDEX_POLYGON.get=function(){return 5},ct.SORTINDEX_MULTIPOLYGON.get=function(){return 6},ct.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},ct.geometryChangedFilter.get=function(){return pt},Object.defineProperties(ht,ct);var pt=function(){};pt.interfaces_=function(){return[lt]},pt.filter=function(t){t.geometryChangedAction()};var ft=function(){};ft.prototype.filter=function(t){},ft.prototype.interfaces_=function(){return[]},ft.prototype.getClass=function(){return ft};var gt=function(){},dt={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}};gt.prototype.isInBoundary=function(t){},gt.prototype.interfaces_=function(){return[]},gt.prototype.getClass=function(){return gt},dt.Mod2BoundaryNodeRule.get=function(){return yt},dt.EndPointBoundaryNodeRule.get=function(){return _t},dt.MultiValentEndPointBoundaryNodeRule.get=function(){return vt},dt.MonoValentEndPointBoundaryNodeRule.get=function(){return mt},dt.MOD2_BOUNDARY_RULE.get=function(){return new yt},dt.ENDPOINT_BOUNDARY_RULE.get=function(){return new _t},dt.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new vt},dt.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new mt},dt.OGC_SFS_BOUNDARY_RULE.get=function(){return gt.MOD2_BOUNDARY_RULE},Object.defineProperties(gt,dt);var yt=function(){};yt.prototype.isInBoundary=function(t){return t%2==1},yt.prototype.interfaces_=function(){return[gt]},yt.prototype.getClass=function(){return yt};var _t=function(){};_t.prototype.isInBoundary=function(t){return 0<t},_t.prototype.interfaces_=function(){return[gt]},_t.prototype.getClass=function(){return _t};var vt=function(){};vt.prototype.isInBoundary=function(t){return 1<t},vt.prototype.interfaces_=function(){return[gt]},vt.prototype.getClass=function(){return vt};var mt=function(){};mt.prototype.isInBoundary=function(t){return 1===t},mt.prototype.interfaces_=function(){return[gt]},mt.prototype.getClass=function(){return mt};var bt=function(){};bt.prototype.add=function(){},bt.prototype.addAll=function(){},bt.prototype.isEmpty=function(){},bt.prototype.iterator=function(){},bt.prototype.size=function(){},bt.prototype.toArray=function(){},bt.prototype.remove=function(){},(n.prototype=new Error).name="IndexOutOfBoundsException";var Et=function(){};Et.prototype.hasNext=function(){},Et.prototype.next=function(){},Et.prototype.remove=function(){};var wt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.get=function(){},e.prototype.set=function(){},e.prototype.isEmpty=function(){},e}(bt);(r.prototype=new Error).name="NoSuchElementException";var xt=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof bt&&this.addAll(arguments[0])}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.ensureCapacity=function(){},e.prototype.interfaces_=function(){return[t,bt]},e.prototype.add=function(t){return 1===arguments.length?this.array_.push(t):this.array_.splice(t,arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.set=function(t,e){var n=this.array_[t];return this.array_[t]=e,n},e.prototype.iterator=function(){return new It(this)},e.prototype.get=function(t){if(t<0||t>=this.size())throw new n;return this.array_[t]},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},e.prototype.remove=function(t){for(var e=!1,n=0,r=this.array_.length;n<r;n++)if(this.array_[n]===t){this.array_.splice(n,1),e=!0;break}return e},e}(wt),It=function(e){function t(t){e.call(this),this.arrayList_=t,this.position_=0}return e&&(t.__proto__=e),((t.prototype=Object.create(e&&e.prototype)).constructor=t).prototype.next=function(){if(this.position_===this.arrayList_.size())throw new r;return this.arrayList_.get(this.position_++)},t.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},t.prototype.set=function(t){return this.arrayList_.set(this.position_-1,t)},t.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},t}(Et),Nt=function(m){function t(){if(m.call(this),0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.ensureCapacity(t.length),this.add(t,!0)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.ensureCapacity(e.length),this.add(e,n)}}m&&(t.__proto__=m),(t.prototype=Object.create(m&&m.prototype)).constructor=t;var e={coordArrayType:{configurable:!0}};return e.coordArrayType.get=function(){return new Array(0).fill(null)},t.prototype.getCoordinate=function(t){return this.get(t)},t.prototype.addAll=function(){if(2!==arguments.length)return m.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},t.prototype.clone=function(){for(var t=m.prototype.clone.call(this),e=0;e<this.size();e++)t.add(e,this.get(e).copy());return t},t.prototype.toCoordinateArray=function(){return this.toArray(t.coordArrayType)},t.prototype.add=function(){if(1===arguments.length){var t=arguments[0];m.prototype.add.call(this,t)}else if(2===arguments.length){if(arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var e=arguments[0],n=arguments[1];return this.add(e,n,!0),!0}if(arguments[0]instanceof I&&"boolean"==typeof arguments[1]){var r=arguments[0];if(!arguments[1]&&1<=this.size()&&this.get(this.size()-1).equals2D(r))return null;m.prototype.add.call(this,r)}else if(arguments[0]instanceof Object&&"boolean"==typeof arguments[1]){var i=arguments[0],o=arguments[1];return this.add(i,o),!0}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var s=arguments[0],a=arguments[1];if(arguments[2])for(var u=0;u<s.length;u++)this.add(s[u],a);else for(var l=s.length-1;0<=l;l--)this.add(s[l],a);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof I){var h=arguments[0],c=arguments[1];if(!arguments[2]){var p=this.size();if(0<p){if(0<h&&this.get(h-1).equals2D(c))return null;if(h<p&&this.get(h).equals2D(c))return null}}m.prototype.add.call(this,h,c)}}else if(4===arguments.length){var f=arguments[0],g=arguments[1],d=arguments[2],y=arguments[3],_=1;y<d&&(_=-1);for(var v=d;v!==y;v+=_)this.add(f[v],g);return!0}},t.prototype.closeRing=function(){0<this.size()&&this.add(new I(this.get(0)),!1)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},Object.defineProperties(t,e),t}(xt),St=function(){},Ct={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Ct.ForwardComparator.get=function(){return Lt},Ct.BidirectionalComparator.get=function(){return Tt},Ct.coordArrayType.get=function(){return new Array(0).fill(null)},St.prototype.interfaces_=function(){return[]},St.prototype.getClass=function(){return St},St.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))},St.ptNotInList=function(t,e){for(var n=0;n<t.length;n++){var r=t[n];if(St.indexOf(r,e)<0)return r}return null},St.scroll=function(t,e){var n=St.indexOf(e,t);if(n<0)return null;var r=new Array(t.length).fill(null);z.arraycopy(t,n,r,0,t.length-n),z.arraycopy(t,0,r,t.length-n,n),z.arraycopy(r,0,t,0,t.length)},St.equals=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(t===e)return!0;if(null===t||null===e)return!1;if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].equals(e[n]))return!1;return!0}if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2];if(r===i)return!0;if(null===r||null===i)return!1;if(r.length!==i.length)return!1;for(var s=0;s<r.length;s++)if(0!==o.compare(r[s],i[s]))return!1;return!0}},St.intersection=function(t,e){for(var n=new Nt,r=0;r<t.length;r++)e.intersects(t[r])&&n.add(t[r],!0);return n.toCoordinateArray()},St.hasRepeatedPoints=function(t){for(var e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1},St.removeRepeatedPoints=function(t){return St.hasRepeatedPoints(t)?new Nt(t,!1).toCoordinateArray():t},St.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}},St.removeNull=function(t){for(var e=0,n=0;n<t.length;n++)null!==t[n]&&e++;var r=new Array(e).fill(null);if(0===e)return r;for(var i=0,o=0;o<t.length;o++)null!==t[o]&&(r[i++]=t[o]);return r},St.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 I(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 I(r[i+u])},St.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},St.envelope=function(t){for(var e=new X,n=0;n<t.length;n++)e.expandToInclude(t[n]);return e},St.toCoordinateArray=function(t){return t.toArray(St.coordArrayType)},St.atLeastNCoordinatesOrNothing=function(t,e){return e.length>=t?e:[]},St.indexOf=function(t,e){for(var n=0;n<e.length;n++)if(t.equals(e[n]))return n;return-1},St.increasingDirection=function(t){for(var e=0;e<Math.trunc(t.length/2);e++){var n=t.length-1-e,r=t[e].compareTo(t[n]);if(0!==r)return r}return 1},St.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},St.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},St.extract=function(t,e,n){e=O.clamp(e,0,t.length);var r=(n=O.clamp(n,-1,t.length))-e+1;n<0&&(r=0),e>=t.length&&(r=0),n<e&&(r=0);var i=new Array(r).fill(null);if(0===r)return i;for(var o=0,s=e;s<=n;s++)i[o++]=t[s];return i},Object.defineProperties(St,Ct);var Lt=function(){};Lt.prototype.compare=function(t,e){return St.compare(t,e)},Lt.prototype.interfaces_=function(){return[x]},Lt.prototype.getClass=function(){return Lt};var Tt=function(){};Tt.prototype.compare=function(t,e){var n=t,r=e;if(n.length<r.length)return-1;if(n.length>r.length)return 1;if(0===n.length)return 0;var i=St.compare(n,r);return St.isEqualReversed(n,r)?0:i},Tt.prototype.OLDcompare=function(t,e){var n=t,r=e;if(n.length<r.length)return-1;if(n.length>r.length)return 1;if(0===n.length)return 0;for(var i=St.increasingDirection(n),o=St.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},Tt.prototype.interfaces_=function(){return[x]},Tt.prototype.getClass=function(){return Tt};var Rt=function(){};Rt.prototype.get=function(){},Rt.prototype.put=function(){},Rt.prototype.size=function(){},Rt.prototype.values=function(){},Rt.prototype.entrySet=function(){};var Ot=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e}(Rt);(i.prototype=new Error).name="OperationNotSupported",(o.prototype=new bt).contains=function(){};var Pt=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof bt&&this.addAll(arguments[0])}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.contains=function(t){for(var e=0,n=this.array_.length;e<n;e++)if(this.array_[e]===t)return!0;return!1},e.prototype.add=function(t){return!this.contains(t)&&(this.array_.push(t),!0)},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.remove=function(t){throw new Error},e.prototype.size=function(){return this.array_.length},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},e.prototype.iterator=function(){return new Mt(this)},e}(o),Mt=function(e){function t(t){e.call(this),this.hashSet_=t,this.position_=0}return e&&(t.__proto__=e),((t.prototype=Object.create(e&&e.prototype)).constructor=t).prototype.next=function(){if(this.position_===this.hashSet_.size())throw new r;return this.hashSet_.array_[this.position_++]},t.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},t.prototype.remove=function(){throw new i},t}(Et),At=0;(c.prototype=new Ot).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},c.prototype.put=function(t,e){if(null===this.root_)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:At,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n,r,i=this.root_;do{if(n=i,(r=t.compareTo(i.key))<0)i=i.left;else{if(!(0<r)){var o=i.value;return i.value=e,o}i=i.right}}while(null!==i);var s={key:t,left:null,right:null,value:e,parent:n,color:At,getValue:function(){return this.value},getKey:function(){return this.key}};return r<0?n.left=s:n.right=s,this.fixAfterInsertion(s),this.size_++,null},c.prototype.fixAfterInsertion=function(t){for(t.color=1;null!=t&&t!==this.root_&&1===t.parent.color;)if(a(t)===l(a(a(t)))){var e=h(a(a(t)));1===s(e)?(u(a(t),At),u(e,At),u(a(a(t)),1),t=a(a(t))):(t===h(a(t))&&(t=a(t),this.rotateLeft(t)),u(a(t),At),u(a(a(t)),1),this.rotateRight(a(a(t))))}else{var n=l(a(a(t)));1===s(n)?(u(a(t),At),u(n,At),u(a(a(t)),1),t=a(a(t))):(t===l(a(t))&&(t=a(t),this.rotateRight(t)),u(a(t),At),u(a(a(t)),1),this.rotateLeft(a(a(t))))}this.root_.color=At},c.prototype.values=function(){var t=new xt,e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=c.successor(e));)t.add(e.value);return t},c.prototype.entrySet=function(){var t=new Pt,e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=c.successor(e));)t.add(e);return t},c.prototype.rotateLeft=function(t){if(null!=t){var e=t.right;t.right=e.left,null!=e.left&&(e.left.parent=t),e.parent=t.parent,null===t.parent?this.root_=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,(e.left=t).parent=e}},c.prototype.rotateRight=function(t){if(null!=t){var e=t.left;t.left=e.right,null!=e.right&&(e.right.parent=t),e.parent=t.parent,null===t.parent?this.root_=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,(e.right=t).parent=e}},c.prototype.getFirstEntry=function(){var t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t},c.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},c.prototype.size=function(){return this.size_};var Dt=function(){};Dt.prototype.interfaces_=function(){return[]},Dt.prototype.getClass=function(){return Dt},p.prototype=new o,(f.prototype=new p).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},f.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},f.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},f.prototype.remove=function(t){throw new i},f.prototype.size=function(){return this.array_.length},f.prototype.isEmpty=function(){return 0===this.array_.length},f.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},f.prototype.iterator=function(){return new Ft(this)};var Ft=function(t){this.treeSet_=t,this.position_=0};Ft.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new r;return this.treeSet_.array_[this.position_++]},Ft.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},Ft.prototype.remove=function(){throw new i};var kt=function(){};kt.sort=function(){var t,e,n,r,i=arguments[0];if(1===arguments.length)r=function(t,e){return t.compareTo(e)},i.sort(r);else if(2===arguments.length)n=arguments[1],r=function(t,e){return n.compare(t,e)},i.sort(r);else if(3===arguments.length){(e=i.slice(arguments[1],arguments[2])).sort();var o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length));for(i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])}else if(4===arguments.length)for(e=i.slice(arguments[1],arguments[2]),n=arguments[3],r=function(t,e){return n.compare(t,e)},e.sort(r),o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length)),i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])},kt.asList=function(t){for(var e=new xt,n=0,r=t.length;n<r;n++)e.add(t[n]);return e};var Bt=function(){},Gt={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}};Gt.P.get=function(){return 0},Gt.L.get=function(){return 1},Gt.A.get=function(){return 2},Gt.FALSE.get=function(){return-1},Gt.TRUE.get=function(){return-2},Gt.DONTCARE.get=function(){return-3},Gt.SYM_FALSE.get=function(){return"F"},Gt.SYM_TRUE.get=function(){return"T"},Gt.SYM_DONTCARE.get=function(){return"*"},Gt.SYM_P.get=function(){return"0"},Gt.SYM_L.get=function(){return"1"},Gt.SYM_A.get=function(){return"2"},Bt.prototype.interfaces_=function(){return[]},Bt.prototype.getClass=function(){return Bt},Bt.toDimensionSymbol=function(t){switch(t){case Bt.FALSE:return Bt.SYM_FALSE;case Bt.TRUE:return Bt.SYM_TRUE;case Bt.DONTCARE:return Bt.SYM_DONTCARE;case Bt.P:return Bt.SYM_P;case Bt.L:return Bt.SYM_L;case Bt.A:return Bt.SYM_A}throw new v("Unknown dimension value: "+t)},Bt.toDimensionValue=function(t){switch(D.toUpperCase(t)){case Bt.SYM_FALSE:return Bt.FALSE;case Bt.SYM_TRUE:return Bt.TRUE;case Bt.SYM_DONTCARE:return Bt.DONTCARE;case Bt.SYM_P:return Bt.P;case Bt.SYM_L:return Bt.L;case Bt.SYM_A:return Bt.A}throw new v("Unknown dimension symbol: "+t)},Object.defineProperties(Bt,Gt);var jt=function(){};jt.prototype.filter=function(t){},jt.prototype.interfaces_=function(){return[]},jt.prototype.getClass=function(){return jt};var Ut=function(){};Ut.prototype.filter=function(t,e){},Ut.prototype.isDone=function(){},Ut.prototype.isGeometryChanged=function(){},Ut.prototype.interfaces_=function(){return[]},Ut.prototype.getClass=function(){return Ut};var Vt=function(i){function n(t,e){if(i.call(this,e),this._geometries=t||[],i.hasNullElements(this._geometries))throw new v("geometries must not contain null elements")}i&&(n.__proto__=i),(n.prototype=Object.create(i&&i.prototype)).constructor=n;var t={serialVersionUID:{configurable:!0}};return n.prototype.computeEnvelopeInternal=function(){for(var t=new X,e=0;e<this._geometries.length;e++)t.expandToInclude(this._geometries[e].getEnvelopeInternal());return t},n.prototype.getGeometryN=function(t){return this._geometries[t]},n.prototype.getSortIndex=function(){return i.SORTINDEX_GEOMETRYCOLLECTION},n.prototype.getCoordinates=function(){for(var t=new Array(this.getNumPoints()).fill(null),e=-1,n=0;n<this._geometries.length;n++)for(var r=this._geometries[n].getCoordinates(),i=0;i<r.length;i++)t[++e]=r[i];return t},n.prototype.getArea=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getArea();return t},n.prototype.equalsExact=function(){if(2!==arguments.length)return i.prototype.equalsExact.apply(this,arguments);var t=arguments[0],e=arguments[1];if(!this.isEquivalentClass(t))return!1;var n=t;if(this._geometries.length!==n._geometries.length)return!1;for(var r=0;r<this._geometries.length;r++)if(!this._geometries[r].equalsExact(n._geometries[r],e))return!1;return!0},n.prototype.normalize=function(){for(var t=0;t<this._geometries.length;t++)this._geometries[t].normalize();kt.sort(this._geometries)},n.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},n.prototype.getBoundaryDimension=function(){for(var t=Bt.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getBoundaryDimension());return t},n.prototype.getDimension=function(){for(var t=Bt.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getDimension());return t},n.prototype.getLength=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getLength();return t},n.prototype.getNumPoints=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getNumPoints();return t},n.prototype.getNumGeometries=function(){return this._geometries.length},n.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),n=0;n<this._geometries.length;n++)e[n]=this._geometries[n].reverse();return this.getFactory().createGeometryCollection(e)},n.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=new f(kt.asList(this._geometries)),n=new f(kt.asList(t._geometries));return this.compare(e,n)}if(2===arguments.length){for(var r=arguments[0],i=arguments[1],o=r,s=this.getNumGeometries(),a=o.getNumGeometries(),u=0;u<s&&u<a;){var l=this.getGeometryN(u),h=o.getGeometryN(u),c=l.compareToSameClass(h,i);if(0!==c)return c;u++}return u<s?1:u<a?-1:0}},n.prototype.apply=function(){if(R(arguments[0],ft))for(var t=arguments[0],e=0;e<this._geometries.length;e++)this._geometries[e].apply(t);else if(R(arguments[0],Ut)){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(R(arguments[0],jt)){var i=arguments[0];i.filter(this);for(var o=0;o<this._geometries.length;o++)this._geometries[o].apply(i)}else if(R(arguments[0],lt)){var s=arguments[0];s.filter(this);for(var a=0;a<this._geometries.length;a++)this._geometries[a].apply(s)}},n.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),et.shouldNeverReachHere(),null},n.prototype.clone=function(){var t=i.prototype.clone.call(this);t._geometries=new Array(this._geometries.length).fill(null);for(var e=0;e<this._geometries.length;e++)t._geometries[e]=this._geometries[e].clone();return t},n.prototype.getGeometryType=function(){return"GeometryCollection"},n.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),e=0;e<t.length;e++)t[e]=this._geometries[e].copy();return new n(t,this._factory)},n.prototype.isEmpty=function(){for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isEmpty())return!1;return!0},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},t.serialVersionUID.get=function(){return-0x4f07bcb1f857d800},Object.defineProperties(n,t),n}(ht),qt=function(n){function r(){n.apply(this,arguments)}n&&(r.__proto__=n),(r.prototype=Object.create(n&&n.prototype)).constructor=r;var t={serialVersionUID:{configurable:!0}};return r.prototype.getSortIndex=function(){return ht.SORTINDEX_MULTILINESTRING},r.prototype.equalsExact=function(){if(2!==arguments.length)return n.prototype.equalsExact.apply(this,arguments);var t=arguments[0],e=arguments[1];return!!this.isEquivalentClass(t)&&n.prototype.equalsExact.call(this,t,e)},r.prototype.getBoundaryDimension=function(){return this.isClosed()?Bt.FALSE:0},r.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isClosed())return!1;return!0},r.prototype.getDimension=function(){return 1},r.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),n=0;n<this._geometries.length;n++)e[t-1-n]=this._geometries[n].reverse();return this.getFactory().createMultiLineString(e)},r.prototype.getBoundary=function(){return new zt(this).getBoundary()},r.prototype.getGeometryType=function(){return"MultiLineString"},r.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),e=0;e<t.length;e++)t[e]=this._geometries[e].copy();return new r(t,this._factory)},r.prototype.interfaces_=function(){return[Dt]},r.prototype.getClass=function(){return r},t.serialVersionUID.get=function(){return 0x7155d2ab4afa8000},Object.defineProperties(r,t),r}(Vt),zt=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,1===arguments.length){var t=arguments[0],e=gt.MOD2_BOUNDARY_RULE;this._geom=t,this._geomFact=t.getFactory(),this._bnRule=e}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this._geom=n,this._geomFact=n.getFactory(),this._bnRule=r}};zt.prototype.boundaryMultiLineString=function(t){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var e=this.computeBoundaryCoordinates(t);return 1===e.length?this._geomFact.createPoint(e[0]):this._geomFact.createMultiPointFromCoords(e)},zt.prototype.getBoundary=function(){return this._geom instanceof Jt?this.boundaryLineString(this._geom):this._geom instanceof qt?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},zt.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()])},zt.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},zt.prototype.computeBoundaryCoordinates=function(t){var e=new xt;this._endpointMap=new c;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 St.toCoordinateArray(e)},zt.prototype.addEndpoint=function(t){var e=this._endpointMap.get(t);null===e&&(e=new Yt,this._endpointMap.put(t,e)),e.count++},zt.prototype.interfaces_=function(){return[]},zt.prototype.getClass=function(){return zt},zt.getBoundary=function(){if(1===arguments.length){var t=arguments[0];return new zt(t).getBoundary()}if(2===arguments.length){var e=arguments[0],n=arguments[1];return new zt(e,n).getBoundary()}};var Yt=function(){this.count=null};Yt.prototype.interfaces_=function(){return[]},Yt.prototype.getClass=function(){return Yt};var Xt=function(){},Ht={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};Xt.prototype.interfaces_=function(){return[]},Xt.prototype.getClass=function(){return Xt},Xt.chars=function(t,e){for(var n=new Array(e).fill(null),r=0;r<e;r++)n[r]=t;return String(n)},Xt.getStackTrace=function(){if(1===arguments.length){var t=arguments[0],e=new function(){},n=new function(){}(e);return t.printStackTrace(n),e.toString()}if(2===arguments.length){for(var r=arguments[0],i=arguments[1],o="",s=new function(){}(new function(){}(Xt.getStackTrace(r))),a=0;a<i;a++)try{o+=s.readLine()+Xt.NEWLINE}catch(t){if(!(t instanceof g))throw t;et.shouldNeverReachHere()}return o}},Xt.split=function(t,e){for(var n=e.length,r=new xt,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},Xt.toString=function(){if(1===arguments.length){var t=arguments[0];return Xt.SIMPLE_ORDINATE_FORMAT.format(t)}},Xt.spaces=function(t){return Xt.chars(" ",t)},Ht.NEWLINE.get=function(){return z.getProperty("line.separator")},Ht.SIMPLE_ORDINATE_FORMAT.get=function(){return new function(){}("0.#")},Object.defineProperties(Xt,Ht);var Wt=function(){};Wt.prototype.interfaces_=function(){return[]},Wt.prototype.getClass=function(){return Wt},Wt.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))},Wt.isRing=function(t){var e=t.size();return 0===e||!(e<=3)&&t.getOrdinate(0,j.X)===t.getOrdinate(e-1,j.X)&&t.getOrdinate(0,j.Y)===t.getOrdinate(e-1,j.Y)},Wt.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)||m.isNaN(s)&&m.isNaN(a)))return!1}return!0},Wt.extend=function(t,e,n){var r=t.create(n,e.getDimension()),i=e.size();if(Wt.copy(e,0,r,0,i),0<i)for(var o=i;o<n;o++)Wt.copy(e,i-1,r,o,1);return r},Wt.reverse=function(t){for(var e=t.size()-1,n=Math.trunc(e/2),r=0;r<=n;r++)Wt.swap(t,r,e-r)},Wt.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)}},Wt.copy=function(t,e,n,r,i){for(var o=0;o<i;o++)Wt.copyCoord(t,e+o,n,r+o)},Wt.toString=function(){if(1===arguments.length){var t=arguments[0],e=t.size();if(0===e)return"()";var n=t.getDimension(),r=new M;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(Xt.toString(t.getOrdinate(i,o)))}return r.append(")"),r.toString()}},Wt.ensureValidRing=function(t,e){var n=e.size();return 0===n?e:n<=3?Wt.createClosedRing(t,e,4):e.getOrdinate(0,j.X)===e.getOrdinate(n-1,j.X)&&e.getOrdinate(0,j.Y)===e.getOrdinate(n-1,j.Y)?e:Wt.createClosedRing(t,e,n+1)},Wt.createClosedRing=function(t,e,n){var r=t.create(n,e.getDimension()),i=e.size();Wt.copy(e,0,r,0,i);for(var o=i;o<n;o++)Wt.copy(e,0,r,o,1);return r};var Jt=function(i){function e(t,e){i.call(this,e),this._points=null,this.init(t)}i&&(e.__proto__=i),(e.prototype=Object.create(i&&i.prototype)).constructor=e;var t={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new X:this._points.expandEnvelope(new X)},e.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},e.prototype.getSortIndex=function(){return i.SORTINDEX_LINESTRING},e.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},e.prototype.equalsExact=function(){if(2!==arguments.length)return i.prototype.equalsExact.apply(this,arguments);var t=arguments[0],e=arguments[1];if(!this.isEquivalentClass(t))return!1;var n=t;if(this._points.size()!==n._points.size())return!1;for(var r=0;r<this._points.size();r++)if(!this.equal(this._points.getCoordinate(r),n._points.getCoordinate(r),e))return!1;return!0},e.prototype.normalize=function(){for(var t=0;t<Math.trunc(this._points.size()/2);t++){var e=this._points.size()-1-t;if(!this._points.getCoordinate(t).equals(this._points.getCoordinate(e)))return 0<this._points.getCoordinate(t).compareTo(this._points.getCoordinate(e))&&Wt.reverse(this._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?Bt.FALSE:0},e.prototype.isClosed=function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},e.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},e.prototype.getDimension=function(){return 1},e.prototype.getLength=function(){return at.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var t=this._points.copy();return Wt.reverse(t),this.getFactory().createLineString(t)},e.prototype.compareToSameClass=function(){if(1===arguments.length){for(var t=arguments[0],e=0,n=0;e<this._points.size()&&n<t._points.size();){var r=this._points.getCoordinate(e).compareTo(t._points.getCoordinate(n));if(0!==r)return r;e++,n++}return e<this._points.size()?1:n<t._points.size()?-1:0}if(2===arguments.length){var i=arguments[0];return arguments[1].compare(this._points,i._points)}},e.prototype.apply=function(){if(R(arguments[0],ft))for(var t=arguments[0],e=0;e<this._points.size();e++)t.filter(this._points.getCoordinate(e));else if(R(arguments[0],Ut)){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 R(arguments[0],jt)?arguments[0].filter(this):R(arguments[0],lt)&&arguments[0].filter(this)},e.prototype.getBoundary=function(){return new zt(this).getBoundary()},e.prototype.isEquivalentClass=function(t){return t instanceof e},e.prototype.clone=function(){var t=i.prototype.clone.call(this);return t._points=this._points.clone(),t},e.prototype.getCoordinateN=function(t){return this._points.getCoordinate(t)},e.prototype.getGeometryType=function(){return"LineString"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.getCoordinateSequence=function(){return this._points},e.prototype.isEmpty=function(){return 0===this._points.size()},e.prototype.init=function(t){if(null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),1===t.size())throw new v("Invalid number of points in LineString (found "+t.size()+" - must be 0 or >= 2)");this._points=t},e.prototype.isCoordinate=function(t){for(var e=0;e<this._points.size();e++)if(this._points.getCoordinate(e).equals(t))return!0;return!1},e.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},e.prototype.getPointN=function(t){return this.getFactory().createPoint(this._points.getCoordinate(t))},e.prototype.interfaces_=function(){return[Dt]},e.prototype.getClass=function(){return e},t.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(e,t),e}(ht),Kt=function(){};Kt.prototype.interfaces_=function(){return[]},Kt.prototype.getClass=function(){return Kt};var Zt=function(n){function t(t,e){n.call(this,e),this._coordinates=t||null,this.init(this._coordinates)}n&&(t.__proto__=n),(t.prototype=Object.create(n&&n.prototype)).constructor=t;var e={serialVersionUID:{configurable:!0}};return t.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new X;var t=new X;return t.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),t},t.prototype.getSortIndex=function(){return n.SORTINDEX_POINT},t.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},t.prototype.equalsExact=function(){if(2!==arguments.length)return n.prototype.equalsExact.apply(this,arguments);var t=arguments[0],e=arguments[1];return!!this.isEquivalentClass(t)&&(!(!this.isEmpty()||!t.isEmpty())||this.isEmpty()===t.isEmpty()&&this.equal(t.getCoordinate(),this.getCoordinate(),e))},t.prototype.normalize=function(){},t.prototype.getCoordinate=function(){return 0!==this._coordinates.size()?this._coordinates.getCoordinate(0):null},t.prototype.getBoundaryDimension=function(){return Bt.FALSE},t.prototype.getDimension=function(){return 0},t.prototype.getNumPoints=function(){return this.isEmpty()?0:1},t.prototype.reverse=function(){return this.copy()},t.prototype.getX=function(){if(null===this.getCoordinate())throw new Error("getX called on empty Point");return this.getCoordinate().x},t.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0];return this.getCoordinate().compareTo(t.getCoordinate())}if(2===arguments.length){var e=arguments[0];return arguments[1].compare(this._coordinates,e._coordinates)}},t.prototype.apply=function(){if(R(arguments[0],ft)){var t=arguments[0];if(this.isEmpty())return null;t.filter(this.getCoordinate())}else if(R(arguments[0],Ut)){var e=arguments[0];if(this.isEmpty())return null;e.filter(this._coordinates,0),e.isGeometryChanged()&&this.geometryChanged()}else R(arguments[0],jt)?arguments[0].filter(this):R(arguments[0],lt)&&arguments[0].filter(this)},t.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},t.prototype.clone=function(){var t=n.prototype.clone.call(this);return t._coordinates=this._coordinates.clone(),t},t.prototype.getGeometryType=function(){return"Point"},t.prototype.copy=function(){return new t(this._coordinates.copy(),this._factory)},t.prototype.getCoordinateSequence=function(){return this._coordinates},t.prototype.getY=function(){if(null===this.getCoordinate())throw new Error("getY called on empty Point");return this.getCoordinate().y},t.prototype.isEmpty=function(){return 0===this._coordinates.size()},t.prototype.init=function(t){null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),et.isTrue(t.size()<=1),this._coordinates=t},t.prototype.isSimple=function(){return!0},t.prototype.interfaces_=function(){return[Kt]},t.prototype.getClass=function(){return t},e.serialVersionUID.get=function(){return 0x44077bad161cbc00},Object.defineProperties(t,e),t}(ht),Qt=function(){};Qt.prototype.interfaces_=function(){return[]},Qt.prototype.getClass=function(){return Qt};var $t=function(s){function r(t,e,n){if(s.call(this,n),this._shell=null,(this._holes=null)===t&&(t=this.getFactory().createLinearRing()),null===e&&(e=[]),s.hasNullElements(e))throw new v("holes must not contain null elements");if(t.isEmpty()&&s.hasNonEmptyElements(e))throw new v("shell is empty but holes are not");this._shell=t,this._holes=e}s&&(r.__proto__=s),(r.prototype=Object.create(s&&s.prototype)).constructor=r;var t={serialVersionUID:{configurable:!0}};return r.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},r.prototype.getSortIndex=function(){return s.SORTINDEX_POLYGON},r.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var t=new Array(this.getNumPoints()).fill(null),e=-1,n=this._shell.getCoordinates(),r=0;r<n.length;r++)t[++e]=n[r];for(var i=0;i<this._holes.length;i++)for(var o=this._holes[i].getCoordinates(),s=0;s<o.length;s++)t[++e]=o[s];return t},r.prototype.getArea=function(){var t=0;t+=Math.abs(at.signedArea(this._shell.getCoordinateSequence()));for(var e=0;e<this._holes.length;e++)t-=Math.abs(at.signedArea(this._holes[e].getCoordinateSequence()));return t},r.prototype.isRectangle=function(){if(0!==this.getNumInteriorRing())return!1;if(null===this._shell)return!1;if(5!==this._shell.getNumPoints())return!1;for(var t=this._shell.getCoordinateSequence(),e=this.getEnvelopeInternal(),n=0;n<5;n++){var r=t.getX(n);if(r!==e.getMinX()&&r!==e.getMaxX())return!1;var i=t.getY(n);if(i!==e.getMinY()&&i!==e.getMaxY())return!1}for(var o=t.getX(0),s=t.getY(0),a=1;a<=4;a++){var u=t.getX(a),l=t.getY(a);if(u!==o==(l!==s))return!1;o=u,s=l}return!0},r.prototype.equalsExact=function(){if(2!==arguments.length)return s.prototype.equalsExact.apply(this,arguments);var t=arguments[0],e=arguments[1];if(!this.isEquivalentClass(t))return!1;var n=t,r=this._shell,i=n._shell;if(!r.equalsExact(i,e))return!1;if(this._holes.length!==n._holes.length)return!1;for(var o=0;o<this._holes.length;o++)if(!this._holes[o].equalsExact(n._holes[o],e))return!1;return!0},r.prototype.normalize=function(){if(0===arguments.length){this.normalize(this._shell,!0);for(var t=0;t<this._holes.length;t++)this.normalize(this._holes[t],!1);kt.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);z.arraycopy(e.getCoordinates(),0,r,0,r.length);var i=St.minCoordinate(e.getCoordinates());St.scroll(r,i),z.arraycopy(r,0,e.getCoordinates(),0,r.length),e.getCoordinates()[r.length]=r[0],at.isCCW(e.getCoordinates())===n&&St.reverse(e.getCoordinates())}},r.prototype.getCoordinate=function(){return this._shell.getCoordinate()},r.prototype.getNumInteriorRing=function(){return this._holes.length},r.prototype.getBoundaryDimension=function(){return 1},r.prototype.getDimension=function(){return 2},r.prototype.getLength=function(){var t=0;t+=this._shell.getLength();for(var e=0;e<this._holes.length;e++)t+=this._holes[e].getLength();return t},r.prototype.getNumPoints=function(){for(var t=this._shell.getNumPoints(),e=0;e<this._holes.length;e++)t+=this._holes[e].getNumPoints();return t},r.prototype.reverse=function(){var t=this.copy();t._shell=this._shell.copy().reverse(),t._holes=new Array(this._holes.length).fill(null);for(var e=0;e<this._holes.length;e++)t._holes[e]=this._holes[e].copy().reverse();return t},r.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},r.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=this._shell,n=t._shell;return e.compareToSameClass(n)}if(2===arguments.length){var r=arguments[0],i=arguments[1],o=r,s=this._shell,a=o._shell,u=s.compareToSameClass(a,i);if(0!==u)return u;for(var l=this.getNumInteriorRing(),h=o.getNumInteriorRing(),c=0;c<l&&c<h;){var p=this.getInteriorRingN(c),f=o.getInteriorRingN(c),g=p.compareToSameClass(f,i);if(0!==g)return g;c++}return c<l?1:c<h?-1:0}},r.prototype.apply=function(t){if(R(t,ft)){this._shell.apply(t);for(var e=0;e<this._holes.length;e++)this._holes[e].apply(t)}else if(R(t,Ut)){if(this._shell.apply(t),!t.isDone())for(var n=0;n<this._holes.length&&(this._holes[n].apply(t),!t.isDone());n++);t.isGeometryChanged()&&this.geometryChanged()}else if(R(t,jt))t.filter(this);else if(R(t,lt)){t.filter(this),this._shell.apply(t);for(var r=0;r<this._holes.length;r++)this._holes[r].apply(t)}},r.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var t=new Array(this._holes.length+1).fill(null);t[0]=this._shell;for(var e=0;e<this._holes.length;e++)t[e+1]=this._holes[e];return t.length<=1?this.getFactory().createLinearRing(t[0].getCoordinateSequence()):this.getFactory().createMultiLineString(t)},r.prototype.clone=function(){var t=s.prototype.clone.call(this);t._shell=this._shell.clone(),t._holes=new Array(this._holes.length).fill(null);for(var e=0;e<this._holes.length;e++)t._holes[e]=this._holes[e].clone();return t},r.prototype.getGeometryType=function(){return"Polygon"},r.prototype.copy=function(){for(var t=this._shell.copy(),e=new Array(this._holes.length).fill(null),n=0;n<e.length;n++)e[n]=this._holes[n].copy();return new r(t,e,this._factory)},r.prototype.getExteriorRing=function(){return this._shell},r.prototype.isEmpty=function(){return this._shell.isEmpty()},r.prototype.getInteriorRingN=function(t){return this._holes[t]},r.prototype.interfaces_=function(){return[Qt]},r.prototype.getClass=function(){return r},t.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(r,t),r}(ht),te=function(n){function r(){n.apply(this,arguments)}n&&(r.__proto__=n),(r.prototype=Object.create(n&&n.prototype)).constructor=r;var t={serialVersionUID:{configurable:!0}};return r.prototype.getSortIndex=function(){return ht.SORTINDEX_MULTIPOINT},r.prototype.isValid=function(){return!0},r.prototype.equalsExact=function(){if(2!==arguments.length)return n.prototype.equalsExact.apply(this,arguments);var t=arguments[0],e=arguments[1];return!!this.isEquivalentClass(t)&&n.prototype.equalsExact.call(this,t,e)},r.prototype.getCoordinate=function(){if(1!==arguments.length)return n.prototype.getCoordinate.apply(this,arguments);var t=arguments[0];return this._geometries[t].getCoordinate()},r.prototype.getBoundaryDimension=function(){return Bt.FALSE},r.prototype.getDimension=function(){return 0},r.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},r.prototype.getGeometryType=function(){return"MultiPoint"},r.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),e=0;e<t.length;e++)t[e]=this._geometries[e].copy();return new r(t,this._factory)},r.prototype.interfaces_=function(){return[Kt]},r.prototype.getClass=function(){return r},t.serialVersionUID.get=function(){return-0x6fb1ed4162e0fc00},Object.defineProperties(r,t),r}(Vt),ee=function(n){function t(t,e){t instanceof I&&e instanceof _e&&(t=e.getCoordinateSequenceFactory().create(t)),n.call(this,t,e),this.validateConstruction()}n&&(t.__proto__=n),(t.prototype=Object.create(n&&n.prototype)).constructor=t;var e={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return t.prototype.getSortIndex=function(){return ht.SORTINDEX_LINEARRING},t.prototype.getBoundaryDimension=function(){return Bt.FALSE},t.prototype.isClosed=function(){return!!this.isEmpty()||n.prototype.isClosed.call(this)},t.prototype.reverse=function(){var t=this._points.copy();return Wt.reverse(t),this.getFactory().createLinearRing(t)},t.prototype.validateConstruction=function(){if(!this.isEmpty()&&!n.prototype.isClosed.call(this))throw new v("Points of LinearRing do not form a closed linestring");if(1<=this.getCoordinateSequence().size()&&this.getCoordinateSequence().size()<t.MINIMUM_VALID_SIZE)throw new v("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},t.prototype.getGeometryType=function(){return"LinearRing"},t.prototype.copy=function(){return new t(this._points.copy(),this._factory)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},e.MINIMUM_VALID_SIZE.get=function(){return 4},e.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(t,e),t}(Jt),ne=function(n){function r(){n.apply(this,arguments)}n&&(r.__proto__=n),(r.prototype=Object.create(n&&n.prototype)).constructor=r;var t={serialVersionUID:{configurable:!0}};return r.prototype.getSortIndex=function(){return ht.SORTINDEX_MULTIPOLYGON},r.prototype.equalsExact=function(){if(2!==arguments.length)return n.prototype.equalsExact.apply(this,arguments);var t=arguments[0],e=arguments[1];return!!this.isEquivalentClass(t)&&n.prototype.equalsExact.call(this,t,e)},r.prototype.getBoundaryDimension=function(){return 1},r.prototype.getDimension=function(){return 2},r.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),n=0;n<this._geometries.length;n++)e[n]=this._geometries[n].reverse();return this.getFactory().createMultiPolygon(e)},r.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var t=new xt,e=0;e<this._geometries.length;e++)for(var n=this._geometries[e].getBoundary(),r=0;r<n.getNumGeometries();r++)t.add(n.getGeometryN(r));var i=new Array(t.size()).fill(null);return this.getFactory().createMultiLineString(t.toArray(i))},r.prototype.getGeometryType=function(){return"MultiPolygon"},r.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),e=0;e<t.length;e++)t[e]=this._geometries[e].copy();return new r(t,this._factory)},r.prototype.interfaces_=function(){return[Qt]},r.prototype.getClass=function(){return r},t.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(r,t),r}(Vt),re=function(t){this._factory=t||null,this._isUserDataCopied=!1},ie={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};re.prototype.setCopyUserData=function(t){this._isUserDataCopied=t},re.prototype.edit=function(t,e){if(null===t)return null;var n=this.editInternal(t,e);return this._isUserDataCopied&&n.setUserData(t.getUserData()),n},re.prototype.editInternal=function(t,e){return null===this._factory&&(this._factory=t.getFactory()),t instanceof Vt?this.editGeometryCollection(t,e):t instanceof $t?this.editPolygon(t,e):t instanceof Zt?e.edit(t,this._factory):t instanceof Jt?e.edit(t,this._factory):(et.shouldNeverReachHere("Unsupported Geometry class: "+t.getClass().getName()),null)},re.prototype.editGeometryCollection=function(t,e){for(var n=e.edit(t,this._factory),r=new xt,i=0;i<n.getNumGeometries();i++){var o=this.edit(n.getGeometryN(i),e);null===o||o.isEmpty()||r.add(o)}return n.getClass()===te?this._factory.createMultiPoint(r.toArray([])):n.getClass()===qt?this._factory.createMultiLineString(r.toArray([])):n.getClass()===ne?this._factory.createMultiPolygon(r.toArray([])):this._factory.createGeometryCollection(r.toArray([]))},re.prototype.editPolygon=function(t,e){var n=e.edit(t,this._factory);if(null===n&&(n=this._factory.createPolygon(null)),n.isEmpty())return n;var r=this.edit(n.getExteriorRing(),e);if(null===r||r.isEmpty())return this._factory.createPolygon();for(var i=new xt,o=0;o<n.getNumInteriorRing();o++){var s=this.edit(n.getInteriorRingN(o),e);null===s||s.isEmpty()||i.add(s)}return this._factory.createPolygon(r,i.toArray([]))},re.prototype.interfaces_=function(){return[]},re.prototype.getClass=function(){return re},re.GeometryEditorOperation=function(){},ie.NoOpGeometryOperation.get=function(){return oe},ie.CoordinateOperation.get=function(){return se},ie.CoordinateSequenceOperation.get=function(){return ae},Object.defineProperties(re,ie);var oe=function(){};oe.prototype.edit=function(t,e){return t},oe.prototype.interfaces_=function(){return[re.GeometryEditorOperation]},oe.prototype.getClass=function(){return oe};var se=function(){};se.prototype.edit=function(t,e){var n=this.editCoordinates(t.getCoordinates(),t);return null===n?t:t instanceof ee?e.createLinearRing(n):t instanceof Jt?e.createLineString(n):t instanceof Zt?0<n.length?e.createPoint(n[0]):e.createPoint():t},se.prototype.interfaces_=function(){return[re.GeometryEditorOperation]},se.prototype.getClass=function(){return se};var ae=function(){};ae.prototype.edit=function(t,e){return t instanceof ee?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof Jt?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Zt?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t},ae.prototype.interfaces_=function(){return[re.GeometryEditorOperation]},ae.prototype.getClass=function(){return ae};var ue=function(){if(this._dimension=3,this._coordinates=null,1===arguments.length){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var t=arguments[0];this._coordinates=new Array(t).fill(null);for(var e=0;e<t;e++)this._coordinates[e]=new I}else if(R(arguments[0],j)){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],a=arguments[1];this._coordinates=new Array(s).fill(null),this._dimension=a;for(var u=0;u<s;u++)this._coordinates[u]=new I}},le={serialVersionUID:{configurable:!0}};ue.prototype.setOrdinate=function(t,e,n){switch(e){case j.X:this._coordinates[t].x=n;break;case j.Y:this._coordinates[t].y=n;break;case j.Z:this._coordinates[t].z=n;break;default:throw new v("invalid ordinateIndex")}},ue.prototype.size=function(){return this._coordinates.length},ue.prototype.getOrdinate=function(t,e){switch(e){case j.X:return this._coordinates[t].x;case j.Y:return this._coordinates[t].y;case j.Z:return this._coordinates[t].z}return m.NaN},ue.prototype.getCoordinate=function(){if(1===arguments.length){var t=arguments[0];return this._coordinates[t]}if(2===arguments.length){var e=arguments[0],n=arguments[1];n.x=this._coordinates[e].x,n.y=this._coordinates[e].y,n.z=this._coordinates[e].z}},ue.prototype.getCoordinateCopy=function(t){return new I(this._coordinates[t])},ue.prototype.getDimension=function(){return this._dimension},ue.prototype.getX=function(t){return this._coordinates[t].x},ue.prototype.clone=function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].clone();return new ue(t,this._dimension)},ue.prototype.expandEnvelope=function(t){for(var e=0;e<this._coordinates.length;e++)t.expandToInclude(this._coordinates[e]);return t},ue.prototype.copy=function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].copy();return new ue(t,this._dimension)},ue.prototype.toString=function(){if(0<this._coordinates.length){var t=new M(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var e=1;e<this._coordinates.length;e++)t.append(", "),t.append(this._coordinates[e]);return t.append(")"),t.toString()}return"()"},ue.prototype.getY=function(t){return this._coordinates[t].y},ue.prototype.toCoordinateArray=function(){return this._coordinates},ue.prototype.interfaces_=function(){return[j,e]},ue.prototype.getClass=function(){return ue},le.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(ue,le);var he=function(){},ce={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};he.prototype.readResolve=function(){return he.instance()},he.prototype.create=function(){if(1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];return new ue(t)}if(R(arguments[0],j)){var e=arguments[0];return new ue(e)}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];return 3<r&&(r=3),r<2?new ue(n):new ue(n,r)}},he.prototype.interfaces_=function(){return[C,e]},he.prototype.getClass=function(){return he},he.instance=function(){return he.instanceObject},ce.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},ce.instanceObject.get=function(){return new he},Object.defineProperties(he,ce);var pe=function(t){function e(){t.call(this),this.map_=new Map}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.get=function(t){return this.map_.get(t)||null},e.prototype.put=function(t,e){return this.map_.set(t,e),e},e.prototype.values=function(){for(var t=new xt,e=this.map_.values(),n=e.next();!n.done;)t.add(n.value),n=e.next();return t},e.prototype.entrySet=function(){var e=new Pt;return this.map_.entries().forEach(function(t){return e.add(t)}),e},e.prototype.size=function(){return this.map_.size()},e}(Rt),fe=function t(){if(this._modelType=null,this._scale=null,0===arguments.length)this._modelType=t.FLOATING;else if(1===arguments.length)if(arguments[0]instanceof de){var e=arguments[0];(this._modelType=e)===t.FIXED&&this.setScale(1)}else if("number"==typeof arguments[0]){var n=arguments[0];this._modelType=t.FIXED,this.setScale(n)}else if(arguments[0]instanceof t){var r=arguments[0];this._modelType=r._modelType,this._scale=r._scale}},ge={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};fe.prototype.equals=function(t){if(!(t instanceof fe))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale},fe.prototype.compareTo=function(t){var e=t,n=this.getMaximumSignificantDigits(),r=e.getMaximumSignificantDigits();return new A(n).compareTo(new A(r))},fe.prototype.getScale=function(){return this._scale},fe.prototype.isFloating=function(){return this._modelType===fe.FLOATING||this._modelType===fe.FLOATING_SINGLE},fe.prototype.getType=function(){return this._modelType},fe.prototype.toString=function(){var t="UNKNOWN";return this._modelType===fe.FLOATING?t="Floating":this._modelType===fe.FLOATING_SINGLE?t="Floating-Single":this._modelType===fe.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},fe.prototype.makePrecise=function(){if("number"==typeof arguments[0]){var t=arguments[0];return m.isNaN(t)?t:this._modelType===fe.FLOATING_SINGLE?t:this._modelType===fe.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof I){var e=arguments[0];if(this._modelType===fe.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}},fe.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===fe.FLOATING?t=16:this._modelType===fe.FLOATING_SINGLE?t=6:this._modelType===fe.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},fe.prototype.setScale=function(t){this._scale=Math.abs(t)},fe.prototype.interfaces_=function(){return[e,E]},fe.prototype.getClass=function(){return fe},fe.mostPrecise=function(t,e){return 0<=t.compareTo(e)?t:e},ge.serialVersionUID.get=function(){return 0x6bee6404e9a25c00},ge.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(fe,ge);var de=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},ye={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};de.prototype.readResolve=function(){return de.nameToTypeMap.get(this._name)},de.prototype.toString=function(){return this._name},de.prototype.interfaces_=function(){return[e]},de.prototype.getClass=function(){return de},ye.serialVersionUID.get=function(){return-552860263173159e4},ye.nameToTypeMap.get=function(){return new pe},Object.defineProperties(de,ye),fe.Type=de,fe.FIXED=new de("FIXED"),fe.FLOATING=new de("FLOATING"),fe.FLOATING_SINGLE=new de("FLOATING SINGLE");var _e=function t(){this._precisionModel=new fe,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),0===arguments.length||(1===arguments.length?R(arguments[0],C)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof fe&&(this._precisionModel=arguments[0]):2===arguments.length?(this._precisionModel=arguments[0],this._SRID=arguments[1]):3===arguments.length&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},ve={serialVersionUID:{configurable:!0}};_e.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new I(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new I(t.getMinX(),t.getMinY()),new I(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new I(t.getMinX(),t.getMinY()),new I(t.getMinX(),t.getMaxY()),new I(t.getMaxX(),t.getMaxY()),new I(t.getMaxX(),t.getMinY()),new I(t.getMinX(),t.getMinY())]),null)},_e.prototype.createLineString=function(t){return t?t instanceof Array?new Jt(this.getCoordinateSequenceFactory().create(t),this):R(t,j)?new Jt(t,this):void 0:new Jt(this.getCoordinateSequenceFactory().create([]),this)},_e.prototype.createMultiLineString=function(){if(0===arguments.length)return new qt(null,this);if(1===arguments.length){var t=arguments[0];return new qt(t,this)}},_e.prototype.buildGeometry=function(t){for(var e=null,n=!1,r=!1,i=t.iterator();i.hasNext();){var o=i.next(),s=o.getClass();null===e&&(e=s),s!==e&&(n=!0),o.isGeometryCollectionOrDerived()&&(r=!0)}if(null===e)return this.createGeometryCollection();if(n||r)return this.createGeometryCollection(_e.toGeometryArray(t));var a=t.iterator().next();if(1<t.size()){if(a instanceof $t)return this.createMultiPolygon(_e.toPolygonArray(t));if(a instanceof Jt)return this.createMultiLineString(_e.toLineStringArray(t));if(a instanceof Zt)return this.createMultiPoint(_e.toPointArray(t));et.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a},_e.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)},_e.prototype.createPoint=function(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof I){var t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(R(arguments[0],j)){var e=arguments[0];return new Zt(e,this)}}},_e.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},_e.prototype.createPolygon=function(){if(0===arguments.length)return new $t(null,null,this);if(1===arguments.length){if(R(arguments[0],j)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}if(arguments[0]instanceof ee){var n=arguments[0];return this.createPolygon(n,null)}}else if(2===arguments.length){var r=arguments[0],i=arguments[1];return new $t(r,i,this)}},_e.prototype.getSRID=function(){return this._SRID},_e.prototype.createGeometryCollection=function(){if(0===arguments.length)return new Vt(null,this);if(1===arguments.length){var t=arguments[0];return new Vt(t,this)}},_e.prototype.createGeometry=function(t){return new re(this).edit(t,{edit:function(){if(2===arguments.length){var t=arguments[0];return this._coordinateSequenceFactory.create(t)}}})},_e.prototype.getPrecisionModel=function(){return this._precisionModel},_e.prototype.createLinearRing=function(){if(0===arguments.length)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(R(arguments[0],j)){var e=arguments[0];return new ee(e,this)}}},_e.prototype.createMultiPolygon=function(){if(0===arguments.length)return new ne(null,this);if(1===arguments.length){var t=arguments[0];return new ne(t,this)}},_e.prototype.createMultiPoint=function(){if(0===arguments.length)return new te(null,this);if(1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];return new te(t,this)}if(arguments[0]instanceof Array){var e=arguments[0];return this.createMultiPoint(null!==e?this.getCoordinateSequenceFactory().create(e):null)}if(R(arguments[0],j)){var n=arguments[0];if(null===n)return this.createMultiPoint(new Array(0).fill(null));for(var r=new Array(n.size()).fill(null),i=0;i<n.size();i++){var o=this.getCoordinateSequenceFactory().create(1,n.getDimension());Wt.copy(n,i,o,0,1),r[i]=this.createPoint(o)}return this.createMultiPoint(r)}}},_e.prototype.interfaces_=function(){return[e]},_e.prototype.getClass=function(){return _e},_e.toMultiPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},_e.toGeometryArray=function(t){if(null===t)return null;var e=new Array(t.size()).fill(null);return t.toArray(e)},_e.getDefaultCoordinateSequenceFactory=function(){return he.instance()},_e.toMultiLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},_e.toLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},_e.toMultiPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},_e.toLinearRingArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},_e.toPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},_e.toPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},_e.createPointFromInternalCoord=function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)},ve.serialVersionUID.get=function(){return-0x5ea75f2051eeb400},Object.defineProperties(_e,ve);var me=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],be=function(t){this.geometryFactory=t||new _e};be.prototype.read=function(t){var e,n=(e="string"==typeof t?JSON.parse(t):t).type;if(!Ee[n])throw new Error("Unknown GeoJSON type: "+e.type);return-1!==me.indexOf(n)?Ee[n].apply(this,[e.coordinates]):"GeometryCollection"===n?Ee[n].apply(this,[e.geometries]):Ee[n].apply(this,[e])},be.prototype.write=function(t){var e=t.getGeometryType();if(!we[e])throw new Error("Geometry is not supported");return we[e].apply(this,[t])};var Ee={Feature:function(t){var e={};for(var n in t)e[n]=t[n];if(t.geometry){var r=t.geometry.type;if(!Ee[r])throw new Error("Unknown GeoJSON type: "+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=Ee.bbox.apply(this,[t.bbox])),e},FeatureCollection:function(t){var e={};if(t.features){e.features=[];for(var n=0;n<t.features.length;++n)e.features.push(this.read(t.features[n]))}return t.bbox&&(e.bbox=this.parse.bbox.apply(this,[t.bbox])),e},coordinates:function(t){for(var e=[],n=0;n<t.length;++n){var r=t[n];e.push(new I(r[0],r[1]))}return e},bbox:function(t){return this.geometryFactory.createLinearRing([new I(t[0],t[1]),new I(t[2],t[1]),new I(t[2],t[3]),new I(t[0],t[3]),new I(t[0],t[1])])},Point:function(t){var e=new I(t[0],t[1]);return this.geometryFactory.createPoint(e)},MultiPoint:function(t){for(var e=[],n=0;n<t.length;++n)e.push(Ee.Point.apply(this,[t[n]]));return this.geometryFactory.createMultiPoint(e)},LineString:function(t){var e=Ee.coordinates.apply(this,[t]);return this.geometryFactory.createLineString(e)},MultiLineString:function(t){for(var e=[],n=0;n<t.length;++n)e.push(Ee.LineString.apply(this,[t[n]]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(t){for(var e=Ee.coordinates.apply(this,[t[0]]),n=this.geometryFactory.createLinearRing(e),r=[],i=1;i<t.length;++i){var o=t[i],s=Ee.coordinates.apply(this,[o]),a=this.geometryFactory.createLinearRing(s);r.push(a)}return this.geometryFactory.createPolygon(n,r)},MultiPolygon:function(t){for(var e=[],n=0;n<t.length;++n){var r=t[n];e.push(Ee.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)}},we={coordinate:function(t){return[t.x,t.y]},Point:function(t){return{type:"Point",coordinates:we.coordinate.apply(this,[t.getCoordinate()])}},MultiPoint:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=we.Point.apply(this,[r]);e.push(i.coordinates)}return{type:"MultiPoint",coordinates:e}},LineString:function(t){for(var e=[],n=t.getCoordinates(),r=0;r<n.length;++r){var i=n[r];e.push(we.coordinate.apply(this,[i]))}return{type:"LineString",coordinates:e}},MultiLineString:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=we.LineString.apply(this,[r]);e.push(i.coordinates)}return{type:"MultiLineString",coordinates:e}},Polygon:function(t){var e=[],n=we.LineString.apply(this,[t._shell]);e.push(n.coordinates);for(var r=0;r<t._holes.length;++r){var i=t._holes[r],o=we.LineString.apply(this,[i]);e.push(o.coordinates)}return{type:"Polygon",coordinates:e}},MultiPolygon:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=we.Polygon.apply(this,[r]);e.push(i.coordinates)}return{type:"MultiPolygon",coordinates:e}},GeometryCollection:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=r.getGeometryType();e.push(we[i].apply(this,[r]))}return{type:"GeometryCollection",geometries:e}}},xe=function(t){this.geometryFactory=t||new _e,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new be(this.geometryFactory)};xe.prototype.read=function(t){var e=this.parser.read(t);return this.precisionModel.getType()===fe.FIXED&&this.reducePrecision(e),e},xe.prototype.reducePrecision=function(t){var e,n;if(t.coordinate)this.precisionModel.makePrecise(t.coordinate);else if(t.points)for(e=0,n=t.points.length;e<n;e++)this.precisionModel.makePrecise(t.points[e]);else if(t.geometries)for(e=0,n=t.geometries.length;e<n;e++)this.reducePrecision(t.geometries[e])};var Ie=function(){this.parser=new be(this.geometryFactory)};Ie.prototype.write=function(t){return this.parser.write(t)};var Ne=function(){},Se={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};Ne.prototype.interfaces_=function(){return[]},Ne.prototype.getClass=function(){return Ne},Ne.opposite=function(t){return t===Ne.LEFT?Ne.RIGHT:t===Ne.RIGHT?Ne.LEFT:t},Se.ON.get=function(){return 0},Se.LEFT.get=function(){return 1},Se.RIGHT.get=function(){return 2},Object.defineProperties(Ne,Se),(d.prototype=new Error).name="EmptyStackException",(y.prototype=new wt).add=function(t){return this.array_.push(t),!0},y.prototype.get=function(t){if(t<0||t>=this.size())throw new Error;return this.array_[t]},y.prototype.push=function(t){return this.array_.push(t),t},y.prototype.pop=function(t){if(0===this.array_.length)throw new d;return this.array_.pop()},y.prototype.peek=function(){if(0===this.array_.length)throw new d;return this.array_[this.array_.length-1]},y.prototype.empty=function(){return 0===this.array_.length},y.prototype.isEmpty=function(){return this.empty()},y.prototype.search=function(t){return this.array_.indexOf(t)},y.prototype.size=function(){return this.array_.length},y.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t};var Ce=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};Ce.prototype.getCoordinate=function(){return this._minCoord},Ce.prototype.getRightmostSide=function(t,e){var n=this.getRightmostSideOfSegment(t,e);return n<0&&(n=this.getRightmostSideOfSegment(t,e-1)),n<0&&(this._minCoord=null,this.checkForRightmostCoordinate(t)),n},Ce.prototype.findRightmostEdgeAtVertex=function(){var t=this._minDe.getEdge().getCoordinates();et.isTrue(0<this._minIndex&&this._minIndex<t.length,"rightmost point expected to be interior vertex of edge");var e=t[this._minIndex-1],n=t[this._minIndex+1],r=at.computeOrientation(this._minCoord,n,e),i=!1;e.y<this._minCoord.y&&n.y<this._minCoord.y&&r===at.COUNTERCLOCKWISE?i=!0:e.y>this._minCoord.y&&n.y>this._minCoord.y&&r===at.CLOCKWISE&&(i=!0),i&&(this._minIndex=this._minIndex-1)},Ce.prototype.getRightmostSideOfSegment=function(t,e){var n=t.getEdge().getCoordinates();if(e<0||e+1>=n.length)return-1;if(n[e].y===n[e+1].y)return-1;var r=Ne.LEFT;return n[e].y<n[e+1].y&&(r=Ne.RIGHT),r},Ce.prototype.getEdge=function(){return this._orientedDe},Ce.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])},Ce.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)},Ce.prototype.findEdge=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();n.isForward()&&this.checkForRightmostCoordinate(n)}et.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)===Ne.LEFT&&(this._orientedDe=this._minDe.getSym())},Ce.prototype.interfaces_=function(){return[]},Ce.prototype.getClass=function(){return Ce};var Le=function(n){function r(t,e){n.call(this,r.msgWithCoord(t,e)),this.pt=e?new I(e):null,this.name="TopologyException"}return n&&(r.__proto__=n),((r.prototype=Object.create(n&&n.prototype)).constructor=r).prototype.getCoordinate=function(){return this.pt},r.prototype.interfaces_=function(){return[]},r.prototype.getClass=function(){return r},r.msgWithCoord=function(t,e){return e?t:t+" [ "+e+" ]"},r}($),Te=function(){this.array_=[]};Te.prototype.addLast=function(t){this.array_.push(t)},Te.prototype.removeFirst=function(){return this.array_.shift()},Te.prototype.isEmpty=function(){return 0===this.array_.length};var Re=function(){this._finder=null,this._dirEdgeList=new xt,this._nodes=new xt,this._rightMostCoord=null,this._env=null,this._finder=new Ce};Re.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();)t.next().setVisited(!1)},Re.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},Re.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 Le("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)}},Re.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(Ne.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)},Re.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},Re.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();1<=e.getDepth(Ne.RIGHT)&&e.getDepth(Ne.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},Re.prototype.computeDepths=function(t){var e=new Pt,n=new Te,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();if(!s.isVisited()){var a=s.getNode();e.contains(a)||(n.addLast(a),e.add(a))}}}},Re.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.x<e._rightMostCoord.x?-1:this._rightMostCoord.x>e._rightMostCoord.x?1:0},Re.prototype.getEnvelope=function(){if(null===this._env){for(var t=new X,e=this._dirEdgeList.iterator();e.hasNext();)for(var n=e.next().getEdge().getCoordinates(),r=0;r<n.length-1;r++)t.expandToInclude(n[r]);this._env=t}return this._env},Re.prototype.addReachable=function(t){var e=new y;for(e.add(t);!e.empty();){var n=e.pop();this.add(n,e)}},Re.prototype.copySymDepths=function(t){var e=t.getSym();e.setDepth(Ne.LEFT,t.getDepth(Ne.RIGHT)),e.setDepth(Ne.RIGHT,t.getDepth(Ne.LEFT))},Re.prototype.add=function(t,e){t.setVisited(!0),this._nodes.add(t);for(var n=t.getEdges().iterator();n.hasNext();){var r=n.next();this._dirEdgeList.add(r);var i=r.getSym().getNode();i.isVisited()||e.push(i)}},Re.prototype.getNodes=function(){return this._nodes},Re.prototype.getDirectedEdges=function(){return this._dirEdgeList},Re.prototype.interfaces_=function(){return[E]},Re.prototype.getClass=function(){return Re};var Oe=function t(){if(this.location=null,1===arguments.length){if(arguments[0]instanceof Array){var e=arguments[0];this.init(e.length)}else if(Number.isInteger(arguments[0])){var n=arguments[0];this.init(1),this.location[Ne.ON]=n}else if(arguments[0]instanceof t){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 if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];this.init(3),this.location[Ne.ON]=o,this.location[Ne.LEFT]=s,this.location[Ne.RIGHT]=a}};Oe.prototype.setAllLocations=function(t){for(var e=0;e<this.location.length;e++)this.location[e]=t},Oe.prototype.isNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==L.NONE)return!1;return!0},Oe.prototype.setAllLocationsIfNull=function(t){for(var e=0;e<this.location.length;e++)this.location[e]===L.NONE&&(this.location[e]=t)},Oe.prototype.isLine=function(){return 1===this.location.length},Oe.prototype.merge=function(t){if(t.location.length>this.location.length){var e=new Array(3).fill(null);e[Ne.ON]=this.location[Ne.ON],e[Ne.LEFT]=L.NONE,e[Ne.RIGHT]=L.NONE,this.location=e}for(var n=0;n<this.location.length;n++)this.location[n]===L.NONE&&n<t.location.length&&(this.location[n]=t.location[n])},Oe.prototype.getLocations=function(){return this.location},Oe.prototype.flip=function(){if(this.location.length<=1)return null;var t=this.location[Ne.LEFT];this.location[Ne.LEFT]=this.location[Ne.RIGHT],this.location[Ne.RIGHT]=t},Oe.prototype.toString=function(){var t=new M;return 1<this.location.length&&t.append(L.toLocationSymbol(this.location[Ne.LEFT])),t.append(L.toLocationSymbol(this.location[Ne.ON])),1<this.location.length&&t.append(L.toLocationSymbol(this.location[Ne.RIGHT])),t.toString()},Oe.prototype.setLocations=function(t,e,n){this.location[Ne.ON]=t,this.location[Ne.LEFT]=e,this.location[Ne.RIGHT]=n},Oe.prototype.get=function(t){return t<this.location.length?this.location[t]:L.NONE},Oe.prototype.isArea=function(){return 1<this.location.length},Oe.prototype.isAnyNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===L.NONE)return!0;return!1},Oe.prototype.setLocation=function(){if(1===arguments.length){var t=arguments[0];this.setLocation(Ne.ON,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.location[e]=n}},Oe.prototype.init=function(t){this.location=new Array(t).fill(null),this.setAllLocations(L.NONE)},Oe.prototype.isEqualOnSide=function(t,e){return this.location[e]===t.location[e]},Oe.prototype.allPositionsEqual=function(t){for(var e=0;e<this.location.length;e++)if(this.location[e]!==t)return!1;return!0},Oe.prototype.interfaces_=function(){return[]},Oe.prototype.getClass=function(){return Oe};var Pe=function t(){if(this.elt=new Array(2).fill(null),1===arguments.length){if(Number.isInteger(arguments[0])){var e=arguments[0];this.elt[0]=new Oe(e),this.elt[1]=new Oe(e)}else if(arguments[0]instanceof t){var n=arguments[0];this.elt[0]=new Oe(n.elt[0]),this.elt[1]=new Oe(n.elt[1])}}else if(2===arguments.length){var r=arguments[0],i=arguments[1];this.elt[0]=new Oe(L.NONE),this.elt[1]=new Oe(L.NONE),this.elt[r].setLocation(i)}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];this.elt[0]=new Oe(o,s,a),this.elt[1]=new Oe(o,s,a)}else if(4===arguments.length){var u=arguments[0],l=arguments[1],h=arguments[2],c=arguments[3];this.elt[0]=new Oe(L.NONE,L.NONE,L.NONE),this.elt[1]=new Oe(L.NONE,L.NONE,L.NONE),this.elt[u].setLocations(l,h,c)}};Pe.prototype.getGeometryCount=function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t},Pe.prototype.setAllLocations=function(t,e){this.elt[t].setAllLocations(e)},Pe.prototype.isNull=function(t){return this.elt[t].isNull()},Pe.prototype.setAllLocationsIfNull=function(){if(1===arguments.length){var t=arguments[0];this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.elt[e].setAllLocationsIfNull(n)}},Pe.prototype.isLine=function(t){return this.elt[t].isLine()},Pe.prototype.merge=function(t){for(var e=0;e<2;e++)null===this.elt[e]&&null!==t.elt[e]?this.elt[e]=new Oe(t.elt[e]):this.elt[e].merge(t.elt[e])},Pe.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},Pe.prototype.getLocation=function(){if(1===arguments.length){var t=arguments[0];return this.elt[t].get(Ne.ON)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return this.elt[e].get(n)}},Pe.prototype.toString=function(){var t=new M;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()},Pe.prototype.isArea=function(){if(0===arguments.length)return this.elt[0].isArea()||this.elt[1].isArea();if(1===arguments.length){var t=arguments[0];return this.elt[t].isArea()}},Pe.prototype.isAnyNull=function(t){return this.elt[t].isAnyNull()},Pe.prototype.setLocation=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.elt[t].setLocation(Ne.ON,e)}else if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];this.elt[n].setLocation(r,i)}},Pe.prototype.isEqualOnSide=function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)},Pe.prototype.allPositionsEqual=function(t,e){return this.elt[t].allPositionsEqual(e)},Pe.prototype.toLine=function(t){this.elt[t].isArea()&&(this.elt[t]=new Oe(this.elt[t].location[0]))},Pe.prototype.interfaces_=function(){return[]},Pe.prototype.getClass=function(){return Pe},Pe.toLineLabel=function(t){for(var e=new Pe(L.NONE),n=0;n<2;n++)e.setLocation(n,t.getLocation(n));return e};var Me=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new xt,this._pts=new xt,this._label=new Pe(L.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new xt,this._geometryFactory=null;var t=arguments[0],e=arguments[1];this._geometryFactory=e,this.computePoints(t),this.computeRing()};Me.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=at.isCCW(this._ring.getCoordinates())},Me.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},Me.prototype.computePoints=function(t){var e=this._startDe=t,n=!0;do{if(null===e)throw new Le("Found null DirectedEdge");if(e.getEdgeRing()===this)throw new Le("Directed Edge visited twice during ring-building at "+e.getCoordinate());this._edges.add(e);var r=e.getLabel();et.isTrue(r.isArea()),this.mergeLabel(r),this.addPoints(e.getEdge(),e.isForward(),n),n=!1,this.setEdgeRing(e,this),e=this.getNext(e)}while(e!==this._startDe)},Me.prototype.getLinearRing=function(){return this._ring},Me.prototype.getCoordinate=function(t){return this._pts.get(t)},Me.prototype.computeMaxNodeDegree=function(){this._maxNodeDegree=0;var t=this._startDe;do{var e=t.getNode().getEdges().getOutgoingDegree(this);e>this._maxNodeDegree&&(this._maxNodeDegree=e),t=this.getNext(t)}while(t!==this._startDe);this._maxNodeDegree*=2},Me.prototype.addPoints=function(t,e,n){var r=t.getCoordinates();if(e){var i=1;n&&(i=0);for(var o=i;o<r.length;o++)this._pts.add(r[o])}else{var s=r.length-2;n&&(s=r.length-1);for(var a=s;0<=a;a--)this._pts.add(r[a])}},Me.prototype.isHole=function(){return this._isHole},Me.prototype.setInResult=function(){for(var t=this._startDe;t.getEdge().setInResult(!0),(t=t.getNext())!==this._startDe;);},Me.prototype.containsPoint=function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!at.isPointInRing(t,e.getCoordinates()))return!1;for(var n=this._holes.iterator();n.hasNext();)if(n.next().containsPoint(t))return!1;return!0},Me.prototype.addHole=function(t){this._holes.add(t)},Me.prototype.isShell=function(){return null===this._shell},Me.prototype.getLabel=function(){return this._label},Me.prototype.getEdges=function(){return this._edges},Me.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},Me.prototype.getShell=function(){return this._shell},Me.prototype.mergeLabel=function(){if(1===arguments.length){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(2===arguments.length){var e=arguments[0],n=arguments[1],r=e.getLocation(n,Ne.RIGHT);if(r===L.NONE)return null;if(this._label.getLocation(n)===L.NONE)return this._label.setLocation(n,r),null}},Me.prototype.setShell=function(t){null!==(this._shell=t)&&t.addHole(this)},Me.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)},Me.prototype.interfaces_=function(){return[]},Me.prototype.getClass=function(){return Me};var Ae=function(n){function t(){var t=arguments[0],e=arguments[1];n.call(this,t,e)}return n&&(t.__proto__=n),((t.prototype=Object.create(n&&n.prototype)).constructor=t).prototype.setEdgeRing=function(t,e){t.setMinEdgeRing(e)},t.prototype.getNext=function(t){return t.getNextMin()},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Me),De=function(n){function t(){var t=arguments[0],e=arguments[1];n.call(this,t,e)}return n&&(t.__proto__=n),((t.prototype=Object.create(n&&n.prototype)).constructor=t).prototype.buildMinimalRings=function(){var t=new xt,e=this._startDe;do{if(null===e.getMinEdgeRing()){var n=new Ae(e,this._geometryFactory);t.add(n)}e=e.getNext()}while(e!==this._startDe);return t},t.prototype.setEdgeRing=function(t,e){t.setEdgeRing(e)},t.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){for(var t=this._startDe;t.getNode().getEdges().linkMinimalDirectedEdges(this),(t=t.getNext())!==this._startDe;);},t.prototype.getNext=function(t){return t.getNext()},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Me),Fe=function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._label=t}};Fe.prototype.setVisited=function(t){this._isVisited=t},Fe.prototype.setInResult=function(t){this._isInResult=t},Fe.prototype.isCovered=function(){return this._isCovered},Fe.prototype.isCoveredSet=function(){return this._isCoveredSet},Fe.prototype.setLabel=function(t){this._label=t},Fe.prototype.getLabel=function(){return this._label},Fe.prototype.setCovered=function(t){this._isCovered=t,this._isCoveredSet=!0},Fe.prototype.updateIM=function(t){et.isTrue(2<=this._label.getGeometryCount(),"found partial label"),this.computeIM(t)},Fe.prototype.isInResult=function(){return this._isInResult},Fe.prototype.isVisited=function(){return this._isVisited},Fe.prototype.interfaces_=function(){return[]},Fe.prototype.getClass=function(){return Fe};var ke=function(n){function i(){n.call(this),this._coord=null,this._edges=null;var t=arguments[0],e=arguments[1];this._coord=t,this._edges=e,this._label=new Pe(0,L.NONE)}return n&&(i.__proto__=n),((i.prototype=Object.create(n&&n.prototype)).constructor=i).prototype.isIncidentEdgeInResult=function(){for(var t=this.getEdges().getEdges().iterator();t.hasNext();)if(t.next().getEdge().isInResult())return!0;return!1},i.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},i.prototype.getCoordinate=function(){return this._coord},i.prototype.print=function(t){t.println("node "+this._coord+" lbl: "+this._label)},i.prototype.computeIM=function(t){},i.prototype.computeMergedLocation=function(t,e){var n=L.NONE;if(n=this._label.getLocation(e),!t.isNull(e)){var r=t.getLocation(e);n!==L.BOUNDARY&&(n=r)}return n},i.prototype.setLabel=function(){if(2!==arguments.length)return n.prototype.setLabel.apply(this,arguments);var t=arguments[0],e=arguments[1];null===this._label?this._label=new Pe(t,e):this._label.setLocation(t,e)},i.prototype.getEdges=function(){return this._edges},i.prototype.mergeLabel=function(){if(arguments[0]instanceof i){var t=arguments[0];this.mergeLabel(t._label)}else if(arguments[0]instanceof Pe)for(var e=arguments[0],n=0;n<2;n++){var r=this.computeMergedLocation(e,n);this._label.getLocation(n)===L.NONE&&this._label.setLocation(n,r)}},i.prototype.add=function(t){this._edges.insert(t),t.setNode(this)},i.prototype.setLabelBoundary=function(t){if(null===this._label)return null;var e=L.NONE;null!==this._label&&(e=this._label.getLocation(t));var n=null;switch(e){case L.BOUNDARY:n=L.INTERIOR;break;case L.INTERIOR:default:n=L.BOUNDARY}this._label.setLocation(t,n)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Fe),Be=function(){this.nodeMap=new c,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};Be.prototype.find=function(t){return this.nodeMap.get(t)},Be.prototype.addNode=function(){if(arguments[0]instanceof I){var t=arguments[0],e=this.nodeMap.get(t);return null===e&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}if(arguments[0]instanceof ke){var n=arguments[0],r=this.nodeMap.get(n.getCoordinate());return null===r?(this.nodeMap.put(n.getCoordinate(),n),n):(r.mergeLabel(n),r)}},Be.prototype.print=function(t){for(var e=this.iterator();e.hasNext();)e.next().print(t)},Be.prototype.iterator=function(){return this.nodeMap.values().iterator()},Be.prototype.values=function(){return this.nodeMap.values()},Be.prototype.getBoundaryNodes=function(t){for(var e=new xt,n=this.iterator();n.hasNext();){var r=n.next();r.getLabel().getLocation(t)===L.BOUNDARY&&e.add(r)}return e},Be.prototype.add=function(t){var e=t.getCoordinate();this.addNode(e).add(t)},Be.prototype.interfaces_=function(){return[]},Be.prototype.getClass=function(){return Be};var Ge=function(){},je={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};Ge.prototype.interfaces_=function(){return[]},Ge.prototype.getClass=function(){return Ge},Ge.isNorthern=function(t){return t===Ge.NE||t===Ge.NW},Ge.isOpposite=function(t,e){return t!==e&&2==(t-e+4)%4},Ge.commonHalfPlane=function(t,e){if(t===e)return t;if(2==(t-e+4)%4)return-1;var n=t<e?t:e;return 0===n&&3===(e<t?t:e)?3:n},Ge.isInHalfPlane=function(t,e){return e===Ge.SE?t===Ge.SE||t===Ge.SW:t===e||t===e+1},Ge.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 v("Cannot compute the quadrant for point ( "+t+", "+e+" )");return 0<=t?0<=e?Ge.NE:Ge.SE:0<=e?Ge.NW:Ge.SW}if(arguments[0]instanceof I&&arguments[1]instanceof I){var n=arguments[0],r=arguments[1];if(r.x===n.x&&r.y===n.y)throw new v("Cannot compute the quadrant for two identical points "+n);return r.x>=n.x?r.y>=n.y?Ge.NE:Ge.SE:r.y>=n.y?Ge.NW:Ge.SW}},je.NE.get=function(){return 0},je.NW.get=function(){return 1},je.SW.get=function(){return 2},je.SE.get=function(){return 3},Object.defineProperties(Ge,je);var Ue=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,1===arguments.length){var t=arguments[0];this._edge=t}else if(3===arguments.length){var e=arguments[0],n=arguments[1],r=arguments[2];this._edge=e,this.init(n,r),this._label=null}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this._edge=i,this.init(o,s),this._label=a}};Ue.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:at.computeOrientation(t._p0,t._p1,this._p1)},Ue.prototype.getDy=function(){return this._dy},Ue.prototype.getCoordinate=function(){return this._p0},Ue.prototype.setNode=function(t){this._node=t},Ue.prototype.print=function(t){var e=Math.atan2(this._dy,this._dx),n=this.getClass().getName(),r=n.lastIndexOf("."),i=n.substring(r+1);t.print("  "+i+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+"   "+this._label)},Ue.prototype.compareTo=function(t){var e=t;return this.compareDirection(e)},Ue.prototype.getDirectedCoordinate=function(){return this._p1},Ue.prototype.getDx=function(){return this._dx},Ue.prototype.getLabel=function(){return this._label},Ue.prototype.getEdge=function(){return this._edge},Ue.prototype.getQuadrant=function(){return this._quadrant},Ue.prototype.getNode=function(){return this._node},Ue.prototype.toString=function(){var t=Math.atan2(this._dy,this._dx),e=this.getClass().getName(),n=e.lastIndexOf(".");return"  "+e.substring(n+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+"   "+this._label},Ue.prototype.computeLabel=function(t){},Ue.prototype.init=function(t,e){this._p0=t,this._p1=e,this._dx=e.x-t.x,this._dy=e.y-t.y,this._quadrant=Ge.quadrant(this._dx,this._dy),et.isTrue(!(0===this._dx&&0===this._dy),"EdgeEnd with identical endpoints found")},Ue.prototype.interfaces_=function(){return[E]},Ue.prototype.getClass=function(){return Ue};var Ve=function(r){function t(){var t=arguments[0],e=arguments[1];if(r.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));else{var n=t.getNumPoints()-1;this.init(t.getCoordinate(n),t.getCoordinate(n-1))}this.computeDirectedLabel()}return r&&(t.__proto__=r),((t.prototype=Object.create(r&&r.prototype)).constructor=t).prototype.getNextMin=function(){return this._nextMin},t.prototype.getDepth=function(t){return this._depth[t]},t.prototype.setVisited=function(t){this._isVisited=t},t.prototype.computeDirectedLabel=function(){this._label=new Pe(this._edge.getLabel()),this._isForward||this._label.flip()},t.prototype.getNext=function(){return this._next},t.prototype.setDepth=function(t,e){if(-999!==this._depth[t]&&this._depth[t]!==e)throw new Le("assigned depths do not match",this.getCoordinate());this._depth[t]=e},t.prototype.isInteriorAreaEdge=function(){for(var t=!0,e=0;e<2;e++)this._label.isArea(e)&&this._label.getLocation(e,Ne.LEFT)===L.INTERIOR&&this._label.getLocation(e,Ne.RIGHT)===L.INTERIOR||(t=!1);return t},t.prototype.setNextMin=function(t){this._nextMin=t},t.prototype.print=function(t){r.prototype.print.call(this,t),t.print(" "+this._depth[Ne.LEFT]+"/"+this._depth[Ne.RIGHT]),t.print(" ("+this.getDepthDelta()+")"),this._isInResult&&t.print(" inResult")},t.prototype.setMinEdgeRing=function(t){this._minEdgeRing=t},t.prototype.isLineEdge=function(){var t=this._label.isLine(0)||this._label.isLine(1),e=!this._label.isArea(0)||this._label.allPositionsEqual(0,L.EXTERIOR),n=!this._label.isArea(1)||this._label.allPositionsEqual(1,L.EXTERIOR);return t&&e&&n},t.prototype.setEdgeRing=function(t){this._edgeRing=t},t.prototype.getMinEdgeRing=function(){return this._minEdgeRing},t.prototype.getDepthDelta=function(){var t=this._edge.getDepthDelta();return this._isForward||(t=-t),t},t.prototype.setInResult=function(t){this._isInResult=t},t.prototype.getSym=function(){return this._sym},t.prototype.isForward=function(){return this._isForward},t.prototype.getEdge=function(){return this._edge},t.prototype.printEdge=function(t){this.print(t),t.print(" "),this._isForward?this._edge.print(t):this._edge.printReverse(t)},t.prototype.setSym=function(t){this._sym=t},t.prototype.setVisitedEdge=function(t){this.setVisited(t),this._sym.setVisited(t)},t.prototype.setEdgeDepths=function(t,e){var n=this.getEdge().getDepthDelta();this._isForward||(n=-n);var r=1;t===Ne.LEFT&&(r=-1);var i=Ne.opposite(t),o=e+n*r;this.setDepth(t,e),this.setDepth(i,o)},t.prototype.getEdgeRing=function(){return this._edgeRing},t.prototype.isInResult=function(){return this._isInResult},t.prototype.setNext=function(t){this._next=t},t.prototype.isVisited=function(){return this._isVisited},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.depthFactor=function(t,e){return t===L.EXTERIOR&&e===L.INTERIOR?1:t===L.INTERIOR&&e===L.EXTERIOR?-1:0},t}(Ue),qe=function(){};qe.prototype.createNode=function(t){return new ke(t,null)},qe.prototype.interfaces_=function(){return[]},qe.prototype.getClass=function(){return qe};var ze=function(){if(this._edges=new xt,this._nodes=null,this._edgeEndList=new xt,0===arguments.length)this._nodes=new Be(new qe);else if(1===arguments.length){var t=arguments[0];this._nodes=new Be(t)}};ze.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)}},ze.prototype.find=function(t){return this._nodes.find(t)},ze.prototype.addNode=function(){if(arguments[0]instanceof ke){var t=arguments[0];return this._nodes.addNode(t)}if(arguments[0]instanceof I){var e=arguments[0];return this._nodes.addNode(e)}},ze.prototype.getNodeIterator=function(){return this._nodes.iterator()},ze.prototype.linkResultDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkResultDirectedEdges()},ze.prototype.debugPrintln=function(t){z.out.println(t)},ze.prototype.isBoundaryNode=function(t,e){var n=this._nodes.find(e);if(null===n)return!1;var r=n.getLabel();return null!==r&&r.getLocation(t)===L.BOUNDARY},ze.prototype.linkAllDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkAllDirectedEdges()},ze.prototype.matchInSameDirection=function(t,e,n,r){return!!t.equals(n)&&at.computeOrientation(t,e,r)===at.COLLINEAR&&Ge.quadrant(t,e)===Ge.quadrant(n,r)},ze.prototype.getEdgeEnds=function(){return this._edgeEndList},ze.prototype.debugPrint=function(t){z.out.print(t)},ze.prototype.getEdgeIterator=function(){return this._edges.iterator()},ze.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},ze.prototype.insertEdge=function(t){this._edges.add(t)},ze.prototype.findEdgeEnd=function(t){for(var e=this.getEdgeEnds().iterator();e.hasNext();){var n=e.next();if(n.getEdge()===t)return n}return null},ze.prototype.addEdges=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this._edges.add(n);var r=new Ve(n,!0),i=new Ve(n,!1);r.setSym(i),i.setSym(r),this.add(r),this.add(i)}},ze.prototype.add=function(t){this._nodes.add(t),this._edgeEndList.add(t)},ze.prototype.getNodes=function(){return this._nodes.values()},ze.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},ze.prototype.interfaces_=function(){return[]},ze.prototype.getClass=function(){return ze},ze.linkResultDirectedEdges=function(t){for(var e=t.iterator();e.hasNext();)e.next().getEdges().linkResultDirectedEdges()};var Ye=function(){this._geometryFactory=null,this._shellList=new xt;var t=arguments[0];this._geometryFactory=t};Ye.prototype.sortShellsAndHoles=function(t,e,n){for(var r=t.iterator();r.hasNext();){var i=r.next();i.isHole()?n.add(i):e.add(i)}},Ye.prototype.computePolygons=function(t){for(var e=new xt,n=t.iterator();n.hasNext();){var r=n.next().toPolygon(this._geometryFactory);e.add(r)}return e},Ye.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 Le("unable to assign hole to a shell",r.getCoordinate(0));r.setShell(i)}}},Ye.prototype.buildMinimalEdgeRings=function(t,e,n){for(var r=new xt,i=t.iterator();i.hasNext();){var o=i.next();if(2<o.getMaxNodeDegree()){o.linkDirectedEdgesForMinimalEdgeRings();var s=o.buildMinimalRings(),a=this.findShell(s);null!==a?(this.placePolygonHoles(a,s),e.add(a)):n.addAll(s)}else r.add(o)}return r},Ye.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();)if(e.next().containsPoint(t))return!0;return!1},Ye.prototype.buildMaximalEdgeRings=function(t){for(var e=new xt,n=t.iterator();n.hasNext();){var r=n.next();if(r.isInResult()&&r.getLabel().isArea()&&null===r.getEdgeRing()){var i=new De(r,this._geometryFactory);e.add(i),i.setInResult()}}return e},Ye.prototype.placePolygonHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();r.isHole()&&r.setShell(t)}},Ye.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},Ye.prototype.findEdgeRingContaining=function(t,e){for(var n=t.getLinearRing(),r=n.getEnvelopeInternal(),i=n.getCoordinateN(0),o=null,s=null,a=e.iterator();a.hasNext();){var u=a.next(),l=u.getLinearRing(),h=l.getEnvelopeInternal();null!==o&&(s=o.getLinearRing().getEnvelopeInternal());var c=!1;h.contains(r)&&at.isPointInRing(i,l.getCoordinates())&&(c=!0),c&&(null===o||s.contains(h))&&(o=u)}return o},Ye.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 et.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n},Ye.prototype.add=function(){if(1===arguments.length){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(2===arguments.length){var e=arguments[0],n=arguments[1];ze.linkResultDirectedEdges(n);var r=this.buildMaximalEdgeRings(e),i=new xt,o=this.buildMinimalEdgeRings(r,this._shellList,i);this.sortShellsAndHoles(o,this._shellList,i),this.placeFreeHoles(this._shellList,i)}},Ye.prototype.interfaces_=function(){return[]},Ye.prototype.getClass=function(){return Ye};var Xe=function(){};Xe.prototype.getBounds=function(){},Xe.prototype.interfaces_=function(){return[]},Xe.prototype.getClass=function(){return Xe};var He=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};He.prototype.getItem=function(){return this._item},He.prototype.getBounds=function(){return this._bounds},He.prototype.interfaces_=function(){return[Xe,e]},He.prototype.getClass=function(){return He};var We=function(){this._size=null,this._items=null,this._size=0,this._items=new xt,this._items.add(null)};We.prototype.poll=function(){if(this.isEmpty())return null;var t=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),t},We.prototype.size=function(){return this._size},We.prototype.reorder=function(t){for(var e=null,n=this._items.get(t);2*t<=this._size&&((e=2*t)!==this._size&&this._items.get(e+1).compareTo(this._items.get(e))<0&&e++,this._items.get(e).compareTo(n)<0);t=e)this._items.set(t,this._items.get(e));this._items.set(t,n)},We.prototype.clear=function(){this._size=0,this._items.clear()},We.prototype.isEmpty=function(){return 0===this._size},We.prototype.add=function(t){this._items.add(null),this._size+=1;var e=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(e/2)))<0;e/=2)this._items.set(e,this._items.get(Math.trunc(e/2)));this._items.set(e,t)},We.prototype.interfaces_=function(){return[]},We.prototype.getClass=function(){return We};var Je=function(){};Je.prototype.visitItem=function(t){},Je.prototype.interfaces_=function(){return[]},Je.prototype.getClass=function(){return Je};var Ke=function(){};Ke.prototype.insert=function(t,e){},Ke.prototype.remove=function(t,e){},Ke.prototype.query=function(){},Ke.prototype.interfaces_=function(){return[]},Ke.prototype.getClass=function(){return Ke};var Ze=function(){if(this._childBoundables=new xt,this._bounds=null,this._level=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._level=t}},Qe={serialVersionUID:{configurable:!0}};Ze.prototype.getLevel=function(){return this._level},Ze.prototype.size=function(){return this._childBoundables.size()},Ze.prototype.getChildBoundables=function(){return this._childBoundables},Ze.prototype.addChildBoundable=function(t){et.isTrue(null===this._bounds),this._childBoundables.add(t)},Ze.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Ze.prototype.getBounds=function(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds},Ze.prototype.interfaces_=function(){return[Xe,e]},Ze.prototype.getClass=function(){return Ze},Qe.serialVersionUID.get=function(){return 0x5a1e55ec41369800},Object.defineProperties(Ze,Qe);var $e=function(){};$e.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}},$e.min=function(t){return $e.sort(t),t.get(0)},$e.sort=function(t,e){var n=t.toArray();e?kt.sort(n,e):kt.sort(n);for(var r=t.iterator(),i=0,o=n.length;i<o;i++)r.next(),r.set(n[i])},$e.singletonList=function(t){var e=new xt;return e.add(t),e};var tn=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var t=arguments[0],e=arguments[1],n=arguments[2];this._boundable1=t,this._boundable2=e,this._itemDistance=n,this._distance=this.distance()};tn.prototype.expandToQueue=function(t,e){var n=tn.isComposite(this._boundable1),r=tn.isComposite(this._boundable2);if(n&&r)return tn.area(this._boundable1)>tn.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 v("neither boundable is composite")},tn.prototype.isLeaves=function(){return!(tn.isComposite(this._boundable1)||tn.isComposite(this._boundable2))},tn.prototype.compareTo=function(t){var e=t;return this._distance<e._distance?-1:this._distance>e._distance?1:0},tn.prototype.expand=function(t,e,n,r){for(var i=t.getChildBoundables().iterator();i.hasNext();){var o=i.next(),s=new tn(o,e,this._itemDistance);s.getDistance()<r&&n.add(s)}},tn.prototype.getBoundable=function(t){return 0===t?this._boundable1:this._boundable2},tn.prototype.getDistance=function(){return this._distance},tn.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},tn.prototype.interfaces_=function(){return[E]},tn.prototype.getClass=function(){return tn},tn.area=function(t){return t.getBounds().getArea()},tn.isComposite=function(t){return t instanceof Ze};var en=function t(){if(this._root=null,this._built=!1,this._itemBoundables=new xt,this._nodeCapacity=null,0===arguments.length){var e=t.DEFAULT_NODE_CAPACITY;this._nodeCapacity=e}else if(1===arguments.length){var n=arguments[0];et.isTrue(1<n,"Node capacity must be greater than 1"),this._nodeCapacity=n}},nn={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};en.prototype.getNodeCapacity=function(){return this._nodeCapacity},en.prototype.lastNode=function(t){return t.get(t.size()-1)},en.prototype.size=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.size(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var n=e.next();n instanceof Ze?t+=this.size(n):n instanceof He&&(t+=1)}return t}},en.prototype.removeItem=function(t,e){for(var n=null,r=t.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof He&&i.getItem()===e&&(n=i)}return null!==n&&(t.getChildBoundables().remove(n),!0)},en.prototype.itemsTree=function(){if(0===arguments.length){this.build();var t=this.itemsTree(this._root);return null===t?new xt:t}if(1===arguments.length){for(var e=arguments[0],n=new xt,r=e.getChildBoundables().iterator();r.hasNext();){var i=r.next();if(i instanceof Ze){var o=this.itemsTree(i);null!==o&&n.add(o)}else i instanceof He?n.add(i.getItem()):et.shouldNeverReachHere()}return n.size()<=0?null:n}},en.prototype.insert=function(t,e){et.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new He(t,e))},en.prototype.boundablesAtLevel=function(){if(1===arguments.length){var t=arguments[0],e=new xt;return this.boundablesAtLevel(t,this._root,e),e}if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];if(et.isTrue(-2<n),r.getLevel()===n)return i.add(r),null;for(var o=r.getChildBoundables().iterator();o.hasNext();){var s=o.next();s instanceof Ze?this.boundablesAtLevel(n,s,i):(et.isTrue(s instanceof He),-1===n&&i.add(s))}return null}},en.prototype.query=function(){if(1===arguments.length){var t=arguments[0];this.build();var e=new xt;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.query(t,this._root,e),e}if(2===arguments.length){var n=arguments[0],r=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,r)}else if(3===arguments.length)if(R(arguments[2],Je)&&arguments[0]instanceof Object&&arguments[1]instanceof Ze)for(var i=arguments[0],o=arguments[1],s=arguments[2],a=o.getChildBoundables(),u=0;u<a.size();u++){var l=a.get(u);this.getIntersectsOp().intersects(l.getBounds(),i)&&(l instanceof Ze?this.query(i,l,s):l instanceof He?s.visitItem(l.getItem()):et.shouldNeverReachHere())}else if(R(arguments[2],wt)&&arguments[0]instanceof Object&&arguments[1]instanceof Ze)for(var h=arguments[0],c=arguments[1],p=arguments[2],f=c.getChildBoundables(),g=0;g<f.size();g++){var d=f.get(g);this.getIntersectsOp().intersects(d.getBounds(),h)&&(d instanceof Ze?this.query(h,d,p):d instanceof He?p.add(d.getItem()):et.shouldNeverReachHere())}},en.prototype.build=function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0},en.prototype.getRoot=function(){return this.build(),this._root},en.prototype.remove=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.remove(t,this._root,e)}if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2],o=this.removeItem(r,i);if(o)return!0;for(var s=null,a=r.getChildBoundables().iterator();a.hasNext();){var u=a.next();if(this.getIntersectsOp().intersects(u.getBounds(),n)&&u instanceof Ze&&(o=this.remove(n,u,i))){s=u;break}}return null!==s&&s.getChildBoundables().isEmpty()&&r.getChildBoundables().remove(s),o}},en.prototype.createHigherLevels=function(t,e){et.isTrue(!t.isEmpty());var n=this.createParentBoundables(t,e+1);return 1===n.size()?n.get(0):this.createHigherLevels(n,e+1)},en.prototype.depth=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var n=e.next();if(n instanceof Ze){var r=this.depth(n);t<r&&(t=r)}}return t+1}},en.prototype.createParentBoundables=function(t,e){et.isTrue(!t.isEmpty());var n=new xt;n.add(this.createNode(e));var r=new xt(t);$e.sort(r,this.getComparator());for(var i=r.iterator();i.hasNext();){var o=i.next();this.lastNode(n).getChildBoundables().size()===this.getNodeCapacity()&&n.add(this.createNode(e)),this.lastNode(n).addChildBoundable(o)}return n},en.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},en.prototype.interfaces_=function(){return[e]},en.prototype.getClass=function(){return en},en.compareDoubles=function(t,e){return e<t?1:t<e?-1:0},nn.IntersectsOp.get=function(){return rn},nn.serialVersionUID.get=function(){return-0x35ef64c82d4c5400},nn.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(en,nn);var rn=function(){},on=function(){};on.prototype.distance=function(t,e){},on.prototype.interfaces_=function(){return[]},on.prototype.getClass=function(){return on};var sn=function(l){function _(t){t=t||_.DEFAULT_NODE_CAPACITY,l.call(this,t)}l&&(_.__proto__=l),(_.prototype=Object.create(l&&l.prototype)).constructor=_;var t={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return _.prototype.createParentBoundablesFromVerticalSlices=function(t,e){et.isTrue(0<t.length);for(var n=new xt,r=0;r<t.length;r++)n.addAll(this.createParentBoundablesFromVerticalSlice(t[r],e));return n},_.prototype.createNode=function(t){return new an(t)},_.prototype.size=function(){return 0===arguments.length?l.prototype.size.call(this):l.prototype.size.apply(this,arguments)},_.prototype.insert=function(){if(2!==arguments.length)return l.prototype.insert.apply(this,arguments);var t=arguments[0],e=arguments[1];if(t.isNull())return null;l.prototype.insert.call(this,t,e)},_.prototype.getIntersectsOp=function(){return _.intersectsOp},_.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 xt;for(var s=0;i.hasNext()&&s<n;){var a=i.next();r[o].add(a),s++}}return r},_.prototype.query=function(){if(1===arguments.length){var t=arguments[0];return l.prototype.query.call(this,t)}if(2===arguments.length){var e=arguments[0],n=arguments[1];l.prototype.query.call(this,e,n)}else if(3===arguments.length)if(R(arguments[2],Je)&&arguments[0]instanceof Object&&arguments[1]instanceof Ze){var r=arguments[0],i=arguments[1],o=arguments[2];l.prototype.query.call(this,r,i,o)}else if(R(arguments[2],wt)&&arguments[0]instanceof Object&&arguments[1]instanceof Ze){var s=arguments[0],a=arguments[1],u=arguments[2];l.prototype.query.call(this,s,a,u)}},_.prototype.getComparator=function(){return _.yComparator},_.prototype.createParentBoundablesFromVerticalSlice=function(t,e){return l.prototype.createParentBoundables.call(this,t,e)},_.prototype.remove=function(){if(2!==arguments.length)return l.prototype.remove.apply(this,arguments);var t=arguments[0],e=arguments[1];return l.prototype.remove.call(this,t,e)},_.prototype.depth=function(){return 0===arguments.length?l.prototype.depth.call(this):l.prototype.depth.apply(this,arguments)},_.prototype.createParentBoundables=function(t,e){et.isTrue(!t.isEmpty());var n=Math.trunc(Math.ceil(t.size()/this.getNodeCapacity())),r=new xt(t);$e.sort(r,_.xComparator);var i=this.verticalSlices(r,Math.trunc(Math.ceil(Math.sqrt(n))));return this.createParentBoundablesFromVerticalSlices(i,e)},_.prototype.nearestNeighbour=function(){if(1===arguments.length){if(R(arguments[0],on)){var t=arguments[0],e=new tn(this.getRoot(),this.getRoot(),t);return this.nearestNeighbour(e)}if(arguments[0]instanceof tn){var n=arguments[0];return this.nearestNeighbour(n,m.POSITIVE_INFINITY)}}else if(2===arguments.length){if(arguments[0]instanceof _&&R(arguments[1],on)){var r=arguments[0],i=arguments[1],o=new tn(this.getRoot(),r.getRoot(),i);return this.nearestNeighbour(o)}if(arguments[0]instanceof tn&&"number"==typeof arguments[1]){var s=arguments[0],a=arguments[1],u=null,l=new We;for(l.add(s);!l.isEmpty()&&0<a;){var h=l.poll(),c=h.getDistance();if(a<=c)break;h.isLeaves()?(a=c,u=h):h.expandToQueue(l,a)}return[u.getBoundable(0).getItem(),u.getBoundable(1).getItem()]}}else if(3===arguments.length){var p=arguments[0],f=arguments[1],g=arguments[2],d=new He(p,f),y=new tn(this.getRoot(),d,g);return this.nearestNeighbour(y)[0]}},_.prototype.interfaces_=function(){return[Ke,e]},_.prototype.getClass=function(){return _},_.centreX=function(t){return _.avg(t.getMinX(),t.getMaxX())},_.avg=function(t,e){return(t+e)/2},_.centreY=function(t){return _.avg(t.getMinY(),t.getMaxY())},t.STRtreeNode.get=function(){return an},t.serialVersionUID.get=function(){return 0x39920f7d5f261e0},t.xComparator.get=function(){return{interfaces_:function(){return[x]},compare:function(t,e){return l.compareDoubles(_.centreX(t.getBounds()),_.centreX(e.getBounds()))}}},t.yComparator.get=function(){return{interfaces_:function(){return[x]},compare:function(t,e){return l.compareDoubles(_.centreY(t.getBounds()),_.centreY(e.getBounds()))}}},t.intersectsOp.get=function(){return{interfaces_:function(){return[l.IntersectsOp]},intersects:function(t,e){return t.intersects(e)}}},t.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(_,t),_}(en),an=function(e){function t(){var t=arguments[0];e.call(this,t)}return e&&(t.__proto__=e),((t.prototype=Object.create(e&&e.prototype)).constructor=t).prototype.computeBounds=function(){for(var t=null,e=this.getChildBoundables().iterator();e.hasNext();){var n=e.next();null===t?t=new X(n.getBounds()):t.expandToInclude(n.getBounds())}return t},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Ze),un=function(){};un.prototype.interfaces_=function(){return[]},un.prototype.getClass=function(){return un},un.relativeSign=function(t,e){return t<e?-1:e<t?1:0},un.compare=function(t,e,n){if(e.equals2D(n))return 0;var r=un.relativeSign(e.x,n.x),i=un.relativeSign(e.y,n.y);switch(t){case 0:return un.compareValue(r,i);case 1:return un.compareValue(i,r);case 2:return un.compareValue(i,-r);case 3:return un.compareValue(-r,i);case 4:return un.compareValue(-r,-i);case 5:return un.compareValue(-i,-r);case 6:return un.compareValue(-i,r);case 7:return un.compareValue(r,-i)}return et.shouldNeverReachHere("invalid octant value"),0},un.compareValue=function(t,e){return t<0?-1:0<t?1:e<0?-1:0<e?1:0};var ln=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this._segString=t,this.coord=new I(e),this.segmentIndex=n,this._segmentOctant=r,this._isInterior=!e.equals2D(t.getCoordinate(n))};ln.prototype.getCoordinate=function(){return this.coord},ln.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},ln.prototype.compareTo=function(t){var e=t;return this.segmentIndex<e.segmentIndex?-1:this.segmentIndex>e.segmentIndex?1:this.coord.equals2D(e.coord)?0:un.compare(this._segmentOctant,this.coord,e.coord)},ln.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t},ln.prototype.isInterior=function(){return this._isInterior},ln.prototype.interfaces_=function(){return[E]},ln.prototype.getClass=function(){return ln};var hn=function(){this._nodeMap=new c,this._edge=null;var t=arguments[0];this._edge=t};hn.prototype.getSplitCoordinates=function(){var t=new Nt;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()},hn.prototype.addCollapsedNodes=function(){var t=new xt;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var e=t.iterator();e.hasNext();){var n=e.next().intValue();this.add(this._edge.getCoordinate(n),n)}},hn.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)},hn.prototype.findCollapsesFromExistingVertices=function(t){for(var e=0;e<this._edge.size()-2;e++){var n=this._edge.getCoordinate(e),r=this._edge.getCoordinate(e+2);n.equals2D(r)&&t.add(new A(e+1))}},hn.prototype.addEdgeCoordinates=function(t,e,n){var r=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(r);n.add(new I(t.coord),!1);for(var o=t.segmentIndex+1;o<=e.segmentIndex;o++)n.add(this._edge.getCoordinate(o));i&&n.add(new I(e.coord))},hn.prototype.iterator=function(){return this._nodeMap.values().iterator()},hn.prototype.addSplitEdges=function(t){this.addEndpoints(),this.addCollapsedNodes();for(var e=this.iterator(),n=e.next();e.hasNext();){var r=e.next(),i=this.createSplitEdge(n,r);t.add(i),n=r}},hn.prototype.findCollapseIndex=function(t,e,n){if(!t.coord.equals2D(e.coord))return!1;var r=e.segmentIndex-t.segmentIndex;return e.isInterior()||r--,1===r&&(n[0]=t.segmentIndex+1,!0)},hn.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 A(e[0])),r=i}},hn.prototype.getEdge=function(){return this._edge},hn.prototype.addEndpoints=function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)},hn.prototype.createSplitEdge=function(t,e){var n=e.segmentIndex-t.segmentIndex+2,r=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(r);i||n--;var o=new Array(n).fill(null),s=0;o[s++]=new I(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this._edge.getCoordinate(a);return i&&(o[s]=new I(e.coord)),new gn(o,this._edge.getData())},hn.prototype.add=function(t,e){var n=new ln(this._edge,t,e,this._edge.getSegmentOctant(e)),r=this._nodeMap.get(n);return null!==r?(et.isTrue(r.coord.equals2D(t),"Found equal nodes with different coordinates"),r):(this._nodeMap.put(n,n),n)},hn.prototype.checkSplitEdgesCorrectness=function(t){var e=this._edge.getCoordinates(),n=t.get(0).getCoordinate(0);if(!n.equals2D(e[0]))throw new $("bad split edge start point at "+n);var r=t.get(t.size()-1).getCoordinates(),i=r[r.length-1];if(!i.equals2D(e[e.length-1]))throw new $("bad split edge end point at "+i)},hn.prototype.interfaces_=function(){return[]},hn.prototype.getClass=function(){return hn};var cn=function(){};cn.prototype.interfaces_=function(){return[]},cn.prototype.getClass=function(){return cn},cn.octant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new v("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 I&&arguments[1]instanceof I){var i=arguments[0],o=arguments[1],s=o.x-i.x,a=o.y-i.y;if(0===s&&0===a)throw new v("Cannot compute the octant for two identical points "+i);return cn.octant(s,a)}};var pn=function(){};pn.prototype.getCoordinates=function(){},pn.prototype.size=function(){},pn.prototype.getCoordinate=function(t){},pn.prototype.isClosed=function(){},pn.prototype.setData=function(t){},pn.prototype.getData=function(){},pn.prototype.interfaces_=function(){return[]},pn.prototype.getClass=function(){return pn};var fn=function(){};fn.prototype.addIntersection=function(t,e){},fn.prototype.interfaces_=function(){return[pn]},fn.prototype.getClass=function(){return fn};var gn=function(){this._nodeList=new hn(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};gn.prototype.getCoordinates=function(){return this._pts},gn.prototype.size=function(){return this._pts.length},gn.prototype.getCoordinate=function(t){return this._pts[t]},gn.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},gn.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},gn.prototype.setData=function(t){this._data=t},gn.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:cn.octant(t,e)},gn.prototype.getData=function(){return this._data},gn.prototype.addIntersection=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(4===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[3],o=new I(n.getIntersection(i));this.addIntersection(o,r)}},gn.prototype.toString=function(){return Q.toLineString(new ue(this._pts))},gn.prototype.getNodeList=function(){return this._nodeList},gn.prototype.addIntersectionNode=function(t,e){var n=e,r=n+1;if(r<this._pts.length){var i=this._pts[r];t.equals2D(i)&&(n=r)}return this._nodeList.add(t,n)},gn.prototype.addIntersections=function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++)this.addIntersection(t,e,n,r)},gn.prototype.interfaces_=function(){return[fn]},gn.prototype.getClass=function(){return gn},gn.getNodedSubstrings=function(){if(1===arguments.length){var t=arguments[0],e=new xt;return gn.getNodedSubstrings(t,e),e}if(2===arguments.length)for(var n=arguments[0],r=arguments[1],i=n.iterator();i.hasNext();)i.next().getNodeList().addSplitEdges(r)};var dn=function(){if(this.p0=null,this.p1=null,0===arguments.length)this.p0=new I,this.p1=new I;else if(1===arguments.length){var t=arguments[0];this.p0=new I(t.p0),this.p1=new I(t.p1)}else if(2===arguments.length)this.p0=arguments[0],this.p1=arguments[1];else if(4===arguments.length){var e=arguments[0],n=arguments[1],r=arguments[2],i=arguments[3];this.p0=new I(e,n),this.p1=new I(r,i)}},yn={serialVersionUID:{configurable:!0}};dn.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},dn.prototype.orientationIndex=function(){if(arguments[0]instanceof dn){var t=arguments[0],e=at.orientationIndex(this.p0,this.p1,t.p0),n=at.orientationIndex(this.p0,this.p1,t.p1);return 0<=e&&0<=n?Math.max(e,n):e<=0&&n<=0?Math.max(e,n):0}if(arguments[0]instanceof I){var r=arguments[0];return at.orientationIndex(this.p0,this.p1,r)}},dn.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},dn.prototype.isVertical=function(){return this.p0.x===this.p1.x},dn.prototype.equals=function(t){if(!(t instanceof dn))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)},dn.prototype.intersection=function(t){var e=new it;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},dn.prototype.project=function(){if(arguments[0]instanceof I){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new I(t);var e=this.projectionFactor(t),n=new I;return n.x=this.p0.x+e*(this.p1.x-this.p0.x),n.y=this.p0.y+e*(this.p1.y-this.p0.y),n}if(arguments[0]instanceof dn){var r=arguments[0],i=this.projectionFactor(r.p0),o=this.projectionFactor(r.p1);if(1<=i&&1<=o)return null;if(i<=0&&o<=0)return null;var s=this.project(r.p0);i<0&&(s=this.p0),1<i&&(s=this.p1);var a=this.project(r.p1);return o<0&&(a=this.p0),1<o&&(a=this.p1),new dn(s,a)}},dn.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},dn.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},dn.prototype.getCoordinate=function(t){return 0===t?this.p0:this.p1},dn.prototype.distancePerpendicular=function(t){return at.distancePointLinePerpendicular(t,this.p0,this.p1)},dn.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},dn.prototype.midPoint=function(){return dn.midPoint(this.p0,this.p1)},dn.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,r=e*e+n*n;return r<=0?m.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/r},dn.prototype.closestPoints=function(t){var e=this.intersection(t);if(null!==e)return[e,e];var n=new Array(2).fill(null),r=m.MAX_VALUE,i=null,o=this.closestPoint(t.p0);r=o.distance(t.p0),n[0]=o,n[1]=t.p0;var s=this.closestPoint(t.p1);(i=s.distance(t.p1))<r&&(r=i,n[0]=s,n[1]=t.p1);var a=t.closestPoint(this.p0);(i=a.distance(this.p0))<r&&(r=i,n[0]=this.p0,n[1]=a);var u=t.closestPoint(this.p1);return(i=u.distance(this.p1))<r&&(r=i,n[0]=this.p1,n[1]=u),n},dn.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},dn.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},dn.prototype.getLength=function(){return this.p0.distance(this.p1)},dn.prototype.compareTo=function(t){var e=t,n=this.p0.compareTo(e.p0);return 0!==n?n:this.p1.compareTo(e.p1)},dn.prototype.reverse=function(){var t=this.p0;this.p0=this.p1,this.p1=t},dn.prototype.equalsTopo=function(t){return this.p0.equals(t.p0)&&(this.p1.equals(t.p1)||this.p0.equals(t.p1))&&this.p1.equals(t.p0)},dn.prototype.lineIntersection=function(t){try{return Y.intersection(this.p0,this.p1,t.p0,t.p1)}catch(t){if(!(t instanceof q))throw t}return null},dn.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},dn.prototype.pointAlongOffset=function(t,e){var n=this.p0.x+t*(this.p1.x-this.p0.x),r=this.p0.y+t*(this.p1.y-this.p0.y),i=this.p1.x-this.p0.x,o=this.p1.y-this.p0.y,s=Math.sqrt(i*i+o*o),a=0,u=0;if(0!==e){if(s<=0)throw new Error("Cannot compute offset from zero-length line segment");a=e*i/s,u=e*o/s}return new I(n-u,r+a)},dn.prototype.setCoordinates=function(){if(1===arguments.length){var t=arguments[0];this.setCoordinates(t.p0,t.p1)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.p0.x=e.x,this.p0.y=e.y,this.p1.x=n.x,this.p1.y=n.y}},dn.prototype.segmentFraction=function(t){var e=this.projectionFactor(t);return e<0?e=0:(1<e||m.isNaN(e))&&(e=1),e},dn.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},dn.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},dn.prototype.distance=function(){if(arguments[0]instanceof dn){var t=arguments[0];return at.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof I){var e=arguments[0];return at.distancePointLine(e,this.p0,this.p1)}},dn.prototype.pointAlong=function(t){var e=new I;return e.x=this.p0.x+t*(this.p1.x-this.p0.x),e.y=this.p0.y+t*(this.p1.y-this.p0.y),e},dn.prototype.hashCode=function(){var t=m.doubleToLongBits(this.p0.x);t^=31*m.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),n=m.doubleToLongBits(this.p1.x);return n^=31*m.doubleToLongBits(this.p1.y),e^Math.trunc(n)^Math.trunc(n>>32)},dn.prototype.interfaces_=function(){return[E,e]},dn.prototype.getClass=function(){return dn},dn.midPoint=function(t,e){return new I((t.x+e.x)/2,(t.y+e.y)/2)},yn.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(dn,yn);var _n=function(){this.tempEnv1=new X,this.tempEnv2=new X,this._overlapSeg1=new dn,this._overlapSeg2=new dn};_n.prototype.overlap=function(){if(2===arguments.length);else if(4===arguments.length){var 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)}},_n.prototype.interfaces_=function(){return[]},_n.prototype.getClass=function(){return _n};var vn=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this._pts=t,this._start=e,this._end=n,this._context=r};vn.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]},vn.prototype.computeSelect=function(t,e,n,r){var i=this._pts[e],o=this._pts[n];if(r.tempEnv1.init(i,o),n-e==1)return r.select(this,e),null;if(!t.intersects(r.tempEnv1))return null;var s=Math.trunc((e+n)/2);e<s&&this.computeSelect(t,e,s,r),s<n&&this.computeSelect(t,s,n,r)},vn.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},vn.prototype.computeOverlaps=function(t,e){this.computeOverlapsInternal(this._start,this._end,t,t._start,t._end,e)},vn.prototype.setId=function(t){this._id=t},vn.prototype.select=function(t,e){this.computeSelect(t,this._start,this._end,e)},vn.prototype.getEnvelope=function(){if(null===this._env){var t=this._pts[this._start],e=this._pts[this._end];this._env=new X(t,e)}return this._env},vn.prototype.getEndIndex=function(){return this._end},vn.prototype.getStartIndex=function(){return this._start},vn.prototype.getContext=function(){return this._context},vn.prototype.getId=function(){return this._id},vn.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];if(e-t==1&&i-r==1)return o.overlap(this,t,n,r),null;if(o.tempEnv1.init(s,a),o.tempEnv2.init(u,l),!o.tempEnv1.intersects(o.tempEnv2))return null;var h=Math.trunc((t+e)/2),c=Math.trunc((r+i)/2);t<h&&(r<c&&this.computeOverlapsInternal(t,h,n,r,c,o),c<i&&this.computeOverlapsInternal(t,h,n,c,i,o)),h<e&&(r<c&&this.computeOverlapsInternal(h,e,n,r,c,o),c<i&&this.computeOverlapsInternal(h,e,n,c,i,o))},vn.prototype.interfaces_=function(){return[]},vn.prototype.getClass=function(){return vn};var mn=function(){};mn.prototype.interfaces_=function(){return[]},mn.prototype.getClass=function(){return mn},mn.getChainStartIndices=function(t){var e=0,n=new xt;n.add(new A(e));do{var r=mn.findChainEnd(t,e);n.add(new A(r)),e=r}while(e<t.length-1);return mn.toIntArray(n)},mn.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=Ge.quadrant(t[n],t[n+1]),i=e+1;i<t.length&&(t[i-1].equals2D(t[i])||Ge.quadrant(t[i-1],t[i])===r);)i++;return i-1},mn.getChains=function(){if(1===arguments.length){var t=arguments[0];return mn.getChains(t,null)}if(2===arguments.length){for(var e=arguments[0],n=arguments[1],r=new xt,i=mn.getChainStartIndices(e),o=0;o<i.length-1;o++){var s=new vn(e,i[o],i[o+1],n);r.add(s)}return r}},mn.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),n=0;n<e.length;n++)e[n]=t.get(n).intValue();return e};var bn=function(){};bn.prototype.computeNodes=function(t){},bn.prototype.getNodedSubstrings=function(){},bn.prototype.interfaces_=function(){return[]},bn.prototype.getClass=function(){return bn};var En=function(){if(this._segInt=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.setSegmentIntersector(t)}};En.prototype.setSegmentIntersector=function(t){this._segInt=t},En.prototype.interfaces_=function(){return[bn]},En.prototype.getClass=function(){return En};var wn=function(e){function t(t){t?e.call(this,t):e.call(this),this._monoChains=new xt,this._index=new sn,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t;var n={SegmentOverlapAction:{configurable:!0}};return t.prototype.getMonotoneChains=function(){return this._monoChains},t.prototype.getNodedSubstrings=function(){return gn.getNodedSubstrings(this._nodedSegStrings)},t.prototype.getIndex=function(){return this._index},t.prototype.add=function(t){for(var e=mn.getChains(t.getCoordinates(),t).iterator();e.hasNext();){var n=e.next();n.setId(this._idCounter++),this._index.insert(n.getEnvelope(),n),this._monoChains.add(n)}},t.prototype.computeNodes=function(t){for(var e=(this._nodedSegStrings=t).iterator();e.hasNext();)this.add(e.next());this.intersectChains()},t.prototype.intersectChains=function(){for(var t=new xn(this._segInt),e=this._monoChains.iterator();e.hasNext();)for(var n=e.next(),r=this._index.query(n.getEnvelope()).iterator();r.hasNext();){var i=r.next();if(i.getId()>n.getId()&&(n.computeOverlaps(i,t),this._nOverlaps++),this._segInt.isDone())return null}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},n.SegmentOverlapAction.get=function(){return xn},Object.defineProperties(t,n),t}(En),xn=function(s){function t(){s.call(this),this._si=null;var t=arguments[0];this._si=t}return s&&(t.__proto__=s),((t.prototype=Object.create(s&&s.prototype)).constructor=t).prototype.overlap=function(){if(4!==arguments.length)return s.prototype.overlap.apply(this,arguments);var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3],i=t.getContext(),o=n.getContext();this._si.processIntersections(i,e,o,r)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(_n),In=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.setQuadrantSegments(e)}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(r)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(o),this.setJoinStyle(s),this.setMitreLimit(a)}},Nn={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}};In.prototype.getEndCapStyle=function(){return this._endCapStyle},In.prototype.isSingleSided=function(){return this._isSingleSided},In.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,0===this._quadrantSegments&&(this._joinStyle=In.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=In.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==In.JOIN_ROUND&&(this._quadrantSegments=In.DEFAULT_QUADRANT_SEGMENTS)},In.prototype.getJoinStyle=function(){return this._joinStyle},In.prototype.setJoinStyle=function(t){this._joinStyle=t},In.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},In.prototype.getSimplifyFactor=function(){return this._simplifyFactor},In.prototype.getQuadrantSegments=function(){return this._quadrantSegments},In.prototype.setEndCapStyle=function(t){this._endCapStyle=t},In.prototype.getMitreLimit=function(){return this._mitreLimit},In.prototype.setMitreLimit=function(t){this._mitreLimit=t},In.prototype.setSingleSided=function(t){this._isSingleSided=t},In.prototype.interfaces_=function(){return[]},In.prototype.getClass=function(){return In},In.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)},Nn.CAP_ROUND.get=function(){return 1},Nn.CAP_FLAT.get=function(){return 2},Nn.CAP_SQUARE.get=function(){return 3},Nn.JOIN_ROUND.get=function(){return 1},Nn.JOIN_MITRE.get=function(){return 2},Nn.JOIN_BEVEL.get=function(){return 3},Nn.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},Nn.DEFAULT_MITRE_LIMIT.get=function(){return 5},Nn.DEFAULT_SIMPLIFY_FACTOR.get=function(){return.01},Object.defineProperties(In,Nn);var Sn=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=at.COUNTERCLOCKWISE,this._inputLine=t||null},Cn={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Sn.prototype.isDeletable=function(t,e,n,r){var i=this._inputLine[t],o=this._inputLine[e],s=this._inputLine[n];return!!this.isConcave(i,o,s)&&!!this.isShallow(i,o,s,r)&&this.isShallowSampled(i,o,t,n,r)},Sn.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]=Sn.DELETE,r=i=!0),t=i?n:e,e=this.findNextNonDeletedIndex(t),n=this.findNextNonDeletedIndex(e)}return r},Sn.prototype.isShallowConcavity=function(t,e,n,r){return at.computeOrientation(t,e,n)===this._angleOrientation&&at.distancePointLine(e,t,n)<r},Sn.prototype.isShallowSampled=function(t,e,n,r,i){var o=Math.trunc((r-n)/Sn.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},Sn.prototype.isConcave=function(t,e,n){var r=at.computeOrientation(t,e,n)===this._angleOrientation;return r},Sn.prototype.simplify=function(t){for(this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=at.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);this.deleteShallowConcavities(););return this.collapseLine()},Sn.prototype.findNextNonDeletedIndex=function(t){for(var e=t+1;e<this._inputLine.length&&this._isDeleted[e]===Sn.DELETE;)e++;return e},Sn.prototype.isShallow=function(t,e,n,r){return at.distancePointLine(e,t,n)<r},Sn.prototype.collapseLine=function(){for(var t=new Nt,e=0;e<this._inputLine.length;e++)this._isDeleted[e]!==Sn.DELETE&&t.add(this._inputLine[e]);return t.toCoordinateArray()},Sn.prototype.interfaces_=function(){return[]},Sn.prototype.getClass=function(){return Sn},Sn.simplify=function(t,e){return new Sn(t).simplify(e)},Cn.INIT.get=function(){return 0},Cn.DELETE.get=function(){return 1},Cn.KEEP.get=function(){return 1},Cn.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(Sn,Cn);var Ln=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new xt},Tn={COORDINATE_ARRAY_TYPE:{configurable:!0}};Ln.prototype.getCoordinates=function(){return this._ptList.toArray(Ln.COORDINATE_ARRAY_TYPE)},Ln.prototype.setPrecisionModel=function(t){this._precisionModel=t},Ln.prototype.addPt=function(t){var e=new I(t);if(this._precisionModel.makePrecise(e),this.isRedundant(e))return null;this._ptList.add(e)},Ln.prototype.revere=function(){},Ln.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])},Ln.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1);return t.distance(e)<this._minimimVertexDistance},Ln.prototype.toString=function(){return(new _e).createLineString(this.getCoordinates()).toString()},Ln.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var t=new I(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1);if(t.equals(e))return null;this._ptList.add(t)},Ln.prototype.setMinimumVertexDistance=function(t){this._minimimVertexDistance=t},Ln.prototype.interfaces_=function(){return[]},Ln.prototype.getClass=function(){return Ln},Tn.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(Ln,Tn);var Rn=function(){},On={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};Rn.prototype.interfaces_=function(){return[]},Rn.prototype.getClass=function(){return Rn},Rn.toDegrees=function(t){return 180*t/Math.PI},Rn.normalize=function(t){for(;t>Math.PI;)t-=Rn.PI_TIMES_2;for(;t<=-Math.PI;)t+=Rn.PI_TIMES_2;return t},Rn.angle=function(){if(1===arguments.length){var t=arguments[0];return Math.atan2(t.y,t.x)}if(2===arguments.length){var e=arguments[0],n=arguments[1],r=n.x-e.x,i=n.y-e.y;return Math.atan2(i,r)}},Rn.isAcute=function(t,e,n){var r=t.x-e.x,i=t.y-e.y;return 0<r*(n.x-e.x)+i*(n.y-e.y)},Rn.isObtuse=function(t,e,n){var r=t.x-e.x,i=t.y-e.y;return r*(n.x-e.x)+i*(n.y-e.y)<0},Rn.interiorAngle=function(t,e,n){var r=Rn.angle(e,t),i=Rn.angle(e,n);return Math.abs(i-r)},Rn.normalizePositive=function(t){if(t<0){for(;t<0;)t+=Rn.PI_TIMES_2;Rn.PI_TIMES_2<=t&&(t=0)}else{for(;Rn.PI_TIMES_2<=t;)t-=Rn.PI_TIMES_2;t<0&&(t=0)}return t},Rn.angleBetween=function(t,e,n){var r=Rn.angle(e,t),i=Rn.angle(e,n);return Rn.diff(r,i)},Rn.diff=function(t,e){var n=null;return(n=t<e?e-t:t-e)>Math.PI&&(n=2*Math.PI-n),n},Rn.toRadians=function(t){return t*Math.PI/180},Rn.getTurn=function(t,e){var n=Math.sin(e-t);return 0<n?Rn.COUNTERCLOCKWISE:n<0?Rn.CLOCKWISE:Rn.NONE},Rn.angleBetweenOriented=function(t,e,n){var r=Rn.angle(e,t),i=Rn.angle(e,n)-r;return i<=-Math.PI?i+Rn.PI_TIMES_2:i>Math.PI?i-Rn.PI_TIMES_2:i},On.PI_TIMES_2.get=function(){return 2*Math.PI},On.PI_OVER_2.get=function(){return Math.PI/2},On.PI_OVER_4.get=function(){return Math.PI/4},On.COUNTERCLOCKWISE.get=function(){return at.COUNTERCLOCKWISE},On.CLOCKWISE.get=function(){return at.CLOCKWISE},On.NONE.get=function(){return at.COLLINEAR},Object.defineProperties(Rn,On);var Pn=function t(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new dn,this._seg1=new dn,this._offset0=new dn,this._offset1=new dn,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],n=arguments[1],r=arguments[2];this._precisionModel=e,this._bufParams=n,this._li=new it,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),8<=n.getQuadrantSegments()&&n.getJoinStyle()===In.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(r)},Mn={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}};Pn.prototype.addNextSegment=function(t,e){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var n=at.computeOrientation(this._s0,this._s1,this._s2),r=n===at.CLOCKWISE&&this._side===Ne.LEFT||n===at.COUNTERCLOCKWISE&&this._side===Ne.RIGHT;0===n?this.addCollinear(e):r?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)},Pn.prototype.addLineEndCap=function(t,e){var n=new dn(t,e),r=new dn;this.computeOffsetSegment(n,Ne.LEFT,this._distance,r);var i=new dn;this.computeOffsetSegment(n,Ne.RIGHT,this._distance,i);var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o);switch(this._bufParams.getEndCapStyle()){case In.CAP_ROUND:this._segList.addPt(r.p1),this.addFilletArc(e,a+Math.PI/2,a-Math.PI/2,at.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case In.CAP_FLAT:this._segList.addPt(r.p1),this._segList.addPt(i.p1);break;case In.CAP_SQUARE:var u=new I;u.x=Math.abs(this._distance)*Math.cos(a),u.y=Math.abs(this._distance)*Math.sin(a);var l=new I(r.p1.x+u.x,r.p1.y+u.y),h=new I(i.p1.x+u.x,i.p1.y+u.y);this._segList.addPt(l),this._segList.addPt(h)}},Pn.prototype.getCoordinates=function(){return this._segList.getCoordinates()},Pn.prototype.addMitreJoin=function(t,e,n,r){var i=!0,o=null;try{o=Y.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 q))throw t;o=new I(0,0),i=!1}i?this._segList.addPt(o):this.addLimitedMitreJoin(e,n,r,this._bufParams.getMitreLimit())},Pn.prototype.addFilletCorner=function(t,e,n,r,i){var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o),u=n.x-t.x,l=n.y-t.y,h=Math.atan2(l,u);r===at.CLOCKWISE?a<=h&&(a+=2*Math.PI):h<=a&&(a-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,a,h,r,i),this._segList.addPt(n)},Pn.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*Pn.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===In.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===In.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))},Pn.prototype.createSquare=function(t){this._segList.addPt(new I(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new I(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new I(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new I(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()},Pn.prototype.addSegments=function(t,e){this._segList.addPts(t,e)},Pn.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},Pn.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},Pn.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)},Pn.prototype.addLimitedMitreJoin=function(t,e,n,r){var i=this._seg0.p1,o=Rn.angle(i,this._seg0.p0),s=Rn.angleBetweenOriented(this._seg0.p0,i,this._seg1.p1)/2,a=Rn.normalize(o+s),u=Rn.normalize(a+Math.PI),l=r*n,h=n-l*Math.abs(Math.sin(s)),c=i.x+l*Math.cos(u),p=i.y+l*Math.sin(u),f=new I(c,p),g=new dn(i,f),d=g.pointAlongOffset(1,h),y=g.pointAlongOffset(1,-h);this._side===Ne.LEFT?(this._segList.addPt(d),this._segList.addPt(y)):(this._segList.addPt(y),this._segList.addPt(d))},Pn.prototype.computeOffsetSegment=function(t,e,n,r){var i=e===Ne.LEFT?1:-1,o=t.p1.x-t.p0.x,s=t.p1.y-t.p0.y,a=Math.sqrt(o*o+s*s),u=i*n*o/a,l=i*n*s/a;r.p0.x=t.p0.x-l,r.p0.y=t.p0.y+u,r.p1.x=t.p1.x-l,r.p1.y=t.p1.y+u},Pn.prototype.addFilletArc=function(t,e,n,r,i){var o=r===at.CLOCKWISE?-1:1,s=Math.abs(e-n),a=Math.trunc(s/this._filletAngleQuantum+.5);if(a<1)return null;for(var u=s/a,l=0,h=new I;l<s;){var c=e+o*l;h.x=t.x+i*Math.cos(c),h.y=t.y+i*Math.sin(c),this._segList.addPt(h),l+=u}},Pn.prototype.addInsideTurn=function(t,e){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*Pn.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),0<this._closingSegLengthFactor){var n=new I((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(n);var r=new I((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(r)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},Pn.prototype.createCircle=function(t){var e=new I(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},Pn.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)},Pn.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Ln,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*Pn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},Pn.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),2<=this._li.getIntersectionNum()&&(this._bufParams.getJoinStyle()===In.JOIN_BEVEL||this._bufParams.getJoinStyle()===In.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,at.CLOCKWISE,this._distance))},Pn.prototype.closeRing=function(){this._segList.closeRing()},Pn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},Pn.prototype.interfaces_=function(){return[]},Pn.prototype.getClass=function(){return Pn},Mn.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return.001},Mn.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return.001},Mn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},Mn.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(Pn,Mn);var An=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};An.prototype.getOffsetCurve=function(t,e){if(0===(this._distance=e))return null;var n=e<0,r=Math.abs(e),i=this.getSegGen(r);t.length<=1?this.computePointCurve(t[0],i):this.computeOffsetCurve(t,n,i);var o=i.getCoordinates();return n&&St.reverse(o),o},An.prototype.computeSingleSidedBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var i=Sn.simplify(t,-r),o=i.length-1;n.initSideSegments(i[o],i[o-1],Ne.LEFT),n.addFirstSegment();for(var s=o-2;0<=s;s--)n.addNextSegment(i[s],!0)}else{n.addSegments(t,!1);var a=Sn.simplify(t,r),u=a.length-1;n.initSideSegments(a[0],a[1],Ne.LEFT),n.addFirstSegment();for(var l=2;l<=u;l++)n.addNextSegment(a[l],!0)}n.addLastSegment(),n.closeRing()},An.prototype.computeRingBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);e===Ne.RIGHT&&(r=-r);var i=Sn.simplify(t,r),o=i.length-1;n.initSideSegments(i[o-1],i[0],e);for(var s=1;s<=o;s++){var a=1!==s;n.addNextSegment(i[s],a)}n.closeRing()},An.prototype.computeLineBufferCurve=function(t,e){var n=this.simplifyTolerance(this._distance),r=Sn.simplify(t,n),i=r.length-1;e.initSideSegments(r[0],r[1],Ne.LEFT);for(var o=2;o<=i;o++)e.addNextSegment(r[o],!0);e.addLastSegment(),e.addLineEndCap(r[i-1],r[i]);var s=Sn.simplify(t,-n),a=s.length-1;e.initSideSegments(s[a],s[a-1],Ne.LEFT);for(var u=a-2;0<=u;u--)e.addNextSegment(s[u],!0);e.addLastSegment(),e.addLineEndCap(s[1],s[0]),e.closeRing()},An.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case In.CAP_ROUND:e.createCircle(t);break;case In.CAP_SQUARE:e.createSquare(t)}},An.prototype.getLineCurve=function(t,e){if((this._distance=e)<0&&!this._bufParams.isSingleSided())return null;if(0===e)return null;var n=Math.abs(e),r=this.getSegGen(n);if(t.length<=1)this.computePointCurve(t[0],r);else if(this._bufParams.isSingleSided()){var i=e<0;this.computeSingleSidedBufferCurve(t,i,r)}else this.computeLineBufferCurve(t,r);return r.getCoordinates()},An.prototype.getBufferParameters=function(){return this._bufParams},An.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},An.prototype.getRingCurve=function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(0===n)return An.copyCoordinates(t);var r=this.getSegGen(n);return this.computeRingBufferCurve(t,e,r),r.getCoordinates()},An.prototype.computeOffsetCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){var i=Sn.simplify(t,-r),o=i.length-1;n.initSideSegments(i[o],i[o-1],Ne.LEFT),n.addFirstSegment();for(var s=o-2;0<=s;s--)n.addNextSegment(i[s],!0)}else{var a=Sn.simplify(t,r),u=a.length-1;n.initSideSegments(a[0],a[1],Ne.LEFT),n.addFirstSegment();for(var l=2;l<=u;l++)n.addNextSegment(a[l],!0)}n.addLastSegment()},An.prototype.getSegGen=function(t){return new Pn(this._precisionModel,this._bufParams,t)},An.prototype.interfaces_=function(){return[]},An.prototype.getClass=function(){return An},An.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),n=0;n<e.length;n++)e[n]=new I(t[n]);return e};var Dn=function(){this._subgraphs=null,this._seg=new dn,this._cga=new at;var t=arguments[0];this._subgraphs=t},Fn={DepthSegment:{configurable:!0}};Dn.prototype.findStabbedSegments=function(){if(1===arguments.length){for(var t=arguments[0],e=new xt,n=this._subgraphs.iterator();n.hasNext();){var r=n.next(),i=r.getEnvelope();t.y<i.getMinY()||t.y>i.getMaxY()||this.findStabbedSegments(t,r.getDirectedEdges(),e)}return e}if(3===arguments.length)if(R(arguments[2],wt)&&arguments[0]instanceof I&&arguments[1]instanceof Ve){for(var o=arguments[0],s=arguments[1],a=arguments[2],u=s.getEdge().getCoordinates(),l=0;l<u.length-1;l++)if(this._seg.p0=u[l],this._seg.p1=u[l+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<o.x||this._seg.isHorizontal()||o.y<this._seg.p0.y||o.y>this._seg.p1.y||at.computeOrientation(this._seg.p0,this._seg.p1,o)===at.RIGHT)){var h=s.getDepth(Ne.LEFT);this._seg.p0.equals(u[l])||(h=s.getDepth(Ne.RIGHT));var c=new kn(this._seg,h);a.add(c)}}else if(R(arguments[2],wt)&&arguments[0]instanceof I&&R(arguments[1],wt))for(var p=arguments[0],f=arguments[1],g=arguments[2],d=f.iterator();d.hasNext();){var y=d.next();y.isForward()&&this.findStabbedSegments(p,y,g)}},Dn.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);return 0===e.size()?0:$e.min(e)._leftDepth},Dn.prototype.interfaces_=function(){return[]},Dn.prototype.getClass=function(){return Dn},Fn.DepthSegment.get=function(){return kn},Object.defineProperties(Dn,Fn);var kn=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new dn(t),this._leftDepth=e};kn.prototype.compareTo=function(t){var e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(e._upwardSeg);return 0!==n?n:0!=(n=-1*e._upwardSeg.orientationIndex(this._upwardSeg))?n:this._upwardSeg.compareTo(e._upwardSeg)},kn.prototype.compareX=function(t,e){var n=t.p0.compareTo(e.p0);return 0!==n?n:t.p1.compareTo(e.p1)},kn.prototype.toString=function(){return this._upwardSeg.toString()},kn.prototype.interfaces_=function(){return[E]},kn.prototype.getClass=function(){return kn};var Bn=function(t,e,n){this.p0=t||null,this.p1=e||null,this.p2=n||null};Bn.prototype.area=function(){return Bn.area(this.p0,this.p1,this.p2)},Bn.prototype.signedArea=function(){return Bn.signedArea(this.p0,this.p1,this.p2)},Bn.prototype.interpolateZ=function(t){if(null===t)throw new v("Supplied point is null.");return Bn.interpolateZ(t,this.p0,this.p1,this.p2)},Bn.prototype.longestSideLength=function(){return Bn.longestSideLength(this.p0,this.p1,this.p2)},Bn.prototype.isAcute=function(){return Bn.isAcute(this.p0,this.p1,this.p2)},Bn.prototype.circumcentre=function(){return Bn.circumcentre(this.p0,this.p1,this.p2)},Bn.prototype.area3D=function(){return Bn.area3D(this.p0,this.p1,this.p2)},Bn.prototype.centroid=function(){return Bn.centroid(this.p0,this.p1,this.p2)},Bn.prototype.inCentre=function(){return Bn.inCentre(this.p0,this.p1,this.p2)},Bn.prototype.interfaces_=function(){return[]},Bn.prototype.getClass=function(){return Bn},Bn.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)},Bn.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2},Bn.det=function(t,e,n,r){return t*r-e*n},Bn.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,c=t.x-i,p=t.y-o,f=(l*c-a*p)/h,g=(-u*c+s*p)/h;return e.z+f*(n.z-e.z)+g*(r.z-e.z)},Bn.longestSideLength=function(t,e,n){var r=t.distance(e),i=e.distance(n),o=n.distance(t),s=r;return s<i&&(s=i),s<o&&(s=o),s},Bn.isAcute=function(t,e,n){return!!Rn.isAcute(t,e,n)&&!!Rn.isAcute(e,n,t)&&!!Rn.isAcute(n,t,e)},Bn.circumcentre=function(t,e,n){var r=n.x,i=n.y,o=t.x-r,s=t.y-i,a=e.x-r,u=e.y-i,l=2*Bn.det(o,s,a,u),h=Bn.det(s,o*o+s*s,u,a*a+u*u),c=Bn.det(o,o*o+s*s,a,a*a+u*u);return new I(r-h/l,i+c/l)},Bn.perpendicularBisector=function(t,e){var n=e.x-t.x,r=e.y-t.y,i=new Y(t.x+n/2,t.y+r/2,1),o=new Y(t.x-r+n/2,t.y+n+r/2,1);return new Y(i,o)},Bn.angleBisector=function(t,e,n){var r=e.distance(t),i=r/(r+e.distance(n)),o=n.x-t.x,s=n.y-t.y;return new I(t.x+i*o,t.y+i*s)},Bn.area3D=function(t,e,n){var r=e.x-t.x,i=e.y-t.y,o=e.z-t.z,s=n.x-t.x,a=n.y-t.y,u=n.z-t.z,l=i*u-o*a,h=o*s-r*u,c=r*a-i*s,p=l*l+h*h+c*c,f=Math.sqrt(p)/2;return f},Bn.centroid=function(t,e,n){var r=(t.x+e.x+n.x)/3,i=(t.y+e.y+n.y)/3;return new I(r,i)},Bn.inCentre=function(t,e,n){var r=e.distance(n),i=t.distance(n),o=t.distance(e),s=r+i+o,a=(r*t.x+i*e.x+o*n.x)/s,u=(r*t.y+i*e.y+o*n.y)/s;return new I(a,u)};var Gn=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new xt;var t=arguments[0],e=arguments[1],n=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=n};Gn.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,L.EXTERIOR,L.INTERIOR)},Gn.prototype.addPolygon=function(t){var e=this._distance,n=Ne.LEFT;this._distance<0&&(e=-this._distance,n=Ne.RIGHT);var r=t.getExteriorRing(),i=St.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,L.EXTERIOR,L.INTERIOR);for(var o=0;o<t.getNumInteriorRing();o++){var s=t.getInteriorRingN(o),a=St.removeRepeatedPoints(s.getCoordinates());0<this._distance&&this.isErodedCompletely(s,-this._distance)||this.addPolygonRing(a,e,Ne.opposite(n),L.INTERIOR,L.EXTERIOR)}},Gn.prototype.isTriangleErodedCompletely=function(t,e){var n=new Bn(t[0],t[1],t[2]),r=n.inCentre();return at.distancePointLine(r,n.p0,n.p1)<Math.abs(e)},Gn.prototype.addLineString=function(t){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var e=St.removeRepeatedPoints(t.getCoordinates()),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,L.EXTERIOR,L.INTERIOR)},Gn.prototype.addCurve=function(t,e,n){if(null===t||t.length<2)return null;var r=new gn(t,new Pe(0,L.BOUNDARY,e,n));this._curveList.add(r)},Gn.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},Gn.prototype.addPolygonRing=function(t,e,n,r,i){if(0===e&&t.length<ee.MINIMUM_VALID_SIZE)return null;var o=r,s=i;t.length>=ee.MINIMUM_VALID_SIZE&&at.isCCW(t)&&(o=i,s=r,n=Ne.opposite(n));var a=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(a,o,s)},Gn.prototype.add=function(t){if(t.isEmpty())return null;t instanceof $t?this.addPolygon(t):t instanceof Jt?this.addLineString(t):t instanceof Zt?this.addPoint(t):t instanceof te?this.addCollection(t):t instanceof qt?this.addCollection(t):t instanceof ne?this.addCollection(t):t instanceof Vt&&this.addCollection(t)},Gn.prototype.isErodedCompletely=function(t,e){var n=t.getCoordinates();if(n.length<4)return e<0;if(4===n.length)return this.isTriangleErodedCompletely(n,e);var r=t.getEnvelopeInternal(),i=Math.min(r.getHeight(),r.getWidth());return e<0&&2*Math.abs(e)>i},Gn.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);this.add(n)}},Gn.prototype.interfaces_=function(){return[]},Gn.prototype.getClass=function(){return Gn};var jn=function(){};jn.prototype.locate=function(t){},jn.prototype.interfaces_=function(){return[]},jn.prototype.getClass=function(){return jn};var Un=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var t=arguments[0];this._parent=t,this._atStart=!0,this._index=0,this._max=t.getNumGeometries()};Un.prototype.next=function(){if(this._atStart)return this._atStart=!1,Un.isAtomic(this._parent)&&this._index++,this._parent;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new r;var t=this._parent.getGeometryN(this._index++);return t instanceof Vt?(this._subcollectionIterator=new Un(t),this._subcollectionIterator.next()):t},Un.prototype.remove=function(){throw new Error(this.getClass().getName())},Un.prototype.hasNext=function(){if(this._atStart)return!0;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},Un.prototype.interfaces_=function(){return[Et]},Un.prototype.getClass=function(){return Un},Un.isAtomic=function(t){return!(t instanceof Vt)};var Vn=function(){this._geom=null;var t=arguments[0];this._geom=t};Vn.prototype.locate=function(t){return Vn.locate(t,this._geom)},Vn.prototype.interfaces_=function(){return[jn]},Vn.prototype.getClass=function(){return Vn},Vn.isPointInRing=function(t,e){return!!e.getEnvelopeInternal().intersects(t)&&at.isPointInRing(t,e.getCoordinates())},Vn.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var n=e.getExteriorRing();if(!Vn.isPointInRing(t,n))return!1;for(var r=0;r<e.getNumInteriorRing();r++){var i=e.getInteriorRingN(r);if(Vn.isPointInRing(t,i))return!1}return!0},Vn.containsPoint=function(t,e){if(e instanceof $t)return Vn.containsPointInPolygon(t,e);if(e instanceof Vt)for(var n=new Un(e);n.hasNext();){var r=n.next();if(r!==e&&Vn.containsPoint(t,r))return!0}return!1},Vn.locate=function(t,e){return e.isEmpty()?L.EXTERIOR:Vn.containsPoint(t,e)?L.INTERIOR:L.EXTERIOR};var qn=function(){this._edgeMap=new c,this._edgeList=null,this._ptInAreaLocation=[L.NONE,L.NONE]};qn.prototype.getNextCW=function(t){this.getEdges();var e=this._edgeList.indexOf(t),n=e-1;return 0===e&&(n=this._edgeList.size()-1),this._edgeList.get(n)},qn.prototype.propagateSideLabels=function(t){for(var e=L.NONE,n=this.iterator();n.hasNext();){var r=n.next().getLabel();r.isArea(t)&&r.getLocation(t,Ne.LEFT)!==L.NONE&&(e=r.getLocation(t,Ne.LEFT))}if(e===L.NONE)return null;for(var i=e,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getLabel();if(a.getLocation(t,Ne.ON)===L.NONE&&a.setLocation(t,Ne.ON,i),a.isArea(t)){var u=a.getLocation(t,Ne.LEFT),l=a.getLocation(t,Ne.RIGHT);if(l!==L.NONE){if(l!==i)throw new Le("side location conflict",s.getCoordinate());u===L.NONE&&et.shouldNeverReachHere("found single null side (at "+s.getCoordinate()+")"),i=u}else et.isTrue(a.getLocation(t,Ne.LEFT)===L.NONE,"found single null side"),a.setLocation(t,Ne.RIGHT,i),a.setLocation(t,Ne.LEFT,i)}}},qn.prototype.getCoordinate=function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null},qn.prototype.print=function(t){z.out.println("EdgeEndStar:   "+this.getCoordinate());for(var e=this.iterator();e.hasNext();)e.next().print(t)},qn.prototype.isAreaLabelsConsistent=function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},qn.prototype.checkAreaLabelsConsistent=function(t){var e=this.getEdges();if(e.size()<=0)return!0;var n=e.size()-1,r=e.get(n).getLabel().getLocation(t,Ne.LEFT);et.isTrue(r!==L.NONE,"Found unlabelled area edge");for(var i=r,o=this.iterator();o.hasNext();){var s=o.next().getLabel();et.isTrue(s.isArea(t),"Found non-area edge");var a=s.getLocation(t,Ne.LEFT),u=s.getLocation(t,Ne.RIGHT);if(a===u)return!1;if(u!==i)return!1;i=a}return!0},qn.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},qn.prototype.iterator=function(){return this.getEdges().iterator()},qn.prototype.getEdges=function(){return null===this._edgeList&&(this._edgeList=new xt(this._edgeMap.values())),this._edgeList},qn.prototype.getLocation=function(t,e,n){return this._ptInAreaLocation[t]===L.NONE&&(this._ptInAreaLocation[t]=Vn.locate(e,n[t].getGeometry())),this._ptInAreaLocation[t]},qn.prototype.toString=function(){var t=new M;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()},qn.prototype.computeEdgeEndLabels=function(t){for(var e=this.iterator();e.hasNext();)e.next().computeLabel(t)},qn.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)===L.BOUNDARY&&(e[i]=!0);for(var o=this.iterator();o.hasNext();)for(var s=o.next(),a=s.getLabel(),u=0;u<2;u++)if(a.isAnyNull(u)){var l=L.NONE;if(e[u])l=L.EXTERIOR;else{var h=s.getCoordinate();l=this.getLocation(u,h,t)}a.setAllLocationsIfNull(u,l)}},qn.prototype.getDegree=function(){return this._edgeMap.size()},qn.prototype.insertEdgeEnd=function(t,e){this._edgeMap.put(t,e),this._edgeList=null},qn.prototype.interfaces_=function(){return[]},qn.prototype.getClass=function(){return qn};var zn=function(o){function t(){o.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return o&&(t.__proto__=o),((t.prototype=Object.create(o&&o.prototype)).constructor=t).prototype.linkResultDirectedEdges=function(){this.getResultAreaEdges();for(var t=null,e=null,n=this._SCANNING_FOR_INCOMING,r=0;r<this._resultAreaEdgeList.size();r++){var i=this._resultAreaEdgeList.get(r),o=i.getSym();if(i.getLabel().isArea())switch(null===t&&i.isInResult()&&(t=i),n){case this._SCANNING_FOR_INCOMING:if(!o.isInResult())continue;e=o,n=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!i.isInResult())continue;e.setNext(i),n=this._SCANNING_FOR_INCOMING}}if(n===this._LINKING_TO_OUTGOING){if(null===t)throw new Le("no outgoing dirEdge found",this.getCoordinate());et.isTrue(t.isInResult(),"unable to link last incoming dirEdge"),e.setNext(t)}},t.prototype.insert=function(t){var e=t;this.insertEdgeEnd(e,e)},t.prototype.getRightmostEdge=function(){var t=this.getEdges(),e=t.size();if(e<1)return null;var n=t.get(0);if(1===e)return n;var r=t.get(e-1),i=n.getQuadrant(),o=r.getQuadrant();return Ge.isNorthern(i)&&Ge.isNorthern(o)?n:Ge.isNorthern(i)||Ge.isNorthern(o)?0!==n.getDy()?n:0!==r.getDy()?r:(et.shouldNeverReachHere("found two horizontal edges incident on node"),null):r},t.prototype.print=function(t){z.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){var n=e.next();t.print("out "),n.print(t),t.println(),t.print("in "),n.getSym().print(t),t.println()}},t.prototype.getResultAreaEdges=function(){if(null!==this._resultAreaEdgeList)return this._resultAreaEdgeList;this._resultAreaEdgeList=new xt;for(var t=this.iterator();t.hasNext();){var e=t.next();(e.isInResult()||e.getSym().isInResult())&&this._resultAreaEdgeList.add(e)}return this._resultAreaEdgeList},t.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))}},t.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)},t.prototype.computeDepths=function(){if(1===arguments.length){var t=arguments[0],e=this.findIndex(t),n=t.getDepth(Ne.LEFT),r=t.getDepth(Ne.RIGHT),i=this.computeDepths(e+1,this._edgeList.size(),n);if(this.computeDepths(0,e,i)!==r)throw new Le("depth mismatch at "+t.getCoordinate())}else if(3===arguments.length){for(var o=arguments[0],s=arguments[1],a=arguments[2],u=o;u<s;u++){var l=this._edgeList.get(u);l.setEdgeDepths(Ne.RIGHT,a),a=l.getDepth(Ne.LEFT)}return a}},t.prototype.mergeSymLabels=function(){for(var t=this.iterator();t.hasNext();){var e=t.next();e.getLabel().merge(e.getSym().getLabel())}},t.prototype.linkMinimalDirectedEdges=function(t){for(var e=null,n=null,r=this._SCANNING_FOR_INCOMING,i=this._resultAreaEdgeList.size()-1;0<=i;i--){var o=this._resultAreaEdgeList.get(i),s=o.getSym();switch(null===e&&o.getEdgeRing()===t&&(e=o),r){case this._SCANNING_FOR_INCOMING:if(s.getEdgeRing()!==t)continue;n=s,r=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(o.getEdgeRing()!==t)continue;n.setNextMin(o),r=this._SCANNING_FOR_INCOMING}}r===this._LINKING_TO_OUTGOING&&(et.isTrue(null!==e,"found null for first outgoing dirEdge"),et.isTrue(e.getEdgeRing()===t,"unable to link last incoming dirEdge"),n.setNextMin(e))},t.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}},t.prototype.getLabel=function(){return this._label},t.prototype.findCoveredLineEdges=function(){for(var t=L.NONE,e=this.iterator();e.hasNext();){var n=e.next(),r=n.getSym();if(!n.isLineEdge()){if(n.isInResult()){t=L.INTERIOR;break}if(r.isInResult()){t=L.EXTERIOR;break}}}if(t===L.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===L.INTERIOR):(s.isInResult()&&(i=L.EXTERIOR),a.isInResult()&&(i=L.INTERIOR))}},t.prototype.computeLabelling=function(t){o.prototype.computeLabelling.call(this,t),this._label=new Pe(L.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!==L.INTERIOR&&i!==L.BOUNDARY||this._label.setLocation(r,L.INTERIOR)}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(qn),Yn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.createNode=function(t){return new ke(t,new zn)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(qe),Xn=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};Xn.prototype.compareTo=function(t){var e=t;return Xn.compareOriented(this._pts,this._orientation,e._pts,e._orientation)},Xn.prototype.interfaces_=function(){return[E]},Xn.prototype.getClass=function(){return Xn},Xn.orientation=function(t){return 1===St.increasingDirection(t)},Xn.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 c=(u+=i)===s,p=(l+=o)===a;if(c&&!p)return-1;if(!c&&p)return 1;if(c&&p)return 0}};var Hn=function(){this._edges=new xt,this._ocaMap=new c};Hn.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(")  ")},Hn.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())},Hn.prototype.findEdgeIndex=function(t){for(var e=0;e<this._edges.size();e++)if(this._edges.get(e).equals(t))return e;return-1},Hn.prototype.iterator=function(){return this._edges.iterator()},Hn.prototype.getEdges=function(){return this._edges},Hn.prototype.get=function(t){return this._edges.get(t)},Hn.prototype.findEqualEdge=function(t){var e=new Xn(t.getCoordinates());return this._ocaMap.get(e)},Hn.prototype.add=function(t){this._edges.add(t);var e=new Xn(t.getCoordinates());this._ocaMap.put(e,t)},Hn.prototype.interfaces_=function(){return[]},Hn.prototype.getClass=function(){return Hn};var Wn=function(){};Wn.prototype.processIntersections=function(t,e,n,r){},Wn.prototype.isDone=function(){},Wn.prototype.interfaces_=function(){return[]},Wn.prototype.getClass=function(){return Wn};var Jn=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var t=arguments[0];this._li=t};Jn.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&1===this._li.getIntersectionNum()){if(Jn.isAdjacentSegments(e,r))return!0;if(t.isClosed()){var i=t.size()-1;if(0===e&&r===i||0===r&&e===i)return!0}}return!1},Jn.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Jn.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Jn.prototype.getLineIntersector=function(){return this._li},Jn.prototype.hasProperIntersection=function(){return this._hasProper},Jn.prototype.processIntersections=function(t,e,n,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)))},Jn.prototype.hasIntersection=function(){return this._hasIntersection},Jn.prototype.isDone=function(){return!1},Jn.prototype.hasInteriorIntersection=function(){return this._hasInterior},Jn.prototype.interfaces_=function(){return[Wn]},Jn.prototype.getClass=function(){return Jn},Jn.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var Kn=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],e=arguments[1],n=arguments[2];this.coord=new I(t),this.segmentIndex=e,this.dist=n};Kn.prototype.getSegmentIndex=function(){return this.segmentIndex},Kn.prototype.getCoordinate=function(){return this.coord},Kn.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)},Kn.prototype.compareTo=function(t){var e=t;return this.compare(e.segmentIndex,e.dist)},Kn.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&0===this.dist||this.segmentIndex===t},Kn.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},Kn.prototype.getDistance=function(){return this.dist},Kn.prototype.compare=function(t,e){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<e?-1:this.dist>e?1:0},Kn.prototype.interfaces_=function(){return[E]},Kn.prototype.getClass=function(){return Kn};var Zn=function(){this._nodeMap=new c,this.edge=null;var t=arguments[0];this.edge=t};Zn.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)},Zn.prototype.iterator=function(){return this._nodeMap.values().iterator()},Zn.prototype.addSplitEdges=function(t){this.addEndpoints();for(var e=this.iterator(),n=e.next();e.hasNext();){var r=e.next(),i=this.createSplitEdge(n,r);t.add(i),n=r}},Zn.prototype.addEndpoints=function(){var t=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[t],t,0)},Zn.prototype.createSplitEdge=function(t,e){var n=e.segmentIndex-t.segmentIndex+2,r=this.edge.pts[e.segmentIndex],i=0<e.dist||!e.coord.equals2D(r);i||n--;var o=new Array(n).fill(null),s=0;o[s++]=new I(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this.edge.pts[a];return i&&(o[s]=e.coord),new nr(o,new Pe(this.edge._label))},Zn.prototype.add=function(t,e,n){var r=new Kn(t,e,n),i=this._nodeMap.get(r);return null!==i?i:(this._nodeMap.put(r,r),r)},Zn.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();)if(e.next().coord.equals(t))return!0;return!1},Zn.prototype.interfaces_=function(){return[]},Zn.prototype.getClass=function(){return Zn};var Qn=function(){};Qn.prototype.getChainStartIndices=function(t){var e=0,n=new xt;n.add(new A(e));do{var r=this.findChainEnd(t,e);n.add(new A(r)),e=r}while(e<t.length-1);return Qn.toIntArray(n)},Qn.prototype.findChainEnd=function(t,e){for(var n=Ge.quadrant(t[e],t[e+1]),r=e+1;r<t.length&&Ge.quadrant(t[r-1],t[r])===n;)r++;return r-1},Qn.prototype.interfaces_=function(){return[]},Qn.prototype.getClass=function(){return Qn},Qn.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),n=0;n<e.length;n++)e[n]=t.get(n).intValue();return e};var $n=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new X,this.env2=new X;var t=arguments[0];this.e=t,this.pts=t.getCoordinates();var e=new Qn;this.startIndex=e.getChainStartIndices(this.pts)};$n.prototype.getCoordinates=function(){return this.pts},$n.prototype.getMaxX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return n<e?e:n},$n.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return e<n?e:n},$n.prototype.computeIntersectsForChain=function(){if(4===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],e,e.startIndex[n],e.startIndex[n+1],r)}else if(6===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3],u=arguments[4],l=arguments[5],h=this.pts[i],c=this.pts[o],p=s.pts[a],f=s.pts[u];if(o-i==1&&u-a==1)return l.addIntersections(this.e,i,s.e,a),null;if(this.env1.init(h,c),this.env2.init(p,f),!this.env1.intersects(this.env2))return null;var g=Math.trunc((i+o)/2),d=Math.trunc((a+u)/2);i<g&&(a<d&&this.computeIntersectsForChain(i,g,s,a,d,l),d<u&&this.computeIntersectsForChain(i,g,s,d,u,l)),g<o&&(a<d&&this.computeIntersectsForChain(g,o,s,a,d,l),d<u&&this.computeIntersectsForChain(g,o,s,d,u,l))}},$n.prototype.getStartIndexes=function(){return this.startIndex},$n.prototype.computeIntersects=function(t,e){for(var n=0;n<this.startIndex.length-1;n++)for(var r=0;r<t.startIndex.length-1;r++)this.computeIntersectsForChain(n,t,r,e)},$n.prototype.interfaces_=function(){return[]},$n.prototype.getClass=function(){return $n};var tr=function t(){this._depth=Array(2).fill().map(function(){return Array(3)});for(var e=0;e<2;e++)for(var n=0;n<3;n++)this._depth[e][n]=t.NULL_VALUE},er={NULL_VALUE:{configurable:!0}};tr.prototype.getDepth=function(t,e){return this._depth[t][e]},tr.prototype.setDepth=function(t,e,n){this._depth[t][e]=n},tr.prototype.isNull=function(){if(0===arguments.length){for(var t=0;t<2;t++)for(var e=0;e<3;e++)if(this._depth[t][e]!==tr.NULL_VALUE)return!1;return!0}if(1===arguments.length){var n=arguments[0];return this._depth[n][1]===tr.NULL_VALUE}if(2===arguments.length){var r=arguments[0],i=arguments[1];return this._depth[r][i]===tr.NULL_VALUE}},tr.prototype.normalize=function(){for(var t=0;t<2;t++)if(!this.isNull(t)){var e=this._depth[t][1];this._depth[t][2]<e&&(e=this._depth[t][2]),e<0&&(e=0);for(var n=1;n<3;n++){var r=0;this._depth[t][n]>e&&(r=1),this._depth[t][n]=r}}},tr.prototype.getDelta=function(t){return this._depth[t][Ne.RIGHT]-this._depth[t][Ne.LEFT]},tr.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?L.EXTERIOR:L.INTERIOR},tr.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},tr.prototype.add=function(){if(1===arguments.length)for(var t=arguments[0],e=0;e<2;e++)for(var n=1;n<3;n++){var r=t.getLocation(e,n);r!==L.EXTERIOR&&r!==L.INTERIOR||(this.isNull(e,n)?this._depth[e][n]=tr.depthAtLocation(r):this._depth[e][n]+=tr.depthAtLocation(r))}else if(3===arguments.length){var i=arguments[0],o=arguments[1];arguments[2]===L.INTERIOR&&this._depth[i][o]++}},tr.prototype.interfaces_=function(){return[]},tr.prototype.getClass=function(){return tr},tr.depthAtLocation=function(t){return t===L.EXTERIOR?0:t===L.INTERIOR?1:tr.NULL_VALUE},er.NULL_VALUE.get=function(){return-1},Object.defineProperties(tr,er);var nr=function(r){function s(){if(r.call(this),this.pts=null,this._env=null,this.eiList=new Zn(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new tr,this._depthDelta=0,1===arguments.length){var t=arguments[0];s.call(this,t,null)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.pts=e,this._label=n}}return r&&(s.__proto__=r),((s.prototype=Object.create(r&&r.prototype)).constructor=s).prototype.getDepth=function(){return this._depth},s.prototype.getCollapsedEdge=function(){var t=new Array(2).fill(null);return t[0]=this.pts[0],t[1]=this.pts[1],new s(t,Pe.toLineLabel(this._label))},s.prototype.isIsolated=function(){return this._isIsolated},s.prototype.getCoordinates=function(){return this.pts},s.prototype.setIsolated=function(t){this._isIsolated=t},s.prototype.setName=function(t){this._name=t},s.prototype.equals=function(t){if(!(t instanceof s))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},s.prototype.getCoordinate=function(){if(0===arguments.length)return 0<this.pts.length?this.pts[0]:null;if(1===arguments.length){var t=arguments[0];return this.pts[t]}},s.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)},s.prototype.computeIM=function(t){s.updateIM(this._label,t)},s.prototype.isCollapsed=function(){return!!this._label.isArea()&&3===this.pts.length&&!!this.pts[0].equals(this.pts[2])},s.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},s.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},s.prototype.getDepthDelta=function(){return this._depthDelta},s.prototype.getNumPoints=function(){return this.pts.length},s.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("")},s.prototype.getMonotoneChainEdge=function(){return null===this._mce&&(this._mce=new $n(this)),this._mce},s.prototype.getEnvelope=function(){if(null===this._env){this._env=new X;for(var t=0;t<this.pts.length;t++)this._env.expandToInclude(this.pts[t])}return this._env},s.prototype.addIntersection=function(t,e,n,r){var i=new I(t.getIntersection(r)),o=e,s=t.getEdgeDistance(n,r),a=o+1;if(a<this.pts.length){var u=this.pts[a];i.equals2D(u)&&(o=a,s=0)}this.eiList.add(i,o,s)},s.prototype.toString=function(){var t=new M;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()},s.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},s.prototype.setDepthDelta=function(t){this._depthDelta=t},s.prototype.getEdgeIntersectionList=function(){return this.eiList},s.prototype.addIntersections=function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++)this.addIntersection(t,e,n,r)},s.prototype.interfaces_=function(){return[]},s.prototype.getClass=function(){return s},s.updateIM=function(){if(2!==arguments.length)return r.prototype.updateIM.apply(this,arguments);var t=arguments[0],e=arguments[1];e.setAtLeastIfValid(t.getLocation(0,Ne.ON),t.getLocation(1,Ne.ON),1),t.isArea()&&(e.setAtLeastIfValid(t.getLocation(0,Ne.LEFT),t.getLocation(1,Ne.LEFT),2),e.setAtLeastIfValid(t.getLocation(0,Ne.RIGHT),t.getLocation(1,Ne.RIGHT),2))},s}(Fe),rr=function(t){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new Hn,this._bufParams=t||null};rr.prototype.setWorkingPrecisionModel=function(t){this._workingPrecisionModel=t},rr.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var n=e.getLabel(),r=t.getLabel();e.isPointwiseEqual(t)||(r=new Pe(t.getLabel())).flip(),n.merge(r);var i=rr.depthDelta(r),o=e.getDepthDelta()+i;e.setDepthDelta(o)}else this._edgeList.add(t),t.setDepthDelta(rr.depthDelta(t.getLabel()))},rr.prototype.buildSubgraphs=function(t,e){for(var n=new xt,r=t.iterator();r.hasNext();){var i=r.next(),o=i.getRightmostCoordinate(),s=new Dn(n).getDepth(o);i.computeDepth(s),i.findResultEdges(),n.add(i),e.add(i.getDirectedEdges(),i.getNodes())}},rr.prototype.createSubgraphs=function(t){for(var e=new xt,n=t.getNodes().iterator();n.hasNext();){var r=n.next();if(!r.isVisited()){var i=new Re;i.create(r),e.add(i)}}return $e.sort(e,$e.reverseOrder()),e},rr.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},rr.prototype.getNoder=function(t){if(null!==this._workingNoder)return this._workingNoder;var e=new wn,n=new it;return n.setPrecisionModel(t),e.setSegmentIntersector(new Jn(n)),e},rr.prototype.buffer=function(t,e){var n=this._workingPrecisionModel;null===n&&(n=t.getPrecisionModel()),this._geomFact=t.getFactory();var r=new An(n,this._bufParams),i=new Gn(t,e,r).getCurves();if(i.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(i,n),this._graph=new ze(new Yn),this._graph.addEdges(this._edgeList.getEdges());var o=this.createSubgraphs(this._graph),s=new Ye(this._geomFact);this.buildSubgraphs(o,s);var a=s.getPolygons();return a.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(a)},rr.prototype.computeNodedEdges=function(t,e){var n=this.getNoder(e);n.computeNodes(t);for(var r=n.getNodedSubstrings().iterator();r.hasNext();){var i=r.next(),o=i.getCoordinates();if(2!==o.length||!o[0].equals2D(o[1])){var s=i.getData(),a=new nr(i.getCoordinates(),new Pe(s));this.insertUniqueEdge(a)}}},rr.prototype.setNoder=function(t){this._workingNoder=t},rr.prototype.interfaces_=function(){return[]},rr.prototype.getClass=function(){return rr},rr.depthDelta=function(t){var e=t.getLocation(0,Ne.LEFT),n=t.getLocation(0,Ne.RIGHT);return e===L.INTERIOR&&n===L.EXTERIOR?1:e===L.EXTERIOR&&n===L.INTERIOR?-1:0},rr.convertSegStrings=function(t){for(var e=new _e,n=new xt;t.hasNext();){var r=t.next(),i=e.createLineString(r.getCoordinates());n.add(i)}return e.buildGeometry(n)};var ir=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,2===arguments.length){var t=arguments[0],e=arguments[1];this._noder=t,this._scaleFactor=e,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(4===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2],o=arguments[3];this._noder=n,this._scaleFactor=r,this._offsetX=i,this._offsetY=o,this._isScaled=!this.isIntegerPrecision()}};ir.prototype.rescale=function(){if(R(arguments[0],bt))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])&&z.out.println(n)}},ir.prototype.scale=function(){if(R(arguments[0],bt)){for(var t=arguments[0],e=new xt,n=t.iterator();n.hasNext();){var r=n.next();e.add(new gn(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 I(Math.round((i[s].x-this._offsetX)*this._scaleFactor),Math.round((i[s].y-this._offsetY)*this._scaleFactor),i[s].z);return St.removeRepeatedPoints(o)}},ir.prototype.isIntegerPrecision=function(){return 1===this._scaleFactor},ir.prototype.getNodedSubstrings=function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t},ir.prototype.computeNodes=function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)},ir.prototype.interfaces_=function(){return[bn]},ir.prototype.getClass=function(){return ir};var or=function(){this._li=new it,this._segStrings=null;var t=arguments[0];this._segStrings=t},sr={fact:{configurable:!0}};or.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 $("found endpt/interior pt intersection at index "+o+" :pt "+n)},or.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],d=h.getCoordinates()[c+1],y=p.getCoordinates()[f],_=p.getCoordinates()[f+1];if(this._li.computeIntersection(g,d,y,_),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,g,d)||this.hasInteriorIntersection(this._li,y,_)))throw new $("found non-noded intersection at "+g+"-"+d+" and "+y+"-"+_)}},or.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},or.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])},or.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},or.prototype.checkCollapse=function(t,e,n){if(t.equals(n))throw new $("found non-noded collapse at "+or.fact.createLineString([t,e,n]))},or.prototype.interfaces_=function(){return[]},or.prototype.getClass=function(){return or},sr.fact.get=function(){return new _e},Object.defineProperties(or,sr);var ar=function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var t=arguments[0],e=arguments[1],n=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=e,this._li=n,e<=0)throw new v("Scale factor must be non-zero");1!==e&&(this._pt=new I(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new I,this._p1Scaled=new I),this.initCorners(this._pt)},ur={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};ar.prototype.intersectsScaled=function(t,e){var n=Math.min(t.x,e.x),r=Math.max(t.x,e.x),i=Math.min(t.y,e.y),o=Math.max(t.y,e.y),s=this._maxx<n||this._minx>r||this._maxy<i||this._miny>o;if(s)return!1;var a=this.intersectsToleranceSquare(t,e);return et.isTrue(!(s&&a),"Found bad envelope test"),a},ar.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 I(this._maxx,this._maxy),this._corner[1]=new I(this._minx,this._maxy),this._corner[2]=new I(this._minx,this._miny),this._corner[3]=new I(this._maxx,this._miny)},ar.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))},ar.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},ar.prototype.getCoordinate=function(){return this._originalPt},ar.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},ar.prototype.getSafeEnvelope=function(){if(null===this._safeEnv){var t=ar.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new X(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},ar.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()))))},ar.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)))))},ar.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)},ar.prototype.interfaces_=function(){return[]},ar.prototype.getClass=function(){return ar},ur.SAFE_ENV_EXPANSION_FACTOR.get=function(){return.75},Object.defineProperties(ar,ur);var lr=function(){this.tempEnv1=new X,this.selectedSegment=new dn};lr.prototype.select=function(){if(1===arguments.length);else if(2===arguments.length){var t=arguments[0],e=arguments[1];t.getLineSegment(e,this.selectedSegment),this.select(this.selectedSegment)}},lr.prototype.interfaces_=function(){return[]},lr.prototype.getClass=function(){return lr};var hr=function(){this._index=null;var t=arguments[0];this._index=t},cr={HotPixelSnapAction:{configurable:!0}};hr.prototype.snap=function(){if(1===arguments.length){var t=arguments[0];return this.snap(t,null,-1)}if(3===arguments.length){var e=arguments[0],n=arguments[1],r=arguments[2],i=e.getSafeEnvelope(),o=new pr(e,n,r);return this._index.query(i,{interfaces_:function(){return[Je]},visitItem:function(t){t.select(i,o)}}),o.isNodeAdded()}},hr.prototype.interfaces_=function(){return[]},hr.prototype.getClass=function(){return hr},cr.HotPixelSnapAction.get=function(){return pr},Object.defineProperties(hr,cr);var pr=function(r){function t(){r.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}return r&&(t.__proto__=r),((t.prototype=Object.create(r&&r.prototype)).constructor=t).prototype.isNodeAdded=function(){return this._isNodeAdded},t.prototype.select=function(){if(2!==arguments.length)return r.prototype.select.apply(this,arguments);var t=arguments[0],e=arguments[1],n=t.getContext();if(null!==this._parentEdge&&n===this._parentEdge&&e===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(n,e)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(lr),fr=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new xt};fr.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)}},fr.prototype.isDone=function(){return!1},fr.prototype.getInteriorIntersections=function(){return this._interiorIntersections},fr.prototype.interfaces_=function(){return[Wn]},fr.prototype.getClass=function(){return fr};var gr=function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var t=arguments[0];this._pm=t,this._li=new it,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()};gr.prototype.checkCorrectness=function(t){var e=gn.getNodedSubstrings(t),n=new or(e);try{n.checkValid()}catch(t){if(!(t instanceof V))throw t;t.printStackTrace()}},gr.prototype.getNodedSubstrings=function(){return gn.getNodedSubstrings(this._nodedSegStrings)},gr.prototype.snapRound=function(t,e){var n=this.findInteriorIntersections(t,e);this.computeIntersectionSnaps(n),this.computeVertexSnaps(t)},gr.prototype.findInteriorIntersections=function(t,e){var n=new fr(e);return this._noder.setSegmentIntersector(n),this._noder.computeNodes(t),n.getInteriorIntersections()},gr.prototype.computeVertexSnaps=function(){if(R(arguments[0],bt))for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.computeVertexSnaps(e)}else if(arguments[0]instanceof gn)for(var n=arguments[0],r=n.getCoordinates(),i=0;i<r.length;i++){var o=new ar(r[i],this._scaleFactor,this._li);this._pointSnapper.snap(o,n,i)&&n.addIntersection(r[i],i)}},gr.prototype.computeNodes=function(t){this._nodedSegStrings=t,this._noder=new wn,this._pointSnapper=new hr(this._noder.getIndex()),this.snapRound(t,this._li)},gr.prototype.computeIntersectionSnaps=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next(),r=new ar(n,this._scaleFactor,this._li);this._pointSnapper.snap(r)}},gr.prototype.interfaces_=function(){return[bn]},gr.prototype.getClass=function(){return gr};var dr=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new In,this._resultGeometry=null,this._saveException=null,1===arguments.length){var t=arguments[0];this._argGeom=t}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this._argGeom=e,this._bufParams=n}},yr={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};dr.prototype.bufferFixedPrecision=function(t){var e=new ir(new gr(new fe(1)),t.getScale()),n=new rr(this._bufParams);n.setWorkingPrecisionModel(t),n.setNoder(e),this._resultGeometry=n.buffer(this._argGeom,this._distance)},dr.prototype.bufferReducedPrecision=function(){var t=this;if(0===arguments.length){for(var e=dr.MAX_PRECISION_DIGITS;0<=e;e--){try{t.bufferReducedPrecision(e)}catch(e){if(!(e instanceof Le))throw e;t._saveException=e}if(null!==t._resultGeometry)return null}throw this._saveException}if(1===arguments.length){var n=arguments[0],r=dr.precisionScaleFactor(this._argGeom,this._distance,n),i=new fe(r);this.bufferFixedPrecision(i)}},dr.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===fe.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},dr.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},dr.prototype.bufferOriginalPrecision=function(){try{var t=new rr(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof $))throw t;this._saveException=t}},dr.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},dr.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},dr.prototype.interfaces_=function(){return[]},dr.prototype.getClass=function(){return dr},dr.bufferOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return new dr(t).getResultGeometry(e)}if(3===arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof ht&&"number"==typeof arguments[1]){var n=arguments[0],r=arguments[1],i=arguments[2],o=new dr(n);return o.setQuadrantSegments(i),o.getResultGeometry(r)}if(arguments[2]instanceof In&&arguments[0]instanceof ht&&"number"==typeof arguments[1]){var s=arguments[0],a=arguments[1],u=arguments[2];return new dr(s,u).getResultGeometry(a)}}else if(4===arguments.length){var l=arguments[0],h=arguments[1],c=arguments[2],p=arguments[3],f=new dr(l);return f.setQuadrantSegments(c),f.setEndCapStyle(p),f.getResultGeometry(h)}},dr.precisionScaleFactor=function(t,e,n){var r=t.getEnvelopeInternal(),i=O.max(Math.abs(r.getMaxX()),Math.abs(r.getMaxY()),Math.abs(r.getMinX()),Math.abs(r.getMinY()))+2*(0<e?e:0),o=n-Math.trunc(Math.log(i)/Math.log(10)+1);return Math.pow(10,o)},yr.CAP_ROUND.get=function(){return In.CAP_ROUND},yr.CAP_BUTT.get=function(){return In.CAP_FLAT},yr.CAP_FLAT.get=function(){return In.CAP_FLAT},yr.CAP_SQUARE.get=function(){return In.CAP_SQUARE},yr.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(dr,yr);var _r=function(){this._pt=[new I,new I],this._distance=m.NaN,this._isNull=!0};_r.prototype.getCoordinates=function(){return this._pt},_r.prototype.getCoordinate=function(t){return this._pt[t]},_r.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r<this._distance&&this.initialize(e,n,r)}},_r.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(r),this._distance=i,this._isNull=!1}},_r.prototype.getDistance=function(){return this._distance},_r.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r>this._distance&&this.initialize(e,n,r)}},_r.prototype.interfaces_=function(){return[]},_r.prototype.getClass=function(){return _r};var vr=function(){};vr.prototype.interfaces_=function(){return[]},vr.prototype.getClass=function(){return vr},vr.computeDistance=function(){if(arguments[2]instanceof _r&&arguments[0]instanceof Jt&&arguments[1]instanceof I)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=t.getCoordinates(),i=new dn,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 _r&&arguments[0]instanceof $t&&arguments[1]instanceof I){var a=arguments[0],u=arguments[1],l=arguments[2];vr.computeDistance(a.getExteriorRing(),u,l);for(var h=0;h<a.getNumInteriorRing();h++)vr.computeDistance(a.getInteriorRingN(h),u,l)}else if(arguments[2]instanceof _r&&arguments[0]instanceof ht&&arguments[1]instanceof I){var c=arguments[0],p=arguments[1],f=arguments[2];if(c instanceof Jt)vr.computeDistance(c,p,f);else if(c instanceof $t)vr.computeDistance(c,p,f);else if(c instanceof Vt)for(var g=c,d=0;d<g.getNumGeometries();d++){var y=g.getGeometryN(d);vr.computeDistance(y,p,f)}else f.setMinimum(c.getCoordinate(),p)}else if(arguments[2]instanceof _r&&arguments[0]instanceof dn&&arguments[1]instanceof I){var _=arguments[0],v=arguments[1],m=arguments[2],b=_.closestPoint(v);m.setMinimum(b,v)}};var mr=function(t){this._maxPtDist=new _r,this._inputGeom=t||null},br={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};mr.prototype.computeMaxMidpointDistance=function(t){var e=new wr(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},mr.prototype.computeMaxVertexDistance=function(t){var e=new Er(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},mr.prototype.findDistance=function(t){return this.computeMaxVertexDistance(t),this.computeMaxMidpointDistance(t),this._maxPtDist.getDistance()},mr.prototype.getDistancePoints=function(){return this._maxPtDist},mr.prototype.interfaces_=function(){return[]},mr.prototype.getClass=function(){return mr},br.MaxPointDistanceFilter.get=function(){return Er},br.MaxMidpointDistanceFilter.get=function(){return wr},Object.defineProperties(mr,br);var Er=function(t){this._maxPtDist=new _r,this._minPtDist=new _r,this._geom=t||null};Er.prototype.filter=function(t){this._minPtDist.initialize(),vr.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Er.prototype.getMaxPointDistance=function(){return this._maxPtDist},Er.prototype.interfaces_=function(){return[ft]},Er.prototype.getClass=function(){return Er};var wr=function(t){this._maxPtDist=new _r,this._minPtDist=new _r,this._geom=t||null};wr.prototype.filter=function(t,e){if(0===e)return null;var n=t.getCoordinate(e-1),r=t.getCoordinate(e),i=new I((n.x+r.x)/2,(n.y+r.y)/2);this._minPtDist.initialize(),vr.computeDistance(this._geom,i,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},wr.prototype.isDone=function(){return!1},wr.prototype.isGeometryChanged=function(){return!1},wr.prototype.getMaxPointDistance=function(){return this._maxPtDist},wr.prototype.interfaces_=function(){return[Ut]},wr.prototype.getClass=function(){return wr};var xr=function(t){this._comps=t||null};xr.prototype.filter=function(t){t instanceof $t&&this._comps.add(t)},xr.prototype.interfaces_=function(){return[jt]},xr.prototype.getClass=function(){return xr},xr.getPolygons=function(){if(1===arguments.length){var t=arguments[0];return xr.getPolygons(t,new xt)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e instanceof $t?n.add(e):e instanceof Vt&&e.apply(new xr(n)),n}};var Ir=function(){if(this._lines=null,this._isForcedToLineString=!1,1===arguments.length){var t=arguments[0];this._lines=t}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this._lines=e,this._isForcedToLineString=n}};Ir.prototype.filter=function(t){if(this._isForcedToLineString&&t instanceof ee){var e=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(e),null}t instanceof Jt&&this._lines.add(t)},Ir.prototype.setForceToLineString=function(t){this._isForcedToLineString=t},Ir.prototype.interfaces_=function(){return[lt]},Ir.prototype.getClass=function(){return Ir},Ir.getGeometry=function(){if(1===arguments.length){var t=arguments[0];return t.getFactory().buildGeometry(Ir.getLines(t))}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e.getFactory().buildGeometry(Ir.getLines(e,n))}},Ir.getLines=function(){if(1===arguments.length){var t=arguments[0];return Ir.getLines(t,!1)}if(2===arguments.length){if(R(arguments[0],bt)&&R(arguments[1],bt)){for(var e=arguments[0],n=arguments[1],r=e.iterator();r.hasNext();){var i=r.next();Ir.getLines(i,n)}return n}if(arguments[0]instanceof ht&&"boolean"==typeof arguments[1]){var o=arguments[0],s=arguments[1],a=new xt;return o.apply(new Ir(a,s)),a}if(arguments[0]instanceof ht&&R(arguments[1],bt)){var u=arguments[0],l=arguments[1];return u instanceof Jt?l.add(u):u.apply(new Ir(l)),l}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&R(arguments[0],bt)&&R(arguments[1],bt)){for(var h=arguments[0],c=arguments[1],p=arguments[2],f=h.iterator();f.hasNext();){var g=f.next();Ir.getLines(g,c,p)}return c}if("boolean"==typeof arguments[2]&&arguments[0]instanceof ht&&R(arguments[1],bt)){var d=arguments[0],y=arguments[1],_=arguments[2];return d.apply(new Ir(y,_)),y}}};var Nr=function(){if(this._boundaryRule=gt.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];if(null===t)throw new v("Rule must be non-null");this._boundaryRule=t}};Nr.prototype.locateInternal=function(){if(arguments[0]instanceof I&&arguments[1]instanceof $t){var t=arguments[0],e=arguments[1];if(e.isEmpty())return L.EXTERIOR;var n=e.getExteriorRing(),r=this.locateInPolygonRing(t,n);if(r===L.EXTERIOR)return L.EXTERIOR;if(r===L.BOUNDARY)return L.BOUNDARY;for(var i=0;i<e.getNumInteriorRing();i++){var o=e.getInteriorRingN(i),s=this.locateInPolygonRing(t,o);if(s===L.INTERIOR)return L.EXTERIOR;if(s===L.BOUNDARY)return L.BOUNDARY}return L.INTERIOR}if(arguments[0]instanceof I&&arguments[1]instanceof Jt){var a=arguments[0],u=arguments[1];if(!u.getEnvelopeInternal().intersects(a))return L.EXTERIOR;var l=u.getCoordinates();return u.isClosed()||!a.equals(l[0])&&!a.equals(l[l.length-1])?at.isOnLine(a,l)?L.INTERIOR:L.EXTERIOR:L.BOUNDARY}if(arguments[0]instanceof I&&arguments[1]instanceof Zt){var h=arguments[0];return arguments[1].getCoordinate().equals2D(h)?L.INTERIOR:L.EXTERIOR}},Nr.prototype.locateInPolygonRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?at.locatePointInRing(t,e.getCoordinates()):L.EXTERIOR},Nr.prototype.intersects=function(t,e){return this.locate(t,e)!==L.EXTERIOR},Nr.prototype.updateLocationInfo=function(t){t===L.INTERIOR&&(this._isIn=!0),t===L.BOUNDARY&&this._numBoundaries++},Nr.prototype.computeLocation=function(t,e){if(e instanceof Zt&&this.updateLocationInfo(this.locateInternal(t,e)),e instanceof Jt)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof $t)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof qt)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 ne)for(var o=e,s=0;s<o.getNumGeometries();s++){var a=o.getGeometryN(s);this.updateLocationInfo(this.locateInternal(t,a))}else if(e instanceof Vt)for(var u=new Un(e);u.hasNext();){var l=u.next();l!==e&&this.computeLocation(t,l)}},Nr.prototype.locate=function(t,e){return e.isEmpty()?L.EXTERIOR:e instanceof Jt?this.locateInternal(t,e):e instanceof $t?this.locateInternal(t,e):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,e),this._boundaryRule.isInBoundary(this._numBoundaries)?L.BOUNDARY:0<this._numBoundaries||this._isIn?L.INTERIOR:L.EXTERIOR)},Nr.prototype.interfaces_=function(){return[]},Nr.prototype.getClass=function(){return Nr};var Sr=function t(){if(this._component=null,this._segIndex=null,this._pt=null,2===arguments.length){var e=arguments[0],n=arguments[1];t.call(this,e,t.INSIDE_AREA,n)}else if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2];this._component=r,this._segIndex=i,this._pt=o}},Cr={INSIDE_AREA:{configurable:!0}};Sr.prototype.isInsideArea=function(){return this._segIndex===Sr.INSIDE_AREA},Sr.prototype.getCoordinate=function(){return this._pt},Sr.prototype.getGeometryComponent=function(){return this._component},Sr.prototype.getSegmentIndex=function(){return this._segIndex},Sr.prototype.interfaces_=function(){return[]},Sr.prototype.getClass=function(){return Sr},Cr.INSIDE_AREA.get=function(){return-1},Object.defineProperties(Sr,Cr);var Lr=function(t){this._pts=t||null};Lr.prototype.filter=function(t){t instanceof Zt&&this._pts.add(t)},Lr.prototype.interfaces_=function(){return[jt]},Lr.prototype.getClass=function(){return Lr},Lr.getPoints=function(){if(1===arguments.length){var t=arguments[0];return t instanceof Zt?$e.singletonList(t):Lr.getPoints(t,new xt)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e instanceof Zt?n.add(e):e instanceof Vt&&e.apply(new Lr(n)),n}};var Tr=function(){this._locations=null;var t=arguments[0];this._locations=t};Tr.prototype.filter=function(t){(t instanceof Zt||t instanceof Jt||t instanceof $t)&&this._locations.add(new Sr(t,0,t.getCoordinate()))},Tr.prototype.interfaces_=function(){return[jt]},Tr.prototype.getClass=function(){return Tr},Tr.getLocations=function(t){var e=new xt;return t.apply(new Tr(e)),e};var Rr=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Nr,this._minDistanceLocation=null,this._minDistance=m.MAX_VALUE,2===arguments.length){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=r,this._terminateDistance=i}};Rr.prototype.computeContainmentDistance=function(){if(0===arguments.length){var t=new Array(2).fill(null);if(this.computeContainmentDistance(0,t),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1],r=1-e,i=xr.getPolygons(this._geom[e]);if(0<i.size()){var o=Tr.getLocations(this._geom[r]);if(this.computeContainmentDistance(o,i,n),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[r]=n[0],this._minDistanceLocation[e]=n[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&R(arguments[0],wt)&&R(arguments[1],wt)){for(var s=arguments[0],a=arguments[1],u=arguments[2],l=0;l<s.size();l++)for(var h=s.get(l),c=0;c<a.size();c++)if(this.computeContainmentDistance(h,a.get(c),u),this._minDistance<=this._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof Sr&&arguments[1]instanceof $t){var p=arguments[0],f=arguments[1],g=arguments[2],d=p.getCoordinate();if(L.EXTERIOR!==this._ptLocator.locate(d,f))return this._minDistance=0,g[0]=p,g[1]=new Sr(f,d),null}},Rr.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}},Rr.prototype.computeFacetDistance=function(){var t=new Array(2).fill(null),e=Ir.getLines(this._geom[0]),n=Ir.getLines(this._geom[1]),r=Lr.getPoints(this._geom[0]),i=Lr.getPoints(this._geom[1]);return this.computeMinDistanceLines(e,n,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(e,i,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(n,r,t),this.updateMinDistance(t,!0),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistancePoints(r,i,t),void this.updateMinDistance(t,!1))))},Rr.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},Rr.prototype.updateMinDistance=function(t,e){if(null===t[0])return null;this._minDistanceLocation[1]=e?(this._minDistanceLocation[0]=t[1],t[0]):(this._minDistanceLocation[0]=t[0],t[1])},Rr.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},Rr.prototype.computeMinDistance=function(){if(0===arguments.length){if(null!==this._minDistanceLocation)return null;if(this._minDistanceLocation=new Array(2).fill(null),this.computeContainmentDistance(),this._minDistance<=this._terminateDistance)return null;this.computeFacetDistance()}else if(3===arguments.length)if(arguments[2]instanceof Array&&arguments[0]instanceof Jt&&arguments[1]instanceof Zt){var t=arguments[0],e=arguments[1],n=arguments[2];if(t.getEnvelopeInternal().distance(e.getEnvelopeInternal())>this._minDistance)return null;for(var r=t.getCoordinates(),i=e.getCoordinate(),o=0;o<r.length-1;o++){var s=at.distancePointLine(i,r[o],r[o+1]);if(s<this._minDistance){this._minDistance=s;var a=new dn(r[o],r[o+1]).closestPoint(i);n[0]=new Sr(t,o,a),n[1]=new Sr(e,0,i)}if(this._minDistance<=this._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof Jt&&arguments[1]instanceof Jt){var u=arguments[0],l=arguments[1],h=arguments[2];if(u.getEnvelopeInternal().distance(l.getEnvelopeInternal())>this._minDistance)return null;for(var c=u.getCoordinates(),p=l.getCoordinates(),f=0;f<c.length-1;f++)for(var g=0;g<p.length-1;g++){var d=at.distanceLineLine(c[f],c[f+1],p[g],p[g+1]);if(d<this._minDistance){this._minDistance=d;var y=new dn(c[f],c[f+1]),_=new dn(p[g],p[g+1]),v=y.closestPoints(_);h[0]=new Sr(u,f,v[0]),h[1]=new Sr(l,g,v[1])}if(this._minDistance<=this._terminateDistance)return null}}},Rr.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 Sr(i,0,i.getCoordinate()),n[1]=new Sr(s,0,s.getCoordinate())),this._minDistance<=this._terminateDistance)return null}},Rr.prototype.distance=function(){if(null===this._geom[0]||null===this._geom[1])throw new v("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},Rr.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}},Rr.prototype.interfaces_=function(){return[]},Rr.prototype.getClass=function(){return Rr},Rr.distance=function(t,e){return new Rr(t,e).distance()},Rr.isWithinDistance=function(t,e,n){return new Rr(t,e,n).distance()<=n},Rr.nearestPoints=function(t,e){return new Rr(t,e).nearestPoints()};var Or=function(){this._pt=[new I,new I],this._distance=m.NaN,this._isNull=!0};Or.prototype.getCoordinates=function(){return this._pt},Or.prototype.getCoordinate=function(t){return this._pt[t]},Or.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r<this._distance&&this.initialize(e,n,r)}},Or.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(r),this._distance=i,this._isNull=!1}},Or.prototype.toString=function(){return Q.toLineString(this._pt[0],this._pt[1])},Or.prototype.getDistance=function(){return this._distance},Or.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r>this._distance&&this.initialize(e,n,r)}},Or.prototype.interfaces_=function(){return[]},Or.prototype.getClass=function(){return Or};var Pr=function(){};Pr.prototype.interfaces_=function(){return[]},Pr.prototype.getClass=function(){return Pr},Pr.computeDistance=function(){if(arguments[2]instanceof Or&&arguments[0]instanceof Jt&&arguments[1]instanceof I)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=new dn,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 Or&&arguments[0]instanceof $t&&arguments[1]instanceof I){var a=arguments[0],u=arguments[1],l=arguments[2];Pr.computeDistance(a.getExteriorRing(),u,l);for(var h=0;h<a.getNumInteriorRing();h++)Pr.computeDistance(a.getInteriorRingN(h),u,l)}else if(arguments[2]instanceof Or&&arguments[0]instanceof ht&&arguments[1]instanceof I){var c=arguments[0],p=arguments[1],f=arguments[2];if(c instanceof Jt)Pr.computeDistance(c,p,f);else if(c instanceof $t)Pr.computeDistance(c,p,f);else if(c instanceof Vt)for(var g=c,d=0;d<g.getNumGeometries();d++){var y=g.getGeometryN(d);Pr.computeDistance(y,p,f)}else f.setMinimum(c.getCoordinate(),p)}else if(arguments[2]instanceof Or&&arguments[0]instanceof dn&&arguments[1]instanceof I){var _=arguments[0],v=arguments[1],m=arguments[2],b=_.closestPoint(v);m.setMinimum(b,v)}};var Mr=function(){this._g0=null,this._g1=null,this._ptDist=new Or,this._densifyFrac=0;var t=arguments[0],e=arguments[1];this._g0=t,this._g1=e},Ar={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};Mr.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},Mr.prototype.setDensifyFraction=function(t){if(1<t||t<=0)throw new v("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},Mr.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},Mr.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},Mr.prototype.computeOrientedDistance=function(t,e,n){var r=new Dr(e);if(t.apply(r),n.setMaximum(r.getMaxPointDistance()),0<this._densifyFrac){var i=new Fr(e,this._densifyFrac);t.apply(i),n.setMaximum(i.getMaxPointDistance())}},Mr.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},Mr.prototype.interfaces_=function(){return[]},Mr.prototype.getClass=function(){return Mr},Mr.distance=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return new Mr(t,e).distance()}if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2],o=new Mr(n,r);return o.setDensifyFraction(i),o.distance()}},Ar.MaxPointDistanceFilter.get=function(){return Dr},Ar.MaxDensifiedByFractionDistanceFilter.get=function(){return Fr},Object.defineProperties(Mr,Ar);var Dr=function(){this._maxPtDist=new Or,this._minPtDist=new Or,this._euclideanDist=new Pr,this._geom=null;var t=arguments[0];this._geom=t};Dr.prototype.filter=function(t){this._minPtDist.initialize(),Pr.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Dr.prototype.getMaxPointDistance=function(){return this._maxPtDist},Dr.prototype.interfaces_=function(){return[ft]},Dr.prototype.getClass=function(){return Dr};var Fr=function(){this._maxPtDist=new Or,this._minPtDist=new Or,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};Fr.prototype.filter=function(t,e){if(0===e)return null;for(var n=t.getCoordinate(e-1),r=t.getCoordinate(e),i=(r.x-n.x)/this._numSubSegs,o=(r.y-n.y)/this._numSubSegs,s=0;s<this._numSubSegs;s++){var a=n.x+s*i,u=n.y+s*o,l=new I(a,u);this._minPtDist.initialize(),Pr.computeDistance(this._geom,l,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}},Fr.prototype.isDone=function(){return!1},Fr.prototype.isGeometryChanged=function(){return!1},Fr.prototype.getMaxPointDistance=function(){return this._maxPtDist},Fr.prototype.interfaces_=function(){return[Ut]},Fr.prototype.getClass=function(){return Fr};var kr=function(t,e,n){this._minValidDistance=null,this._maxValidDistance=null,this._minDistanceFound=null,this._maxDistanceFound=null,this._isValid=!0,this._errMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._bufDistance=e||null,this._result=n||null},Br={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};kr.prototype.checkMaximumDistance=function(t,e,n){var r=new Mr(e,t);if(r.setDensifyFraction(.25),this._maxDistanceFound=r.orientedDistance(),this._maxDistanceFound>n){this._isValid=!1;var i=r.getCoordinates();this._errorLocation=i[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+Q.toLineString(i[0],i[1])+")"}},kr.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=kr.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(),kr.VERBOSE&&z.out.println("Min Dist= "+this._minDistanceFound+"  err= "+(1-this._minDistanceFound/this._bufDistance)+"  Max Dist= "+this._maxDistanceFound+"  err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},kr.prototype.checkNegativeValid=function(){if(!(this._input instanceof $t||this._input instanceof ne||this._input instanceof Vt))return null;var t=this.getPolygonLines(this._input);if(this.checkMinimumDistance(t,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(t,this._result,this._maxValidDistance)},kr.prototype.getErrorIndicator=function(){return this._errorIndicator},kr.prototype.checkMinimumDistance=function(t,e,n){var r=new Rr(t,e,n);if(this._minDistanceFound=r.distance(),this._minDistanceFound<n){this._isValid=!1;var i=r.nearestPoints();this._errorLocation=r.nearestPoints()[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+Q.toLineString(i[0],i[1])+" )"}},kr.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)},kr.prototype.getErrorLocation=function(){return this._errorLocation},kr.prototype.getPolygonLines=function(t){for(var e=new xt,n=new Ir(e),r=xr.getPolygons(t).iterator();r.hasNext();)r.next().apply(n);return t.getFactory().buildGeometry(e)},kr.prototype.getErrorMessage=function(){return this._errMsg},kr.prototype.interfaces_=function(){return[]},kr.prototype.getClass=function(){return kr},Br.VERBOSE.get=function(){return!1},Br.MAX_DISTANCE_DIFF_FRAC.get=function(){return.012},Object.defineProperties(kr,Br);var Gr=function(t,e,n){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._distance=e||null,this._result=n||null},jr={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};Gr.prototype.isValid=function(){return this.checkPolygonal(),this._isValid&&(this.checkExpectedEmpty(),this._isValid&&(this.checkEnvelope(),this._isValid&&(this.checkArea(),this._isValid&&this.checkDistance()))),this._isValid},Gr.prototype.checkEnvelope=function(){if(this._distance<0)return null;var t=this._distance*Gr.MAX_ENV_DIFF_FRAC;0===t&&(t=.001);var e=new X(this._input.getEnvelopeInternal());e.expandBy(this._distance);var n=new X(this._result.getEnvelopeInternal());n.expandBy(t),n.contains(e)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(n)),this.report("Envelope")},Gr.prototype.checkDistance=function(){var t=new kr(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")},Gr.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")},Gr.prototype.checkPolygonal=function(){this._result instanceof $t||this._result instanceof ne||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},Gr.prototype.getErrorIndicator=function(){return this._errorIndicator},Gr.prototype.getErrorLocation=function(){return this._errorLocation},Gr.prototype.checkExpectedEmpty=function(){return 2<=this._input.getDimension()?null:0<this._distance?null:(this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),void this.report("ExpectedEmpty"))},Gr.prototype.report=function(t){if(!Gr.VERBOSE)return null;z.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},Gr.prototype.getErrorMessage=function(){return this._errorMsg},Gr.prototype.interfaces_=function(){return[]},Gr.prototype.getClass=function(){return Gr},Gr.isValidMsg=function(t,e,n){var r=new Gr(t,e,n);return r.isValid()?null:r.getErrorMessage()},Gr.isValid=function(t,e,n){return!!new Gr(t,e,n).isValid()},jr.VERBOSE.get=function(){return!1},jr.MAX_ENV_DIFF_FRAC.get=function(){return.012},Object.defineProperties(Gr,jr);var Ur=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};Ur.prototype.getCoordinates=function(){return this._pts},Ur.prototype.size=function(){return this._pts.length},Ur.prototype.getCoordinate=function(t){return this._pts[t]},Ur.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Ur.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:cn.octant(this.getCoordinate(t),this.getCoordinate(t+1))},Ur.prototype.setData=function(t){this._data=t},Ur.prototype.getData=function(){return this._data},Ur.prototype.toString=function(){return Q.toLineString(new ue(this._pts))},Ur.prototype.interfaces_=function(){return[pn]},Ur.prototype.getClass=function(){return Ur};var Vr=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new xt,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};Vr.prototype.getInteriorIntersection=function(){return this._interiorIntersection},Vr.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},Vr.prototype.getIntersectionSegments=function(){return this._intSegments},Vr.prototype.count=function(){return this._intersectionCount},Vr.prototype.getIntersections=function(){return this._intersections},Vr.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},Vr.prototype.setKeepIntersections=function(t){this._keepIntersections=t},Vr.prototype.processIntersections=function(t,e,n,r){if(!this._findAllIntersections&&this.hasIntersection())return null;if(t===n&&e===r)return null;if(this._isCheckEndSegmentsOnly&&!this.isEndSegment(t,e)&&!this.isEndSegment(n,r))return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=i,this._intSegments[1]=o,this._intSegments[2]=s,this._intSegments[3]=a,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},Vr.prototype.isEndSegment=function(t,e){return 0===e||e>=t.size()-2},Vr.prototype.hasIntersection=function(){return null!==this._interiorIntersection},Vr.prototype.isDone=function(){return!this._findAllIntersections&&null!==this._interiorIntersection},Vr.prototype.interfaces_=function(){return[Wn]},Vr.prototype.getClass=function(){return Vr},Vr.createAllIntersectionsFinder=function(t){var e=new Vr(t);return e.setFindAllIntersections(!0),e},Vr.createAnyIntersectionFinder=function(t){return new Vr(t)},Vr.createIntersectionCounter=function(t){var e=new Vr(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var qr=function(){this._li=new it,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};qr.prototype.execute=function(){if(null!==this._segInt)return null;this.checkInteriorIntersections()},qr.prototype.getIntersections=function(){return this._segInt.getIntersections()},qr.prototype.isValid=function(){return this.execute(),this._isValid},qr.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},qr.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new Vr(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new wn;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},qr.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new Le(this.getErrorMessage(),this._segInt.getInteriorIntersection())},qr.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Q.toLineString(t[0],t[1])+" and "+Q.toLineString(t[2],t[3])},qr.prototype.interfaces_=function(){return[]},qr.prototype.getClass=function(){return qr},qr.computeIntersections=function(t){var e=new qr(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var zr=function t(){this._nv=null;var e=arguments[0];this._nv=new qr(t.toSegmentStrings(e))};zr.prototype.checkValid=function(){this._nv.checkValid()},zr.prototype.interfaces_=function(){return[]},zr.prototype.getClass=function(){return zr},zr.toSegmentStrings=function(t){for(var e=new xt,n=t.iterator();n.hasNext();){var r=n.next();e.add(new Ur(r.getCoordinates(),r))}return e},zr.checkValid=function(t){new zr(t).checkValid()};var Yr=function(t){this._mapOp=t};Yr.prototype.map=function(t){for(var e=new xt,n=0;n<t.getNumGeometries();n++){var r=this._mapOp.map(t.getGeometryN(n));r.isEmpty()||e.add(r)}return t.getFactory().createGeometryCollection(_e.toGeometryArray(e))},Yr.prototype.interfaces_=function(){return[]},Yr.prototype.getClass=function(){return Yr},Yr.map=function(t,e){return new Yr(e).map(t)};var Xr=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new xt,this._resultLineList=new xt;var t=arguments[0],e=arguments[1],n=arguments[2];this._op=t,this._geometryFactory=e,this._ptLocator=n};Xr.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)}},Xr.prototype.labelIsolatedLine=function(t,e){var n=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(e));t.getLabel().setLocation(e,n)},Xr.prototype.build=function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList},Xr.prototype.collectLineEdge=function(t,e,n){var r=t.getLabel(),i=t.getEdge();t.isLineEdge()&&(t.isVisited()||!Si.isResultOfOp(r,e)||i.isCovered()||(n.add(i),t.setVisitedEdge(!0)))},Xr.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();if(n.isLineEdge()&&!r.isCoveredSet()){var i=this._op.isCoveredByA(n.getCoordinate());r.setCovered(i)}}},Xr.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))}},Xr.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)}},Xr.prototype.collectBoundaryTouchEdge=function(t,e,n){var r=t.getLabel();return t.isLineEdge()?null:t.isVisited()?null:t.isInteriorAreaEdge()?null:t.getEdge().isInResult()?null:(et.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void(Si.isResultOfOp(r,e)&&e===Si.INTERSECTION&&(n.add(t.getEdge()),t.setVisitedEdge(!0))))},Xr.prototype.interfaces_=function(){return[]},Xr.prototype.getClass=function(){return Xr};var Hr=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new xt;var t=arguments[0],e=arguments[1];this._op=t,this._geometryFactory=e};Hr.prototype.filterCoveredNodeToPoint=function(t){var e=t.getCoordinate();if(!this._op.isCoveredByLA(e)){var n=this._geometryFactory.createPoint(e);this._resultPointList.add(n)}},Hr.prototype.extractNonCoveredResultNodes=function(t){for(var e=this._op.getGraph().getNodes().iterator();e.hasNext();){var n=e.next();if(!(n.isInResult()||n.isIncidentEdgeInResult()||0!==n.getEdges().getDegree()&&t!==Si.INTERSECTION)){var r=n.getLabel();Si.isResultOfOp(r,t)&&this.filterCoveredNodeToPoint(n)}}},Hr.prototype.build=function(t){return this.extractNonCoveredResultNodes(t),this._resultPointList},Hr.prototype.interfaces_=function(){return[]},Hr.prototype.getClass=function(){return Hr};var Wr=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};Wr.prototype.transformPoint=function(t,e){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},Wr.prototype.transformPolygon=function(t,e){var n=!0,r=this.transformLinearRing(t.getExteriorRing(),t);null!==r&&r instanceof ee&&!r.isEmpty()||(n=!1);for(var i=new xt,o=0;o<t.getNumInteriorRing();o++){var s=this.transformLinearRing(t.getInteriorRingN(o),t);null===s||s.isEmpty()||(s instanceof ee||(n=!1),i.add(s))}if(n)return this._factory.createPolygon(r,i.toArray([]));var a=new xt;return null!==r&&a.add(r),a.addAll(i),this._factory.buildGeometry(a)},Wr.prototype.createCoordinateSequence=function(t){return this._factory.getCoordinateSequenceFactory().create(t)},Wr.prototype.getInputGeometry=function(){return this._inputGeom},Wr.prototype.transformMultiLineString=function(t,e){for(var n=new xt,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)},Wr.prototype.transformCoordinates=function(t,e){return this.copy(t)},Wr.prototype.transformLineString=function(t,e){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},Wr.prototype.transformMultiPoint=function(t,e){for(var n=new xt,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)},Wr.prototype.transformMultiPolygon=function(t,e){for(var n=new xt,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)},Wr.prototype.copy=function(t){return t.copy()},Wr.prototype.transformGeometryCollection=function(t,e){for(var n=new xt,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(_e.toGeometryArray(n)):this._factory.buildGeometry(n)},Wr.prototype.transform=function(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof Zt)return this.transformPoint(t,null);if(t instanceof te)return this.transformMultiPoint(t,null);if(t instanceof ee)return this.transformLinearRing(t,null);if(t instanceof Jt)return this.transformLineString(t,null);if(t instanceof qt)return this.transformMultiLineString(t,null);if(t instanceof $t)return this.transformPolygon(t,null);if(t instanceof ne)return this.transformMultiPolygon(t,null);if(t instanceof Vt)return this.transformGeometryCollection(t,null);throw new v("Unknown Geometry subtype: "+t.getClass().getName())},Wr.prototype.transformLinearRing=function(t,e){var n=this.transformCoordinates(t.getCoordinateSequence(),t);if(null===n)return this._factory.createLinearRing(null);var r=n.size();return 0<r&&r<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)},Wr.prototype.interfaces_=function(){return[]},Wr.prototype.getClass=function(){return Wr};var Jr=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new dn,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Jt&&"number"==typeof arguments[1]){var e=arguments[0],n=arguments[1];t.call(this,e.getCoordinates(),n)}else if(arguments[0]instanceof Array&&"number"==typeof arguments[1]){var r=arguments[0],i=arguments[1];this._srcPts=r,this._isClosed=t.isClosed(r),this._snapTolerance=i}};Jr.prototype.snapVertices=function(t,e){for(var n=this._isClosed?t.size()-1:t.size(),r=0;r<n;r++){var i=t.get(r),o=this.findSnapForVertex(i,e);null!==o&&(t.set(r,new I(o)),0===r&&this._isClosed&&t.set(t.size()-1,new I(o)))}},Jr.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},Jr.prototype.snapTo=function(t){var e=new Nt(this._srcPts);return this.snapVertices(e,t),this.snapSegments(e,t),e.toCoordinateArray()},Jr.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 I(i),!1)}},Jr.prototype.findSegmentIndexToSnap=function(t,e){for(var n=m.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},Jr.prototype.setAllowSnappingToSourceVertices=function(t){this._allowSnappingToSourceVertices=t},Jr.prototype.interfaces_=function(){return[]},Jr.prototype.getClass=function(){return Jr},Jr.isClosed=function(t){return!(t.length<=1)&&t[0].equals2D(t[t.length-1])};var Kr=function(t){this._srcGeom=t||null},Zr={SNAP_PRECISION_FACTOR:{configurable:!0}};Kr.prototype.snapTo=function(t,e){var n=this.extractTargetCoordinates(t);return new Qr(e,n).transform(this._srcGeom)},Kr.prototype.snapToSelf=function(t,e){var n=this.extractTargetCoordinates(this._srcGeom),r=new Qr(t,n,!0).transform(this._srcGeom),i=r;return e&&R(i,Qt)&&(i=r.buffer(0)),i},Kr.prototype.computeSnapTolerance=function(t){return this.computeMinimumSegmentLength(t)/10},Kr.prototype.extractTargetCoordinates=function(t){for(var e=new f,n=t.getCoordinates(),r=0;r<n.length;r++)e.add(n[r]);return e.toArray(new Array(0).fill(null))},Kr.prototype.computeMinimumSegmentLength=function(t){for(var e=m.MAX_VALUE,n=0;n<t.length-1;n++){var r=t[n].distance(t[n+1]);r<e&&(e=r)}return e},Kr.prototype.interfaces_=function(){return[]},Kr.prototype.getClass=function(){return Kr},Kr.snap=function(t,e,n){var r=new Array(2).fill(null),i=new Kr(t);r[0]=i.snapTo(e,n);var o=new Kr(e);return r[1]=o.snapTo(r[0],n),r},Kr.computeOverlaySnapTolerance=function(){if(1===arguments.length){var t=arguments[0],e=Kr.computeSizeBasedSnapTolerance(t),n=t.getPrecisionModel();if(n.getType()===fe.FIXED){var r=1/n.getScale()*2/1.415;e<r&&(e=r)}return e}if(2===arguments.length){var i=arguments[0],o=arguments[1];return Math.min(Kr.computeOverlaySnapTolerance(i),Kr.computeOverlaySnapTolerance(o))}},Kr.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*Kr.SNAP_PRECISION_FACTOR},Kr.snapToSelf=function(t,e,n){return new Kr(t).snapToSelf(e,n)},Zr.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(Kr,Zr);var Qr=function(r){function t(t,e,n){r.call(this),this._snapTolerance=t||null,this._snapPts=e||null,this._isSelfSnap=void 0!==n&&n}return r&&(t.__proto__=r),((t.prototype=Object.create(r&&r.prototype)).constructor=t).prototype.snapLine=function(t,e){var n=new Jr(t,this._snapTolerance);return n.setAllowSnappingToSourceVertices(this._isSelfSnap),n.snapTo(e)},t.prototype.transformCoordinates=function(t,e){var n=t.toCoordinateArray(),r=this.snapLine(n,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(r)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Wr),$r=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};$r.prototype.getCommon=function(){return m.longBitsToDouble(this._commonBits)},$r.prototype.add=function(t){var e=m.doubleToLongBits(t);return this._isFirst?(this._commonBits=e,this._commonSignExp=$r.signExpBits(this._commonBits),this._isFirst=!1,null):$r.signExpBits(e)!==this._commonSignExp?(this._commonBits=0,null):(this._commonMantissaBitsCount=$r.numCommonMostSigMantissaBits(this._commonBits,e),void(this._commonBits=$r.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))))},$r.prototype.toString=function(){if(1===arguments.length){var t=arguments[0],e=m.longBitsToDouble(t),n="0000000000000000000000000000000000000000000000000000000000000000"+m.toBinaryString(t),r=n.substring(n.length-64);return r.substring(0,1)+"  "+r.substring(1,12)+"(exp) "+r.substring(12)+" [ "+e+" ]"}},$r.prototype.interfaces_=function(){return[]},$r.prototype.getClass=function(){return $r},$r.getBit=function(t,e){return 0!=(t&1<<e)?1:0},$r.signExpBits=function(t){return t>>52},$r.zeroLowerBits=function(t,e){return t&~((1<<e)-1)},$r.numCommonMostSigMantissaBits=function(t,e){for(var n=0,r=52;0<=r;r--){if($r.getBit(t,r)!==$r.getBit(e,r))return n;n++}return 52};var ti=function(){this._commonCoord=null,this._ccFilter=new ni},ei={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};ti.prototype.addCommonBits=function(t){var e=new ri(this._commonCoord);t.apply(e),t.geometryChanged()},ti.prototype.removeCommonBits=function(t){if(0===this._commonCoord.x&&0===this._commonCoord.y)return t;var e=new I(this._commonCoord);e.x=-e.x,e.y=-e.y;var n=new ri(e);return t.apply(n),t.geometryChanged(),t},ti.prototype.getCommonCoordinate=function(){return this._commonCoord},ti.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},ti.prototype.interfaces_=function(){return[]},ti.prototype.getClass=function(){return ti},ei.CommonCoordinateFilter.get=function(){return ni},ei.Translater.get=function(){return ri},Object.defineProperties(ti,ei);var ni=function(){this._commonBitsX=new $r,this._commonBitsY=new $r};ni.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},ni.prototype.getCommonCoordinate=function(){return new I(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},ni.prototype.interfaces_=function(){return[ft]},ni.prototype.getClass=function(){return ni};var ri=function(){this.trans=null;var t=arguments[0];this.trans=t};ri.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)},ri.prototype.isDone=function(){return!1},ri.prototype.isGeometryChanged=function(){return!0},ri.prototype.interfaces_=function(){return[Ut]},ri.prototype.getClass=function(){return ri};var ii=function(t,e){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()};ii.prototype.selfSnap=function(t){return new Kr(t).snapTo(t,this._snapTolerance)},ii.prototype.removeCommonBits=function(t){this._cbr=new ti,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},ii.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},ii.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),n=Si.overlayOp(e[0],e[1],t);return this.prepareResult(n)},ii.prototype.checkValid=function(t){t.isValid()||z.out.println("Snapped geometry is invalid")},ii.prototype.computeSnapTolerance=function(){this._snapTolerance=Kr.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},ii.prototype.snap=function(t){var e=this.removeCommonBits(t);return Kr.snap(e[0],e[1],this._snapTolerance)},ii.prototype.interfaces_=function(){return[]},ii.prototype.getClass=function(){return ii},ii.overlayOp=function(t,e,n){return new ii(t,e).getResultGeometry(n)},ii.union=function(t,e){return ii.overlayOp(t,e,Si.UNION)},ii.intersection=function(t,e){return ii.overlayOp(t,e,Si.INTERSECTION)},ii.symDifference=function(t,e){return ii.overlayOp(t,e,Si.SYMDIFFERENCE)},ii.difference=function(t,e){return ii.overlayOp(t,e,Si.DIFFERENCE)};var oi=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};oi.prototype.getResultGeometry=function(t){var e=null,n=!1,r=null;try{e=Si.overlayOp(this._geom[0],this._geom[1],t),n=!0}catch(t){if(!(t instanceof $))throw t;r=t}if(!n)try{e=ii.overlayOp(this._geom[0],this._geom[1],t)}catch(t){throw t instanceof $?r:t}return e},oi.prototype.interfaces_=function(){return[]},oi.prototype.getClass=function(){return oi},oi.overlayOp=function(t,e,n){return new oi(t,e).getResultGeometry(n)},oi.union=function(t,e){return oi.overlayOp(t,e,Si.UNION)},oi.intersection=function(t,e){return oi.overlayOp(t,e,Si.INTERSECTION)},oi.symDifference=function(t,e){return oi.overlayOp(t,e,Si.SYMDIFFERENCE)},oi.difference=function(t,e){return oi.overlayOp(t,e,Si.DIFFERENCE)};var si=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};si.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},si.prototype.interfaces_=function(){return[]},si.prototype.getClass=function(){return si};var ai=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,2===arguments.length){var e=arguments[0],n=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=n}else if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2];this._eventType=t.INSERT,this._label=r,this._xValue=i,this._obj=o}},ui={INSERT:{configurable:!0},DELETE:{configurable:!0}};ai.prototype.isDelete=function(){return this._eventType===ai.DELETE},ai.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},ai.prototype.getObject=function(){return this._obj},ai.prototype.compareTo=function(t){var e=t;return this._xValue<e._xValue?-1:this._xValue>e._xValue?1:this._eventType<e._eventType?-1:this._eventType>e._eventType?1:0},ai.prototype.getInsertEvent=function(){return this._insertEvent},ai.prototype.isInsert=function(){return this._eventType===ai.INSERT},ai.prototype.isSameLabel=function(t){return null!==this._label&&this._label===t._label},ai.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},ai.prototype.interfaces_=function(){return[E]},ai.prototype.getClass=function(){return ai},ui.INSERT.get=function(){return 1},ui.DELETE.get=function(){return 2},Object.defineProperties(ai,ui);var li=function(){};li.prototype.interfaces_=function(){return[]},li.prototype.getClass=function(){return li};var hi=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],e=arguments[1],n=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=n};hi.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&1===this._li.getIntersectionNum()){if(hi.isAdjacentSegments(e,r))return!0;if(t.isClosed()){var i=t.getNumPoints()-1;if(0===e&&r===i||0===r&&e===i)return!0}}return!1},hi.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},hi.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},hi.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},hi.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},hi.prototype.hasProperIntersection=function(){return this._hasProper},hi.prototype.hasIntersection=function(){return this._hasIntersection},hi.prototype.isDone=function(){return this._isDone},hi.prototype.isBoundaryPoint=function(t,e){return!(null===e||!this.isBoundaryPointInternal(t,e[0])&&!this.isBoundaryPointInternal(t,e[1]))},hi.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e},hi.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))))},hi.prototype.interfaces_=function(){return[]},hi.prototype.getClass=function(){return hi},hi.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var ci=function(t){function e(){t.call(this),this.events=new xt,this.nOverlaps=null}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.prepareEvents=function(){$e.sort(this.events);for(var t=0;t<this.events.size();t++){var e=this.events.get(t);e.isDelete()&&e.getInsertEvent().setDeleteEventIndex(t)}},e.prototype.computeIntersections=function(){if(1===arguments.length){var t=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var e=0;e<this.events.size();e++){var n=this.events.get(e);if(n.isInsert()&&this.processOverlaps(e,n.getDeleteEventIndex(),n,t),t.isDone())break}}else if(3===arguments.length)if(arguments[2]instanceof hi&&R(arguments[0],wt)&&R(arguments[1],wt)){var r=arguments[0],i=arguments[1],o=arguments[2];this.addEdges(r,r),this.addEdges(i,i),this.computeIntersections(o)}else if("boolean"==typeof arguments[2]&&R(arguments[0],wt)&&arguments[1]instanceof hi){var s=arguments[0],a=arguments[1];arguments[2]?this.addEdges(s,null):this.addEdges(s),this.computeIntersections(a)}},e.prototype.addEdge=function(t,e){for(var n=t.getMonotoneChainEdge(),r=n.getStartIndexes(),i=0;i<r.length-1;i++){var o=new si(n,i),s=new ai(e,n.getMinX(i),o);this.events.add(s),this.events.add(new ai(n.getMaxX(i),s))}},e.prototype.processOverlaps=function(t,e,n,r){for(var i=n.getObject(),o=t;o<e;o++){var s=this.events.get(o);if(s.isInsert()){var a=s.getObject();n.isSameLabel(s)||(i.computeIntersections(a,r),this.nOverlaps++)}}},e.prototype.addEdges=function(){if(1===arguments.length)for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.addEdge(e,e)}else if(2===arguments.length)for(var n=arguments[0],r=arguments[1],i=n.iterator();i.hasNext();){var o=i.next();this.addEdge(o,r)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(li),pi=function(){this._min=m.POSITIVE_INFINITY,this._max=m.NEGATIVE_INFINITY},fi={NodeComparator:{configurable:!0}};pi.prototype.getMin=function(){return this._min},pi.prototype.intersects=function(t,e){return!(this._min>e||this._max<t)},pi.prototype.getMax=function(){return this._max},pi.prototype.toString=function(){return Q.toLineString(new I(this._min,0),new I(this._max,0))},pi.prototype.interfaces_=function(){return[]},pi.prototype.getClass=function(){return pi},fi.NodeComparator.get=function(){return gi},Object.defineProperties(pi,fi);var gi=function(){};gi.prototype.compare=function(t,e){var n=t,r=e,i=(n._min+n._max)/2,o=(r._min+r._max)/2;return i<o?-1:o<i?1:0},gi.prototype.interfaces_=function(){return[x]},gi.prototype.getClass=function(){return gi};var di=function(r){function t(){r.call(this),this._item=null;var t=arguments[0],e=arguments[1],n=arguments[2];this._min=t,this._max=e,this._item=n}return r&&(t.__proto__=r),((t.prototype=Object.create(r&&r.prototype)).constructor=t).prototype.query=function(t,e,n){if(!this.intersects(t,e))return null;n.visitItem(this._item)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(pi),yi=function(n){function t(){n.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)}return n&&(t.__proto__=n),((t.prototype=Object.create(n&&n.prototype)).constructor=t).prototype.buildExtent=function(t,e){this._min=Math.min(t._min,e._min),this._max=Math.max(t._max,e._max)},t.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)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(pi),_i=function(){this._leaves=new xt,this._root=null,this._level=0};_i.prototype.buildTree=function(){$e.sort(this._leaves,new pi.NodeComparator);for(var t=this._leaves,e=null,n=new xt;;){if(this.buildLevel(t,n),1===n.size())return n.get(0);e=t,t=n,n=e}},_i.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 di(t,e,n))},_i.prototype.query=function(t,e,n){this.init(),this._root.query(t,e,n)},_i.prototype.buildRoot=function(){if(null!==this._root)return null;this._root=this.buildTree()},_i.prototype.printNode=function(t){z.out.println(Q.toLineString(new I(t._min,this._level),new I(t._max,this._level)))},_i.prototype.init=function(){if(null!==this._root)return null;this.buildRoot()},_i.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var n=0;n<t.size();n+=2){var r=t.get(n);if(null===(n+1<t.size()?t.get(n):null))e.add(r);else{var i=new yi(t.get(n),t.get(n+1));e.add(i)}}},_i.prototype.interfaces_=function(){return[]},_i.prototype.getClass=function(){return _i};var vi=function(){this._items=new xt};vi.prototype.visitItem=function(t){this._items.add(t)},vi.prototype.getItems=function(){return this._items},vi.prototype.interfaces_=function(){return[Je]},vi.prototype.getClass=function(){return vi};var mi=function(){this._index=null;var t=arguments[0];if(!R(t,Qt))throw new v("Argument must be Polygonal");this._index=new wi(t)},bi={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};mi.prototype.locate=function(t){var e=new st(t),n=new Ei(e);return this._index.query(t.y,t.y,n),e.getLocation()},mi.prototype.interfaces_=function(){return[jn]},mi.prototype.getClass=function(){return mi},bi.SegmentVisitor.get=function(){return Ei},bi.IntervalIndexedGeometry.get=function(){return wi},Object.defineProperties(mi,bi);var Ei=function(){this._counter=null;var t=arguments[0];this._counter=t};Ei.prototype.visitItem=function(t){var e=t;this._counter.countSegment(e.getCoordinate(0),e.getCoordinate(1))},Ei.prototype.interfaces_=function(){return[Je]},Ei.prototype.getClass=function(){return Ei};var wi=function(){this._index=new _i;var t=arguments[0];this.init(t)};wi.prototype.init=function(t){for(var e=Ir.getLines(t).iterator();e.hasNext();){var n=e.next().getCoordinates();this.addLine(n)}},wi.prototype.addLine=function(t){for(var e=1;e<t.length;e++){var n=new dn(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)}},wi.prototype.query=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=new vi;return this._index.query(t,e,n),n.getItems()}if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2];this._index.query(r,i,o)}},wi.prototype.interfaces_=function(){return[]},wi.prototype.getClass=function(){return wi};var xi=function(s){function o(){if(s.call(this),this._parentGeom=null,this._lineEdgeMap=new pe,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new Nr,2===arguments.length){var t=arguments[0],e=arguments[1],n=gt.OGC_SFS_BOUNDARY_RULE;this._argIndex=t,this._parentGeom=e,this._boundaryNodeRule=n,null!==e&&this.add(e)}else if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2];this._argIndex=r,this._parentGeom=i,this._boundaryNodeRule=o,null!==i&&this.add(i)}}return s&&(o.__proto__=s),((o.prototype=Object.create(s&&s.prototype)).constructor=o).prototype.insertBoundaryPoint=function(t,e){var n=this._nodes.addNode(e).getLabel(),r=1;n.getLocation(t,Ne.ON)===L.BOUNDARY&&r++;var i=o.determineBoundary(this._boundaryNodeRule,r);n.setLocation(t,i)},o.prototype.computeSelfNodes=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.computeSelfNodes(t,e,!1)}if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2],o=new hi(n,!0,!1);o.setIsDoneIfProperInt(i);var s=this.createEdgeSetIntersector(),a=this._parentGeom instanceof ee||this._parentGeom instanceof $t||this._parentGeom instanceof ne,u=r||!a;return s.computeIntersections(this._edges,o,u),this.addSelfIntersectionNodes(this._argIndex),o}},o.prototype.computeSplitEdges=function(t){for(var e=this._edges.iterator();e.hasNext();)e.next().eiList.addSplitEdges(t)},o.prototype.computeEdgeIntersections=function(t,e,n){var r=new hi(e,n,!0);return r.setBoundaryNodes(this.getBoundaryNodes(),t.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,t._edges,r),r},o.prototype.getGeometry=function(){return this._parentGeom},o.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},o.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},o.prototype.addPoint=function(){if(arguments[0]instanceof Zt){var t=arguments[0].getCoordinate();this.insertPoint(this._argIndex,t,L.INTERIOR)}else if(arguments[0]instanceof I){var e=arguments[0];this.insertPoint(this._argIndex,e,L.INTERIOR)}},o.prototype.addPolygon=function(t){this.addPolygonRing(t.getExteriorRing(),L.EXTERIOR,L.INTERIOR);for(var e=0;e<t.getNumInteriorRing();e++){var n=t.getInteriorRingN(e);this.addPolygonRing(n,L.INTERIOR,L.EXTERIOR)}},o.prototype.addEdge=function(t){this.insertEdge(t);var e=t.getCoordinates();this.insertPoint(this._argIndex,e[0],L.BOUNDARY),this.insertPoint(this._argIndex,e[e.length-1],L.BOUNDARY)},o.prototype.addLineString=function(t){var e=St.removeRepeatedPoints(t.getCoordinates());if(e.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=e[0],null;var n=new nr(e,new Pe(this._argIndex,L.INTERIOR));this._lineEdgeMap.put(t,n),this.insertEdge(n),et.isTrue(2<=e.length,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,e[0]),this.insertBoundaryPoint(this._argIndex,e[e.length-1])},o.prototype.getInvalidPoint=function(){return this._invalidPoint},o.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},o.prototype.getBoundaryNodes=function(){return null===this._boundaryNodes&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},o.prototype.addSelfIntersectionNode=function(t,e,n){if(this.isBoundaryNode(t,e))return null;n===L.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(t,e):this.insertPoint(t,e,n)},o.prototype.addPolygonRing=function(t,e,n){if(t.isEmpty())return null;var r=St.removeRepeatedPoints(t.getCoordinates());if(r.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=r[0],null;var i=e,o=n;at.isCCW(r)&&(i=n,o=e);var s=new nr(r,new Pe(this._argIndex,L.BOUNDARY,i,o));this._lineEdgeMap.put(t,s),this.insertEdge(s),this.insertPoint(this._argIndex,r[0],L.BOUNDARY)},o.prototype.insertPoint=function(t,e,n){var r=this._nodes.addNode(e),i=r.getLabel();null===i?r._label=new Pe(t,n):i.setLocation(t,n)},o.prototype.createEdgeSetIntersector=function(){return new ci},o.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)}},o.prototype.add=function(){if(1!==arguments.length)return s.prototype.add.apply(this,arguments);var t=arguments[0];if(t.isEmpty())return null;if(t instanceof ne&&(this._useBoundaryDeterminationRule=!1),t instanceof $t)this.addPolygon(t);else if(t instanceof Jt)this.addLineString(t);else if(t instanceof Zt)this.addPoint(t);else if(t instanceof te)this.addCollection(t);else if(t instanceof qt)this.addCollection(t);else if(t instanceof ne)this.addCollection(t);else{if(!(t instanceof Vt))throw new Error(t.getClass().getName());this.addCollection(t)}},o.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);this.add(n)}},o.prototype.locate=function(t){return R(this._parentGeom,Qt)&&50<this._parentGeom.getNumGeometries()?(null===this._areaPtLocator&&(this._areaPtLocator=new mi(this._parentGeom)),this._areaPtLocator.locate(t)):this._ptLocator.locate(t,this._parentGeom)},o.prototype.findEdge=function(){if(1!==arguments.length)return s.prototype.findEdge.apply(this,arguments);var t=arguments[0];return this._lineEdgeMap.get(t)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o.determineBoundary=function(t,e){return t.isInBoundary(e)?L.BOUNDARY:L.INTERIOR},o}(ze),Ii=function(){if(this._li=new it,this._resultPrecisionModel=null,this._arg=null,1===arguments.length){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new xi(0,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1],r=gt.OGC_SFS_BOUNDARY_RULE;0<=e.getPrecisionModel().compareTo(n.getPrecisionModel())?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new xi(0,e,r),this._arg[1]=new xi(1,n,r)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];0<=i.getPrecisionModel().compareTo(o.getPrecisionModel())?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(o.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new xi(0,i,s),this._arg[1]=new xi(1,o,s)}};Ii.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},Ii.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},Ii.prototype.interfaces_=function(){return[]},Ii.prototype.getClass=function(){return Ii};var Ni=function(){};Ni.prototype.interfaces_=function(){return[]},Ni.prototype.getClass=function(){return Ni},Ni.map=function(){if(arguments[0]instanceof ht&&R(arguments[1],Ni.MapOp)){for(var t=arguments[0],e=arguments[1],n=new xt,r=0;r<t.getNumGeometries();r++){var i=e.map(t.getGeometryN(r));null!==i&&n.add(i)}return t.getFactory().buildGeometry(n)}if(R(arguments[0],bt)&&R(arguments[1],Ni.MapOp)){for(var o=arguments[0],s=arguments[1],a=new xt,u=o.iterator();u.hasNext();){var l=u.next(),h=s.map(l);null!==h&&a.add(h)}return a}},Ni.MapOp=function(){};var Si=function(n){function o(){var t=arguments[0],e=arguments[1];n.call(this,t,e),this._ptLocator=new Nr,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new Hn,this._resultPolyList=new xt,this._resultLineList=new xt,this._resultPointList=new xt,this._graph=new ze(new Yn),this._geomFact=t.getFactory()}return n&&(o.__proto__=n),((o.prototype=Object.create(n&&n.prototype)).constructor=o).prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var n=e.getLabel(),r=t.getLabel();e.isPointwiseEqual(t)||(r=new Pe(t.getLabel())).flip();var i=e.getDepth();i.isNull()&&i.add(n),i.add(r),n.merge(r)}else this._edgeList.add(t)},o.prototype.getGraph=function(){return this._graph},o.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))}},o.prototype.isCoveredByLA=function(t){return!!this.isCovered(t,this._resultLineList)||!!this.isCovered(t,this._resultPolyList)},o.prototype.computeGeometry=function(t,e,n,r){var i=new xt;return i.addAll(t),i.addAll(e),i.addAll(n),i.isEmpty()?o.createEmptyResult(r,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(i)},o.prototype.mergeSymLabels=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();)t.next().getEdges().mergeSymLabels()},o.prototype.isCovered=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();if(this._ptLocator.locate(t,r)!==L.EXTERIOR)return!0}return!1},o.prototype.replaceCollapsedEdges=function(){for(var t=new xt,e=this._edgeList.iterator();e.hasNext();){var n=e.next();n.isCollapsed()&&(e.remove(),t.add(n.getCollapsedEdge()))}this._edgeList.addAll(t)},o.prototype.updateNodeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),n=e.getEdges().getLabel();e.getLabel().merge(n)}},o.prototype.getResultGeometry=function(t){return this.computeOverlay(t),this._resultGeom},o.prototype.insertUniqueEdges=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this.insertUniqueEdge(n)}},o.prototype.computeOverlay=function(t){this.copyPoints(0),this.copyPoints(1),this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1),this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!0);var e=new xt;this._arg[0].computeSplitEdges(e),this._arg[1].computeSplitEdges(e),this.insertUniqueEdges(e),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),zr.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(t),this.cancelDuplicateResultEdges();var n=new Ye(this._geomFact);n.add(this._graph),this._resultPolyList=n.getPolygons();var r=new Xr(this,this._geomFact,this._ptLocator);this._resultLineList=r.build(t);var i=new Hr(this,this._geomFact,this._ptLocator);this._resultPointList=i.build(t),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,t)},o.prototype.labelIncompleteNode=function(t,e){var n=this._ptLocator.locate(t.getCoordinate(),this._arg[e].getGeometry());t.getLabel().setLocation(e,n)},o.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))}},o.prototype.findResultAreaEdges=function(t){for(var e=this._graph.getEdgeEnds().iterator();e.hasNext();){var n=e.next(),r=n.getLabel();r.isArea()&&!n.isInteriorAreaEdge()&&o.isResultOfOp(r.getLocation(0,Ne.RIGHT),r.getLocation(1,Ne.RIGHT),t)&&n.setInResult(!0)}},o.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):(et.isTrue(!r.isNull(i,Ne.LEFT),"depth of LEFT side has not been initialized"),n.setLocation(i,Ne.LEFT,r.getLocation(i,Ne.LEFT)),et.isTrue(!r.isNull(i,Ne.RIGHT),"depth of RIGHT side has not been initialized"),n.setLocation(i,Ne.RIGHT,r.getLocation(i,Ne.RIGHT))))}}},o.prototype.computeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();)t.next().getEdges().computeLabelling(this._arg);this.mergeSymLabels(),this.updateNodeLabelling()},o.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)}},o.prototype.isCoveredByA=function(t){return!!this.isCovered(t,this._resultPolyList)},o.prototype.interfaces_=function(){return[]},o.prototype.getClass=function(){return o},o}(Ii);Si.overlayOp=function(t,e,n){return new Si(t,e).getResultGeometry(n)},Si.intersection=function(t,e){if(t.isEmpty()||e.isEmpty())return Si.createEmptyResult(Si.INTERSECTION,t,e,t.getFactory());if(t.isGeometryCollection()){var n=e;return Yr.map(t,{interfaces_:function(){return[Ni.MapOp]},map:function(t){return t.intersection(n)}})}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),oi.overlayOp(t,e,Si.INTERSECTION)},Si.symDifference=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return Si.createEmptyResult(Si.SYMDIFFERENCE,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),oi.overlayOp(t,e,Si.SYMDIFFERENCE)},Si.resultDimension=function(t,e,n){var r=e.getDimension(),i=n.getDimension(),o=-1;switch(t){case Si.INTERSECTION:o=Math.min(r,i);break;case Si.UNION:o=Math.max(r,i);break;case Si.DIFFERENCE:o=r;break;case Si.SYMDIFFERENCE:o=Math.max(r,i)}return o},Si.createEmptyResult=function(t,e,n,r){var i=null;switch(Si.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},Si.difference=function(t,e){return t.isEmpty()?Si.createEmptyResult(Si.DIFFERENCE,t,e,t.getFactory()):e.isEmpty()?t.copy():(t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),oi.overlayOp(t,e,Si.DIFFERENCE))},Si.isResultOfOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=t.getLocation(0),r=t.getLocation(1);return Si.isResultOfOp(n,r,e)}if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];switch(i===L.BOUNDARY&&(i=L.INTERIOR),o===L.BOUNDARY&&(o=L.INTERIOR),s){case Si.INTERSECTION:return i===L.INTERIOR&&o===L.INTERIOR;case Si.UNION:return i===L.INTERIOR||o===L.INTERIOR;case Si.DIFFERENCE:return i===L.INTERIOR&&o!==L.INTERIOR;case Si.SYMDIFFERENCE:return i===L.INTERIOR&&o!==L.INTERIOR||i!==L.INTERIOR&&o===L.INTERIOR}return!1}},Si.INTERSECTION=1,Si.UNION=2,Si.DIFFERENCE=3,Si.SYMDIFFERENCE=4;var Ci=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new Nr,this._seg=new dn;var t=arguments[0],e=arguments[1];this._g=t,this._boundaryDistanceTolerance=e,this._linework=this.extractLinework(t)};Ci.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},Ci.prototype.getLocation=function(t){return this.isWithinToleranceOfBoundary(t)?L.BOUNDARY:this._ptLocator.locate(t,this._g)},Ci.prototype.extractLinework=function(t){var e=new Li;t.apply(e);var n=e.getLinework(),r=_e.toLineStringArray(n);return t.getFactory().createMultiLineString(r)},Ci.prototype.interfaces_=function(){return[]},Ci.prototype.getClass=function(){return Ci};var Li=function(){this._linework=null,this._linework=new xt};Li.prototype.getLinework=function(){return this._linework},Li.prototype.filter=function(t){if(t instanceof $t){var e=t;this._linework.add(e.getExteriorRing());for(var n=0;n<e.getNumInteriorRing();n++)this._linework.add(e.getInteriorRingN(n))}},Li.prototype.interfaces_=function(){return[jt]},Li.prototype.getClass=function(){return Li};var Ti=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var t=arguments[0];this._g=t};Ti.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)},Ti.prototype.setSidesToGenerate=function(t,e){this._doLeft=t,this._doRight=e},Ti.prototype.getPoints=function(t){for(var e=new xt,n=Ir.getLines(this._g).iterator();n.hasNext();){var r=n.next();this.extractPoints(r,t,e)}return e},Ti.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),a=n*i/s,u=n*o/s,l=(e.x+t.x)/2,h=(e.y+t.y)/2;if(this._doLeft){var c=new I(l-u,h+a);r.add(c)}if(this._doRight){var p=new I(l+u,h-a);r.add(p)}},Ti.prototype.interfaces_=function(){return[]},Ti.prototype.getClass=function(){return Ti};var Ri=function t(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=t.TOLERANCE,this._testCoords=new xt;var e=arguments[0],n=arguments[1],r=arguments[2];this._boundaryDistanceTolerance=t.computeBoundaryDistanceTolerance(e,n),this._geom=[e,n,r],this._locFinder=[new Ci(this._geom[0],this._boundaryDistanceTolerance),new Ci(this._geom[1],this._boundaryDistanceTolerance),new Ci(this._geom[2],this._boundaryDistanceTolerance)]},Oi={TOLERANCE:{configurable:!0}};Ri.prototype.reportResult=function(t,e,n){z.out.println("Overlay result invalid - A:"+L.toLocationSymbol(e[0])+" B:"+L.toLocationSymbol(e[1])+" expected:"+(n?"i":"e")+" actual:"+L.toLocationSymbol(e[2]))},Ri.prototype.isValid=function(t){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var e=this.checkValid(t);return e},Ri.prototype.checkValid=function(){if(1===arguments.length){for(var t=arguments[0],e=0;e<this._testCoords.size();e++){var n=this._testCoords.get(e);if(!this.checkValid(t,n))return this._invalidLocation=n,!1}return!0}if(2===arguments.length){var r=arguments[0],i=arguments[1];return this._location[0]=this._locFinder[0].getLocation(i),this._location[1]=this._locFinder[1].getLocation(i),this._location[2]=this._locFinder[2].getLocation(i),!!Ri.hasLocation(this._location,L.BOUNDARY)||this.isValidResult(r,this._location)}},Ri.prototype.addTestPts=function(t){var e=new Ti(t);this._testCoords.addAll(e.getPoints(5*this._boundaryDistanceTolerance))},Ri.prototype.isValidResult=function(t,e){var n=Si.isResultOfOp(e[0],e[1],t),r=!(n^e[2]===L.INTERIOR);return r||this.reportResult(t,e,n),r},Ri.prototype.getInvalidLocation=function(){return this._invalidLocation},Ri.prototype.interfaces_=function(){return[]},Ri.prototype.getClass=function(){return Ri},Ri.hasLocation=function(t,e){for(var n=0;n<3;n++)if(t[n]===e)return!0;return!1},Ri.computeBoundaryDistanceTolerance=function(t,e){return Math.min(Kr.computeSizeBasedSnapTolerance(t),Kr.computeSizeBasedSnapTolerance(e))},Ri.isValid=function(t,e,n,r){return new Ri(t,e,r).isValid(n)},Oi.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(Ri,Oi);var Pi=function t(e){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=t.extractFactory(e),this._inputGeoms=e};Pi.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)}},Pi.prototype.combine=function(){for(var t=new xt,e=this._inputGeoms.iterator();e.hasNext();){var n=e.next();this.extractElements(n,t)}return 0===t.size()?null!==this._geomFactory?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(t)},Pi.prototype.interfaces_=function(){return[]},Pi.prototype.getClass=function(){return Pi},Pi.combine=function(){if(1===arguments.length){var t=arguments[0];return new Pi(t).combine()}if(2===arguments.length){var e=arguments[0],n=arguments[1];return new Pi(Pi.createList(e,n)).combine()}if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2];return new Pi(Pi.createList(r,i,o)).combine()}},Pi.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},Pi.createList=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=new xt;return n.add(t),n.add(e),n}if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2],s=new xt;return s.add(r),s.add(i),s.add(o),s}};var Mi=function(){this._inputPolys=null,this._geomFactory=null;var t=arguments[0];this._inputPolys=t,null===this._inputPolys&&(this._inputPolys=new xt)},Ai={STRTREE_NODE_CAPACITY:{configurable:!0}};Mi.prototype.reduceToGeometries=function(t){for(var e=new xt,n=t.iterator();n.hasNext();){var r=n.next(),i=null;R(r,wt)?i=this.unionTree(r):r instanceof ht&&(i=r),e.add(i)}return e},Mi.prototype.extractByEnvelope=function(t,e,n){for(var r=new xt,i=0;i<e.getNumGeometries();i++){var o=e.getGeometryN(i);o.getEnvelopeInternal().intersects(t)?r.add(o):n.add(o)}return this._geomFactory.buildGeometry(r)},Mi.prototype.unionOptimized=function(t,e){var n=t.getEnvelopeInternal(),r=e.getEnvelopeInternal();if(!n.intersects(r))return Pi.combine(t,e);if(t.getNumGeometries()<=1&&e.getNumGeometries()<=1)return this.unionActual(t,e);var i=n.intersection(r);return this.unionUsingEnvelopeIntersection(t,e,i)},Mi.prototype.union=function(){if(null===this._inputPolys)throw new Error("union() method cannot be called twice");if(this._inputPolys.isEmpty())return null;this._geomFactory=this._inputPolys.iterator().next().getFactory();for(var t=new sn(Mi.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)},Mi.prototype.binaryUnion=function(){if(1===arguments.length){var t=arguments[0];return this.binaryUnion(t,0,t.size())}if(3===arguments.length){var e=arguments[0],n=arguments[1],r=arguments[2];if(r-n<=1){var i=Mi.getGeometry(e,n);return this.unionSafe(i,null)}if(r-n==2)return this.unionSafe(Mi.getGeometry(e,n),Mi.getGeometry(e,n+1));var o=Math.trunc((r+n)/2),s=this.binaryUnion(e,n,o),a=this.binaryUnion(e,o,r);return this.unionSafe(s,a)}},Mi.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},Mi.prototype.unionSafe=function(t,e){return null===t&&null===e?null:null===t?e.copy():null===e?t.copy():this.unionOptimized(t,e)},Mi.prototype.unionActual=function(t,e){return Mi.restrictToPolygons(t.union(e))},Mi.prototype.unionTree=function(t){var e=this.reduceToGeometries(t);return this.binaryUnion(e)},Mi.prototype.unionUsingEnvelopeIntersection=function(t,e,n){var r=new xt,i=this.extractByEnvelope(n,t,r),o=this.extractByEnvelope(n,e,r),s=this.unionActual(i,o);return r.add(s),Pi.combine(r)},Mi.prototype.bufferUnion=function(){if(1===arguments.length){var t=arguments[0];return t.get(0).getFactory().buildGeometry(t).buffer(0)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e.getFactory().createGeometryCollection([e,n]).buffer(0)}},Mi.prototype.interfaces_=function(){return[]},Mi.prototype.getClass=function(){return Mi},Mi.restrictToPolygons=function(t){if(R(t,Qt))return t;var e=xr.getPolygons(t);return 1===e.size()?e.get(0):t.getFactory().createMultiPolygon(_e.toPolygonArray(e))},Mi.getGeometry=function(t,e){return e>=t.size()?null:t.get(e)},Mi.union=function(t){return new Mi(t).union()},Ai.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(Mi,Ai);var Di=function(){};Di.prototype.interfaces_=function(){return[]},Di.prototype.getClass=function(){return Di},Di.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return Si.createEmptyResult(Si.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),oi.overlayOp(t,e,Si.UNION)},t.GeoJSONReader=xe,t.GeoJSONWriter=Ie,t.OverlayOp=Si,t.UnionOp=Di,t.BufferOp=dr,Object.defineProperty(t,"__esModule",{value:!0})}(e)},function(t,e,n){"use strict";var r=n(38),i=n(39),y=n(40),o=n(44);function s(t,e,n){var r=t;return i(e)?(n=e,"string"==typeof t&&(r={uri:t})):r=o(e,{uri:t}),r.callback=n,r}function _(t,e,n){return a(e=s(t,e,n))}function a(r){if(void 0===r.callback)throw new Error("callback argument missing");var i=!1,o=function(t,e,n){i||(i=!0,r.callback(t,e,n))};function e(t){return clearTimeout(u),t instanceof Error||(t=new Error(""+(t||"Unknown XMLHttpRequest Error"))),t.statusCode=0,o(t,d)}function t(){if(!s){var t;clearTimeout(u),t=r.useXDR&&void 0===a.status?200:1223===a.status?204:a.status;var e=d,n=null;return 0!==t?(e={body:function(){var t=void 0;if(t=a.response?a.response:a.responseText||function(t){try{if("document"===t.responseType)return t.responseXML;var e=t.responseXML&&"parsererror"===t.responseXML.documentElement.nodeName;if(""===t.responseType&&!e)return t.responseXML}catch(t){}return null}(a),g)try{t=JSON.parse(t)}catch(t){}return t}(),statusCode:t,method:h,headers:{},url:l,rawRequest:a},a.getAllResponseHeaders&&(e.headers=y(a.getAllResponseHeaders()))):n=new Error("Internal XMLHttpRequest Error"),o(n,e,e.body)}}var n,s,a=r.xhr||null;a||(a=r.cors||r.useXDR?new _.XDomainRequest:new _.XMLHttpRequest);var u,l=a.url=r.uri||r.url,h=a.method=r.method||"GET",c=r.body||r.data,p=a.headers=r.headers||{},f=!!r.sync,g=!1,d={body:void 0,headers:{},statusCode:0,method:h,url:l,rawRequest:a};if("json"in r&&!1!==r.json&&(g=!0,p.accept||p.Accept||(p.Accept="application/json"),"GET"!==h&&"HEAD"!==h&&(p["content-type"]||p["Content-Type"]||(p["Content-Type"]="application/json"),c=JSON.stringify(!0===r.json?c:r.json))),a.onreadystatechange=function(){4===a.readyState&&setTimeout(t,0)},a.onload=t,a.onerror=e,a.onprogress=function(){},a.onabort=function(){s=!0},a.ontimeout=e,a.open(h,l,!f,r.username,r.password),f||(a.withCredentials=!!r.withCredentials),!f&&0<r.timeout&&(u=setTimeout(function(){if(!s){s=!0,a.abort("timeout");var t=new Error("XMLHttpRequest timeout");t.code="ETIMEDOUT",e(t)}},r.timeout)),a.setRequestHeader)for(n in p)p.hasOwnProperty(n)&&a.setRequestHeader(n,p[n]);else if(r.headers&&!function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}(r.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in r&&(a.responseType=r.responseType),"beforeSend"in r&&"function"==typeof r.beforeSend&&r.beforeSend(a),a.send(c||null),a}t.exports=_,(t.exports.default=_).XMLHttpRequest=r.XMLHttpRequest||function(){},_.XDomainRequest="withCredentials"in new _.XMLHttpRequest?_.XMLHttpRequest:r.XDomainRequest,function(t,e){for(var n=0;n<t.length;n++)e(t[n])}(["get","put","post","patch","head","delete"],function(r){_["delete"===r?"del":r]=function(t,e,n){return(e=s(t,e,n)).method=r.toUpperCase(),a(e)}})},function(t,e){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function u(t){return"function"==typeof t}function l(t){return"object"==typeof t&&null!==t}function h(t){return void 0===t}((t.exports=r).EventEmitter=r).prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},r.prototype.emit=function(t){var e,n,r,i,o,s;if(this._events||(this._events={}),"error"===t&&(!this._events.error||l(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var a=new Error('Uncaught, unspecified "error" event. ('+e+")");throw a.context=e,a}if(h(n=this._events[t]))return!1;if(u(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:i=Array.prototype.slice.call(arguments,1),n.apply(this,i)}else if(l(n))for(i=Array.prototype.slice.call(arguments,1),r=(s=n.slice()).length,o=0;o<r;o++)s[o].apply(this,i);return!0},r.prototype.on=r.prototype.addListener=function(t,e){var n;if(!u(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,u(e.listener)?e.listener:e),this._events[t]?l(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,l(this._events[t])&&!this._events[t].warned&&(n=h(this._maxListeners)?r.defaultMaxListeners:this._maxListeners)&&0<n&&this._events[t].length>n&&(this._events[t].warned=!0,console.trace),this},r.prototype.once=function(t,e){if(!u(e))throw TypeError("listener must be a function");var n=!1;function r(){this.removeListener(t,r),n||(n=!0,e.apply(this,arguments))}return r.listener=e,this.on(t,r),this},r.prototype.removeListener=function(t,e){var n,r,i,o;if(!u(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(i=(n=this._events[t]).length,r=-1,n===e||u(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(l(n)){for(o=i;0<o--;)if(n[o]===e||n[o].listener&&n[o].listener===e){r=o;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(u(n=this._events[t]))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){return this._events&&this._events[t]?u(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(u(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,n){(((e=t.exports=n(26)).Stream=e).Readable=e).Writable=n(14),e.Duplex=n(3),e.Transform=n(30),e.PassThrough=n(65)},function(x,t,I){"use strict";(function(t,e,n){var _=I(8);function c(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var r=t.entry;t.entry=null;for(;r;){var i=r.callback;e.pendingcb--,i(n),r=r.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}x.exports=h;var a,p=!t.browser&&-1<["v0.10","v0.9."].indexOf(t.version.slice(0,5))?e:_.nextTick;h.WritableState=l;var r=I(6);r.inherits=I(4);var i={deprecate:I(64)},o=I(27),v=I(9).Buffer,m=n.Uint8Array||function(){};var s,u=I(28);function b(){}function l(t,e){a=a||I(3),t=t||{};var n=e instanceof a;this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var r=t.highWaterMark,i=t.writableHighWaterMark,o=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:n&&(i||0===i)?i:o,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var s=(this.destroyed=!1)===t.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,r=n.sync,i=n.writecb;if(c=n,c.writing=!1,c.writecb=null,c.length-=c.writelen,c.writelen=0,e)s=t,a=n,u=r,l=e,h=i,--a.pendingcb,u?(_.nextTick(h,l),_.nextTick(w,s,a),s._writableState.errorEmitted=!0,s.emit("error",l)):(h(l),s._writableState.errorEmitted=!0,s.emit("error",l),w(s,a));else{var o=d(n);o||n.corked||n.bufferProcessing||!n.bufferedRequest||g(t,n),r?p(f,t,n,o,i):f(t,n,o,i)}var s,a,u,l,h;var c}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new c(this)}function h(t){if(a=a||I(3),!(s.call(h,this)||this instanceof a))return new h(t);this._writableState=new l(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),o.call(this)}function E(t,e,n,r,i,o,s){e.writelen=r,e.writecb=s,e.writing=!0,e.sync=!0,n?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function f(t,e,n,r){var i,o;n||(i=t,0===(o=e).length&&o.needDrain&&(o.needDrain=!1,i.emit("drain"))),e.pendingcb--,r(),w(t,e)}function g(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,i=new Array(r),o=e.corkedRequestsFree;o.entry=n;for(var s=0,a=!0;n;)(i[s]=n).isBuf||(a=!1),n=n.next,s+=1;i.allBuffers=a,E(t,e,!0,e.length,i,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new c(e),e.bufferedRequestCount=0}else{for(;n;){var u=n.chunk,l=n.encoding,h=n.callback;if(E(t,e,!1,e.objectMode?1:u.length,u,l,h),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function d(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function y(e,n){e._final(function(t){n.pendingcb--,t&&e.emit("error",t),n.prefinished=!0,e.emit("prefinish"),w(e,n)})}function w(t,e){var n,r,i=d(e);return i&&(n=t,(r=e).prefinished||r.finalCalled||("function"==typeof n._final?(r.pendingcb++,r.finalCalled=!0,_.nextTick(y,n,r)):(r.prefinished=!0,n.emit("prefinish"))),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),i}r.inherits(h,o),l.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(l.prototype,"buffer",{get:i.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(s=Function.prototype[Symbol.hasInstance],Object.defineProperty(h,Symbol.hasInstance,{value:function(t){return!!s.call(this,t)||this===h&&(t&&t._writableState instanceof l)}})):s=function(t){return t instanceof this},h.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},h.prototype.write=function(t,e,n){var r,i,o,s,a,u,l,h,c,p,f,g=this._writableState,d=!1,y=!g.objectMode&&(r=t,v.isBuffer(r)||r instanceof m);return y&&!v.isBuffer(t)&&(i=t,t=v.from(i)),"function"==typeof e&&(n=e,e=null),y?e="buffer":e||(e=g.defaultEncoding),"function"!=typeof n&&(n=b),g.ended?(c=this,p=n,f=new Error("write after end"),c.emit("error",f),_.nextTick(p,f)):(y||(o=this,s=g,u=n,h=!(l=!0),null===(a=t)?h=new TypeError("May not write null values to stream"):"string"==typeof a||void 0===a||s.objectMode||(h=new TypeError("Invalid non-string/buffer chunk")),h&&(o.emit("error",h),_.nextTick(u,h),l=!1),l))&&(g.pendingcb++,d=function(t,e,n,r,i,o){if(!n){var s=function(t,e,n){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=v.from(e,n));return e}(e,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=e.objectMode?1:r.length;e.length+=a;var u=e.length<e.highWaterMark;u||(e.needDrain=!0);if(e.writing||e.corked){var l=e.lastBufferedRequest;e.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:o,next:null},l?l.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else E(t,e,!1,a,r,i,o);return u}(this,g,y,t,e,n)),d},h.prototype.cork=function(){this._writableState.corked++},h.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.finished||t.bufferProcessing||!t.bufferedRequest||g(this,t))},h.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(-1<["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(h.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),h.prototype._write=function(t,e,n){n(new Error("_write() is not implemented"))},h.prototype._writev=null,h.prototype.end=function(t,e,n){var r=this._writableState;"function"==typeof t?(n=t,e=t=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(t,e,n){e.ending=!0,w(t,e),n&&(e.finished?_.nextTick(n):t.once("finish",n));e.ended=!0,t.writable=!1}(this,r,n)},Object.defineProperty(h.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),h.prototype.destroy=u.destroy,h.prototype._undestroy=u.undestroy,h.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,I(2),I(62).setImmediate,I(1))},function(t,e,n){"use strict";n.r(e),n.d(e,"coordEach",function(){return w}),n.d(e,"coordReduce",function(){return r}),n.d(e,"propEach",function(){return o}),n.d(e,"propReduce",function(){return i}),n.d(e,"featureEach",function(){return s}),n.d(e,"featureReduce",function(){return a}),n.d(e,"coordAll",function(){return u}),n.d(e,"geomEach",function(){return l}),n.d(e,"geomReduce",function(){return h}),n.d(e,"flattenEach",function(){return f}),n.d(e,"flattenReduce",function(){return c}),n.d(e,"segmentEach",function(){return g}),n.d(e,"segmentReduce",function(){return d}),n.d(e,"lineEach",function(){return y}),n.d(e,"lineReduce",function(){return _});var p=n(0);function w(t,e,n){if(null!==t)for(var r,i,o,s,a,u,l,h,c=0,p=0,f=t.type,g="FeatureCollection"===f,d="Feature"===f,y=g?t.features.length:1,_=0;_<y;_++){a=(h=!!(l=g?t.features[_].geometry:d?t.geometry:t)&&"GeometryCollection"===l.type)?l.geometries.length:1;for(var v=0;v<a;v++){var m=0,b=0;if(null!==(s=h?l.geometries[v]:l)){u=s.coordinates;var E=s.type;switch(c=!n||"Polygon"!==E&&"MultiPolygon"!==E?0:1,E){case null:break;case"Point":e(u,p,_,m,b),p++,m++;break;case"LineString":case"MultiPoint":for(r=0;r<u.length;r++)e(u[r],p,_,m,b),p++,"MultiPoint"===E&&m++;"LineString"===E&&m++;break;case"Polygon":case"MultiLineString":for(r=0;r<u.length;r++){for(i=0;i<u[r].length-c;i++)e(u[r][i],p,_,m,b),p++;"MultiLineString"===E&&m++,"Polygon"===E&&b++}"Polygon"===E&&m++;break;case"MultiPolygon":for(r=0;r<u.length;r++){for("MultiPolygon"===E&&(b=0),i=0;i<u[r].length;i++){for(o=0;o<u[r][i].length-c;o++)e(u[r][i][o],p,_,m,b),p++;b++}m++}break;case"GeometryCollection":for(r=0;r<s.geometries.length;r++)w(s.geometries[r],e,n);break;default:throw new Error("Unknown Geometry Type")}}}}}function r(t,o,s,e){var a=s;return w(t,function(t,e,n,r,i){a=0===e&&void 0===s?t:o(a,t,e,n,r,i)},e),a}function o(t,e){var n;switch(t.type){case"FeatureCollection":for(n=0;n<t.features.length;n++)e(t.features[n].properties,n);break;case"Feature":e(t.properties,0)}}function i(t,n,r){var i=r;return o(t,function(t,e){i=0===e&&void 0===r?t:n(i,t,e)}),i}function s(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var n=0;n<t.features.length;n++)e(t.features[n],n)}function a(t,n,r){var i=r;return s(t,function(t,e){i=0===e&&void 0===r?t:n(i,t,e)}),i}function u(t){var e=[];return w(t,function(t){e.push(t)}),e}function l(t,e){var n,r,i,o,s,a,u,l,h,c,p=0,f="FeatureCollection"===t.type,g="Feature"===t.type,d=f?t.features.length:1;for(n=0;n<d;n++){for(a=f?t.features[n].geometry:g?t.geometry:t,l=f?t.features[n].properties:g?t.properties:{},h=f?t.features[n].bbox:g?t.bbox:void 0,c=f?t.features[n].id:g?t.id:void 0,s=(u=!!a&&"GeometryCollection"===a.type)?a.geometries.length:1,i=0;i<s;i++)if(null!==(o=u?a.geometries[i]:a))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":e(o,p,l,h,c);break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)e(o.geometries[r],p,l,h,c);break;default:throw new Error("Unknown Geometry Type")}else e(null,p,l,h,c);p++}}function h(t,o,s){var a=s;return l(t,function(t,e,n,r,i){a=0===e&&void 0===s?t:o(a,t,e,n,r,i)}),a}function f(t,a){l(t,function(t,r,i,e,n){var o,s=null===t?null:t.type;switch(s){case null:case"Point":case"LineString":case"Polygon":return void a(Object(p.feature)(t,i,{bbox:e,id:n}),r,0)}switch(s){case"MultiPoint":o="Point";break;case"MultiLineString":o="LineString";break;case"MultiPolygon":o="Polygon"}t.coordinates.forEach(function(t,e){var n={type:o,coordinates:t};a(Object(p.feature)(n,i),r,e)})})}function c(t,r,i){var o=i;return f(t,function(t,e,n){o=0===e&&0===n&&void 0===i?t:r(o,t,e,n)}),o}function g(t,c){f(t,function(a,u,l){var h=0;if(a.geometry){var t=a.geometry.type;"Point"!==t&&"MultiPoint"!==t&&r(a,function(t,e,n,r,i,o){var s=Object(p.lineString)([t,e],a.properties);return c(s,u,l,o,h),h++,e})}})}function d(t,o,s){var a=s,u=!1;return g(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 y(t,s){if(!t)throw new Error("geojson is required");f(t,function(t,e,n){if(null!==t.geometry){var r=t.geometry.type,i=t.geometry.coordinates;switch(r){case"LineString":s(t,e,n,0,0);break;case"Polygon":for(var o=0;o<i.length;o++)s(Object(p.lineString)(i[o],t.properties),e,n,o)}}})}function _(t,i,o){var s=o;return y(t,function(t,e,n,r){s=0===e&&void 0===o?t:i(s,t,e,n,r)}),s}},function(t,e,n){"use strict";var o=Math.PI/180,r=180/Math.PI;function i(t){var e=s(t[0]+1,t[2]);return[s(t[0],t[2]),a(t[1]+1,t[2]),e,a(t[1],t[2])]}function s(t,e){return t/Math.pow(2,e)*360-180}function a(t,e){var n=Math.PI-2*Math.PI*t/Math.pow(2,e);return r*Math.atan(.5*(Math.exp(n)-Math.exp(-n)))}function u(t,e,n){var r=g(t,e,n);return r[0]=Math.floor(r[0]),r[1]=Math.floor(r[1]),r}function l(t){return[[2*t[0],2*t[1],t[2]+1],[2*t[0]+1,2*t[1],t[2]+1],[2*t[0]+1,2*t[1]+1,t[2]+1],[2*t[0],2*t[1]+1,t[2]+1]]}function h(t){return t[0]%2==0&&t[1]%2==0?[t[0]/2,t[1]/2,t[2]-1]:t[0]%2==0&&!t[1]%2==0?[t[0]/2,(t[1]-1)/2,t[2]-1]:!t[0]%2==0&&t[1]%2==0?[(t[0]-1)/2,t[1]/2,t[2]-1]:[(t[0]-1)/2,(t[1]-1)/2,t[2]-1]}function c(t){return l(h(t))}function p(t,e){for(var n=0;n<t.length;n++)if(f(t[n],e))return!0;return!1}function f(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}function g(t,e,n){var r=Math.sin(e*o),i=Math.pow(2,n);return[i*(t/360+.5),i*(.5-.25*Math.log((1+r)/(1-r))/Math.PI),n]}t.exports={tileToGeoJSON:function(t){var e=i(t);return{type:"Polygon",coordinates:[[[e[0],e[1]],[e[0],e[3]],[e[2],e[3]],[e[2],e[1]],[e[0],e[1]]]]}},tileToBBOX:i,getChildren:l,getParent:h,getSiblings:c,hasTile:p,hasSiblings:function(t,e){for(var n=c(t),r=0;r<n.length;r++)if(!p(e,n[r]))return!1;return!0},tilesEqual:f,tileToQuadkey:function(t){for(var e="",n=t[2];0<n;n--){var r=0,i=1<<n-1;0!=(t[0]&i)&&r++,0!=(t[1]&i)&&(r+=2),e+=r.toString()}return e},quadkeyToTile:function(t){for(var e=0,n=0,r=t.length,i=r;0<i;i--){var o=1<<i-1,s=+t[r-i];1===s&&(e|=o),2===s&&(n|=o),3===s&&(e|=o,n|=o)}return[e,n,r]},pointToTile:u,bboxToTile:function(t){var e=u(t[0],t[1],32),n=u(t[2],t[3],32),r=[e[0],e[1],n[0],n[1]],i=function(t){for(var e=0;e<28;e++){var n=1<<32-(e+1);if((t[0]&n)!=(t[2]&n)||(t[1]&n)!=(t[3]&n))return e}return 28}(r);return 0===i?[0,0,0]:[r[0]>>>32-i,r[1]>>>32-i,i]},pointToTileFraction:g}},function(t,e,n){"use strict";t.exports=function(t,e,n){return 0===t.length?t:e?(n||t.sort(e),function(t,e){for(var n=1,r=t.length,i=t[0],o=t[0],s=1;s<r;++s)if(o=i,e(i=t[s],o)){if(s===n){n++;continue}t[n++]=i}return t.length=n,t}(t,e)):(n||t.sort(),function(t){for(var e=1,n=t.length,r=t[0],i=t[0],o=1;o<n;++o,i=r)if(i=r,(r=t[o])!==i){if(o===e){e++;continue}t[e++]=r}return t.length=e,t}(t))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var f=n(0),g=n(5);e.default=function(t,e,n,r){void 0===r&&(r={});var i=g.getCoord(t),o=f.degreesToRadians(i[0]),s=f.degreesToRadians(i[1]),a=f.degreesToRadians(n),u=f.lengthToRadians(e,r.units),l=Math.asin(Math.sin(s)*Math.cos(u)+Math.cos(s)*Math.sin(u)*Math.cos(a)),h=o+Math.atan2(Math.sin(a)*Math.sin(u)*Math.cos(s),Math.cos(u)-Math.sin(s)*Math.sin(l)),c=f.radiansToDegrees(h),p=f.radiansToDegrees(l);return f.point([c,p],r.properties)}},function(t,e,n){"use strict";t.exports=i;var r=n(21);function i(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}i.Varint=0,i.Fixed64=1,i.Bytes=2,i.Fixed32=5;var o=4294967296,s=1/o;function a(t){return t.type===i.Bytes?t.readVarint()+t.pos:t.pos+1}function u(t,e,n){return n?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function l(t,e,n){var r=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.ceil(Math.log(e)/(7*Math.LN2));n.realloc(r);for(var i=n.pos-1;t<=i;i--)n.buf[i+r]=n.buf[i]}function h(t,e){for(var n=0;n<t.length;n++)e.writeVarint(t[n])}function c(t,e){for(var n=0;n<t.length;n++)e.writeSVarint(t[n])}function p(t,e){for(var n=0;n<t.length;n++)e.writeFloat(t[n])}function f(t,e){for(var n=0;n<t.length;n++)e.writeDouble(t[n])}function g(t,e){for(var n=0;n<t.length;n++)e.writeBoolean(t[n])}function d(t,e){for(var n=0;n<t.length;n++)e.writeFixed32(t[n])}function y(t,e){for(var n=0;n<t.length;n++)e.writeSFixed32(t[n])}function _(t,e){for(var n=0;n<t.length;n++)e.writeFixed64(t[n])}function v(t,e){for(var n=0;n<t.length;n++)e.writeSFixed64(t[n])}function m(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function b(t,e,n){t[n]=e,t[n+1]=e>>>8,t[n+2]=e>>>16,t[n+3]=e>>>24}function E(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}i.prototype={destroy:function(){this.buf=null},readFields:function(t,e,n){for(n=n||this.length;this.pos<n;){var r=this.readVarint(),i=r>>3,o=this.pos;this.type=7&r,t(i,e,this),this.pos===o&&this.skip(r)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=m(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=E(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=m(this.buf,this.pos)+m(this.buf,this.pos+4)*o;return this.pos+=8,t},readSFixed64:function(){var t=m(this.buf,this.pos)+E(this.buf,this.pos+4)*o;return this.pos+=8,t},readFloat:function(){var t=r.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=r.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,n,r=this.buf;return e=127&(n=r[this.pos++]),n<128?e:(e|=(127&(n=r[this.pos++]))<<7,n<128?e:(e|=(127&(n=r[this.pos++]))<<14,n<128?e:(e|=(127&(n=r[this.pos++]))<<21,n<128?e:function(t,e,n){var r,i,o=n.buf;if(i=o[n.pos++],r=(112&i)>>4,i<128)return u(t,r,e);if(i=o[n.pos++],r|=(127&i)<<3,i<128)return u(t,r,e);if(i=o[n.pos++],r|=(127&i)<<10,i<128)return u(t,r,e);if(i=o[n.pos++],r|=(127&i)<<17,i<128)return u(t,r,e);if(i=o[n.pos++],r|=(127&i)<<24,i<128)return u(t,r,e);if(i=o[n.pos++],r|=(1&i)<<31,i<128)return u(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(n=r[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=function(t,e,n){var r="",i=e;for(;i<n;){var o,s,a,u=t[i],l=null,h=239<u?4:223<u?3:191<u?2:1;if(n<i+h)break;1===h?u<128&&(l=u):2===h?128==(192&(o=t[i+1]))&&(l=(31&u)<<6|63&o)<=127&&(l=null):3===h?(o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&((l=(15&u)<<12|(63&o)<<6|63&s)<=2047||55296<=l&&l<=57343)&&(l=null)):4===h&&(o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&((l=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)<=65535||1114112<=l)&&(l=null)),null===l?(l=65533,h=1):65535<l&&(l-=65536,r+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),r+=String.fromCharCode(l),i+=h}return r}(this.buf,this.pos,t);return this.pos=t,e},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){var n=a(this);for(t=t||[];this.pos<n;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){var e=a(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){var e=a(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){var e=a(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){var e=a(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){var e=a(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){var e=a(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){var e=a(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){var e=a(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===i.Varint)for(;127<this.buf[this.pos++];);else if(e===i.Bytes)this.pos=this.readVarint()+this.pos;else if(e===i.Fixed32)this.pos+=4;else{if(e!==i.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var n=new Uint8Array(e);n.set(this.buf),this.buf=n,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),b(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),b(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),b(this.buf,-1&t,this.pos),b(this.buf,Math.floor(t*s),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),b(this.buf,-1&t,this.pos),b(this.buf,Math.floor(t*s),this.pos+4),this.pos+=8},writeVarint:function(t){268435455<(t=+t||0)||t<0?function(t,e){var n,r;0<=t?(n=t%4294967296|0,r=t/4294967296|0):(r=~(-t/4294967296),4294967295^(n=~(-t%4294967296))?n=n+1|0:r=r+1|(n=0));if(0x10000000000000000<=t||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),i=n,o=e,o.buf[o.pos++]=127&i|128,i>>>=7,o.buf[o.pos++]=127&i|128,i>>>=7,o.buf[o.pos++]=127&i|128,i>>>=7,o.buf[o.pos++]=127&i|128,i>>>=7,o.buf[o.pos]=127&i,function(t,e){var n=(7&t)<<4;if(e.buf[e.pos++]|=n|((t>>>=3)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;e.buf[e.pos++]=127&t}(r,e);var i,o}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(127<t?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(127<t?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(127<t?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,n){for(var r,i,o=0;o<e.length;o++){if(55295<(r=e.charCodeAt(o))&&r<57344){if(!i){56319<r||o+1===e.length?(t[n++]=239,t[n++]=191,t[n++]=189):i=r;continue}if(r<56320){t[n++]=239,t[n++]=191,t[n++]=189,i=r;continue}r=i-55296<<10|r-56320|65536,i=null}else i&&(t[n++]=239,t[n++]=191,t[n++]=189,i=null);t[n++]=r<128?r:(t[n++]=r<2048?r>>6|192:(t[n++]=r<65536?r>>12|224:(t[n++]=r>>18|240,r>>12&63|128),r>>6&63|128),63&r|128)}return n}(this.buf,t,this.pos);var n=this.pos-e;128<=n&&l(e,n,this),this.pos=e-1,this.writeVarint(n),this.pos+=n},writeFloat:function(t){this.realloc(4),r.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),r.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var n=0;n<e;n++)this.buf[this.pos++]=t[n]},writeRawMessage:function(t,e){this.pos++;var n=this.pos;t(e,this);var r=this.pos-n;128<=r&&l(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,e,n){this.writeTag(t,i.Bytes),this.writeRawMessage(e,n)},writePackedVarint:function(t,e){this.writeMessage(t,h,e)},writePackedSVarint:function(t,e){this.writeMessage(t,c,e)},writePackedBoolean:function(t,e){this.writeMessage(t,g,e)},writePackedFloat:function(t,e){this.writeMessage(t,p,e)},writePackedDouble:function(t,e){this.writeMessage(t,f,e)},writePackedFixed32:function(t,e){this.writeMessage(t,d,e)},writePackedSFixed32:function(t,e){this.writeMessage(t,y,e)},writePackedFixed64:function(t,e){this.writeMessage(t,_,e)},writePackedSFixed64:function(t,e){this.writeMessage(t,v,e)},writeBytesField:function(t,e){this.writeTag(t,i.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,i.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,i.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,i.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,i.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,i.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,i.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,i.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,i.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,i.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}}},function(t,e,n){t.exports.VectorTile=n(45),t.exports.VectorTileFeature=n(23),t.exports.VectorTileLayer=n(22)},function(t,e){e.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,u=(1<<a)-1,l=u>>1,h=-7,c=n?i-1:0,p=n?-1:1,f=t[e+c];for(c+=p,o=f&(1<<-h)-1,f>>=-h,h+=a;0<h;o=256*o+t[e+c],c+=p,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=r;0<h;s=256*s+t[e+c],c+=p,h-=8);if(0===o)o=1-l;else{if(o===u)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),o-=l}return(f?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var s,a,u,l=8*o-i-1,h=(1<<l)-1,c=h>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,g=r?1:-1,d=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),2<=(e+=1<=s+c?p/u:p*Math.pow(2,1-c))*u&&(s++,u/=2),h<=s+c?(a=0,s=h):1<=s+c?(a=(e*u-1)*Math.pow(2,i),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,i),s=0));8<=i;t[n+f]=255&a,f+=g,a/=256,i-=8);for(s=s<<i|a,l+=i;0<l;t[n+f]=255&s,f+=g,s/=256,l-=8);t[n+f-g]|=128*d}},function(t,e,n){"use strict";var r=n(23);function i(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(o,this,e),this.length=this._features.length}function o(t,e,n){15===t?e.version=n.readVarint():1===t?e.name=n.readString():5===t?e.extent=n.readVarint():2===t?e._features.push(n.pos):3===t?e._keys.push(n.readString()):4===t&&e._values.push(function(t){var e=null,n=t.readVarint()+t.pos;for(;t.pos<n;){var r=t.readVarint()>>3;e=1===r?t.readString():2===r?t.readFloat():3===r?t.readDouble():4===r?t.readVarint64():5===r?t.readVarint():6===r?t.readSVarint():7===r?t.readBoolean():null}return e}(n))}(t.exports=i).prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new r(this._pbf,e,this.extent,this._keys,this._values)}},function(t,e,n){"use strict";var l=n(46);function f(t,e,n,r,i){this.properties={},this.extent=n,this.type=0,this._pbf=t,this._geometry=-1,this._keys=r,this._values=i,t.readFields(o,this,e)}function o(t,e,n){1==t?e.id=n.readVarint():2==t?function(t,e){var n=t.readVarint()+t.pos;for(;t.pos<n;){var r=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[r]=i}}(n,e):3==t?e.type=n.readVarint():4==t&&(e._geometry=n.pos)}function g(t){for(var e,n,r=0,i=0,o=t.length,s=o-1;i<o;s=i++)e=t[i],r+=((n=t[s]).x-e.x)*(e.y+n.y);return r}(t.exports=f).types=["Unknown","Point","LineString","Polygon"],f.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,n=t.readVarint()+t.pos,r=1,i=0,o=0,s=0,a=[];t.pos<n;){if(i<=0){var u=t.readVarint();r=7&u,i=u>>3}if(i--,1===r||2===r)o+=t.readSVarint(),s+=t.readSVarint(),1===r&&(e&&a.push(e),e=[]),e.push(new l(o,s));else{if(7!==r)throw new Error("unknown command "+r);e&&e.push(e[0].clone())}}return e&&a.push(e),a},f.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,n=1,r=0,i=0,o=0,s=1/0,a=-1/0,u=1/0,l=-1/0;t.pos<e;){if(r<=0){var h=t.readVarint();n=7&h,r=h>>3}if(r--,1===n||2===n)(i+=t.readSVarint())<s&&(s=i),a<i&&(a=i),(o+=t.readSVarint())<u&&(u=o),l<o&&(l=o);else if(7!==n)throw new Error("unknown command "+n)}return[s,u,a,l]},f.prototype.toGeoJSON=function(t,e,n){var r,i,o=this.extent*Math.pow(2,n),s=this.extent*t,a=this.extent*e,u=this.loadGeometry(),l=f.types[this.type];function h(t){for(var e=0;e<t.length;e++){var n=t[e],r=180-360*(n.y+a)/o;t[e]=[360*(n.x+s)/o-180,360/Math.PI*Math.atan(Math.exp(r*Math.PI/180))-90]}}switch(this.type){case 1:var c=[];for(r=0;r<u.length;r++)c[r]=u[r][0];h(u=c);break;case 2:for(r=0;r<u.length;r++)h(u[r]);break;case 3:for(u=function(t){var e=t.length;if(e<=1)return[t];for(var n,r,i=[],o=0;o<e;o++){var s=g(t[o]);0!==s&&(void 0===r&&(r=s<0),r===s<0?(n&&i.push(n),n=[t[o]]):n.push(t[o]))}n&&i.push(n);return i}(u),r=0;r<u.length;r++)for(i=0;i<u[r].length;i++)h(u[r][i])}1===u.length?u=u[0]:l="Multi"+l;var p={type:"Feature",geometry:{type:l,coordinates:u},properties:this.properties};return"id"in this&&(p.id=this.id),p}},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e,n){var d=n(49),l=n(50),h="undefined"!=typeof Float64Array;function i(t,e){return t[0]-e[0]}function y(){var t,e=this.stride,n=new Array(e.length);for(t=0;t<n.length;++t)n[t]=[Math.abs(e[t]),t];n.sort(i);var r=new Array(n.length);for(t=0;t<r.length;++t)r[t]=n[t][1];return r}function c(t,e){var n=["View",e,"d",t].join("");e<0&&(n="View_Nil"+t);var r="generic"===t;if(-1===e){var i="function "+n+"(a){this.data=a;};var proto="+n+".prototype;proto.dtype='"+t+"';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new "+n+"(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_"+n+"(a){return new "+n+"(a);}";return new Function(i)()}if(0===e){i="function "+n+"(a,d) {this.data = a;this.offset = d};var proto="+n+".prototype;proto.dtype='"+t+"';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function "+n+"_copy() {return new "+n+"(this.data,this.offset)};proto.pick=function "+n+"_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function "+n+"_get(){return "+(r?"this.data.get(this.offset)":"this.data[this.offset]")+"};proto.set=function "+n+"_set(v){return "+(r?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+"};return function construct_"+n+"(a,b,c,d){return new "+n+"(a,d)}";return new Function("TrivialArray",i)(_[t][0])}i=["'use strict'"];var o=d(e),s=o.map(function(t){return"i"+t}),a="this.offset+"+o.map(function(t){return"this.stride["+t+"]*i"+t}).join("+"),u=o.map(function(t){return"b"+t}).join(","),l=o.map(function(t){return"c"+t}).join(",");i.push("function "+n+"(a,"+u+","+l+",d){this.data=a","this.shape=["+u+"]","this.stride=["+l+"]","this.offset=d|0}","var proto="+n+".prototype","proto.dtype='"+t+"'","proto.dimension="+e),i.push("Object.defineProperty(proto,'size',{get:function "+n+"_size(){return "+o.map(function(t){return"this.shape["+t+"]"}).join("*"),"}})"),1===e?i.push("proto.order=[0]"):(i.push("Object.defineProperty(proto,'order',{get:"),e<4?(i.push("function "+n+"_order(){"),2===e?i.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===e&&i.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):i.push("ORDER})")),i.push("proto.set=function "+n+"_set("+s.join(",")+",v){"),r?i.push("return this.data.set("+a+",v)}"):i.push("return this.data["+a+"]=v}"),i.push("proto.get=function "+n+"_get("+s.join(",")+"){"),r?i.push("return this.data.get("+a+")}"):i.push("return this.data["+a+"]}"),i.push("proto.index=function "+n+"_index(",s.join(),"){return "+a+"}"),i.push("proto.hi=function "+n+"_hi("+s.join(",")+"){return new "+n+"(this.data,"+o.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+o.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var h=o.map(function(t){return"a"+t+"=this.shape["+t+"]"}),c=o.map(function(t){return"c"+t+"=this.stride["+t+"]"});i.push("proto.lo=function "+n+"_lo("+s.join(",")+"){var b=this.offset,d=0,"+h.join(",")+","+c.join(","));for(var p=0;p<e;++p)i.push("if(typeof i"+p+"==='number'&&i"+p+">=0){d=i"+p+"|0;b+=c"+p+"*d;a"+p+"-=d}");i.push("return new "+n+"(this.data,"+o.map(function(t){return"a"+t}).join(",")+","+o.map(function(t){return"c"+t}).join(",")+",b)}"),i.push("proto.step=function "+n+"_step("+s.join(",")+"){var "+o.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+o.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(p=0;p<e;++p)i.push("if(typeof i"+p+"==='number'){d=i"+p+"|0;if(d<0){c+=b"+p+"*(a"+p+"-1);a"+p+"=ceil(-a"+p+"/d)}else{a"+p+"=ceil(a"+p+"/d)}b"+p+"*=d}");i.push("return new "+n+"(this.data,"+o.map(function(t){return"a"+t}).join(",")+","+o.map(function(t){return"b"+t}).join(",")+",c)}");var f=new Array(e),g=new Array(e);for(p=0;p<e;++p)f[p]="a[i"+p+"]",g[p]="b[i"+p+"]";i.push("proto.transpose=function "+n+"_transpose("+s+"){"+s.map(function(t,e){return t+"=("+t+"===undefined?"+e+":"+t+"|0)"}).join(";"),"var a=this.shape,b=this.stride;return new "+n+"(this.data,"+f.join(",")+","+g.join(",")+",this.offset)}"),i.push("proto.pick=function "+n+"_pick("+s+"){var a=[],b=[],c=this.offset");for(p=0;p<e;++p)i.push("if(typeof i"+p+"==='number'&&i"+p+">=0){c=(c+this.stride["+p+"]*i"+p+")|0}else{a.push(this.shape["+p+"]);b.push(this.stride["+p+"])}");return i.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),i.push("return function construct_"+n+"(data,shape,stride,offset){return new "+n+"(data,"+o.map(function(t){return"shape["+t+"]"}).join(",")+","+o.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}"),new Function("CTOR_LIST","ORDER",i.join("\n"))(_[t],y)}var _={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],buffer:[],generic:[]};t.exports=function(t,e,n,r){if(void 0===t)return(0,_.array[0])([]);"number"==typeof t&&(t=[t]),void 0===e&&(e=[t.length]);var i=e.length;if(void 0===n){n=new Array(i);for(var o=i-1,s=1;0<=o;--o)n[o]=s,s*=e[o]}if(void 0===r)for(o=r=0;o<i;++o)n[o]<0&&(r-=(e[o]-1)*n[o]);for(var a=function(t){if(l(t))return"buffer";if(h)switch(Object.prototype.toString.call(t)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped"}return Array.isArray(t)?"array":"generic"}(t),u=_[a];u.length<=i+1;)u.push(c(a,u.length-1));return(0,u[i+1])(t,e,n,r)}},function(M,t,A){"use strict";(function(t,y){var _=A(8);M.exports=p;var s,v=A(24);p.ReadableState=o;A(12).EventEmitter;var m=function(t,e){return t.listeners(e).length},i=A(27),l=A(9).Buffer,h=t.Uint8Array||function(){};var e=A(6);e.inherits=A(4);var n=A(59),b=void 0;b=n&&n.debuglog?n.debuglog("stream"):function(){};var a,u=A(60),r=A(28);e.inherits(p,i);var c=["error","close","destroy","pause","resume"];function o(t,e){t=t||{};var n=e instanceof(s=s||A(3));this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var r=t.highWaterMark,i=t.readableHighWaterMark,o=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:n&&(i||0===i)?i:o,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new u,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(a||(a=A(29).StringDecoder),this.decoder=new a(t.encoding),this.encoding=t.encoding)}function p(t){if(s=s||A(3),!(this instanceof p))return new p(t);this._readableState=new o(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),i.call(this)}function f(t,e,n,r,i){var o,s,a,u=t._readableState;null===e?(u.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,w(t)}(t,u)):(i||(o=function(t,e){var n;r=e,l.isBuffer(r)||r instanceof h||"string"==typeof e||void 0===e||t.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));var r;return n}(u,e)),o?t.emit("error",o):u.objectMode||e&&0<e.length?("string"==typeof e||u.objectMode||Object.getPrototypeOf(e)===l.prototype||(s=e,e=l.from(s)),r?u.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):g(t,u,e,!0):u.ended?t.emit("error",new Error("stream.push() after EOF")):(u.reading=!1,u.decoder&&!n?(e=u.decoder.write(e),u.objectMode||0!==e.length?g(t,u,e,!1):I(t,u)):g(t,u,e,!1))):r||(u.reading=!1));return!(a=u).ended&&(a.needReadable||a.length<a.highWaterMark||0===a.length)}function g(t,e,n,r){e.flowing&&0===e.length&&!e.sync?(t.emit("data",n),t.read(0)):(e.length+=e.objectMode?1:n.length,r?e.buffer.unshift(n):e.buffer.push(n),e.needReadable&&w(t)),I(t,e)}Object.defineProperty(p.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),p.prototype.destroy=r.destroy,p.prototype._undestroy=r.undestroy,p.prototype._destroy=function(t,e){this.push(null),e(t)},p.prototype.push=function(t,e){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof t&&((e=e||r.defaultEncoding)!==r.encoding&&(t=l.from(t,e),e=""),n=!0),f(this,t,e,!1,n)},p.prototype.unshift=function(t){return f(this,t,null,!0,!1)},p.prototype.isPaused=function(){return!1===this._readableState.flowing},p.prototype.setEncoding=function(t){return a||(a=A(29).StringDecoder),this._readableState.decoder=new a(t),this._readableState.encoding=t,this};var d=8388608;function E(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=(d<=(n=t)?n=d:(n--,n|=n>>>1,n|=n>>>2,n|=n>>>4,n|=n>>>8,n|=n>>>16,n++),n)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0));var n}function w(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(b("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?_.nextTick(x,t):x(t))}function x(t){b("emit readable"),t.emit("readable"),L(t)}function I(t,e){e.readingMore||(e.readingMore=!0,_.nextTick(N,t,e))}function N(t,e){for(var n=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(b("maybeReadMore read 0"),t.read(0),n!==e.length);)n=e.length;e.readingMore=!1}function S(t){b("readable nexttick read 0"),t.read(0)}function C(t,e){e.reading||(b("resume read 0"),t.read(0)),e.resumeScheduled=!1,e.awaitDrain=0,t.emit("resume"),L(t),e.flowing&&!e.reading&&t.read(0)}function L(t){var e=t._readableState;for(b("flow",e.flowing);e.flowing&&null!==t.read(););}function T(t,e){return 0===e.length?null:(e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):n=function(t,e,n){var r;t<e.head.data.length?(r=e.head.data.slice(0,t),e.head.data=e.head.data.slice(t)):r=t===e.head.data.length?e.shift():n?function(t,e){var n=e.head,r=1,i=n.data;t-=i.length;for(;n=n.next;){var o=n.data,s=t>o.length?o.length:t;if(s===o.length?i+=o:i+=o.slice(0,t),0===(t-=s)){s===o.length?(++r,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n).data=o.slice(s);break}++r}return e.length-=r,i}(t,e):function(t,e){var n=l.allocUnsafe(t),r=e.head,i=1;r.data.copy(n),t-=r.data.length;for(;r=r.next;){var o=r.data,s=t>o.length?o.length:t;if(o.copy(n,n.length-t,0,s),0===(t-=s)){s===o.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r).data=o.slice(s);break}++i}return e.length-=i,n}(t,e);return r}(t,e.buffer,e.decoder),n);var n}function R(t){var e=t._readableState;if(0<e.length)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,_.nextTick(O,e,t))}function O(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function P(t,e){for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return n;return-1}p.prototype.read=function(t){b("read",t),t=parseInt(t,10);var e=this._readableState,n=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return b("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?R(this):w(this),null;if(0===(t=E(t,e))&&e.ended)return 0===e.length&&R(this),null;var r,i=e.needReadable;return b("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&b("length less than watermark",i=!0),e.ended||e.reading?b("reading or ended",i=!1):i&&(b("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=E(n,e))),null===(r=0<t?T(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&R(this)),null!==r&&this.emit("data",r),r},p.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},p.prototype.pipe=function(n,t){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=n;break;case 1:i.pipes=[i.pipes,n];break;default:i.pipes.push(n)}i.pipesCount+=1,b("pipe count=%d opts=%j",i.pipesCount,t);var e=(!t||!1!==t.end)&&n!==y.stdout&&n!==y.stderr?s:d;function o(t,e){b("onunpipe"),t===r&&e&&!1===e.hasUnpiped&&(e.hasUnpiped=!0,b("cleanup"),n.removeListener("close",f),n.removeListener("finish",g),n.removeListener("drain",u),n.removeListener("error",p),n.removeListener("unpipe",o),r.removeListener("end",s),r.removeListener("end",d),r.removeListener("data",c),l=!0,!i.awaitDrain||n._writableState&&!n._writableState.needDrain||u())}function s(){b("onend"),n.end()}i.endEmitted?_.nextTick(e):r.once("end",e),n.on("unpipe",o);var a,u=(a=r,function(){var t=a._readableState;b("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&m(a,"data")&&(t.flowing=!0,L(a))});n.on("drain",u);var l=!1;var h=!1;function c(t){b("ondata"),(h=!1)!==n.write(t)||h||((1===i.pipesCount&&i.pipes===n||1<i.pipesCount&&-1!==P(i.pipes,n))&&!l&&(b("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,h=!0),r.pause())}function p(t){b("onerror",t),d(),n.removeListener("error",p),0===m(n,"error")&&n.emit("error",t)}function f(){n.removeListener("finish",g),d()}function g(){b("onfinish"),n.removeListener("close",f),d()}function d(){b("unpipe"),r.unpipe(n)}return r.on("data",c),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?v(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(n,"error",p),n.once("close",f),n.once("finish",g),n.emit("pipe",r),i.flowing||(b("pipe resume"),r.resume()),n},p.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n)),this;if(!t){var r=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)r[o].emit("unpipe",this,n);return this}var s=P(e.pipes,t);return-1===s||(e.pipes.splice(s,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,n)),this},p.prototype.addListener=p.prototype.on=function(t,e){var n=i.prototype.on.call(this,t,e);if("data"===t)!1!==this._readableState.flowing&&this.resume();else if("readable"===t){var r=this._readableState;r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&w(this):_.nextTick(S,this))}return n},p.prototype.resume=function(){var t,e,n=this._readableState;return n.flowing||(b("resume"),n.flowing=!0,t=this,(e=n).resumeScheduled||(e.resumeScheduled=!0,_.nextTick(C,t,e))),this},p.prototype.pause=function(){return b("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(b("pause"),this._readableState.flowing=!1,this.emit("pause")),this},p.prototype.wrap=function(e){var n=this,r=this._readableState,i=!1;for(var t in e.on("end",function(){if(b("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&n.push(t)}n.push(null)}),e.on("data",function(t){(b("wrapped data"),r.decoder&&(t=r.decoder.write(t)),r.objectMode&&null==t)||(r.objectMode||t&&t.length)&&(n.push(t)||(i=!0,e.pause()))}),e)void 0===this[t]&&"function"==typeof e[t]&&(this[t]=function(t){return function(){return e[t].apply(e,arguments)}}(t));for(var o=0;o<c.length;o++)e.on(c[o],this.emit.bind(this,c[o]));return this._read=function(t){b("wrapped _read",t),i&&(i=!1,e.resume())},this},Object.defineProperty(p.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),p._fromList=T}).call(this,A(1),A(2))},function(t,e,n){t.exports=n(12).EventEmitter},function(t,e,n){"use strict";var o=n(8);function s(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var n=this,r=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return r||i?e?e(t):!t||this._writableState&&this._writableState.errorEmitted||o.nextTick(s,this,t):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!e&&t?(o.nextTick(s,n,t),n._writableState&&(n._writableState.errorEmitted=!0)):e&&e(t)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(t,e,n){"use strict";var r=n(9).Buffer,i=r.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(r.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=l,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=h,this.end=c,e=3;break;default:return this.write=p,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(e)}function s(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,n=function(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(1<t.lastNeed&&1<e.length){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(2<t.lastNeed&&2<e.length&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2!=0)return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1);var n=t.toString("utf16le",e);if(n){var r=n.charCodeAt(n.length-1);if(55296<=r&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}function l(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function h(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function c(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function p(t){return t.toString(this.encoding)}function f(t){return t&&t.length?this.write(t):""}(e.StringDecoder=o).prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<t.length?e?e+this.text(t,n):this.text(t,n):e||""},o.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},o.prototype.text=function(t,e){var n=function(t,e,n){var r=e.length-1;if(r<n)return 0;var i=s(e[r]);if(0<=i)return 0<i&&(t.lastNeed=i-1),i;if(--r<n||-2===i)return 0;if(0<=(i=s(e[r])))return 0<i&&(t.lastNeed=i-2),i;if(--r<n||-2===i)return 0;if(0<=(i=s(e[r])))return 0<i&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var r=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,n){"use strict";t.exports=o;var r=n(3),i=n(6);function o(t){if(!(this instanceof o))return new o(t);r.call(this,t),this._transformState={afterTransform:function(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,(n.writecb=null)!=e&&this.push(e),r(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",s)}function s(){var n=this;"function"==typeof this._flush?this._flush(function(t,e){a(n,t,e)}):a(this,null,null)}function a(t,e,n){if(e)return t.emit("error",e);if(null!=n&&t.push(n),t._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(t._transformState.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}i.inherits=n(4),i.inherits(o,r),o.prototype.push=function(t,e){return this._transformState.needTransform=!1,r.prototype.push.call(this,t,e)},o.prototype._transform=function(t,e,n){throw new Error("_transform() is not implemented")},o.prototype._write=function(t,e,n){var r=this._transformState;if(r.writecb=n,r.writechunk=t,r.writeencoding=e,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},o.prototype._read=function(t){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0},o.prototype._destroy=function(t,e){var n=this;r.prototype._destroy.call(this,t,function(t){e(t),n.emit("close")})}},function(t,e){t.exports=THREE},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(15),l=6378137;function i(t){var e=0;if(t&&0<t.length){e+=Math.abs(o(t[0]));for(var n=1;n<t.length;n++)e-=Math.abs(o(t[n]))}return e}function o(t){var e,n,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+=(h(t[o][0])-h(e[0]))*Math.sin(h(n[1]));a=a*l*l/2}return a}function h(t){return t*Math.PI/180}e.default=function(t){return r.geomReduce(t,function(t,e){return t+function(t){var e,n=0;switch(t.type){case"Polygon":return i(t.coordinates);case"MultiPolygon":for(e=0;e<t.coordinates.length;e++)n+=i(t.coordinates[e]);return n;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}(e)},0)}},function(t,e,n){"use strict";var E=n(16);function r(t){return{type:"Feature",geometry:E.tileToGeoJSON(t),properties:{}}}function i(t,e){var n,r,i=t.coordinates,o=e.max_zoom,s={},a=[];if("Point"===t.type)return[E.pointToTile(i[0],i[1],o)];if("MultiPoint"===t.type)for(n=0;n<i.length;n++)s[w((r=E.pointToTile(i[n][0],i[n][1],o))[0],r[1],r[2])]=!0;else if("LineString"===t.type)g(s,i,o);else if("MultiLineString"===t.type)for(n=0;n<i.length;n++)g(s,i[n],o);else if("Polygon"===t.type)h(s,a,i,o);else{if("MultiPolygon"!==t.type)throw new Error("Geometry type not implemented");for(n=0;n<i.length;n++)h(s,a,i[n],o)}if(e.min_zoom===o)return c(s,a),a;var u=a.length;for(c(s,a),n=0;n<u;n++){var l=a[n];s[w(l[0],l[1],l[2])]=!0}return function(t,e,n){for(var r=[],i=n.max_zoom;i>n.min_zoom;i--){for(var o={},s=[],a=0;a<e.length;a++){var u=e[a];if(u[0]%2==0&&u[1]%2==0){var l=w(u[0]+1,u[1],i),h=w(u[0],u[1]+1,i),c=w(u[0]+1,u[1]+1,i);if(t[l]&&t[h]&&t[c]){t[w(u[0],u[1],u[2])]=!1,t[l]=!1,t[h]=!1,t[c]=!1;var p=[u[0]/2,u[1]/2,i-1];i-1===n.min_zoom?r.push(p):(o[w(u[0]/2,u[1]/2,i-1)]=!0,s.push(p))}}}for(a=0;a<e.length;a++)u=e[a],t[w(u[0],u[1],u[2])]&&r.push(u);t=o,e=s}return r}(s,a,e)}function h(t,e,n,r){for(var i=[],o=0;o<n.length;o++){var s=[];g(t,n[o],r,s);for(var a=0,u=s.length,l=u-1;a<u;l=a++){var h=(a+1)%u,c=s[a][1];(c>s[l][1]||c>s[h][1])&&(c<s[l][1]||c<s[h][1])&&c!==s[h][1]&&i.push(s[a])}}for(i.sort(f),o=0;o<i.length;o+=2){c=i[o][1];for(var p=i[o][0]+1;p<i[o+1][0];p++){t[w(p,c,r)]||e.push([p,c,r])}}}function f(t,e){return t[1]-e[1]||t[0]-e[0]}function g(t,e,n,r){for(var i,o,s=0;s<e.length-1;s++){var a=E.pointToTileFraction(e[s][0],e[s][1],n),u=E.pointToTileFraction(e[s+1][0],e[s+1][1],n),l=a[0],h=a[1],c=u[0]-l,p=u[1]-h;if(0!==p||0!==c){var f=0<c?1:-1,g=0<p?1:-1,d=Math.floor(l),y=Math.floor(h),_=0===c?1/0:Math.abs(((0<c?1:0)+d-l)/c),v=0===p?1/0:Math.abs(((0<p?1:0)+y-h)/p),m=Math.abs(f/c),b=Math.abs(g/p);for(d===i&&y===o||(t[w(d,y,n)]=!0,r&&y!==o&&r.push([d,y]),i=d,o=y);_<1||v<1;)_<v?(_+=m,d+=f):(v+=b,y+=g),t[w(d,y,n)]=!0,r&&y!==o&&r.push([d,y]),i=d,o=y}}r&&y===r[0][1]&&r.pop()}function c(t,e){for(var n,r,i,o,s,a=Object.keys(t),u=0;u<a.length;u++)e.push((n=+a[u],void 0,[s=(o=(n-(r=n%32))/32)%(i=2*(1<<r)),(o-s)/i%i,r]))}function w(t,e,n){return 32*(2*(1<<n)*e+t)+n}e.geojson=function(t,e){return{type:"FeatureCollection",features:i(t,e).map(r)}},e.tiles=i,e.indexes=function(t,e){return i(t,e).map(E.tileToQuadkey)}},function(e,t,n){"use strict";(function(t,h){var c=n(48),p=n(25),a=n(51).GifReader,r=(n(52),n(57),n(70));function f(t,e){var n;try{n=new a(t)}catch(t){return void e(t)}if(0<n.numFrames()){var r=[n.numFrames(),n.height,n.width,4],i=new Uint8Array(r[0]*r[1]*r[2]*r[3]),o=p(i,r);try{for(var s=0;s<n.numFrames();++s)n.decodeAndBlitFrameRGBA(s,i.subarray(o.index(s,0,0,0),o.index(s+1,0,0,0)))}catch(t){return void e(t)}e(null,o.transpose(0,2,1))}else{r=[n.height,n.width,4],i=new Uint8Array(r[0]*r[1]*r[2]),o=p(i,r);try{n.decodeAndBlitFrameRGBA(0,i)}catch(t){return void e(t)}e(null,o.transpose(1,0))}}function g(e,n){t.nextTick(function(){try{var t=r(e);t?f(function(t){if(void 0!==t[0])return new Uint8Array(t);for(var e=t.length,n=new Uint8Array(e),r=0;r<e;++r)n[r]=t.get(r);return n}(t),n):n(new Error("Error parsing data URI"))}catch(t){n(t)}})}e.exports=function(t,e,n){n||(n=e,e="");var r,i,o,s,a,u,l=c.extname(t);switch(e||l.toUpperCase()){case".GIF":s=t,a=n,(u=new XMLHttpRequest).open("GET",s,!0),u.responseType="arraybuffer",u.overrideMimeType&&u.overrideMimeType("application/binary"),u.onerror=function(t){a(t)},u.onload=function(){4===u.readyState&&f(new Uint8Array(u.response),a)},u.send();break;default:h.isBuffer(t)&&(t="data:"+e+";base64,"+t.toString("base64")),0===t.indexOf("data:image/gif;")?g(t,n):(r=t,i=n,(o=new Image).crossOrigin="Anonymous",o.onload=function(){var t=document.createElement("canvas");t.width=o.width,t.height=o.height;var e=t.getContext("2d");e.drawImage(o,0,0);var n=e.getImageData(0,0,o.width,o.height);i(null,p(new Uint8Array(n.data),[o.width,o.height,4],[4,4*o.width,1],0))},o.onerror=function(t){i(t)},o.src=r)}}}).call(this,n(2),n(7).Buffer)},function(t,e,n){var r=function(){var i={},h=Math.PI/180,a=180/Math.PI,n=6378137,r=20037508.342789244;function c(t){return Number(t)===t&&t%1!=0}function t(t){if(t=t||{},this.size=t.size||256,!i[this.size]){var e=this.size,n=i[this.size]={};n.Bc=[],n.Cc=[],n.zc=[],n.Ac=[];for(var r=0;r<30;r++)n.Bc.push(e/360),n.Cc.push(e/(2*Math.PI)),n.zc.push(e/2),n.Ac.push(e),e*=2}this.Bc=i[this.size].Bc,this.Cc=i[this.size].Cc,this.zc=i[this.size].zc,this.Ac=i[this.size].Ac}return t.prototype.px=function(t,e){if(c(e)){var n=this.size*Math.pow(2,e),r=n/2,i=n/360,o=n/(2*Math.PI),s=n,a=Math.min(Math.max(Math.sin(h*t[1]),-.9999),.9999);return s<(u=r+t[0]*i)&&(u=s),s<(l=r+.5*Math.log((1+a)/(1-a))*-o)&&(l=s),[u,l]}r=this.zc[e],a=Math.min(Math.max(Math.sin(h*t[1]),-.9999),.9999);var u=Math.round(r+t[0]*this.Bc[e]),l=Math.round(r+.5*Math.log((1+a)/(1-a))*-this.Cc[e]);return u>this.Ac[e]&&(u=this.Ac[e]),l>this.Ac[e]&&(l=this.Ac[e]),[u,l]},t.prototype.ll=function(t,e){if(c(e)){var n=this.size*Math.pow(2,e),r=n/360,i=n/(2*Math.PI),o=n/2,s=(t[1]-o)/-i;return[(t[0]-o)/r,a*(2*Math.atan(Math.exp(s))-.5*Math.PI)]}s=(t[1]-this.zc[e])/-this.Cc[e];return[(t[0]-this.zc[e])/this.Bc[e],a*(2*Math.atan(Math.exp(s))-.5*Math.PI)]},t.prototype.bbox=function(t,e,n,r,i){r&&(e=Math.pow(2,n)-1-e);var o=[t*this.size,(+e+1)*this.size],s=[(+t+1)*this.size,e*this.size],a=this.ll(o,n).concat(this.ll(s,n));return"900913"===i?this.convert(a,"900913"):a},t.prototype.xyz=function(t,e,n,r){"900913"===r&&(t=this.convert(t,"WGS84"));var i=[t[0],t[1]],o=[t[2],t[3]],s=this.px(i,e),a=this.px(o,e),u=[Math.floor(s[0]/this.size),Math.floor((a[0]-1)/this.size)],l=[Math.floor(a[1]/this.size),Math.floor((s[1]-1)/this.size)],h={minX:Math.min.apply(Math,u)<0?0:Math.min.apply(Math,u),minY:Math.min.apply(Math,l)<0?0:Math.min.apply(Math,l),maxX:Math.max.apply(Math,u),maxY:Math.max.apply(Math,l)};if(n){var c={minY:Math.pow(2,e)-1-h.maxY,maxY:Math.pow(2,e)-1-h.minY};h.minY=c.minY,h.maxY=c.maxY}return h},t.prototype.convert=function(t,e){return"900913"===e?this.forward(t.slice(0,2)).concat(this.forward(t.slice(2,4))):this.inverse(t.slice(0,2)).concat(this.inverse(t.slice(2,4)))},t.prototype.forward=function(t){var e=[n*t[0]*h,n*Math.log(Math.tan(.25*Math.PI+.5*t[1]*h))];return e[0]>r&&(e[0]=r),e[0]<-r&&(e[0]=-r),e[1]>r&&(e[1]=r),e[1]<-r&&(e[1]=-r),e},t.prototype.inverse=function(t){return[t[0]*a/n,(.5*Math.PI-2*Math.atan(Math.exp(-t[1]/n)))*a]},t}();t.exports=r},function(t,e,n){"use strict";var r=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var d=n(0),y=n(5),_=r(n(37));e.default=function t(e,n,r){void 0===r&&(r={});var i=y.getGeom(e),o=y.getGeom(n);if("Polygon"===i.type&&"Polygon"===o.type){var s=_.intersection(i.coordinates,o.coordinates);if(null===s||0===s.length)return null;if(1!==s.length)return d.multiPolygon(s,r.properties);var a=s[0][0][0],u=s[0][0][s[0][0].length-1];return a[0]===u[0]&&a[1]===u[1]?d.polygon(s[0],r.properties):null}if("MultiPolygon"===i.type){for(var l=[],h=0,c=i.coordinates;h<c.length;h++){var p=c[h],f=t(y.getGeom(d.polygon(p)),o);if(f){var g=y.getGeom(f);if("Polygon"===g.type)l.push(g.coordinates);else{if("MultiPolygon"!==g.type)throw new Error("intersection is invalid");l=l.concat(g.coordinates)}}}return 0===l.length?null:1===l.length?d.polygon(l[0],r.properties):d.multiPolygon(l,r.properties)}if("MultiPolygon"===o.type)return t(o,i);throw new Error("poly1 and poly2 must be either polygons or multiPolygons")}},function(t,e,n){
  /**
   * martinez v0.4.3
   * Martinez polygon clipping algorithm, does boolean operation on polygons (multipolygons, polygons with holes etc): intersection, union, difference, xor
   *
   * @author Alex Milevski <info@w8r.name>
   * @license MIT
   * @preserve
   */
  !function(t){"use strict";function n(t,e){return e<t?1:t<e?-1:0}var m=function(t,e){void 0===t&&(t=n),void 0===e&&(e=!1),this._compare=t,this._root=null,this._size=0,this._noDuplicates=!!e},e={size:{configurable:!0}};m.prototype.rotateLeft=function(t){var e=t.right;e&&(t.right=e.left,e.left&&(e.left.parent=t),e.parent=t.parent),t.parent?t===t.parent.left?t.parent.left=e:t.parent.right=e:this._root=e,e&&(e.left=t),t.parent=e},m.prototype.rotateRight=function(t){var e=t.left;e&&(t.left=e.right,e.right&&(e.right.parent=t),e.parent=t.parent),t.parent?t===t.parent.left?t.parent.left=e:t.parent.right=e:this._root=e,e&&(e.right=t),t.parent=e},m.prototype._splay=function(t){for(var e=this;t.parent;){var n=t.parent;n.parent?n.left===t&&n.parent.left===n?(e.rotateRight(n.parent),e.rotateRight(n)):n.right===t&&n.parent.right===n?(e.rotateLeft(n.parent),e.rotateLeft(n)):n.left===t&&n.parent.right===n?(e.rotateRight(n),e.rotateLeft(n)):(e.rotateLeft(n),e.rotateRight(n)):n.left===t?e.rotateRight(n):e.rotateLeft(n)}},m.prototype.splay=function(t){for(var e,n,r,i,o;t.parent;)e=t.parent,(n=e.parent)&&n.parent?((r=n.parent).left===n?r.left=t:r.right=t,t.parent=r):(t.parent=null,this._root=t),i=t.left,o=t.right,t===e.left?(n&&(n.left===e?(e.right?(n.left=e.right,n.left.parent=n):n.left=null,(e.right=n).parent=e):(i?(n.right=i).parent=n:n.right=null,(t.left=n).parent=t)),o?(e.left=o).parent=e:e.left=null,(t.right=e).parent=t):(n&&(n.right===e?(e.left?(n.right=e.left,n.right.parent=n):n.right=null,(e.left=n).parent=e):(o?(n.left=o).parent=n:n.left=null,(t.right=n).parent=t)),i?(e.right=i).parent=e:e.right=null,(t.left=e).parent=t)},m.prototype.replace=function(t,e){t.parent?t===t.parent.left?t.parent.left=e:t.parent.right=e:this._root=e,e&&(e.parent=t.parent)},m.prototype.minNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.left;)t=t.left;return t},m.prototype.maxNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.right;)t=t.right;return t},m.prototype.insert=function(t,e){var n=this._root,r=null,i=this._compare;if(this._noDuplicates)for(;n;){if(0===i((r=n).key,t))return;n=i(n.key,t)<0?n.right:n.left}else for(;n;)n=i((r=n).key,t)<0?n.right:n.left;return n={key:t,data:e,left:null,right:null,parent:r},r?i(r.key,n.key)<0?r.right=n:r.left=n:this._root=n,this.splay(n),this._size++,n},m.prototype.find=function(t){for(var e=this._root,n=this._compare;e;){var r=n(e.key,t);if(r<0)e=e.right;else{if(!(0<r))return e;e=e.left}}return null},m.prototype.contains=function(t){for(var e=this._root,n=this._compare;e;){var r=n(t,e.key);if(0===r)return!0;e=r<0?e.left:e.right}return!1},m.prototype.remove=function(t){var e=this.find(t);if(!e)return!1;if(this.splay(e),e.left)if(e.right){var n=this.minNode(e.right);n.parent!==e&&(this.replace(n,n.right),n.right=e.right,n.right.parent=n),this.replace(e,n),n.left=e.left,n.left.parent=n}else this.replace(e,e.left);else this.replace(e,e.right);return this._size--,!0},m.prototype.removeNode=function(t){if(!t)return!1;if(this.splay(t),t.left)if(t.right){var e=this.minNode(t.right);e.parent!==t&&(this.replace(e,e.right),e.right=t.right,e.right.parent=e),this.replace(t,e),e.left=t.left,e.left.parent=e}else this.replace(t,t.left);else this.replace(t,t.right);return this._size--,!0},m.prototype.erase=function(t){var e=this.find(t);if(e){this.splay(e);var n=e.left,r=e.right,i=null;n&&(n.parent=null,i=this.maxNode(n),this.splay(i),this._root=i),r&&(n?i.right=r:this._root=r,r.parent=i),this._size--}},m.prototype.pop=function(){var t=this._root,e=null;if(t){for(;t.left;)t=t.left;e={key:t.key,data:t.data},this.remove(t.key)}return e},m.prototype.next=function(t){var e=t;if(e)if(e.right)for(e=e.right;e&&e.left;)e=e.left;else for(e=t.parent;e&&e.right===t;)e=(t=e).parent;return e},m.prototype.prev=function(t){var e=t;if(e)if(e.left)for(e=e.left;e&&e.right;)e=e.right;else for(e=t.parent;e&&e.left===t;)e=(t=e).parent;return e},m.prototype.forEach=function(t){for(var e=this._root,n=[],r=!1,i=0;!r;)e?(n.push(e),e=e.left):0<n.length?(e=n.pop(),t(e,i++),e=e.right):r=!0;return this},m.prototype.range=function(t,e,n,r){for(var i=[],o=this._compare,s=this._root;0!==i.length||s;)if(s)i.push(s),s=s.left;else{if(s=i.pop(),0<o(s.key,e))break;if(0<=o(s.key,t)&&n.call(r,s))return this;s=s.right}return this},m.prototype.keys=function(){for(var t=this._root,e=[],n=[],r=!1;!r;)t?(e.push(t),t=t.left):0<e.length?(t=e.pop(),n.push(t.key),t=t.right):r=!0;return n},m.prototype.values=function(){for(var t=this._root,e=[],n=[],r=!1;!r;)t?(e.push(t),t=t.left):0<e.length?(t=e.pop(),n.push(t.data),t=t.right):r=!0;return n},m.prototype.at=function(t){for(var e=this._root,n=[],r=!1,i=0;!r;)if(e)n.push(e),e=e.left;else if(0<n.length){if(e=n.pop(),i===t)return e;i++,e=e.right}else r=!0;return null},m.prototype.load=function(t,e,n){if(void 0===t&&(t=[]),void 0===e&&(e=[]),void 0===n&&(n=!1),0!==this._size)throw new Error("bulk-load: tree is not empty");var r=t.length;return 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,this._compare),this._root=function t(e,n,r,i,o){var s=o-i;if(0<s){var a=i+Math.floor(s/2),u=n[a],l=r[a],h={key:u,data:l,parent:e};return h.left=t(h,n,r,i,a),h.right=t(h,n,r,a+1,o),h}return null}(null,t,e,0,r),this._size=r,this},m.prototype.min=function(){var t=this.minNode(this._root);return t?t.key:null},m.prototype.max=function(){var t=this.maxNode(this._root);return t?t.key:null},m.prototype.isEmpty=function(){return null===this._root},e.size.get=function(){return this._size},m.createTree=function(t,e,n,r,i){return new m(n,i).load(t,e,r)},Object.defineProperties(m.prototype,e);var o=0,u=1,l=2,h=3,b=0,E=1,w=2,x=3;function I(t,e,n){null===e?(t.inOut=!1,t.otherInOut=!0):(t.isSubject===e.isSubject?(t.inOut=!e.inOut,t.otherInOut=e.otherInOut):(t.inOut=!e.otherInOut,t.otherInOut=e.isVertical()?!e.inOut:e.inOut),e&&(t.prevInResult=!r(e,n)||e.isVertical()?e.prevInResult:e)),t.inResult=r(t,n)}function r(t,e){switch(t.type){case o:switch(e){case b:return!t.otherInOut;case E:return t.otherInOut;case w:return t.isSubject&&t.otherInOut||!t.isSubject&&!t.otherInOut;case x:return!0}break;case l:return e===b||e===E;case h:return e===w;case u:return!1}return!1}var g=function(t,e,n,r,i){this.left=e,this.point=t,this.otherEvent=n,this.isSubject=r,this.type=i||o,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.inResult=!1,this.resultInOut=!1,this.isExteriorRing=!0};function c(t,e){return t[0]===e[0]&&t[1]===e[1]}function a(t,e,n){return(t[0]-n[0])*(e[1]-n[1])-(e[0]-n[0])*(t[1]-n[1])}function N(t,e){var n,r,i,o=t.point,s=e.point;return o[0]>s[0]?1:o[0]<s[0]?-1:o[1]!==s[1]?o[1]>s[1]?1:-1:(r=e,i=o,(n=t).left===r.left?0===a(i,n.otherEvent.point,r.otherEvent.point)?!n.isSubject&&r.isSubject?1:-1:n.isBelow(r.otherEvent.point)?-1:1:n.left?1:-1)}function p(t,e,n){var r=new g(e,!1,t,t.isSubject),i=new g(e,!0,t.otherEvent,t.isSubject);return c(t.point,t.otherEvent.point),r.contourId=i.contourId=t.contourId,0<N(i,t.otherEvent)&&(t.otherEvent.left=!0,i.left=!1),t.otherEvent.otherEvent=i,t.otherEvent=r,n.push(i),n.push(r),n}function v(t,e){return t[0]*e[1]-t[1]*e[0]}function S(t,e){return t[0]*e[0]+t[1]*e[1]}function C(t,e,n){var r=function(t,e,n,r,i){var o=[e[0]-t[0],e[1]-t[1]],s=[r[0]-n[0],r[1]-n[1]];function a(t,e,n){return[t[0]+e*n[0],t[1]+e*n[1]]}var u=[n[0]-t[0],n[1]-t[1]],l=v(o,s),h=l*l,c=S(o,o);if(0<h){var p=v(u,s)/l;if(p<0||1<p)return null;var f=v(u,o)/l;return f<0||1<f?null:0===p||1===p?i?null:[a(t,p,o)]:0===f||1===f?i?null:[a(n,f,s)]:[a(t,p,o)]}if(l=v(u,o),0<(h=l*l))return null;var g=S(o,u)/c,d=g+S(o,s)/c,y=Math.min(g,d),_=Math.max(g,d);return y<=1&&0<=_?1===y?i?null:[a(t,0<y?y:0,o)]:0===_?i?null:[a(t,_<1?_:1,o)]:i&&0===y&&1===_?null:[a(t,0<y?y:0,o),a(t,_<1?_:1,o)]:null}(t.point,t.otherEvent.point,e.point,e.otherEvent.point),i=r?r.length:0;if(0===i)return 0;if(1===i&&(c(t.point,e.point)||c(t.otherEvent.point,e.otherEvent.point)))return 0;if(2===i&&t.isSubject===e.isSubject)return 0;if(1===i)return c(t.point,r[0])||c(t.otherEvent.point,r[0])||p(t,r[0],n),c(e.point,r[0])||c(e.otherEvent.point,r[0])||p(e,r[0],n),1;var o=[],s=!1,a=!1;return c(t.point,e.point)?s=!0:1===N(t,e)?o.push(e,t):o.push(t,e),c(t.otherEvent.point,e.otherEvent.point)?a=!0:1===N(t.otherEvent,e.otherEvent)?o.push(e.otherEvent,t.otherEvent):o.push(t.otherEvent,e.otherEvent),s&&a||s?(e.type=u,t.type=e.inOut===t.inOut?l:h,s&&!a&&p(o[1].otherEvent,o[0].point,n),2):(a?p(o[0],o[1].point,n):o[0]!==o[3].otherEvent?(p(o[0],o[1].point,n),p(o[1],o[2].point,n)):(p(o[0],o[1].point,n),p(o[3].otherEvent,o[2].point,n)),3)}function L(t,e){if(t===e)return 0;if(0!==a(t.point,t.otherEvent.point,e.point)||0!==a(t.point,t.otherEvent.point,e.otherEvent.point))return c(t.point,e.point)?t.isBelow(e.otherEvent.point)?-1:1:t.point[0]===e.point[0]?t.point[1]<e.point[1]?-1:1:1===N(t,e)?e.isAbove(t.point)?-1:1:t.isBelow(e.point)?-1:1;if(t.isSubject!==e.isSubject)return t.isSubject?-1:1;var n=t.point,r=e.point;return n[0]===r[0]&&n[1]===r[1]?(n=t.otherEvent.point,r=e.otherEvent.point,n[0]===r[0]&&n[1]===r[1]?0:t.contourId>e.contourId?1:-1):1===N(t,e)?1:-1}function f(t,e,n,r){var i=t+1,o=e.length;if(o-1<i)return t-1;for(var s=e[t].point,a=e[i].point;i<o&&a[0]===s[0]&&a[1]===s[1];){if(!n[i])return i;a=e[++i].point}for(i=t-1;n[i]&&r<=i;)i--;return i}function T(t,e){var n,r,i,o=function(t){var e,n,r,i,o=[];for(n=0,r=t.length;n<r;n++)((e=t[n]).left&&e.inResult||!e.left&&e.otherEvent.inResult)&&o.push(e);for(var s=!1;!s;)for(s=!0,n=0,r=o.length;n<r;n++)n+1<r&&1===N(o[n],o[n+1])&&(i=o[n],o[n]=o[n+1],o[n+1]=i,s=!1);for(n=0,r=o.length;n<r;n++)(e=o[n]).pos=n;for(n=0,r=o.length;n<r;n++)(e=o[n]).left||(i=e.pos,e.pos=e.otherEvent.pos,e.otherEvent.pos=i);return o}(t),s={},a=[];for(n=0,r=o.length;n<r;n++)if(!s[n]){var u=[[]];o[n].isExteriorRing?e===w&&!o[n].isSubject&&1<a.length?a[a.length-1].push(u[0]):a.push(u):e!==w||o[n].isSubject||0!==a.length?0===a.length?a.push([[u]]):a[a.length-1].push(u[0]):a.push(u);var l=a.length-1,h=n,c=o[n].point;for(u[0].push(c);n<=h;)i=o[h],s[h]=!0,i.left?(i.resultInOut=!1,i.contourId=l):(i.otherEvent.resultInOut=!0,i.otherEvent.contourId=l),h=i.pos,s[h]=!0,u[0].push(o[h].point),h=f(h,o,s,n);i=o[h=-1===h?n:h],s[h]=s[i.pos]=!0,i.otherEvent.resultInOut=!0,i.otherEvent.contourId=l}return a}g.prototype.isBelow=function(t){var e=this.point,n=this.otherEvent.point;return this.left?0<(e[0]-t[0])*(n[1]-t[1])-(n[0]-t[0])*(e[1]-t[1]):0<(n[0]-t[0])*(e[1]-t[1])-(e[0]-t[0])*(n[1]-t[1])},g.prototype.isAbove=function(t){return!this.isBelow(t)},g.prototype.isVertical=function(){return this.point[0]===this.otherEvent.point[0]},g.prototype.clone=function(){var t=new g(this.point,this.left,this.otherEvent,this.isSubject,this.type);return t.inResult=this.inResult,t.prevInResult=this.prevInResult,t.isExteriorRing=this.isExteriorRing,t.inOut=this.inOut,t.otherInOut=this.otherInOut,t};var R=s,i=s;function s(t,e){if(!(this instanceof s))return new s(t,e);if(this.data=t||[],this.length=this.data.length,this.compare=e||d,0<this.length)for(var n=(this.length>>1)-1;0<=n;n--)this._down(n)}function d(t,e){return t<e?-1:e<t?1:0}s.prototype={push:function(t){this.data.push(t),this.length++,this._up(this.length-1)},pop:function(){if(0!==this.length){var t=this.data[0];return this.length--,0<this.length&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),t}},peek:function(){return this.data[0]},_up:function(t){for(var e=this.data,n=this.compare,r=e[t];0<t;){var i=t-1>>1,o=e[i];if(0<=n(r,o))break;e[t]=o,t=i}e[t]=r},_down:function(t){for(var e=this.data,n=this.compare,r=this.length>>1,i=e[t];t<r;){var o=1+(t<<1),s=o+1,a=e[o];if(s<this.length&&n(e[s],a)<0&&(a=e[o=s]),0<=n(a,i))break;e[t]=a,t=o}e[t]=i}},R.default=i;var y=Math.max,_=Math.min,O=0;function P(t,e,n,r,i,o){var s,a,u,l,h,c;for(s=0,a=t.length-1;s<a;s++)if(u=t[s],l=t[s+1],h=new g(u,!1,void 0,e),c=new g(l,!1,h,e),h.otherEvent=c,u[0]!==l[0]||u[1]!==l[1]){h.contourId=c.contourId=n,o||(h.isExteriorRing=!1,c.isExteriorRing=!1),0<N(h,c)?c.left=!0:h.left=!0;var p=u[0],f=u[1];i[0]=_(i[0],p),i[1]=_(i[1],f),i[2]=y(i[2],p),i[3]=y(i[3],f),r.push(h),r.push(c)}}var M=[];function A(t,e,n){"number"==typeof t[0][0][0]&&(t=[t]),"number"==typeof e[0][0][0]&&(e=[e]);var r,i,o,s,a=(i=e,o=n,s=null,(r=t).length*i.length==0&&(o===b?s=M:o===w?s=r:o!==E&&o!==x||(s=0===r.length?i:r)),s);if(a)return a===M?null:a;var u,l,h,c,p,f,g=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],y=function(t,e,n,r,i){var o,s,a,u,l,h,c=new R(null,N);for(a=0,u=t.length;a<u;a++)for(o=t[a],l=0,h=o.length;l<h;l++)(s=0===l)&&O++,P(o[l],!0,O,c,n,s);for(a=0,u=e.length;a<u;a++)for(o=e[a],l=0,h=o.length;l<h;l++)s=0===l,i===w&&(s=!1),s&&O++,P(o[l],!1,O,c,r,s);return c}(t,e,g,d,n);if(u=t,l=e,p=n,f=null,((h=g)[0]>(c=d)[2]||c[0]>h[2]||h[1]>c[3]||c[1]>h[3])&&(p===b?f=M:p===w?f=u:p!==E&&p!==x||(f=u.concat(l))),a=f)return a===M?null:a;var _=function(t,e,n,r,i,o){for(var s,a,u,l=new m(L),h=[],c=Math.min(r[2],i[2]);0!==t.length;){var p=t.pop();if(h.push(p),o===b&&p.point[0]>c||o===w&&p.point[0]>r[2])break;if(p.left){a=s=l.insert(p),u=l.minNode(),s=s!==u?l.prev(s):null,a=l.next(a);var f=s?s.key:null,g=void 0;if(I(p,f,o),a&&2===C(p,a.key,t)&&(I(p,f,o),I(p,a.key,o)),s&&2===C(s.key,p,t)){var d=s;d=d!==u?l.prev(d):null,g=d?d.key:null,I(f,g,o),I(p,f,o)}}else p=p.otherEvent,a=s=l.find(p),s&&a&&(s=s!==u?l.prev(s):null,a=l.next(a),l.remove(p),a&&s&&C(s.key,a.key,t))}return h}(y,0,0,g,d,n),v=T(_,n);return v}var D={UNION:E,DIFFERENCE:w,INTERSECTION:b,XOR:x};t.union=function(t,e){return A(t,e,E)},t.diff=function(t,e){return A(t,e,w)},t.xor=function(t,e){return A(t,e,x)},t.intersection=function(t,e){return A(t,e,b)},t.operations=D,Object.defineProperty(t,"__esModule",{value:!0})}(e)},function(n,t,e){(function(t){var e;e="undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{},n.exports=e}).call(this,e(1))},function(t,e){t.exports=function(t){var e=n.call(t);return"[object Function]"===e||"function"==typeof t&&"[object RegExp]"!==e||"undefined"!=typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)};var n=Object.prototype.toString},function(t,e,n){var s=n(41),r=n(42);t.exports=function(t){if(!t)return{};var o={};return r(s(t).split("\n"),function(t){var e,n=t.indexOf(":"),r=s(t.slice(0,n)).toLowerCase(),i=s(t.slice(n+1));void 0===o[r]?o[r]=i:(e=o[r],"[object Array]"===Object.prototype.toString.call(e)?o[r].push(i):o[r]=[o[r],i])}),o}},function(t,e){(e=t.exports=function(t){return t.replace(/^\s*|\s*$/g,"")}).left=function(t){return t.replace(/^\s*/,"")},e.right=function(t){return t.replace(/\s*$/,"")}},function(t,e,n){"use strict";var i=n(43),o=Object.prototype.toString,s=Object.prototype.hasOwnProperty;t.exports=function(t,e,n){if(!i(e))throw new TypeError("iterator must be a function");var r;3<=arguments.length&&(r=n),"[object Array]"===o.call(t)?function(t,e,n){for(var r=0,i=t.length;r<i;r++)s.call(t,r)&&(null==n?e(t[r],r,t):e.call(n,t[r],r,t))}(t,e,r):"string"==typeof t?function(t,e,n){for(var r=0,i=t.length;r<i;r++)null==n?e(t.charAt(r),r,t):e.call(n,t.charAt(r),r,t)}(t,e,r):function(t,e,n){for(var r in t)s.call(t,r)&&(null==n?e(t[r],r,t):e.call(n,t[r],r,t))}(t,e,r)}},function(t,e,n){"use strict";var r=Function.prototype.toString,i=/^\s*class\b/,o=function(t){try{var e=r.call(t);return i.test(e)}catch(t){return!1}},s=Object.prototype.toString,a="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;t.exports=function(t){if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if("function"==typeof t&&!t.prototype)return!0;if(a)return function(t){try{return!o(t)&&(r.call(t),!0)}catch(t){return!1}}(t);if(o(t))return!1;var e=s.call(t);return"[object Function]"===e||"[object GeneratorFunction]"===e}},function(t,e){t.exports=function(){for(var t={},e=0;e<arguments.length;e++){var n=arguments[e];for(var r in n)i.call(n,r)&&(t[r]=n[r])}return t};var i=Object.prototype.hasOwnProperty},function(t,e,n){"use strict";var i=n(22);function r(t,e,n){if(3===t){var r=new i(n,n.readVarint()+n.pos);r.length&&(e[r.name]=r)}}t.exports=function(t,e){this.layers=t.readFields(r,{},e)}},function(t,e,n){"use strict";function r(t,e){this.x=t,this.y=e}(t.exports=r).prototype={clone:function(){return new r(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,n=t.y-this.y;return e*e+n*n},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,n=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=n,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),n=Math.sin(t),r=e*this.x-n*this.y,i=n*this.x+e*this.y;return this.x=r,this.y=i,this},_rotateAround:function(t,e){var n=Math.cos(t),r=Math.sin(t),i=e.x+n*(this.x-e.x)-r*(this.y-e.y),o=e.y+r*(this.x-e.x)+n*(this.y-e.y);return this.x=i,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},r.convert=function(t){return t instanceof r?t:Array.isArray(t)?new r(t[0],t[1]):t}},function(t,e,n){"use strict";e.byteLength=function(t){var e=f(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){for(var e,n=f(t),r=n[0],i=n[1],o=new p((l=r,h=i,3*(l+h)/4-h)),s=0,a=0<i?r-4:r,u=0;u<a;u+=4)e=c[t.charCodeAt(u)]<<18|c[t.charCodeAt(u+1)]<<12|c[t.charCodeAt(u+2)]<<6|c[t.charCodeAt(u+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=255&e;var l,h;2===i&&(e=c[t.charCodeAt(u)]<<2|c[t.charCodeAt(u+1)]>>4,o[s++]=255&e);1===i&&(e=c[t.charCodeAt(u)]<<10|c[t.charCodeAt(u+1)]<<4|c[t.charCodeAt(u+2)]>>2,o[s++]=e>>8&255,o[s++]=255&e);return o},e.fromByteArray=function(t){for(var e,n=t.length,r=n%3,i=[],o=0,s=n-r;o<s;o+=16383)i.push(u(t,o,s<o+16383?s:o+16383));1===r?(e=t[n-1],i.push(a[e>>2]+a[e<<4&63]+"==")):2===r&&(e=(t[n-2]<<8)+t[n-1],i.push(a[e>>10]+a[e>>4&63]+a[e<<2&63]+"="));return i.join("")};for(var a=[],c=[],p="undefined"!=typeof Uint8Array?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=r.length;i<o;++i)a[i]=r[i],c[r.charCodeAt(i)]=i;function f(t){var e=t.length;if(0<e%4)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function u(t,e,n){for(var r,i,o=[],s=e;s<n;s+=3)r=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),o.push(a[(i=r)>>18&63]+a[i>>12&63]+a[i>>6&63]+a[63&i]);return o.join("")}c["-".charCodeAt(0)]=62,c["_".charCodeAt(0)]=63},function(t,l,e){(function(i){function o(t,e){for(var n=0,r=t.length-1;0<=r;r--){var i=t[r];"."===i?t.splice(r,1):".."===i?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}var e=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,s=function(t){return e.exec(t).slice(1)};function a(t,e){if(t.filter)return t.filter(e);for(var n=[],r=0;r<t.length;r++)e(t[r],r,t)&&n.push(t[r]);return n}l.resolve=function(){for(var t="",e=!1,n=arguments.length-1;-1<=n&&!e;n--){var r=0<=n?arguments[n]:i.cwd();if("string"!=typeof r)throw new TypeError("Arguments to path.resolve must be strings");r&&(t=r+"/"+t,e="/"===r.charAt(0))}return(e?"/":"")+(t=o(a(t.split("/"),function(t){return!!t}),!e).join("/"))||"."},l.normalize=function(t){var e=l.isAbsolute(t),n="/"===r(t,-1);return(t=o(a(t.split("/"),function(t){return!!t}),!e).join("/"))||e||(t="."),t&&n&&(t+="/"),(e?"/":"")+t},l.isAbsolute=function(t){return"/"===t.charAt(0)},l.join=function(){var t=Array.prototype.slice.call(arguments,0);return l.normalize(a(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},l.relative=function(t,e){function n(t){for(var e=0;e<t.length&&""===t[e];e++);for(var n=t.length-1;0<=n&&""===t[n];n--);return n<e?[]:t.slice(e,n-e+1)}t=l.resolve(t).substr(1),e=l.resolve(e).substr(1);for(var r=n(t.split("/")),i=n(e.split("/")),o=Math.min(r.length,i.length),s=o,a=0;a<o;a++)if(r[a]!==i[a]){s=a;break}var u=[];for(a=s;a<r.length;a++)u.push("..");return(u=u.concat(i.slice(s))).join("/")},l.sep="/",l.delimiter=":",l.dirname=function(t){var e=s(t),n=e[0],r=e[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."},l.basename=function(t,e){var n=s(t)[2];return e&&n.substr(-1*e.length)===e&&(n=n.substr(0,n.length-e.length)),n},l.extname=function(t){return s(t)[3]};var r="b"==="ab".substr(-1)?function(t,e,n){return t.substr(e,n)}:function(t,e,n){return e<0&&(e=t.length+e),t.substr(e,n)}}).call(this,e(2))},function(t,e,n){"use strict";t.exports=function(t){for(var e=new Array(t),n=0;n<t;++n)e[n]=n;return e}},function(t,e){function n(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}
  /*!
   * Determine if an object is a Buffer
   *
   * @author   Feross Aboukhadijeh <https://feross.org>
   * @license  MIT
   */
  t.exports=function(t){return null!=t&&(n(t)||"function"==typeof(e=t).readFloatLE&&"function"==typeof e.slice&&n(e.slice(0,0))||!!t._isBuffer);var e}},function(t,e,n){"use strict";function L(t,e,n,r){for(var i=t[e++],o=1<<i,s=o+1,a=s+1,u=i+1,l=(1<<u)-1,h=0,c=0,p=0,f=t[e++],g=new Int32Array(4096),d=null;;){for(;h<16&&0!==f;)c|=t[e++]<<h,h+=8,1===f?f=t[e++]:--f;if(h<u)break;var y=c&l;if(c>>=u,h-=u,y!==o){if(y===s)break;for(var _=y<a?y:d,v=0,m=_;o<m;)m=g[m]>>8,++v;var b=m;if(r<p+v+(_!==y?1:0))return;n[p++]=b;var E=p+=v;for(_!==y&&(n[p++]=b),m=_;v--;)m=g[m],n[--E]=255&m,m>>=8;null!==d&&a<4096&&(g[a++]=d<<8|b,l+1<=a&&u<12&&(++u,l=l<<1|1)),d=y}else a=s+1,l=(1<<(u=i+1))-1,d=null}return n}try{e.GifWriter=function(_,t,e,n){var v=0,r=void 0===(n=void 0===n?{}:n).loop?null:n.loop,m=void 0===n.palette?null:n.palette;if(t<=0||e<=0||65535<t||65535<e)throw new Error("Width/Height invalid.");function b(t){var e=t.length;if(e<2||256<e||e&e-1)throw new Error("Invalid code/color length, must be power of 2 and 2 .. 256.");return e}_[v++]=71,_[v++]=73,_[v++]=70,_[v++]=56,_[v++]=57,_[v++]=97;var i=0,o=0;if(null!==m){for(var s=b(m);s>>=1;)++i;if(s=1<<i,--i,void 0!==n.background){if(s<=(o=n.background))throw new Error("Background index out of range.");if(0===o)throw new Error("Background index explicitly passed as 0.")}}if(_[v++]=255&t,_[v++]=t>>8&255,_[v++]=255&e,_[v++]=e>>8&255,_[v++]=(null!==m?128:0)|i,_[v++]=o,_[v++]=0,null!==m)for(var a=0,u=m.length;a<u;++a){var l=m[a];_[v++]=l>>16&255,_[v++]=l>>8&255,_[v++]=255&l}if(null!==r){if(r<0||65535<r)throw new Error("Loop count invalid.");_[v++]=33,_[v++]=255,_[v++]=11,_[v++]=78,_[v++]=69,_[v++]=84,_[v++]=83,_[v++]=67,_[v++]=65,_[v++]=80,_[v++]=69,_[v++]=50,_[v++]=46,_[v++]=48,_[v++]=3,_[v++]=1,_[v++]=255&r,_[v++]=r>>8&255,_[v++]=0}var E=!1;this.addFrame=function(t,e,n,r,i,o){if(!0===E&&(--v,E=!1),o=void 0===o?{}:o,t<0||e<0||65535<t||65535<e)throw new Error("x/y invalid.");if(n<=0||r<=0||65535<n||65535<r)throw new Error("Width/Height invalid.");if(i.length<n*r)throw new Error("Not enough pixels for the frame size.");var s=!0,a=o.palette;if(null==a&&(s=!1,a=m),null==a)throw new Error("Must supply either a local or global palette.");for(var u=b(a),l=0;u>>=1;)++l;u=1<<l;var h=void 0===o.delay?0:o.delay,c=void 0===o.disposal?0:o.disposal;if(c<0||3<c)throw new Error("Disposal out of range.");var p=!1,f=0;if(void 0!==o.transparent&&null!==o.transparent&&(p=!0,(f=o.transparent)<0||u<=f))throw new Error("Transparent color index.");if((0!==c||p||0!==h)&&(_[v++]=33,_[v++]=249,_[v++]=4,_[v++]=c<<2|(!0===p?1:0),_[v++]=255&h,_[v++]=h>>8&255,_[v++]=f,_[v++]=0),_[v++]=44,_[v++]=255&t,_[v++]=t>>8&255,_[v++]=255&e,_[v++]=e>>8&255,_[v++]=255&n,_[v++]=n>>8&255,_[v++]=255&r,_[v++]=r>>8&255,_[v++]=!0===s?128|l-1:0,!0===s)for(var g=0,d=a.length;g<d;++g){var y=a[g];_[v++]=y>>16&255,_[v++]=y>>8&255,_[v++]=255&y}return v=function(e,n,t,r){e[n++]=t;var i=n++,o=1<<t,s=o-1,a=o+1,u=a+1,l=t+1,h=0,c=0;function p(t){for(;t<=h;)e[n++]=255&c,c>>=8,h-=8,n===i+256&&(e[i]=255,i=n++)}function f(t){c|=t<<h,h+=l,p(8)}var g=r[0]&s,d={};f(o);for(var y=1,_=r.length;y<_;++y){var v=r[y]&s,m=g<<8|v,b=d[m];if(void 0===b){for(c|=g<<h,h+=l;8<=h;)e[n++]=255&c,c>>=8,h-=8,n===i+256&&(e[i]=255,i=n++);4096===u?(f(o),u=a+1,l=t+1,d={}):(1<<l<=u&&++l,d[m]=u++),g=v}else g=b}return f(g),f(a),p(1),i+1===n?e[i]=0:(e[i]=n-i-1,e[n++]=0),n}(_,v,l<2?2:l,i)},this.end=function(){return!1===E&&(_[v++]=59,E=!0),v},this.getOutputBuffer=function(){return _},this.setOutputBuffer=function(t){_=t},this.getOutputBufferPosition=function(){return v},this.setOutputBufferPosition=function(t){v=t}},e.GifReader=function(E){var t=0;if(71!==E[t++]||73!==E[t++]||70!==E[t++]||56!==E[t++]||56!=(E[t++]+1&253)||97!==E[t++])throw new Error("Invalid GIF 87a/89a header.");var w=E[t++]|E[t++]<<8,e=E[t++]|E[t++]<<8,n=E[t++],r=n>>7,i=1<<1+(7&n);E[t++],E[t++];var o=null,s=null;r&&(o=t,t+=3*(s=i));var a=!0,u=[],l=0,h=null,c=0,p=null;for(this.width=w,this.height=e;a&&t<E.length;)switch(E[t++]){case 33:switch(E[t++]){case 255:if(11!==E[t]||78==E[t+1]&&69==E[t+2]&&84==E[t+3]&&83==E[t+4]&&67==E[t+5]&&65==E[t+6]&&80==E[t+7]&&69==E[t+8]&&50==E[t+9]&&46==E[t+10]&&48==E[t+11]&&3==E[t+12]&&1==E[t+13]&&0==E[t+16])t+=14,p=E[t++]|E[t++]<<8,t++;else for(t+=12;;){if(!(0<=(C=E[t++])))throw Error("Invalid block size");if(0===C)break;t+=C}break;case 249:if(4!==E[t++]||0!==E[t+4])throw new Error("Invalid graphics extension block.");var f=E[t++];l=E[t++]|E[t++]<<8,h=E[t++],0==(1&f)&&(h=null),c=f>>2&7,t++;break;case 254:for(;;){if(!(0<=(C=E[t++])))throw Error("Invalid block size");if(0===C)break;t+=C}break;default:throw new Error("Unknown graphic control label: 0x"+E[t-1].toString(16))}break;case 44:var g=E[t++]|E[t++]<<8,d=E[t++]|E[t++]<<8,y=E[t++]|E[t++]<<8,_=E[t++]|E[t++]<<8,v=E[t++],m=v>>6&1,b=1<<1+(7&v),x=o,I=s,N=!1;v>>7&&(N=!0,x=t,t+=3*(I=b));var S=t;for(t++;;){var C;if(!(0<=(C=E[t++])))throw Error("Invalid block size");if(0===C)break;t+=C}u.push({x:g,y:d,width:y,height:_,has_local_palette:N,palette_offset:x,palette_size:I,data_offset:S,data_length:t-S,transparent_index:h,interlaced:!!m,delay:l,disposal:c});break;case 59:a=!1;break;default:throw new Error("Unknown gif block: 0x"+E[t-1].toString(16))}this.numFrames=function(){return u.length},this.loopCount=function(){return p},this.frameInfo=function(t){if(t<0||t>=u.length)throw new Error("Frame index out of range.");return u[t]},this.decodeAndBlitFrameBGRA=function(t,e){var n=this.frameInfo(t),r=n.width*n.height,i=new Uint8Array(r);L(E,n.data_offset,i,r);var o=n.palette_offset,s=n.transparent_index;null===s&&(s=256);var a=n.width,u=w-a,l=a,h=4*(n.y*w+n.x),c=4*((n.y+n.height)*w+n.x),p=h,f=4*u;!0===n.interlaced&&(f+=4*w*7);for(var g=8,d=0,y=i.length;d<y;++d){var _=i[d];if(0===l&&(l=a,c<=(p+=f)&&(f=4*u+4*w*(g-1),p=h+(a+u)*(g<<1),g>>=1)),_===s)p+=4;else{var v=E[o+3*_],m=E[o+3*_+1],b=E[o+3*_+2];e[p++]=b,e[p++]=m,e[p++]=v,e[p++]=255}--l}},this.decodeAndBlitFrameRGBA=function(t,e){var n=this.frameInfo(t),r=n.width*n.height,i=new Uint8Array(r);L(E,n.data_offset,i,r);var o=n.palette_offset,s=n.transparent_index;null===s&&(s=256);var a=n.width,u=w-a,l=a,h=4*(n.y*w+n.x),c=4*((n.y+n.height)*w+n.x),p=h,f=4*u;!0===n.interlaced&&(f+=4*w*7);for(var g=8,d=0,y=i.length;d<y;++d){var _=i[d];if(0===l&&(l=a,c<=(p+=f)&&(f=4*u+4*w*(g-1),p=h+(a+u)*(g<<1),g>>=1)),_===s)p+=4;else{var v=E[o+3*_],m=E[o+3*_+1],b=E[o+3*_+2];e[p++]=v,e[p++]=m,e[p++]=b,e[p++]=255}--l}}}}catch(t){}},function(t,e,n){"use strict";var o=n(25),s=n(53);t.exports=function(t,e){for(var n=[],r=t,i=1;Array.isArray(r);)n.push(r.length),i*=r.length,r=r[0];return 0===n.length?o():(e||(e=o(new Float64Array(i),n)),s(e,t),e)}},function(t,e,n){t.exports=n(54)({args:["array","scalar","index"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{\nvar _inline_1_v=_inline_1_arg1_,_inline_1_i\nfor(_inline_1_i=0;_inline_1_i<_inline_1_arg2_.length-1;++_inline_1_i) {\n_inline_1_v=_inline_1_v[_inline_1_arg2_[_inline_1_i]]\n}\n_inline_1_arg0_=_inline_1_v[_inline_1_arg2_[_inline_1_arg2_.length-1]]\n}",args:[{name:"_inline_1_arg0_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg2_",lvalue:!1,rvalue:!0,count:4}],thisVars:[],localVars:["_inline_1_i","_inline_1_v"]},post:{body:"{}",args:[],thisVars:[],localVars:[]},funcName:"convert",blockSize:64})},function(t,e,n){"use strict";var o=n(55);function s(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1}t.exports=function(t){var e=new s;e.pre=t.pre,e.body=t.body,e.post=t.post;var n=t.args.slice(0);e.argTypes=n;for(var r=0;r<n.length;++r){var i=n[r];if("array"===i||"object"==typeof i&&i.blockIndices){if(e.argTypes[r]="array",e.arrayArgs.push(r),e.arrayBlockIndices.push(i.blockIndices?i.blockIndices:0),e.shimArgs.push("array"+r),r<e.pre.args.length&&0<e.pre.args[r].count)throw new Error("cwise: pre() block may not reference array args");if(r<e.post.args.length&&0<e.post.args[r].count)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===i)e.scalarArgs.push(r),e.shimArgs.push("scalar"+r);else if("index"===i){if(e.indexArgs.push(r),r<e.pre.args.length&&0<e.pre.args[r].count)throw new Error("cwise: pre() block may not reference array index");if(r<e.body.args.length&&e.body.args[r].lvalue)throw new Error("cwise: body() block may not write to array index");if(r<e.post.args.length&&0<e.post.args[r].count)throw new Error("cwise: post() block may not reference array index")}else if("shape"===i){if(e.shapeArgs.push(r),r<e.pre.args.length&&e.pre.args[r].lvalue)throw new Error("cwise: pre() block may not write to array shape");if(r<e.body.args.length&&e.body.args[r].lvalue)throw new Error("cwise: body() block may not write to array shape");if(r<e.post.args.length&&e.post.args[r].lvalue)throw new Error("cwise: post() block may not write to array shape")}else{if("object"!=typeof i||!i.offset)throw new Error("cwise: Unknown argument type "+n[r]);e.argTypes[r]="offset",e.offsetArgs.push({array:i.array,offset:i.offset}),e.offsetArgIndex.push(r)}}if(e.arrayArgs.length<=0)throw new Error("cwise: No array arguments specified");if(e.pre.args.length>n.length)throw new Error("cwise: Too many arguments in pre() block");if(e.body.args.length>n.length)throw new Error("cwise: Too many arguments in body() block");if(e.post.args.length>n.length)throw new Error("cwise: Too many arguments in post() block");return e.debug=!!t.printCode||!!t.debug,e.funcName=t.funcName||"cwise",e.blockSize=t.blockSize||64,o(e)}},function(t,e,n){"use strict";var c=n(56);t.exports=function(t){var e=["'use strict'","var CACHED={}"],n=[],r=t.funcName+"_cwise_thunk";e.push(["return function ",r,"(",t.shimArgs.join(","),"){"].join(""));for(var i=[],o=[],s=[["array",t.arrayArgs[0],".shape.slice(",Math.max(0,t.arrayBlockIndices[0]),t.arrayBlockIndices[0]<0?","+t.arrayBlockIndices[0]+")":")"].join("")],a=[],u=[],l=0;l<t.arrayArgs.length;++l){var h=t.arrayArgs[l];n.push(["t",h,"=array",h,".dtype,","r",h,"=array",h,".order"].join("")),i.push("t"+h),i.push("r"+h),o.push("t"+h),o.push("r"+h+".join()"),s.push("array"+h+".data"),s.push("array"+h+".stride"),s.push("array"+h+".offset|0"),0<l&&(a.push("array"+t.arrayArgs[0]+".shape.length===array"+h+".shape.length+"+(Math.abs(t.arrayBlockIndices[0])-Math.abs(t.arrayBlockIndices[l]))),u.push("array"+t.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[0])+"]===array"+h+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[l])+"]"))}for(1<t.arrayArgs.length&&(e.push("if (!("+a.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),e.push("for(var shapeIndex=array"+t.arrayArgs[0]+".shape.length-"+Math.abs(t.arrayBlockIndices[0])+"; shapeIndex--\x3e0;) {"),e.push("if (!("+u.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}")),l=0;l<t.scalarArgs.length;++l)s.push("scalar"+t.scalarArgs[l]);return n.push(["type=[",o.join(","),"].join()"].join("")),n.push("proc=CACHED[type]"),e.push("var "+n.join(",")),e.push(["if(!proc){","CACHED[type]=proc=compile([",i.join(","),"])}","return proc(",s.join(","),")}"].join("")),t.debug,new Function("compile",e.join("\n"))(c.bind(void 0,t))}},function(t,e,n){"use strict";var x=n(17);function I(t,e,n){var r,i,o=t.length,s=e.arrayArgs.length,a=0<e.indexArgs.length,u=[],l=[],h=0,c=0;for(r=0;r<o;++r)l.push(["i",r,"=0"].join(""));for(i=0;i<s;++i)for(r=0;r<o;++r)c=h,h=t[r],0===r?l.push(["d",i,"s",r,"=t",i,"p",h].join("")):l.push(["d",i,"s",r,"=(t",i,"p",h,"-s",c,"*t",i,"p",c,")"].join(""));for(0<l.length&&u.push("var "+l.join(",")),r=o-1;0<=r;--r)h=t[r],u.push(["for(i",r,"=0;i",r,"<s",h,";++i",r,"){"].join(""));for(u.push(n),r=0;r<o;++r){for(c=h,h=t[r],i=0;i<s;++i)u.push(["p",i,"+=d",i,"s",r].join(""));a&&(0<r&&u.push(["index[",c,"]-=s",c].join("")),u.push(["++index[",h,"]"].join(""))),u.push("}")}return u.join("\n")}function N(t,e,n){for(var r=t.body,i=[],o=[],s=0;s<t.args.length;++s){var a=t.args[s];if(!(a.count<=0)){var u=new RegExp(a.name,"g"),l="",h=e.arrayArgs.indexOf(s);switch(e.argTypes[s]){case"offset":var c=e.offsetArgIndex.indexOf(s);h=e.offsetArgs[c].array,l="+q"+c;case"array":l="p"+h+l;var p="l"+s,f="a"+h;if(0===e.arrayBlockIndices[h])1===a.count?"generic"===n[h]?a.lvalue?(i.push(["var ",p,"=",f,".get(",l,")"].join("")),r=r.replace(u,p),o.push([f,".set(",l,",",p,")"].join(""))):r=r.replace(u,[f,".get(",l,")"].join("")):r=r.replace(u,[f,"[",l,"]"].join("")):"generic"===n[h]?(i.push(["var ",p,"=",f,".get(",l,")"].join("")),r=r.replace(u,p),a.lvalue&&o.push([f,".set(",l,",",p,")"].join(""))):(i.push(["var ",p,"=",f,"[",l,"]"].join("")),r=r.replace(u,p),a.lvalue&&o.push([f,"[",l,"]=",p].join("")));else{for(var g=[a.name],d=[l],y=0;y<Math.abs(e.arrayBlockIndices[h]);y++)g.push("\\s*\\[([^\\]]+)\\]"),d.push("$"+(y+1)+"*t"+h+"b"+y);if(u=new RegExp(g.join(""),"g"),l=d.join("+"),"generic"===n[h])throw new Error("cwise: Generic arrays not supported in combination with blocks!");r=r.replace(u,[f,"[",l,"]"].join(""))}break;case"scalar":r=r.replace(u,"Y"+e.scalarArgs.indexOf(s));break;case"index":r=r.replace(u,"index");break;case"shape":r=r.replace(u,"shape")}}}return[i.join("\n"),r,o.join("\n")].join("\n").trim()}t.exports=function(t,e){for(var n=e[1].length-Math.abs(t.arrayBlockIndices[0])|0,r=new Array(t.arrayArgs.length),i=new Array(t.arrayArgs.length),o=0;o<t.arrayArgs.length;++o)i[o]=e[2*o],r[o]=e[2*o+1];var s=[],a=[],u=[],l=[],h=[];for(o=0;o<t.arrayArgs.length;++o){t.arrayBlockIndices[o]<0?(u.push(0),l.push(n),s.push(n),a.push(n+t.arrayBlockIndices[o])):(u.push(t.arrayBlockIndices[o]),l.push(t.arrayBlockIndices[o]+n),s.push(0),a.push(t.arrayBlockIndices[o]));for(var c=[],p=0;p<r[o].length;p++)u[o]<=r[o][p]&&r[o][p]<l[o]&&c.push(r[o][p]-u[o]);h.push(c)}var f=["SS"],g=["'use strict'"],d=[];for(p=0;p<n;++p)d.push(["s",p,"=SS[",p,"]"].join(""));for(o=0;o<t.arrayArgs.length;++o){for(f.push("a"+o),f.push("t"+o),f.push("p"+o),p=0;p<n;++p)d.push(["t",o,"p",p,"=t",o,"[",u[o]+p,"]"].join(""));for(p=0;p<Math.abs(t.arrayBlockIndices[o]);++p)d.push(["t",o,"b",p,"=t",o,"[",s[o]+p,"]"].join(""))}for(o=0;o<t.scalarArgs.length;++o)f.push("Y"+o);if(0<t.shapeArgs.length&&d.push("shape=SS.slice(0)"),0<t.indexArgs.length){var y=new Array(n);for(o=0;o<n;++o)y[o]="0";d.push(["index=[",y.join(","),"]"].join(""))}for(o=0;o<t.offsetArgs.length;++o){var _=t.offsetArgs[o],v=[];for(p=0;p<_.offset.length;++p)0!==_.offset[p]&&(1===_.offset[p]?v.push(["t",_.array,"p",p].join("")):v.push([_.offset[p],"*t",_.array,"p",p].join("")));0===v.length?d.push("q"+o+"=0"):d.push(["q",o,"=",v.join("+")].join(""))}var m=x([].concat(t.pre.thisVars).concat(t.body.thisVars).concat(t.post.thisVars));for(0<(d=d.concat(m)).length&&g.push("var "+d.join(",")),o=0;o<t.arrayArgs.length;++o)g.push("p"+o+"|=0");3<t.pre.body.length&&g.push(N(t.pre,t,i));var b=N(t.body,t,i),E=function(t){for(var e=0,n=t[0].length;e<n;){for(var r=1;r<t.length;++r)if(t[r][e]!==t[0][e])return e;++e}return e}(h);E<n?g.push(function(t,e,n,r){for(var i=e.length,o=n.arrayArgs.length,s=n.blockSize,a=0<n.indexArgs.length,u=[],l=0;l<o;++l)u.push(["var offset",l,"=p",l].join(""));for(l=t;l<i;++l)u.push(["for(var j"+l+"=SS[",e[l],"]|0;j",l,">0;){"].join("")),u.push(["if(j",l,"<",s,"){"].join("")),u.push(["s",e[l],"=j",l].join("")),u.push(["j",l,"=0"].join("")),u.push(["}else{s",e[l],"=",s].join("")),u.push(["j",l,"-=",s,"}"].join("")),a&&u.push(["index[",e[l],"]=j",l].join(""));for(l=0;l<o;++l){for(var h=["offset"+l],c=t;c<i;++c)h.push(["j",c,"*t",l,"p",e[c]].join(""));u.push(["p",l,"=(",h.join("+"),")"].join(""))}for(u.push(I(e,n,r)),l=t;l<i;++l)u.push("}");return u.join("\n")}(E,h[0],t,b)):g.push(I(h[0],t,b)),3<t.post.body.length&&g.push(N(t.post,t,i)),t.debug;var w=[t.funcName||"unnamed","_cwise_loop_",r[0].join("s"),"m",E,function(t){for(var e=new Array(t.length),n=!0,r=0;r<t.length;++r){var i=t[r],o=i.match(/\d+/);o=o?o[0]:"",0===i.charAt(0)?e[r]="u"+i.charAt(1)+o:e[r]=i.charAt(0)+o,0<r&&(n=n&&e[r]===e[r-1])}return n?e[0]:e.join("")}(i)].join("");return new Function(["function ",w,"(",f.join(","),"){",g.join("\n"),"} return ",w].join(""))()}},function(e,t,n){(function(l){var h=n(58);function t(e,n,t){e=e||function(t){this.queue(t)},n=n||function(){this.queue(null)};var r=!1,i=!1,o=[],s=!1,a=new h;function u(){for(;o.length&&!a.paused;){var t=o.shift();if(null===t)return a.emit("end");a.emit("data",t)}}return a.readable=a.writable=!0,a.paused=!1,a.autoDestroy=!(t&&!1===t.autoDestroy),a.write=function(t){return e.call(this,t),!a.paused},a.queue=a.push=function(t){return s||(null===t&&(s=!0),o.push(t),u()),a},a.on("end",function(){a.readable=!1,!a.writable&&a.autoDestroy&&l.nextTick(function(){a.destroy()})}),a.end=function(t){if(!r)return r=!0,arguments.length&&a.write(t),a.writable=!1,n.call(a),!a.readable&&a.autoDestroy&&a.destroy(),a},a.destroy=function(){if(!i)return r=i=!0,o.length=0,a.writable=a.readable=!1,a.emit("close"),a},a.pause=function(){if(!a.paused)return a.paused=!0,a},a.resume=function(){return a.paused&&(a.paused=!1,a.emit("resume")),u(),a.paused||a.emit("drain"),a},a}e.exports=t,t.through=t}).call(this,n(2))},function(t,e,n){t.exports=r;var h=n(12).EventEmitter;function r(){h.call(this)}n(4)(r,h),r.Readable=n(13),r.Writable=n(66),r.Duplex=n(67),r.Transform=n(68),r.PassThrough=n(69),(r.Stream=r).prototype.pipe=function(e,t){var n=this;function r(t){e.writable&&!1===e.write(t)&&n.pause&&n.pause()}function i(){n.readable&&n.resume&&n.resume()}n.on("data",r),e.on("drain",i),e._isStdio||t&&!1===t.end||(n.on("end",s),n.on("close",a));var o=!1;function s(){o||(o=!0,e.end())}function a(){o||(o=!0,"function"==typeof e.destroy&&e.destroy())}function u(t){if(l(),0===h.listenerCount(this,"error"))throw t}function l(){n.removeListener("data",r),e.removeListener("drain",i),n.removeListener("end",s),n.removeListener("close",a),n.removeListener("error",u),e.removeListener("error",u),n.removeListener("end",l),n.removeListener("close",l),e.removeListener("close",l)}return n.on("error",u),e.on("error",u),n.on("end",l),n.on("close",l),e.on("close",l),e.emit("pipe",n),e}},function(t,e){},function(t,e,n){"use strict";var a=n(9).Buffer,r=n(61);t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};0<this.length?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n},t.prototype.concat=function(t){if(0===this.length)return a.alloc(0);if(1===this.length)return this.head.data;for(var e,n,r,i=a.allocUnsafe(t>>>0),o=this.head,s=0;o;)e=o.data,n=i,r=s,e.copy(n,r),s+=o.data.length,o=o.next;return i},t}(),r&&r.inspect&&r.inspect.custom&&(t.exports.prototype[r.inspect.custom]=function(){var t=r.inspect({length:this.length});return this.constructor.name+" "+t})},function(t,e){},function(t,i,o){(function(t){var e=void 0!==t&&t||"undefined"!=typeof self&&self||window,n=Function.prototype.apply;function r(t,e){this._id=t,this._clearFn=e}i.setTimeout=function(){return new r(n.call(setTimeout,e,arguments),clearTimeout)},i.setInterval=function(){return new r(n.call(setInterval,e,arguments),clearInterval)},i.clearTimeout=i.clearInterval=function(t){t&&t.close()},r.prototype.unref=r.prototype.ref=function(){},r.prototype.close=function(){this._clearFn.call(e,this._id)},i.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},i.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},i._unrefActive=i.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;0<=e&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},o(63),i.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,i.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,o(1))},function(t,e,n){(function(t,g){!function(n,r){"use strict";if(!n.setImmediate){var i,o,e,s,t,a=1,u={},l=!1,h=n.document,c=Object.getPrototypeOf&&Object.getPrototypeOf(n);c=c&&c.setTimeout?c:n,i="[object process]"==={}.toString.call(n.process)?function(t){g.nextTick(function(){f(t)})}:function(){if(n.postMessage&&!n.importScripts){var t=!0,e=n.onmessage;return n.onmessage=function(){t=!1},n.postMessage("","*"),n.onmessage=e,t}}()?(s="setImmediate$"+Math.random()+"$",t=function(t){t.source===n&&"string"==typeof t.data&&0===t.data.indexOf(s)&&f(+t.data.slice(s.length))},n.addEventListener?n.addEventListener("message",t,!1):n.attachEvent("onmessage",t),function(t){n.postMessage(s+t,"*")}):n.MessageChannel?((e=new MessageChannel).port1.onmessage=function(t){f(t.data)},function(t){e.port2.postMessage(t)}):h&&"onreadystatechange"in h.createElement("script")?(o=h.documentElement,function(t){var e=h.createElement("script");e.onreadystatechange=function(){f(t),e.onreadystatechange=null,o.removeChild(e),e=null},o.appendChild(e)}):function(t){setTimeout(f,0,t)},c.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var r={callback:t,args:e};return u[a]=r,i(a),a++},c.clearImmediate=p}function p(t){delete u[t]}function f(t){if(l)setTimeout(f,0,t);else{var e=u[t];if(e){l=!0;try{!function(t){var e=t.callback,n=t.args;switch(n.length){case 0:e();break;case 1:e(n[0]);break;case 2:e(n[0],n[1]);break;case 3:e(n[0],n[1],n[2]);break;default:e.apply(r,n)}}(e)}finally{p(t),l=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,n(1),n(2))},function(t,e,n){(function(n){function r(t){try{if(!n.localStorage)return!1}catch(t){return!1}var e=n.localStorage[t];return null!=e&&"true"===String(e).toLowerCase()}t.exports=function(t,e){if(r("noDeprecation"))return t;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation"),n=!0}return t.apply(this,arguments)}}}).call(this,n(1))},function(t,e,n){"use strict";t.exports=o;var r=n(30),i=n(6);function o(t){if(!(this instanceof o))return new o(t);r.call(this,t)}i.inherits=n(4),i.inherits(o,r),o.prototype._transform=function(t,e,n){n(null,t)}},function(t,e,n){t.exports=n(14)},function(t,e,n){t.exports=n(3)},function(t,e,n){t.exports=n(13).Transform},function(t,e,n){t.exports=n(13).PassThrough},function(t,e,n){(function(u){t.exports=function(t){if(!/^data\:/i.test(t))throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');var e=(t=t.replace(/\r?\n/g,"")).indexOf(",");if(-1===e||e<=4)throw new TypeError("malformed data: URI");for(var n=t.substring(5,e).split(";"),r=!1,i="US-ASCII",o=0;o<n.length;o++)"base64"==n[o]?r=!0:0==n[o].indexOf("charset=")&&(i=n[o].substring(8));var s=unescape(t.substring(e+1)),a=new u(s,r?"base64":"ascii");return a.type=n[0]||"text/plain",a.charset=i,a}}).call(this,n(7).Buffer)},function(t,e,n){"use strict";n.r(e);var r=n(31),f=n(0),a=n(15),l=n(5);function i(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={};if(!r)return i;Object.keys(r).forEach(function(t){var e=r[t];"object"==typeof e?null===e?i[t]=null:e.length?i[t]=e.map(function(t){return t}):i[t]=n(e):i[t]=e});return i}(e.properties),n.geometry=o(e.geometry),n}function o(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?e.geometries=t.geometries.map(function(t){return o(t)}):e.coordinates=function e(t){if("object"!=typeof t[0])return t.slice();return t.map(function(t){return e(t)})}(t.coordinates),e}var u=function(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return i(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(function(t){return i(t)}),n;case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return o(t);default:throw new Error("unknown GeoJSON type")}var e,n};var h=function(t,e,n,r){if(r=r||{},!Object(f.isObject)(r))throw new Error("options is invalid");var i=r.units,o=r.properties;if(!t)throw new Error("origin is required");if(null==e)throw new Error("distance is required");if(null==n)throw new Error("bearing is required");if(!(0<=e))throw new Error("distance must be greater than 0");var s=Object(f.convertLength)(e,i,"meters"),a=Object(l.getCoord)(t),u=function(t,e,n,r){r=void 0===r?f.earthRadius:Number(r);var i=e/r,o=t[0]*Math.PI/180,s=Object(f.degreesToRadians)(t[1]),a=Object(f.degreesToRadians)(n),u=i*Math.cos(a),l=s+u;Math.abs(l)>Math.PI/2&&(l=0<l?Math.PI-l:-Math.PI-l);var h=Math.log(Math.tan(l/2+Math.PI/4)/Math.tan(s/2+Math.PI/4)),c=1e-11<Math.abs(h)?u/h:Math.cos(s),p=i*Math.sin(a)/c;return[(180*(o+p)/Math.PI+540)%360-180,180*l/Math.PI]}(a,s,n);return u[0]+=180<u[0]-a[0]?-360:180<a[0]-u[0]?360:0,Object(f.point)(u,o)};var c=function(t,n,r,e){if(e=e||{},!Object(f.isObject)(e))throw new Error("options is invalid");var i=e.units,o=e.zTranslation,s=e.mutate;if(!t)throw new Error("geojson is required");if(null==n||isNaN(n))throw new Error("distance is required");if(o&&"number"!=typeof o&&isNaN(o))throw new Error("zTranslation is not a number");if(o=void 0!==o?o:0,0===n&&0===o)return t;if(null==r||isNaN(r))throw new Error("direction is required");return n<0&&(n=-n,r=-r),!1!==s&&void 0!==s||(t=u(t)),Object(a.coordEach)(t,function(t){var e=Object(l.getCoords)(h(t,n,r,{units:i}));t[0]=e[0],t[1]=e[1],o&&3===t.length&&(t[2]+=o)}),t},s=n(10);var p=function(){for(var t=new s.GeoJSONReader,e=t.read(JSON.stringify(arguments[0].geometry)),n=1;n<arguments.length;n++)e=s.UnionOp.union(e,t.read(JSON.stringify(arguments[n].geometry)));return{type:"Feature",geometry:e=(new s.GeoJSONWriter).write(e),properties:arguments[0].properties}},g=n(32),d=n.n(g),y=n(18),_=n.n(y),v=(n(36),n(33)),m=n.n(v),b=n(11),E=n.n(b),w=n(19),I=n.n(w),N=n(20),x=n(17),S=n.n(x),C=n(16),L=n.n(C),T=n(34),R=n.n(T),O=n(35),P=n.n(O),M=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var n=[],r=!0,i=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(r=(s=a.next()).done)&&(n.push(s.value),!e||n.length!==e);r=!0);}catch(t){i=!0,o=t}finally{try{!r&&a.return&&a.return()}finally{if(i)throw o}}return n}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},A=function(){function r(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)}}return function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}}();function D(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}var F=window.THREE?window.THREE:r,k=function(){for(var t=[],e=0;e<4;e++)for(var n=0;n<4;n++)t.push([[127*n+n,512*(n+1)/4],[127*e+e,512*(e+1)/4]]);return t}(),B=new P.a({size:128}),G=function(t){for(var e=[[],[],[],[]],n=0;n<384;n+=3)e[0].push(n+1+t),e[1].push(n/3*384+1+t),e[2].push(n+1+49152-384+t),e[3].push(384*(n/3+1)-2+t);return e}(1),j=function(){function x(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,x);var e=Object.assign({},{unitsSide:1,tokenMapbox:"",apiVector:"mapbox-terrain-vector",apiRgb:"mapbox-terrain-rgb",apiSatellite:"mapbox-satellite"},t);this.constUnitsSide=e.unitsSide,this.tokenMapbox=e.tokenMapbox,this.apiVector=e.apiVector,this.apiRgb=e.apiRgb,this.apiSatellite=e.apiSatellite}return A(x,[{key:"projectCoord",value:function(t,e,n){return[this.constUnitsSide*((t[0]-e[0])/(n[0]-e[0])-.5),this.constUnitsSide*(-.5-(t[1]-n[1])/(n[1]-e[1]))]}},{key:"getProjection",value:function(n,t){var e=this,r=x.originRadiusToBbox(n,t),i=M(r,4),o=i[0],s=i[1],a=i[2],u=i[3],l=x.getUnitsPerMeter(this.constUnitsSide,t);return{proj:function(t){return e.projectCoord(t,[o,u],[a,s])},projInv:function(t,e){return x.projInv(t,e,n,l)},bbox:[o,s,a,u],unitsPerMeter:l}}},{key:"buildSliceGeometry",value:function(t,e,n,r,s,a,i){var u=this,l=new F.Shape,h=[new F.Geometry],o=e,c=x.getUnitsPerMeter(this.constUnitsSide,i),p=-r[o].ele*c;t[0].forEach(function(t,e){var n=u.projectCoord(t,s,a),r=M(n,2),i=r[0],o=r[1];h[0].vertices.push(new F.Vector3(-i,o,p)),0===e?l.moveTo(-i,o):l.lineTo(-i,o)});for(var f=1;f<t.length;f++){var g=new F.Path;h.push(new F.Geometry);for(var d=0;d<t[f].length;d++){var y=this.projectCoord(t[f][d],s,a),_=M(y,2),v=_[0],m=_[1];h[f].vertices.push(new F.Vector3(-v,m,p)),0===d?g.moveTo(-v,m):g.lineTo(-v,m)}l.holes.push(g)}var b=[];h.forEach(function(t,e){var n=new F.Line(h[0],new F.LineBasicMaterial({color:13421772}));n.rotation.y=Math.PI,n.name="dem-vec-line-"+r[o].ele+"-"+n.uuid,b.push(n)});var E=new F.ExtrudeGeometry(l,{depth:r[o+1]?c*(r[o+1].ele-r[o].ele):c*(r[o].ele-r[o-1].ele),bevelEnabled:!1}),w=new F.Mesh(E,new F.MeshBasicMaterial({color:n,wireframe:!1}));return w.rotation.y=Math.PI,w.position.z=-p,w.name="dem-vec-shade-"+r[o].ele+"-"+w.uuid,[b,w]}},{key:"getVectorDem",value:function(s,a,u,l){for(var t,e,n,r,i,h=this,c=(t=[2300184,15557462],e=s.length,r=(n=function(t){return[t>>16,(65280&t)>>8,255&t]})(t[0]),i=n(t[1]-t[0]),function(t){return(r[0]+Math.floor(t*i[0]/e)<<16)+(r[1]+Math.floor(t*i[1]/e)<<8)+(r[2]+Math.floor(t*i[2]/e))}),p=[],o=function(t,e){var n=h.buildSliceGeometry(t,e,c(e),s,a,u,l),r=M(n,2),i=r[0],o=r[1];i.forEach(function(t){p.push(t)}),p.push(o)},f=0;f<s.length;f++){var g=s[f].geometry.geometry;if("Polygon"===g.type)o(g.coordinates,f);else if("MultiPolygon"===g.type)for(var d=0;d<g.coordinates.length;d++)o(g.coordinates[d],f)}return p}},{key:"processRgbTile",value:function(t,p,e,f,n){var g=this,d=[];if(t)for(var r=void 0,i=void 0,o=void 0,s=0;s<t.data.length;s+=4)r=t.data[s],i=t.data[s+1],o=t.data[s+2],d.push(.1*(256*r*256+256*i+o)-1e4);else d=new Array(262144).fill(0);for(var a=[],u=0;u<4;u++)for(var l=0;l<4;l++)a.push([p[0]+2,4*p[1]+u,4*p[2]+l].join("/"));var y=e.map(function(t){return t.join("/")}),_=x.getUnitsPerMeter(this.constUnitsSide,n),v=[];return a.forEach(function(t,e){if(y.includes(t)){for(var n=x.deslash(t),r=k[e],i=[],o=r[0][0];o<r[0][1];o++)for(var s=r[1][0];s<r[1][1];s++)i.push(d[512*o+s]);for(var a=[],u=0,l=0;l<128;l++)for(var h=0;h<128;h++){var c=B.ll([128*n[1]+h,128*n[2]+l],n[0]);a.push.apply(a,D(g.projectCoord(c,f.northWest,f.southEast)).concat([i[u]*_])),u++}v.push([n,a,p])}}),v}},{key:"getRgbDem",value:function(l,h,c){var p=this;l.sort(function(t,e){return t[0].join("/")>e[0].join("/")?1:-1});var f=[],g=x.getDataEleIds(l);return l.forEach(function(t){var e=M(t,3),n=e[0],r=e[1],i=e[2];if(49152===r.length){var o=x.resolveSeams(r,x.getNeighborsInfo(l,g,n)),s=new F.PlaneBufferGeometry(1,1,o[0],o[1]);s.attributes.position.array=new Float32Array(r);var a=new F.Mesh(s,new F.MeshBasicMaterial({wireframe:!0,color:13421772}));a.name="dem-rgb-"+n.join("/");var u=function(t){return[t[1],t[2],t[0]]};a.userData.threeGeo={tile:u(n),srcDem:{tile:u(i),uri:x.getUriMapbox("","mapbox-terrain-rgb",i)}},f.push(a),x.resolveTex(n,h,p.tokenMapbox,function(t){t&&(a.material=new F.MeshBasicMaterial({side:F.FrontSide,map:t})),c&&c(a)})}}),f}},{key:"getRgbTiles",value:function(n,r,i,t,o,s,a){var u=this,l=x.getZoomposEle(n),h=[],c=0;l.forEach(function(e){x.fetchTile(e,t,u.tokenMapbox,function(t){t&&(h=h.concat(u.processRgbTile(t,e,n,r,i))),++c===l.length&&s&&s(u.getRgbDem(h,o,a))})})}},{key:"getVectorTiles",value:function(t,r,i,e,o){var s=this,a=x.getZoomposEle(t),u=[],l={type:"FeatureCollection",features:[]},h=0;a.forEach(function(n){x.fetchTile(n,e,s.tokenMapbox,function(t){if(t&&x.processVectorTile(t,n,l,u),++h===a.length){var e=x.processVectorGeojson(l,u,r.feature,i);o(s.getVectorDem(e,r.northWest,r.southEast,i))}})})}},{key:"getTerrain",value:function(t,e,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{},i=x.getBbox(t,e),o=x.getZoomposCovered(i.feature,n);r.onVectorDem&&this.getVectorTiles(o,i,e,this.apiVector,r.onVectorDem),r.onRgbDem&&this.getRgbTiles(o,i,e,this.apiRgb,this.apiSatellite,r.onRgbDem,r.onSatelliteMat)}},{key:"setApiVector",value:function(t){this.apiVector=t}},{key:"setApiRgb",value:function(t){this.apiRgb=t}},{key:"setApiSatellite",value:function(t){this.apiSatellite=t}}],[{key:"getEleList",value:function(t){return S()(t.features.map(function(t){return t.properties.ele})).sort(function(t,e){return t-e})}},{key:"addBottomEle",value:function(r,t,i){t.forEach(function(t){for(var e=t.properties.ele,n=i[0];n<e;n+=10)r.features.push({type:"Feature",geometry:t.geometry,properties:{ele:n}})})}},{key:"getContours",value:function(s,a,t,e){for(var u=[],n=function(t){var e=s[t],n=a.features.filter(function(t){return t.properties.ele===e});try{var r=f.featureCollection(n).features,i=r.reduce(function(t,e){return p(t,e)},r[0]);if(i){var o=d()(i.geometry);u.push({geometry:i,ele:e,area:o})}}catch(t){}},r=0;r<s.length;r++)n(r);return u}},{key:"getUnitsPerMeter",value:function(t,e){return t/(e*Math.pow(2,.5)*1e3)}},{key:"translate",value:function(t,e,n,r,i){var o=!(5<arguments.length&&void 0!==arguments[5])||arguments[5],s=new F.Vector2(e,n).divideScalar(i),a=90-180*s.angle()/Math.PI;return c(t,s.length(),a,{units:"meters",zTranslation:r/i,mutate:o})}},{key:"projInv",value:function(t,e,n,r){var i=function(t){return[t[1],t[0]]};return i(this.translate(f.point(i(n)),t,e,0,r).geometry.coordinates)}},{key:"bboxToWireframe",value:function(t,e){var n,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},i=Object.assign({},{offsetZ:0,color:52428,height:.001},r),o=M(t,4),s=o[0],a=o[1],u=o[2],l=o[3],h=e([(s+u)/2,(a+l)/2]),c=[].concat(D(e([s,l])),D(e([u,a]))),p=c[0],f=c[1],g=[c[2]-p,f-c[3]],d=i.height,y=new F.LineSegments(new F.EdgesGeometry(new(Function.prototype.bind.apply(F.BoxBufferGeometry,[null].concat(g,[d])))),new F.LineBasicMaterial({color:i.color}));return(n=y.position).set.apply(n,D(h).concat([-d/2+i.offsetZ])),y.name="bbox-"+window.performance.now(),{obj:y,offset:[].concat(D(h),[i.offsetZ]),size:[].concat(g,[i.height])}}},{key:"tileToBbox",value:function(t){return L.a.tileToBBOX(t)}},{key:"dumpBufferAsBlob",value:function(t,e){var n=new Blob([t],{type:"application/octet-stream"}),r=document.createElement("a");r.href=URL.createObjectURL(n),r.download=e,document.body.appendChild(r),r.click()}},{key:"blobToBuffer",value:function(t,n){var e=new FileReader;e.onload=function(t){var e=t.target.result;n(e)},e.readAsArrayBuffer(t)}},{key:"getUriOffline",value:function(t,e){return t+"-"+e.join("-")+".blob"}},{key:"getUriMapbox",value:function(t,e,n){var r=void 0,i=void 0;switch(e){case"mapbox-terrain-vector":r="https://api.mapbox.com/v4/mapbox.mapbox-terrain-v2",i=".vector.pbf";break;case"mapbox-terrain-rgb":r="https://api.mapbox.com/v4/mapbox.terrain-rgb",i="@2x.pngraw";break;case"mapbox-satellite":r="https://api.mapbox.com/v4/mapbox.streets-satellite",i="@2x.jpg70";break;default:return""}return r+"/"+n.join("/")+i+"?access_token="+t}},{key:"isAjaxSuccessful",value:function(t){return 200<=t&&t<300||304===t}},{key:"fetchTile",value:function(t,e,n,r){var i=this,o=e.startsWith("mapbox-"),s=o?this.getUriMapbox(n,e,t):this.getUriOffline(e,t);e.includes("mapbox-terrain-vector")?o?E()({uri:s,responseType:"arraybuffer"},function(t,e,n){!t&&i.isAjaxSuccessful(e.statusCode)?r(new N.VectorTile(new I.a(n))):r(null)}):E()({uri:s,responseType:"blob"},function(t,e,n){!t&&i.isAjaxSuccessful(e.statusCode)?i.blobToBuffer(n,function(t){try{var e=new I.a(t);r(new N.VectorTile(e))}catch(t){return void r(null)}}):r(null)}):(e.includes("mapbox-terrain-rgb")||e.includes("mapbox-satellite"))&&R()(s,function(t,e){r(t?null:e)})}},{key:"getZoomposCovered",value:function(t,e){var n={min_zoom:e,max_zoom:e};return m.a.tiles(t.geometry,n).map(function(t){var e=M(t,3),n=e[0],r=e[1];return[e[2],n,r]})}},{key:"getZoomposEle",value:function(t){var n={};return t.forEach(function(t){var e=[t[0]-2,Math.floor(t[1]/4),Math.floor(t[2]/4)];n[e]?n[e].push(t):n[e]=[t]}),Object.keys(n).map(function(t){return t.split(",").map(function(t){return parseFloat(t)})})}},{key:"processVectorTile",value:function(e,r,i,o){if(e.layers.contour)for(var t=function(t){var n=e.layers.contour.feature(t).toGeoJSON(r[1],r[2],r[0]);0===t&&o.push(n),"MultiPolygon"===n.geometry.type?n.geometry.coordinates.forEach(function(t){var e={type:"Feature",properties:{ele:n.properties.ele},geometry:{type:"Polygon",coordinates:t}};i.features.push(e)}):i.features.push(n)},n=0;n<e.layers.contour.length;n++)t(n)}},{key:"processVectorGeojson",value:function(t,e,n,r){var i=this.getEleList(t);this.addBottomEle(t,e,i);var o=r*r*2*1e6;return this.getContours(i,t,n,o)}},{key:"deslash",value:function(t){return t.split("/").map(function(t){return parseInt(t)})}},{key:"stitchWithNei2",value:function(t,e){for(var n=0;n<128;n++){var r=G[2][n]+384,i=G[0][n];t[r-2]=e[i-2],t[r-1]=e[i-1],t[r]=e[i]}}},{key:"stitchWithNei3",value:function(t,e){for(var n=0;n<128;n++){var r=G[3][n]+3*(1+n),i=G[1][n];t.splice(r-2,0,e[i-2]),t.splice(r-1,0,e[i-1]),t.splice(r,0,e[i])}}},{key:"resolveSeams",value:function(i,t){var o=this,s=[127,127];if(Object.entries(t).forEach(function(t){var e=M(t,2),n=e[0],r=e[1];"2"===n?(o.stitchWithNei2(i,r),s[1]++):"3"===n&&(o.stitchWithNei3(i,r),s[0]++)}),128===s[0]&&128===s[1]){var e=t[6];if(e)i.push(e[0],e[1],e[2]);else{var n=i.length;i.push(i[n-3],i[n-2],i[n-1])}}return s}},{key:"getNeighbors8",value:function(n){var r=[];return[[0,0,-1],[0,-1,0],[0,0,1],[0,1,0],[0,-1,-1],[0,-1,1],[0,1,1],[0,1,-1]].forEach(function(t){var e=t.map(function(t,e){return t+n[e]});r.push(e)}),r}},{key:"getDataEleIds",value:function(t){var n={};return t.forEach(function(t,e){n[t[0].join("/")]=e}),n}},{key:"getNeighborsInfo",value:function(i,o,t){var s={};return this.getNeighbors8(t).forEach(function(t,e){var n=t.join("/");if(n in o){var r=i[o[n]][1];s[e]=r}}),s}},{key:"resolveTex",value:function(t,e,n,r){this.fetchTile(t,e,n,function(t){var e=null;t&&((e=new F.DataTexture(t.data,t.shape[0],t.shape[1],F.RGBAFormat)).flipY=!0,e.needsUpdate=!0),r&&r(e)})}},{key:"originRadiusToBbox",value:function(t,e){var n=function(t){return[t[1],t[0]]},r=M(_()(f.point(n(t)),e,-45,{units:"kilometers"}).geometry.coordinates,2),i=r[0],o=r[1],s=M(_()(f.point(n(t)),e,135,{units:"kilometers"}).geometry.coordinates,2),a=s[0];return[i,s[1],a,o]}},{key:"getBbox",value:function(t,e){var n={type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[]]}},r=this.originRadiusToBbox(t,e),i=M(r,4),o=i[0],s=i[1],a=i[2],u=[o,i[3]],l=[a,s];return n.geometry.coordinates[0]=[u,[l[0],u[1]],l,[u[0],l[1]],u],{feature:n,northWest:u,southEast:l}}}]),x}();e.default=j}]).default;
      exports.default = ThreeGeo;
      Object.defineProperty(exports, '__esModule', { value: true });
  })));