!function(t){var e={};function n®{if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){“undefined”!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:“Module”}),Object.defineProperty(t,“__esModule”,{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&“object”==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r®,Object.defineProperty(r,“default”,{enumerable:!0,value:t}),2&e&&“string”!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,“a”,e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p=“”,n(n.s=0)}([function(t,e,n){(function(t){const e=n(2);t.turf=e,t.turfAPIs=()=>Object.keys(e).filter(t=>e[t].constructor===Function)}).call(this,n(1))},function(t,e){var n;n=function(){return this}();try{n=n||new Function(“return this”)()}catch(t){“object”==typeof window&&(n=window)}t.exports=n},function(t,e,n){!function(t){“use strict”;function e(t,e,n){if(!I(n=n||{}))throw new Error(“options is invalid”);var r=n.bbox,i=n.id;if(void 0===t)throw new Error(“geometry is required”);if(e&&e.constructor!==Object)throw new Error(“properties must be an Object”);r&&N®,i&&C(i);var o={type:“Feature”};return i&&(o.id=i),r&&(o.bbox=r),o.properties=e||{},o.geometry=t,o}function n(t,e,n){if(!I(n=n||{}))throw new Error(“options is invalid”);var i,s=n.bbox;if(!t)throw new Error(“type is required”);if(!e)throw new Error(“coordinates is required”);if(!Array.isArray(e))throw new Error(“coordinates must be an Array”);switch(s&&N(s),t){case“Point”:i=r(e).geometry;break;case“LineString”:i=a(e).geometry;break;case“Polygon”:i=o(e).geometry;break;case“MultiPoint”:i=l(e).geometry;break;case“MultiLineString”:i=h(e).geometry;break;case“MultiPolygon”:i=p(e).geometry;break;default:throw new Error(t+“ is invalid”)}return s&&(i.bbox=s),i}function r(t,n,r){if(!t)throw new Error(“coordinates is required”);if(!Array.isArray(t))throw new Error(“coordinates must be an Array”);if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!b(t[0])||!b(t[1]))throw new Error("coordinates must contain numbers");return e({type:"Point",coordinates:t},n,r)}function i(t,e,n){if(!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");return c(t.map((function(t){return r(t,e)})),n)}function o(t,n,r){if(!t)throw new Error("coordinates is required");for(var i=0;i=0))throw new Error(“precision must be a positive number”);var n=Math.pow(10,e||0);return Math.round(t*n)/n}function d(t,e){if(null==t)throw new Error(“radians is required”);if(e&&“string”!=typeof e)throw new Error(“units must be a string”);var n=bo[e||“kilometers”];if(!n)throw new Error(e+“ units is invalid”);return t*n}function y(t,e){if(null==t)throw new Error(“distance is required”);if(e&&“string”!=typeof e)throw new Error(“units must be a string”);var n=bo[e||“kilometers”];if(!n)throw new Error(e+“ units is invalid”);return t/n}function _(t,e){return v(y(t,e))}function m(t){if(null==t)throw new Error(“bearing is required”);var e=t%360;return e<0&&(e+=360),e}function v(t){if(null==t)throw new Error("radians is required");return t%(2*Math.PI)*180/Math.PI}function x(t){if(null==t)throw new Error("degrees is required");return t%360*Math.PI/180}function E(t,e,n){if(null==t)throw new Error("length is required");if(!(t>=0))throw new Error(“length must be a positive number”);return d(y(t,e),n||“kilometers”)}function w(t,e,n){if(null==t)throw new Error(“area is required”);if(!(t>=0))throw new Error(“area must be a positive number”);var r=No[e||“meters”];if(!r)throw new Error(“invalid original units”);var i=No[n||“kilometers”];if(!i)throw new Error(“invalid final units”);return t/r*i}function b(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function I(t){return!!t&&t.constructor===Object}function N(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(!b(t))throw new Error(“bbox must only contain numbers”)}))}function C(t){if(!t)throw new Error(“id is required”);if(-1===[“string”,“number”].indexOf(typeof t))throw new Error(“id must be a number or a string”)}function S(t,e,n){if(null!==t)for(var r,i,o,s,a,u,c,h,l=0,p=0,f=t.type,g=“FeatureCollection”===f,d=“Feature”===f,y=g?t.features.length:1,_=0;_t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]1&&b(e[0])&&b(e[1]))return e;throw new Error(“Coordinate is not a valid Point”)}function U(t){if(!t)throw new Error(“obj is required”);var e;if(t.length?e=t:t.coordinates?e=t.coordinates:t.geometry&&t.geometry.coordinates&&(e=t.geometry.coordinates),e)return Y(e),e;throw new Error(“No valid coordinates”)}function Y(t){if(t.length>1&&b(t[0])&&b(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return Y(t[0]);throw new Error(“coordinates must only contain numbers”)}function V(t,e,n){if(!e||!n)throw new Error(“type and name required”);if(!t||t.type!==e)throw new Error(“Invalid input to ”n“: must be a ”e“, given ”+t.type)}function H(t,e,n){if(!t)throw new Error(“No feature passed”);if(!n)throw new Error(“.featureOf() requires a name”);if(!t||“Feature”!==t.type||!t.geometry)throw new Error(“Invalid input to ”n“, Feature with geometry required”);if(!t.geometry||t.geometry.type!==e)throw new Error(“Invalid input to ”n“: must be a ”e“, given ”+t.geometry.type)}function W(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;rn“, Feature with geometry required”);if(!i.geometry||i.geometry.type!==e)throw new Error(“Invalid input to ”n“: must be a ”e“, given ”+i.geometry.type)}}function J(t){if(!t)throw new Error(“geojson is required”);if(void 0!==t.geometry)return t.geometry;if(t.coordinates||t.geometries)return t;throw new Error(“geojson must be a valid Feature or Geometry Object”)}function Z(){throw new Error(“invariant.getGeomType has been deprecated in v5.0 in favor of invariant.getType”)}function K(t,e){if(!t)throw new Error((e||“geojson”)+“ is required”);if(t.geometry&&t.geometry.type)return t.geometry.type;if(t.type)return t.type;throw new Error((e||“geojson”)+“ is invalid”)}function Q(t,e,n){n=n||{};for(var r=Object.keys(Lo),i=0;i=0&&d>=0&&d=0;h–)if(Math.abs(e[h][0][0]-u)<=1e-7&&Math.abs(e[h][0][1]-c)<=1e-7){for(var l=s.path.length-2;l>=0;–l)e[h].unshift(s.path[l]);a=!0;break}a||(e[n++]=s.path)}}))})),e}(function(t,e){for(var n=t.length-1,r=t[0].length-1,i={rows:n,cols:r,cells:[]},o=0;o=e?8:0,a|=c>=e?4:0,a|=h>=e?2:0;var p,f,g,d,y=!1;if(5==(a|=l>=e?1:0)||10===a){var _=(u+c+h+l)/4;5===a&&_=t.minX&&e.maxY>=t.minY}function gt(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function dt(t,e,n,r,i){for(var o,s=[e,n];s.length;)(n=s.pop())-(e=s.pop())<=r||(o=e+Math.ceil((n-e)/r/2)*r,Oo(t,o,e,n,i),s.push(e,o,o,n))}function yt(t,e){return t(e={exports:{}},e.exports),e.exports}function _t(t,e){if(!(this instanceof _t))return new _t(t,e);if(this.data=t||[],this.length=this.data.length,this.compare=e||function(t,e){return te?1:0},this.length>0)for(var n=(this.length>>1)-1;n>=0;n–)this._down(n)}function mt(t,e,n){e=Math.max(0,void 0===e?2:e),n=n||0;for(var r,i=function(t){for(var e=t[0],n=t[0],r=t[0],i=t[0],o=0;or[0]&&(r=s),s[1]i[1]&&(i=s)}var a=[e,n,r,i],u=a.slice();for(o=0;oo||a.push({node:h,dist:l})}for(;a.length&&!a.peek().node.children;){var p=a.pop(),f=p.node,g=Nt(f,e,n),d=Nt(f,r,i);if(p.dist=e.minX&&t[0]<=e.maxX&&t[1]>=e.minY&&t[1]<=e.maxY}function Et(t,e,n){for(var r=Math.min(t[0],e[0]),i=Math.min(t[1],e[1]),o=Math.max(t[0],e[0]),s=Math.max(t[1],e[1]),a=n.search({minX:r,minY:i,maxX:o,maxY:s}),u=0;u0!=Yo(t,e,r)>0&&Yo(n,r,t)>0!=Yo(n,r,e)>0}(a[u].p,a[u].next.p,t,e))return!1;return!0}function wt(t){var e=t.p,n=t.next.p;return t.minX=Math.min(e[0],n[0]),t.minY=Math.min(e[1],n[1]),t.maxX=Math.max(e[0],n[0]),t.maxY=Math.max(e[1],n[1]),t}function bt(t,e){var n={p:t,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return e?(n.next=e.next,n.prev=e,e.next.prev=n,e.next=n):(n.prev=n,n.next=n),n}function It(t,e){var n=t[0]-e[0],r=t[1]-e[1];return n*n+r*r}function Nt(t,e,n){var r=e[0],i=e[1],o=n[0]-r,s=n[1]-i;if(0!==o||0!==s){var a=((t[0]-r)*o+(t[1]-i)*s)/(o*o+s*s);a>1?(r=n[0],i=n[1]):a>0&&(r+=o*a,i+=s*a)}return(o=t[0]-r)*o+(s=t[1]-i)*s}function Ct(t,e,n,r,i,o,s,a){var u,c,h,l,p=n-t,f=r-e,g=s-i,d=a-o,y=t-i,_=e-o,m=p*p+f*f,v=p*g+f*d,x=g*g+d*d,E=p*y+f*_,w=g*y+d*_,b=m*x-v*v,I=b,N=b;0===b?(c=0,I=1,l=w,N=x):(l=m*w-v*E,(c=v*w-x*E)<0?(c=0,l=w,N=x):c>I&&(c=I,l=w+v,N=x)),l<0?(l=0,-E<0?c=0:-E>m?c=I:(c=-E,I=m)):l>N&&(l=N,-E+v<0?c=0:-E+v>m?c=I:(c=-E+v,I=m));var C=(1-(h=0===l?0:l/N))*i+h*s-((1-(u=0===c?0:c/I))*t+u*n),S=(1-h)*o+h*a-((1-u)*e+u*r);return C*C+S*S}function St(t,e){if(!I(e=e||{}))throw new Error(“options is invalid”);var n=e.concavity||1/0,r=[];if(S(t,(function(t){r.push([t[0],t[1]])})),!r.length)return null;var i=Vo(r,n);return i.length>3?o([i]):null}function Mt(t,e,n){if(“object”!=typeof(n=n||{}))throw new Error(“options is invalid”);var r=n.ignoreBoundary;if(!t)throw new Error(“point is required”);if(!e)throw new Error(“polygon is required”);var i=X(t),o=U(e),s=e.geometry?e.geometry.type:e.type,a=e.bbox;if(a&&!1===function(t,e){return e[0]<=t[0]&&e[1]<=t[1]&&e[2]>=t[0]&&e[3]>=t[1]}(i,a))return!1;“Polygon”===s&&(o=[o]);for(var u=0,c=!1;ut[1]!=c>t[1]&&t[0]<(u-s)*(t[1]-a)/(c-a)+s&&(r=!r)}return r}function Pt(t,e){var n=[];return A(e,(function(e){O(t,(function(t){Mt(t,e)&&n.push(t)}))})),c(n)}function Ot(t,e){if("FeatureCollection"!==t.type)throw new Error("points must be a FeatureCollection");var n=!1;return c(function(t){if(t.length<3)return[];t.sort(Tt);for(var e,n,r,i,o,s,a=t.length-1,u=t[a].x,c=t[0].x,h=t[a].y,l=h;a--;)t[a].yl&&(l=t[a].y);var p,f=c-u,g=l-h,d=f>g?f:g,y=.5*(c+u),_=.5*(l+h),m=[new Rt({x:y-20*d,y:_-d,__sentinel:!0},{x:y,y:_+20*d,__sentinel:!0},{x:y+20*d,y:_-d,__sentinel:!0})],v=[],x=[];for(a=t.length;a–;){for(x.length=0,p=m.length;p–;)(f=t[a].x-m[p].x)>0&&f*f>m[p].r?(v.push(m[p]),m.splice(p,1)):f*f+(g=t[a].y-m[p].y)*g>m[p].r||(x.push(m[p].a,m[p].b,m[p].b,m[p].c,m[p].c,m[p].a),m.splice(p,1));for(At(x),p=x.length;p;)n=x[–p],e=x[–p],r=t[a],i=n.x-e.x,o=n.y-e.y,s=2*(i*(r.y-n.y)-o*(r.x-n.x)),Math.abs(s)>1e-12&&m.push(new Rt(e,n,r))}for(Array.prototype.push.apply(v,m),a=v.length;a–;)(v[a].a.__sentinel||v[a].b.__sentinel||v[a].c.__sentinel)&&v.splice(a,1);return v}(t.features.map((function(t){var r={x:t.geometry.coordinates[0],y:t.geometry.coordinates[1]};return e?r.z=t.properties[e]:3===t.geometry.coordinates.length&&(n=!0,r.z=t.geometry.coordinates[2]),r}))).map((function(t){var e=[t.a.x,t.a.y],r=[t.b.x,t.b.y],i=[t.c.x,t.c.y],s={};return n?(e.push(t.a.z),r.push(t.b.z),i.push(t.c.z)):s={a:t.a.z,b:t.b.z,c:t.c.z},o([[e,r,i,e]],s)})))}function Rt(t,e,n){this.a=t,this.b=e,this.c=n;var r,i,o=e.x-t.x,s=e.y-t.y,a=n.x-t.x,u=n.y-t.y,c=o*(t.x+e.x)+s*(t.y+e.y),h=a*(t.x+n.x)+u*(t.y+n.y),l=2*(o*(n.y-e.y)-s*(n.x-e.x));this.x=(u*c-s*h)/l,this.y=(o*h-a*c)/l,r=this.x-t.x,i=this.y-t.y,this.r=r*r+i*i}function Tt(t,e){return e.x-t.x}function At(t){var e,n,r,i,o,s=t.length;t:for(;s;)for(n=t[–s],e=t[–s],r=s;r;)if(o=t[–r],i=t[–r],e===i&&n===o||e===o&&n===i){t.splice(s,2),t.splice(r,2),s-=2;continue t}}function Dt(t,e,n){if(!I(n=n||{}))throw new Error(“options is invalid”);var r=n.units,i=X(t),o=X(e),s=x(o[1]-i[1]),a=x(o[0]-i[0]),u=x(i[1]),c=x(o[1]),h=Math.pow(Math.sin(s/2),2)+Math.pow(Math.sin(a/2),2)*Math.cos(u)*Math.cos©;return d(2*Math.atan2(Math.sqrt(h),Math.sqrt(1-h)),r)}function Ft(t){if(!t)throw new Error(“geojson is required”);switch(t.type){case“Feature”:return qt(t);case“FeatureCollection”:return function(t){var e={type:“FeatureCollection”};return Object.keys(t).forEach((function(n){switch(n){case“type”:case“features”:return;default:e[n]=t[n]}})),e.features=t.features.map((function(t){return qt(t)})),e}(t);case“Point”:case“LineString”:case“Polygon”:case“MultiPoint”:case“MultiLineString”:case“MultiPolygon”:case“GeometryCollection”:return Gt(t);default:throw new Error(“unknown GeoJSON type”)}}function qt(t){var e={type:“Feature”};return Object.keys(t).forEach((function(n){switch(n){case“type”:case“properties”:case“geometry”:return;default:e[n]=t[n]}})),e.properties=function t(e){var n={};return e?(Object.keys(e).forEach((function®{var i=e[r];“object”==typeof i?null===i?n[r]=null:i.length?n[r]=i.map((function(t){return t})):n[r]=t(i):n[r]=i})),n):n}(t.properties),e.geometry=Gt(t.geometry),e}function Gt(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),“GeometryCollection”===t.type?(e.geometries=t.geometries.map((function(t){return Gt(t)})),e):(e.coordinates=function t(e){return“object”!=typeof e[0]?e.slice():e.map((function(e){return t(e)}))}(t.coordinates),e)}function Bt(t,e){function n(t,e){e.length&&e.pop();for(var n=u[t<0?~t:t],r=0,i=n.length;r1)for(var s,a,u=1,c=r(o[0]);uc&&(a=o[0],o[0]=o[u],o[u]=a,c=s);return o}))}}function zt(t,e,n){for(var r,i=e+(n—e>>1);e=Math.abs(h)?c>0?o<=r&&r<=a:a<=r&&r<=o:h>0?s<=i&&i<=u:u<=i&&i<=s)}(n,i=e[a+1],r)||o.push(r);return o.push(i),o}function Kt(t,e){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r}function Qt(t,e,n){var r=e.x,i=e.y,o=n.x-r,s=n.y-i;if(0!==o||0!==s){var a=((t.x-r)*o+(t.y-i)*s)/(o*o+s*s);a>1?(r=n.x,i=n.y):a>0&&(r+=o*a,i+=s*a)}return(o=t.x-r)*o+(s=t.y-i)*s}function $t(t,e,n){if(t.length<=2)return t;var r=void 0!==e?e*e:1;return function(t,e){var n=t.length-1,r=[t[0]];return function t(e,n,r,i,o){for(var s,a=i,u=n+1;ua&&(s=u,a=c)}a>i&&(s-n>1&&t(e,n,s,i,o),o.push(e[s]),r-s>1&&t(e,s,r,i,o))}(t,0,n,e,r),r.push(t[n]),r}(t=n?t:function(t,e){for(var n,r=t[0],i=[r],o=1,s=t.length;oe&&(i.push(n),r=n);return r!==n&&i.push(n),i}(t,r),r)}function te(t,e,n){return $t(t.map((function(t){return{x:t[0],y:t[1],z:t[2]}})),e,n).map((function(t){return t.z?[t.x,t.y,t.z]:[t.x,t.y]}))}function ee(t,e,n){return t.map((function(t){var r=t.map((function(t){return{x:t[0],y:t[1]}}));if(r.length<4)throw new Error("invalid polygon");for(var i=$t(r,e,n).map((function(t){return[t.x,t.y]}));!function(t){return!(t.length<3||3===t.length&&t[2][0]===t[0][0]&&t[2][1]===t[0][1])}(i);)i=$t(r,e-=.01*e,n).map((function(t){return[t.x,t.y]}));return i[i.length-1][0]===i[0][0]&&i[i.length-1][1]===i[0][1]||i.push(i[0]),i}))}function ne(t,e){if(!I(e=e||{}))throw new Error("options is invalid");var n=e.resolution||1e4,r=e.sharpness||.85;if(!t)throw new Error("line is required");if(!b(n))throw new Error("resolution must be an number");if(!b(r))throw new Error("sharpness must be an number");for(var i=[],o=new as({points:J(t).coordinates.map((function(t){return{x:t[0],y:t[1]}})),duration:n,sharpness:r}),s=0;s=Dt(t.slice(0,2),[e,i])){var o=(n+i)/2;return[e,o-(r-e)/2,r,o+(r-e)/2]}var s=(e+r)/2;return[s-(i-n)/2,n,s+(i-n)/2,i]}function se(t,e,n,i){if(!I(i=i||{}))throw new Error(“options is invalid”);var o=i.units,s=i.properties,a=X(t),u=x(a[0]),c=x(a[1]),h=x(n),l=y(e,o),p=Math.asin(Math.sin©*Math.cos(l)+Math.cos©*Math.sin(l)*Math.cos(h));return r([v(u+Math.atan2(Math.sin(h)*Math.sin(l)*Math.cos©,Math.cos(l)-Math.sin©*Math.sin(p))),v(p)],s)}function ae(t,e,n){var r=(n=n||{}).steps||64,i=n.properties;if(!t)throw new Error(“center is required”);if(!e)throw new Error(“radius is required”);if(“object”!=typeof n)throw new Error(“options must be an object”);if(“number”!=typeof r)throw new Error(“steps must be a number”);r=r||64,i=i||t.properties||{};for(var s=[],a=0;a=r.next.y&&r.next.y!==r.y){var a=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=i&&a>s){if(s=a,a===i){if(o===r.y)return r;if(o===r.next.y)return r.next}n=r.x=r.x&&r.x>=h&&i!==r.x&&_e(on.x)&&Ee(r,t)&&(n=r,p=u),r=r.next;return n}(t,e)){var n=we(e,t);ge(n,n.next)}}(a[i],n),n=ge(n,n.next);return n}(t,e,p,n)),t.length>80*n){r=o=t[0],i=s=t[1];for(var g=n;go&&(o=a),u>s&&(s=u);c=0!==(c=Math.max(o-r,s-i))?1/c:0}return function t(e,n,r,i,o,s,a){if(e){!a&&s&&function(t,e,n,r){var i=t;do{null===i.z&&(i.z=ye(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,n,r,i,o,s,a,u,c=1;do{for(n=t,t=null,o=null,s=0;n;){for(s++,r=n,a=0,e=0;e0||u>0&&r;)0!==a&&(0===u||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,u--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=r}o.nextZ=null,c*=2}while(s>1)}(i)}(e,i,o,s);for(var u,c,h=e;e.prev!==e.next;)if(u=e.prev,c=e.next,s?function(t,e,n,r){var i=t.prev,o=t,s=t.next;if(me(i,o,s)>=0)return!1;for(var a=i.xo.x?i.x>s.x?i.x:s.x:o.x>s.x?o.x:s.x,h=i.y>o.y?i.y>s.y?i.y:s.y:o.y>s.y?o.y:s.y,l=ye(a,u,e,n,r),p=ye(c,h,e,n,r),f=t.nextZ;f&&f.z<=p;){if(f!==t.prev&&f!==t.next&&_e(i.x,i.y,o.x,o.y,s.x,s.y,f.x,f.y)&&me(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(f=t.prevZ;f&&f.z>=l;){if(f!==t.prev&&f!==t.next&&_e(i.x,i.y,o.x,o.y,s.x,s.y,f.x,f.y)&&me(f.prev,f,f.next)>=0)return!1;f=f.prevZ}return!0}(e,i,o,s):function(t){var e=t.prev,n=t,r=t.next;if(me(e,n,r)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(_e(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&me(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}(e))n.push(u.i/r),n.push(e.i/r),n.push(c.i/r),Ie(e),e=c.next,h=c.next;else if((e=c)===h){a?1===a?t(e=function(t,e,n){var r=t;do{var i=r.prev,o=r.next.next;!ve(i,o)&&xe(i,r,r.next,o)&&Ee(i,o)&&Ee(o,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(o.i/n),Ie®,Ie(r.next),r=t=o),r=r.next}while(r!==t);return r}(e,n,r),n,r,i,o,s,2):2===a&&function(e,n,r,i,o,s){var a=e;do{for(var u=a.next.next;u!==a.prev;){if(a.i!==u.i&&function(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&xe(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&Ee(t,e)&&Ee(e,t)&&function(t,e){var n=t,r=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)}(a,u)){var c=we(a,u);return a=ge(a,a.next),c=ge(c,c.next),t(a,n,r,i,o,s),void t(c,n,r,i,o,s)}u=u.next}a=a.next}while(a!==e)}(e,n,r,i,o,s):t(ge(e),n,r,i,o,s,1);break}}}(p,f,n,r,i,c),f}function fe(t,e,n,r,i){var o,s;if(i===Ce(t,e,n,r)>0)for(o=e;o=e;o-=r)s=be(o,t[o],t[o+1],s);return s&&ve(s,s.next)&&(Ie(s),s=s.next),s}function ge(t,e){if(!t)return t;e||(e=t);var n,r=t;do{if(n=!1,r.steiner||!ve(r,r.next)&&0!==me(r.prev,r,r.next))r=r.next;else{if(Ie®,(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function de(t,e){return t.x-e.x}function ye(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function _e(t,e,n,r,i,o,s,a){return(i-s)*(e-a)-(t-s)*(o-a)>=0&&(t-s)*(r-a)-(n-s)*(e-a)>=0&&(n-s)*(o-a)-(i-s)*(r-a)>=0}function me(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function ve(t,e){return t.x===e.x&&t.y===e.y}function xe(t,e,n,r){return!!(ve(t,e)&&ve(n,r)||ve(t,r)&&ve(n,e))||me(t,e,n)>0!=me(t,e,r)>0&&me(n,r,t)>0!=me(n,r,e)>0}function Ee(t,e){return me(t.prev,t,t.next)<0?me(t,e,t.next)>=0&&me(t,t.prev,e)>=0:me(t,e,t.prev)<0||me(t,t.next,e)<0}function we(t,e){var n=new Ne(t.i,t.x,t.y),r=new Ne(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function be(t,e,n,r){var i=new Ne(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Ie(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Ne(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Ce(t,e,n,r){for(var i=0,o=e,s=n-r;o0&&(r+=t[i-1].length,n.holes.push®)}return n}(t),n=us(e.vertices,e.holes,2),r=[],i=[];n.forEach((function(t,r){var o=n[r];i.push([e.vertices[2*o],e.vertices[2*o+1]])}));for(var s=0;sr;){if(i-r>600){var s=i-r+1,a=n-r+1,u=Math.log(s),c=.5*Math.exp(2*u/3),h=.5*Math.sqrt(u*c*(s-c)/s)*(a-s/2<0?-1:1);t(e,n,Math.max(r,Math.floor(n-a*c/s+h)),Math.min(i,Math.floor(n+(s-a)*c/s+h)),o)}var l=e[n],p=r,f=i;for(Pe(e,r,n),o(e[i],l)>0&&Pe(e,r,i);p0;)f–}0===o(e[r],l)?Pe(e,r,f):Pe(e,++f,i),f<=n&&(r=f+1),n<=f&&(i=f-1)}}(t,e,n||0,r||t.length-1,i||function(t,e){return te?1:0})}function Pe(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function Oe(t,e){if(!(this instanceof Oe))return new Oe(t,e);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),e&&this._initFormat(e),this.clear()}function Re(t,e){Te(t,0,t.children.length,e,t)}function Te(t,e,n,r,i){i||(i=ze(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var o,s=e;s=t.minX&&e.maxY>=t.minY}function ze(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function je(t,e,n,r,i){for(var o,s=[e,n];s.length;)(n=s.pop())-(e=s.pop())<=r||(Le(t,o=e+Math.ceil((n-e)/r/2)*r,e,n,i),s.push(e,o,o,n))}function Xe(t){var e=Oe(t);return e.insert=function(t){if(Array.isArray(t)){var e=t;(t=Ue(e)).bbox=e}else t.bbox=t.bbox?t.bbox:Ye(t);return Oe.prototype.insert.call(this,t)},e.load=function(t){var e=[];return Array.isArray(t)?t.forEach((function(t){var n=Ue(t);n.bbox=t,e.push(n)})):O(t,(function(t){t.bbox=t.bbox?t.bbox:Ye(t),e.push(t)})),Oe.prototype.load.call(this,e)},e.remove=function(t){if(Array.isArray(t)){var e=t;(t=Ue(e)).bbox=e}return Oe.prototype.remove.call(this,t)},e.clear=function(){return Oe.prototype.clear.call(this)},e.search=function(t){return{type:"FeatureCollection",features:Oe.prototype.search.call(this,this.toBBox(t))}},e.collides=function(t){return Oe.prototype.collides.call(this,this.toBBox(t))},e.all=function(){return{type:"FeatureCollection",features:Oe.prototype.all.call(this)}},e.toJSON=function(){return Oe.prototype.toJSON.call(this)},e.fromJSON=function(t){return Oe.prototype.fromJSON.call(this,t)},e.toBBox=function(t){var e;return{minX:(e=t.bbox?t.bbox:Array.isArray(t)&&4===t.length?t:Ye(t))[0],minY:e[1],maxX:e[2],maxY:e[3]}},e}function Ue(t){var e=[t[0],t[1]],n=[t[0],t[3]],r=[t[2],t[3]];return{type:"Feature",bbox:t,properties:{},geometry:{type:"Polygon",coordinates:[[e,[t[2],t[1]],r,n,e]]}}}function Ye(t){var e=[1/0,1/0,-1/0,-1/0];return S(t,(function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]i?n:i,r>o?r:o]}(t,r),n.push(i),r})),n})(n,t.properties).forEach((function(t){t.id=e.length,e.push(t)}))}))}(t,e)})),c(e)}function He(t,n){var r={},i=[];if(“LineString”===t.type&&(t=e(t)),“LineString”===n.type&&(n=e(n)),“Feature”===t.type&&“Feature”===n.type&&“LineString”===t.geometry.type&&“LineString”===n.geometry.type&&2===t.geometry.coordinates.length&&2===n.geometry.coordinates.length){var o=We(t,n);return o&&i.push(o),c(i)}var s=Xe();return s.load(Ve(n)),O(Ve(t),(function(t){O(s.search(t),(function(e){var n=We(t,e);if(n){var o=U(n).join(“,”);r[o]||(r[o]=!0,i.push(n))}}))})),c(i)}function We(t,e){var n=U(t),i=U(e);if(2!==n.length)throw new Error(“ line1 must only contain 2 coordinates”);if(2!==i.length)throw new Error(“ line2 must only contain 2 coordinates”);var o=n[0][0],s=n[0][1],a=n[1][0],u=n[1][1],c=i[0][0],h=i[0][1],l=i[1][0],p=i[1][1],f=(p-h)*(a-o)-(l-c)*(u-s);if(0===f)return null;var g=((l-c)*(s-h)-(p-h)*(o-c))/f,d=((a-o)*(s-h)-(u-s)*(o-c))/f;return g>=0&&g<=1&&d>=0&&d<=1?r([o+g*(a-o),s+g*(u-s)]):null}function Je(t,e,n){if(!I(n=n||{}))throw new Error("options is invalid");var i=t.geometry?t.geometry.type:t.type;if("LineString"!==i&&"MultiLineString"!==i)throw new Error("lines must be LineString or MultiLineString");var o=r([1/0,1/0],{dist:1/0}),s=0;return F(t,(function(t){for(var i=U(t),u=0;u0&&((_=y.features[0]).properties.dist=Dt(e,_,n),_.properties.location=s+Dt(c,_,n)),c.properties.dist180?-(360-r):r}function Ke(t,e){var n=x(t[1]),r=x(e[1]),i=x(e[0]-t[0]);i>Math.PI&&(i-=2*Math.PI),i<-Math.PI&&(i+=2*Math.PI);var o=Math.log(Math.tan(r/2+Math.PI/4)/Math.tan(n/2+Math.PI/4));return(v(Math.atan2(i,o))+360)%360}function Qe(t,e,n){if(!I(n=n||{}))throw new Error("options is invalid");var r=n.units;if(!t)throw new Error("from point is required");if(!e)throw new Error("to point is required");var i=X(t),o=X(e);return o[0]+=o[0]-i[0]>180?-360:i[0]-o[0]>180?360:0,E(function(t,e,n){var r=n=void 0===n?wo:Number(n),i=t[1]*Math.PI/180,o=e[1]*Math.PI/180,s=o-i,a=Math.abs(e[0]-t[0])*Math.PI/180;a>Math.PI&&(a-=2*Math.PI);var u=Math.log(Math.tan(o/2+Math.PI/4)/Math.tan(i/2+Math.PI/4)),c=Math.abs(u)>1e-11?s/u:Math.cos(i);return Math.sqrt(s*s+c*c*a*a)*r}(i,o),“meters”,r)}function $e(t,e){return en(t,“mercator”,e)}function tn(t,e){return en(t,“wgs84”,e)}function en(t,e,n){if(!I(n=n||{}))throw new Error(“options is invalid”);var r=n.mutate;if(!t)throw new Error(“geojson is required”);return Array.isArray(t)&&b(t[0])?t=“mercator”===e?nn(t):rn(t):(!0!==r&&(t=Ft(t)),S(t,(function(t){var n=“mercator”===e?nn(t):rn(t);t[0]=n[0],t[1]=n[1]}))),t}function nn(t){var e=Math.PI/180,n=20037508.342789244,r=[6378137*(Math.abs(t[0])<=180?t[0]:t[0]-360*function(t){return t<0?-1:t>0?1:0}(t[0]))*e,6378137*Math.log(Math.tan(.25*Math.PI+.5*t[1]*e))];return r[0]>n&&(r[0]=n),r[0]<-n&&(r[0]=-n),r[1]>n&&(r[1]=n),r[1]<-n&&(r[1]=-n),r}function rn(t){var e=180/Math.PI;return[t[0]*e/6378137,(.5*Math.PI-2*Math.atan(Math.exp(-t[1]/6378137)))*e]}function on(t,n,i){if(!I(i=i||{}))throw new Error("options is invalid");if(!t)throw new Error("pt is required");if(Array.isArray(t)?t=r(t):"Point"===t.type?t=e(t):H(t,"Point","point"),!n)throw new Error("line is required");Array.isArray(n)?n=a(n):"LineString"===n.type?n=e(n):H(n,"LineString","line");var o=1/0,s=t.geometry.coordinates;return G(n,(function(t){var e=t.geometry.coordinates[0],n=t.geometry.coordinates[1],a=function(t,e,n,i){var o=i.mercator,s=!0!==o?Dt(e,t,i):sn(e,t,i),a=m(!0!==o?ue(e,t):Ze(e,t)),u=m(!0!==o?ue(e,n):Ze(e,n)),c=Math.abs(a-u);if(c>90)return s;var h=(u+180)%360,l=m(!0!==o?ue(n,t):Ze(n,t)),p=Math.abs(l-h);return p>180&&(p=Math.abs(p-360)),p>90?!0!==o?Dt(t,n,i):sn(t,n,i):!0!==o?s*Math.sin(x©):function(t,e,n,i){var o=0;(Math.abs(t[0])>=180||Math.abs(e[0])>=180||Math.abs(n[0])>=180)&&(o=t[0]>0||e[0]>0||n[0]>0?-180:180);var s=r(n),a=tn(function(t,e,n){var r=t[0],i=t[1],o=e[0]-r,s=e[1]-i,a=((n[0]-r)*o+(n[1]-i)*s)/(o*o+s*s);return[r+a*o,i+a*s]}($e([t[0]+o,t[1]]),$e([e[0]+o,e[1]]),$e([n[0]+o,n[1]])));return 0!==o&&(a[0]-=o),Qe(s,a,i)}(e,n,t,i)}(s,e,n,i);o>a&&(o=a)})),o}function sn(t,e,n){var r=n.units,i=0;Math.abs(t[0])>=180&&(i=t[0]>0?-180:180),Math.abs(e[0])>=180&&(i=e[0]>0?-180:180);var o=$e([t[0]+i,t[1]]),s=$e([e[0]+i,e[1]]),a=function(t){return t*t},u=a(o[0]-s[0])+a(o[1]-s[1]);return E(Math.sqrt(u),“meters”,r)}function an(t){for(var n=function(t){return“FeatureCollection”!==t.type?“Feature”!==t.type?c([e(t)]):c([t]):t}(t),i=ce(n),o=!1,s=0;!o&&s0){e+=Math.abs(ln(t[0]));for(var n=1;n2){for(s=0;s=h&&l===i.length-1);l++){if(h>e&&0===o.length){if(!(s=e-h))return o.push(i[l]),a(o);u=ue(i[l],i[l-1])-180,c=se(i[l],s,u,r),o.push(c.geometry.coordinates)}if(h>=n)return(s=n-h)?(u=ue(i[l],i[l-1])-180,c=se(i[l],s,u,r),o.push(c.geometry.coordinates),a(o)):(o.push(i[l]),a(o));if(h>=e&&o.push(i[l]),l===i.length-1)return a(o);h+=Dt(i[l],i[l+1],r)}return a(i[i.length-1])}function dn(t,e,n){var r=(n=n||{}).ignoreEndVertices;if(!I(n))throw new Error(“invalid options”);if(!t)throw new Error(“pt is required”);if(!e)throw new Error(“line is required”);for(var i=X(t),o=U(e),s=0;s=Math.abs(l)?h>0?s0?a=Math.abs(l)?h>0?s<=i&&i0?a<=o&&o=Math.abs(l)?h>0?s0?a=Math.abs(l)?h>0?s<=i&&i<=u:u<=i&&i<=s:l>0?a<=o&&o<=c:c<=o&&o<=a)}(o[s],o[s+1],i,a))return!0}return!1}function yn(t,e){var n=K(t),r=K(e),i=J(t),o=J(e);switch(n){case"Point":switch(r){case"MultiPoint":return function(t,e){var n,r=!1;for(n=0;nr“ geometry not supported”)}case“MultiPoint”:switch®{case“MultiPoint”:return function(t,e){for(var n=0;nr“ geometry not supported”)}case“LineString”:switch®{case“LineString”:return function(t,e){for(var n=0;nr“ geometry not supported”)}case“Polygon”:switch®{case“Polygon”:return function(t,e){var n=j(t);if(!_n(j(e),n))return!1;for(var r=0;rr“ geometry not supported”)}default:throw new Error(“feature1 ”n“ geometry not supported”)}}function _n(t,e){return!(t[0]>e[0]||t[2]e[1]||t[3] is required“);if(”number“!=typeof n)throw new Error(” must be a number“);if(”number“!=typeof r)throw new Error(” must be a number“);!1!==i&&void 0!==i||(t=JSON.parse(JSON.stringify(t)));var o=Math.pow(10,n);return S(t,(function(t){!function(t,e,n){t.length>n&&t.splice(n,t.length);for(var r=0;r=0==e}function bn(t,e){if(!t||!e)return!1;if(t.length!=e.length)return!1;for(var n=0,r=t.length;n1&&n.push(a(l)),c(n)}function Cn(t,e){if(!e.features.length)throw new Error(”lines must contain features“);if(1===e.features.length)return e.features[0];var n,r=1/0;return O(e,(function(e){var i=Je(e,t).properties.dist;ip&&g.push(se(t,e,p,s).geometry.coordinates),a(g,h)}function Ln(t){var e=t%360;return e<0&&(e+=360),e}function Pn(t,e){if(!I(e=e||{}))throw new Error("options is invalid");var n=e.properties,r=K(t),i=U(t);if(n=n||t.properties||{},!i.length)throw new Error("polygon must contain coordinates");switch(r){case"Polygon":return On(i,n);case"MultiPolygon":var o=[];return i.forEach((function(t){o.push(On(t,n))})),c(o);default:throw new Error("geom "r” not supported“)}}function On(t,e){return t.length>1?h(t,e):a(t[0],e)}function Rn(t,e){if(!I(e=e||{}))throw new Error(”options is invalid“);var n=e.properties,r=e.autoComplete,i=e.orderCoords;if(!t)throw new Error(”lines is required“);switch(r=void 0===r||r,i=void 0===i||i,K(t)){case”FeatureCollection“:case”GeometryCollection“:var o=[];return(t.features?t.features:t.geometries).forEach((function(t){o.push(U(Tn(t,{},r,i)))})),p(o,n)}return Tn(t,n,r,i)}function Tn(t,e,n,r){e=e||t.properties||{};var i=U(t),s=K(t);if(!i.length)throw new Error(”line must contain coordinates“);switch(s){case”LineString“:return n&&(i=An(i)),o([i],e);case”MultiLineString“:var u=[],c=0;return i.forEach((function(t){if(n&&(t=An(t)),r){var e=function(t){var e=t[0],n=t[1],r=t[2],i=t[3];return Math.abs(e-r)*Math.abs(n-i)}(j(a(t)));e>c?(u.unshift(t),c=e):u.push(t)}else u.push(t)})),o(u,e);default:throw new Error(”geometry type “s” is not supported“)}}function An(t){var e=t[0],n=e[0],r=e[1],i=t[t.length-1],o=i[0],s=i[1];return n===o&&r===s||t.push(e),t}function Dn(t,e,n){var r,i,o,s,a,u=t.length,c=qn(t[0],e),h=[];for(n||(n=[]),r=1;re[2]&&(n|=2),t[1]e[3]&&(n|=8),n}function Gn(t,e){for(var n=[],r=0;r0&&(i[0][0]===i[i.length-1][0]&&i[0][1]===i[i.length-1][1]||i.push(i[0]),i.length>=4&&n.push(i))}return n}function Bn(t){return”[object Arguments]“===Object.prototype.toString.call(t)}function kn(t,e,n){return n||(n={}),t===e||(t instanceof Date&&e instanceof Date?t.getTime()===e.getTime():!t||!e||”object“!=typeof t&&”object“!=typeof e?(n.strict,t===e):function(t,e,n){var r,i;if(zn(t)||zn(e))return!1;if(t.prototype!==e.prototype)return!1;if(Bn(t))return!!Bn(e)&&kn(t=ws.call(t),e=ws.call(e),n);if(jn(t)){if(!jn(e))return!1;if(t.length!==e.length)return!1;for(r=0;r=0;r–)if(o[r]!==s[r])return!1;for(r=o.length-1;r>=0;r–)if(!kn(t[i=o[r]],e[i],n))return!1;return typeof t==typeof e}(t,e,n))}function zn(t){return null==t}function jn(t){return!(!t||”object“!=typeof t||”number“!=typeof t.length||”function“!=typeof t.copy||”function“!=typeof t.slice||t.length>0&&”number“!=typeof t[0])}function Xn(t,e,n){if(!I(n=n||{}))throw new Error(”options is invalid“);var r,i=n.tolerance||0,o=[],s=Xe();return s.load(Ve(t)),G(e,(function(t){var e=!1;O(s.search(t),(function(n){if(!1===e){var o=U(t).sort(),s=U(n).sort();kn(o,s)||(0===i?dn(o[0],n)&&dn(o[1],n):Je(n,o[0]).properties.dist<=i&&Je(n,o[1]).properties.dist<=i)?(e=!0,r=r?Un(r,t):t):(0===i?dn(s[0],t)&&dn(s[1],t):Je(t,s[0]).properties.dist<=i&&Je(t,s[1]).properties.dist<=i)&&(r=r?Un(r,n):n)}})),!1===e&&r&&(o.push(r),r=void 0)})),r&&o.push(r),c(o)}function Un(t,e){var n=U(e),r=U(t),i=r[0],o=r[r.length-1],s=t.geometry.coordinates;return kn(n[0],i)?s.unshift(n[1]):kn(n[0],o)?s.push(n[1]):kn(n[1],i)?s.unshift(n[0]):kn(n[1],o)&&s.push(n[0]),t}function Yn(t){var e=t%360;return e<0&&(e+=360),e}function Vn(t,e,n,i){if(!I(i=i||{}))throw new Error("options is invalid");var o=i.units,s=i.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(!(e>=0))throw new Error(”distance must be greater than 0“);var a=E(e,o,”meters“),u=X(t),c=function(t,e,n,r){var i=e/(r=void 0===r?wo:Number®),o=t[0]*Math.PI/180,s=x(t[1]),a=x(n),u=i*Math.cos(a),c=s+u;Math.abs©>Math.PI/2&&(c=c>0?Math.PI-c:-Math.PI-c);var h=Math.log(Math.tan(c/2+Math.PI/4)/Math.tan(s/2+Math.PI/4)),l=Math.abs(h)>1e-11?u/h:Math.cos(s);return[(180*(o+i*Math.sin(a)/l)/Math.PI+540)%360-180,180*c/Math.PI]}(u,a,n);return c[0]+=c[0]-u[0]>180?-360:u[0]-c[0]>180?360:0,r(c,s)}function Hn(t,e,n,r,i,o){for(var s=0;s0?function(t,e,n){return Wn(t,e,n)<0}(e,a,i)||(i=a):n>0&&r<=0&&(function(t,e,n){return Wn(t,e,n)>0}(e,a,o)||(o=a)),n=r}return[i,o]}function Wn(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(n[0]-t[0])*(e[1]-t[1])}function Jn(t){if(!t)throw new Error(”line is required“);var e=t.geometry?t.geometry.type:t.type;if(!Array.isArray(t)&&”LineString“!==e)throw new Error(”geometry must be a LineString“);for(var n,r,i=U(t),o=0,s=1;s0}function Zn(t,e){switch(”Feature“===t.type?t.geometry.type:t.type){case”GeometryCollection“:return A(t,(function(t){Zn(t,e)})),t;case”LineString“:return Kn(U(t),e),t;case”Polygon“:return Qn(U(t),e),t;case”MultiLineString“:return U(t).forEach((function(t){Kn(t,e)})),t;case”MultiPolygon“:return U(t).forEach((function(t){Qn(t,e)})),t;case”Point“:case”MultiPoint“:return t}}function Kn(t,e){Jn(t)===e&&t.reverse()}function Qn(t,e){Jn(t[0])!==e&&t[0].reverse();for(var n=1;ne”:“+(e+n)+”]“);var u,c=function(t,e,n){for(var r=t.length-1,i=t[0].length-1,o={rows:r,cols:i,cells:[]},s=e+Math.abs(n),a=0;as?128:64,c|=ls?32:16,c|=ps?8:4;var g=+(c|=fs?2:1),d=0;if(17===c||18===c||33===c||34===c||38===c||68===c||72===c||98===c||102===c||132===c||136===c||137===c||152===c||153===c){var y=(h+l+p+f)/4;d=y>s?2:y0?(c=156,d=4):c=152:33===c?d>0?(c=139,d=4):c=137:72===c?d>0?(c=99,d=4):c=98:132===c&&(d>0?(c=39,d=4):c=38)}if(0!=c&&170!=c){var _,m,v,x,E,w,b,I;_=m=v=x=E=w=b=I=.5;var N=[];1===c?(v=1-tr(e,p,f),I=1-tr(e,h,f),N.push(ha[c])):169===c?(v=tr(s,f,p),I=tr(s,f,h),N.push(ha[c])):4===c?(w=1-tr(e,l,p),x=tr(e,f,p),N.push(ua[c])):166===c?(w=tr(s,p,l),x=1-tr(s,p,f),N.push(ua[c])):16===c?(E=tr(e,p,l),m=tr(e,h,l),N.push(aa[c])):154===c?(E=1-tr(s,l,p),m=1-tr(s,l,h),N.push(aa[c])):64===c?(b=tr(e,f,h),_=1-tr(e,l,h),N.push(pa[c])):106===c?(b=1-tr(s,h,f),_=tr(s,h,l),N.push(pa[c])):168===c?(x=tr(s,f,p),v=tr(e,f,p),I=tr(e,f,h),b=tr(s,f,h),N.push(ca[c]),N.push(ha[c])):2===c?(x=1-tr(e,p,f),v=1-tr(s,p,f),I=1-tr(s,h,f),b=1-tr(e,h,f),N.push(ca[c]),N.push(ha[c])):162===c?(E=tr(s,p,l),w=tr(e,p,l),x=1-tr(e,p,f),v=1-tr(s,p,f),N.push(ca[c]),N.push(ha[c])):8===c?(E=1-tr(e,l,p),w=1-tr(s,l,p),x=tr(s,f,p),v=tr(e,f,p),N.push(aa[c]),N.push(ua[c])):138===c?(E=1-tr(e,l,p),w=1-tr(s,l,p),_=1-tr(s,l,h),m=1-tr(e,l,h),N.push(aa[c]),N.push(ua[c])):32===c?(E=tr(s,p,l),w=tr(e,p,l),_=tr(e,h,l),m=tr(s,h,l),N.push(aa[c]),N.push(ua[c])):42===c?(I=1-tr(s,h,f),b=1-tr(e,h,f),_=tr(e,h,l),m=tr(s,h,l),N.push(la[c]),N.push(pa[c])):128===c&&(I=tr(e,f,h),b=tr(s,f,h),_=1-tr(s,l,h),m=1-tr(e,l,h),N.push(la[c]),N.push(pa[c])),5===c?(w=1-tr(e,l,p),I=1-tr(e,h,f),N.push(ua[c])):165===c?(w=tr(s,p,l),I=tr(s,f,h),N.push(ua[c])):20===c?(x=tr(e,f,p),m=tr(e,h,l),N.push(ca[c])):150===c?(x=1-tr(s,p,f),m=1-tr(s,l,h),N.push(ca[c])):80===c?(E=tr(e,p,l),b=tr(e,f,h),N.push(aa[c])):90===c?(E=1-tr(s,l,p),b=1-tr(s,h,f),N.push(aa[c])):65===c?(v=1-tr(e,p,f),_=1-tr(e,l,h),N.push(ha[c])):105===c?(v=tr(s,f,p),_=tr(s,h,l),N.push(ha[c])):160===c?(E=tr(s,p,l),w=tr(e,p,l),I=tr(e,f,h),b=tr(s,f,h),N.push(aa[c]),N.push(ua[c])):10===c?(E=1-tr(e,l,p),w=1-tr(s,l,p),I=1-tr(s,h,f),b=1-tr(e,h,f),N.push(aa[c]),N.push(ua[c])):130===c?(x=1-tr(e,p,f),v=1-tr(s,p,f),_=1-tr(s,l,h),m=1-tr(e,l,h),N.push(ca[c]),N.push(ha[c])):40===c?(x=tr(s,f,p),v=tr(e,f,p),_=tr(e,h,l),m=tr(s,h,l),N.push(ca[c]),N.push(ha[c])):101===c?(w=tr(s,p,l),_=tr(s,h,l),N.push(ua[c])):69===c?(w=1-tr(e,l,p),_=1-tr(e,l,h),N.push(ua[c])):149===c?(I=tr(s,f,h),m=1-tr(s,l,h),N.push(la[c])):21===c?(I=1-tr(e,h,f),m=tr(e,h,l),N.push(la[c])):86===c?(x=1-tr(s,p,f),b=1-tr(s,h,f),N.push(ca[c])):84===c?(x=tr(e,f,p),b=tr(e,f,h),N.push(ca[c])):89===c?(E=1-tr(s,l,p),v=tr(s,f,p),N.push(ha[c])):81===c?(E=tr(e,p,l),v=1-tr(e,p,f),N.push(ha[c])):96===c?(E=tr(s,p,l),w=tr(e,p,l),b=tr(e,f,h),_=tr(s,h,l),N.push(aa[c]),N.push(ua[c])):74===c?(E=1-tr(e,l,p),w=1-tr(s,l,p),b=1-tr(s,h,f),_=1-tr(e,l,h),N.push(aa[c]),N.push(ua[c])):24===c?(E=1-tr(s,l,p),x=tr(s,f,p),v=tr(e,f,p),m=tr(e,h,l),N.push(aa[c]),N.push(ha[c])):146===c?(E=tr(e,p,l),x=1-tr(e,p,f),v=1-tr(s,p,f),m=1-tr(s,l,h),N.push(aa[c]),N.push(ha[c])):6===c?(w=1-tr(e,l,p),x=1-tr(s,p,f),I=1-tr(s,h,f),b=1-tr(e,h,f),N.push(ua[c]),N.push(ca[c])):164===c?(w=tr(s,p,l),x=tr(e,f,p),I=tr(e,f,h),b=tr(s,f,h),N.push(ua[c]),N.push(ca[c])):129===c?(v=1-tr(e,p,f),I=tr(s,f,h),_=1-tr(s,l,h),m=1-tr(e,l,h),N.push(ha[c]),N.push(la[c])):41===c?(v=tr(s,f,p),I=1-tr(e,h,f),_=tr(e,h,l),m=tr(s,h,l),N.push(ha[c]),N.push(la[c])):66===c?(x=1-tr(e,p,f),v=1-tr(s,p,f),b=1-tr(s,h,f),_=1-tr(e,l,h),N.push(ca[c]),N.push(ha[c])):104===c?(x=tr(s,f,p),v=tr(e,f,p),b=tr(e,f,h),_=tr(s,h,l),N.push(ha[c]),N.push(fa[c])):144===c?(E=tr(e,p,l),I=tr(e,f,h),b=tr(s,f,h),m=1-tr(s,l,h),N.push(aa[c]),N.push(pa[c])):26===c?(E=1-tr(s,l,p),I=1-tr(s,h,f),b=1-tr(e,h,f),m=tr(e,h,l),N.push(aa[c]),N.push(pa[c])):36===c?(w=tr(s,p,l),x=tr(e,f,p),_=tr(e,h,l),m=tr(s,h,l),N.push(ua[c]),N.push(ca[c])):134===c?(w=1-tr(e,l,p),x=1-tr(s,p,f),_=1-tr(s,l,h),m=1-tr(e,l,h),N.push(ua[c]),N.push(ca[c])):9===c?(E=1-tr(e,l,p),w=1-tr(s,l,p),v=tr(s,f,p),I=1-tr(e,h,f),N.push(aa[c]),N.push(ua[c])):161===c?(E=tr(s,p,l),w=tr(e,p,l),v=1-tr(e,p,f),I=tr(s,f,h),N.push(aa[c]),N.push(ua[c])):37===c?(w=tr(s,p,l),I=1-tr(e,h,f),_=tr(e,h,l),m=tr(s,h,l),N.push(ua[c]),N.push(la[c])):133===c?(w=1-tr(e,l,p),I=tr(s,f,h),_=1-tr(s,l,h),m=1-tr(e,l,h),N.push(ua[c]),N.push(la[c])):148===c?(x=tr(e,f,p),I=tr(e,f,h),b=tr(s,f,h),m=1-tr(s,l,h),N.push(ca[c]),N.push(pa[c])):22===c?(x=1-tr(s,p,f),I=1-tr(s,h,f),b=1-tr(e,h,f),m=tr(e,h,l),N.push(ca[c]),N.push(pa[c])):82===c?(E=tr(e,p,l),x=1-tr(e,p,f),v=1-tr(s,p,f),b=1-tr(s,h,f),N.push(aa[c]),N.push(ha[c])):88===c?(E=1-tr(s,l,p),x=tr(s,f,p),v=tr(e,f,p),b=tr(e,f,h),N.push(aa[c]),N.push(ha[c])):73===c?(E=1-tr(e,l,p),w=1-tr(s,l,p),v=tr(s,f,p),_=1-tr(e,l,h),N.push(aa[c]),N.push(ua[c])):97===c?(E=tr(s,p,l),w=tr(e,p,l),v=1-tr(e,p,f),_=tr(s,h,l),N.push(aa[c]),N.push(ua[c])):145===c?(E=tr(e,p,l),v=1-tr(e,p,f),I=tr(s,f,h),m=1-tr(s,l,h),N.push(aa[c]),N.push(la[c])):25===c?(E=1-tr(s,l,p),v=tr(s,f,p),I=1-tr(e,h,f),m=tr(e,h,l),N.push(aa[c]),N.push(la[c])):70===c?(w=1-tr(e,l,p),x=1-tr(s,p,f),b=1-tr(s,h,f),_=1-tr(e,l,h),N.push(ua[c]),N.push(ca[c])):100===c?(w=tr(s,p,l),x=tr(e,f,p),b=tr(e,f,h),_=tr(s,h,l),N.push(ua[c]),N.push(ca[c])):34===c?(0===d?(E=1-tr(e,l,p),w=1-tr(s,l,p),x=tr(s,f,p),v=tr(e,f,p),I=tr(e,f,h),b=tr(s,f,h),_=1-tr(s,l,h),m=1-tr(e,l,h)):(E=tr(s,p,l),w=tr(e,p,l),x=1-tr(e,p,f),v=1-tr(s,p,f),I=1-tr(s,h,f),b=1-tr(e,h,f),_=tr(e,h,l),m=tr(s,h,l)),N.push(aa[c]),N.push(ua[c]),N.push(la[c]),N.push(pa[c])):35===c?(4===d?(E=1-tr(e,l,p),w=1-tr(s,l,p),x=tr(s,f,p),v=tr(e,f,p),I=tr(e,f,h),b=tr(s,f,h),_=1-tr(s,l,h),m=1-tr(e,l,h)):(E=tr(s,p,l),w=tr(e,p,l),x=1-tr(e,p,f),v=1-tr(s,p,f),I=1-tr(s,h,f),b=1-tr(e,h,f),_=tr(e,h,l),m=tr(s,h,l)),N.push(aa[c]),N.push(ua[c]),N.push(ha[c]),N.push(pa[c])):136===c?(0===d?(E=tr(s,p,l),w=tr(e,p,l),x=1-tr(e,p,f),v=1-tr(s,p,f),I=1-tr(s,h,f),b=1-tr(e,h,f),_=tr(e,h,l),m=tr(s,h,l)):(E=1-tr(e,l,p),w=1-tr(s,l,p),x=tr(s,f,p),v=tr(e,f,p),I=tr(e,f,h),b=tr(s,f,h),_=1-tr(s,l,h),m=1-tr(e,l,h)),N.push(aa[c]),N.push(ua[c]),N.push(la[c]),N.push(pa[c])):153===c?(0===d?(E=tr(e,p,l),v=1-tr(e,p,f),I=1-tr(e,h,f),m=tr(e,h,l)):(E=1-tr(s,l,p),v=tr(s,f,p),I=tr(s,f,h),m=1-tr(s,l,h)),N.push(aa[c]),N.push(ha[c])):102===c?(0===d?(w=1-tr(e,l,p),x=tr(e,f,p),b=tr(e,f,h),_=1-tr(e,l,h)):(w=tr(s,p,l),x=1-tr(s,p,f),b=1-tr(s,h,f),_=tr(s,h,l)),N.push(ua[c]),N.push(pa[c])):155===c?(4===d?(E=tr(e,p,l),v=1-tr(e,p,f),I=1-tr(e,h,f),m=tr(e,h,l)):(E=1-tr(s,l,p),v=tr(s,f,p),I=tr(s,f,h),m=1-tr(s,l,h)),N.push(aa[c]),N.push(la[c])):103===c?(4===d?(w=1-tr(e,l,p),x=tr(e,f,p),b=tr(e,f,h),_=1-tr(e,l,h)):(w=tr(s,p,l),x=1-tr(s,p,f),b=1-tr(s,h,f),_=tr(s,h,l)),N.push(ua[c]),N.push(ca[c])):152===c?(0===d?(E=tr(e,p,l),x=1-tr(e,p,f),v=1-tr(s,p,f),I=1-tr(s,h,f),b=1-tr(e,h,f),m=tr(e,h,l)):(E=1-tr(s,l,p),x=tr(s,f,p),v=tr(e,f,p),I=tr(e,f,h),b=tr(s,f,h),m=1-tr(s,l,h)),N.push(aa[c]),N.push(ca[c]),N.push(ha[c])):156===c?(4===d?(E=tr(e,p,l),x=1-tr(e,p,f),v=1-tr(s,p,f),I=1-tr(s,h,f),b=1-tr(e,h,f),m=tr(e,h,l)):(E=1-tr(s,l,p),x=tr(s,f,p),v=tr(e,f,p),I=tr(e,f,h),b=tr(s,f,h),m=1-tr(s,l,h)),N.push(aa[c]),N.push(ha[c]),N.push(pa[c])):137===c?(0===d?(E=tr(s,p,l),w=tr(e,p,l),v=1-tr(e,p,f),I=1-tr(e,h,f),_=tr(e,h,l),m=tr(s,h,l)):(E=1-tr(e,l,p),w=1-tr(s,l,p),v=tr(s,f,p),I=tr(s,f,h),_=1-tr(s,l,h),m=1-tr(e,l,h)),N.push(aa[c]),N.push(ua[c]),N.push(ha[c])):139===c?(4===d?(E=tr(s,p,l),w=tr(e,p,l),v=1-tr(e,p,f),I=1-tr(e,h,f),_=tr(e,h,l),m=tr(s,h,l)):(E=1-tr(e,l,p),w=1-tr(s,l,p),v=tr(s,f,p),I=tr(s,f,h),_=1-tr(s,l,h),m=1-tr(e,l,h)),N.push(aa[c]),N.push(ua[c]),N.push(la[c])):98===c?(0===d?(E=1-tr(e,l,p),w=1-tr(s,l,p),x=tr(s,f,p),v=tr(e,f,p),b=tr(e,f,h),_=1-tr(e,l,h)):(E=tr(s,p,l),w=tr(e,p,l),x=1-tr(e,p,f),v=1-tr(s,p,f),b=1-tr(s,h,f),_=tr(s,h,l)),N.push(aa[c]),N.push(ua[c]),N.push(pa[c])):99===c?(4===d?(E=1-tr(e,l,p),w=1-tr(s,l,p),x=tr(s,f,p),v=tr(e,f,p),b=tr(e,f,h),_=1-tr(e,l,h)):(E=tr(s,p,l),w=tr(e,p,l),x=1-tr(e,p,f),v=1-tr(s,p,f),b=1-tr(s,h,f),_=tr(s,h,l)),N.push(aa[c]),N.push(ua[c]),N.push(ha[c])):38===c?(0===d?(w=1-tr(e,l,p),x=tr(e,f,p),I=tr(e,f,h),b=tr(s,f,h),_=1-tr(s,l,h),m=1-tr(e,l,h)):(w=tr(s,p,l),x=1-tr(s,p,f),I=1-tr(s,h,f),b=1-tr(e,h,f),_=tr(e,h,l),m=tr(s,h,l)),N.push(ua[c]),N.push(la[c]),N.push(pa[c])):39===c?(4===d?(w=1-tr(e,l,p),x=tr(e,f,p),I=tr(e,f,h),b=tr(s,f,h),_=1-tr(s,l,h),m=1-tr(e,l,h)):(w=tr(s,p,l),x=1-tr(s,p,f),I=1-tr(s,h,f),b=1-tr(e,h,f),_=tr(e,h,l),m=tr(s,h,l)),N.push(ua[c]),N.push(ca[c]),N.push(pa[c])):85===c&&(E=1,w=0,x=1,v=0,I=0,b=1,_=0,m=1),(_<0||_>1||m<0||m>1||E<0||E>1||x<0||x>1||I<0||I>1||b<0||b>1)&&console.log(”MarchingSquaresJS-isoBands: “c” “g” “h”,“l”,“p”,“f” “d” “_” “m” “E” “w” “x” “v” “I” “+b),o.cells[a][u]={cval:c,cval_real:g,flipped:d,topleft:_,topright:m,righttop:E,rightbottom:w,bottomright:x,bottomleft:v,leftbottom:I,lefttop:b,edges:N}}}}}return o}(t,e,n);return Is.polygons?(Is.verbose&&console.log(”MarchingSquaresJS-isoBands: returning single polygons for each grid cell“),u=function(t){var e=[],n=0;return t.cells.forEach((function(t,r){t.forEach((function(t,i){if(void 0!==t){var o=da[t.cval](t);”object“==typeof o&&er(o)?”object“==typeof o[0]&&er(o[0])?”object“==typeof o[0][0]&&er(o[0][0])?o.forEach((function(t){t.forEach((function(t){t[0]+=i,t[1]+=r})),e[n++]=t})):(o.forEach((function(t){t[0]+=i,t[1]+=r})),e[n++]=o):console.log(”MarchingSquaresJS-isoBands: bandcell polygon with malformed coordinates“):console.log(”MarchingSquaresJS-isoBands: bandcell polygon with null coordinates“)}}))})),e}©):(Is.verbose&&console.log(”MarchingSquaresJS-isoBands: returning polygon paths for entire data grid“),u=function(t){for(var e=[],n=t.rows,r=t.cols,i=[],o=0;o0){var a=function(t){if(t.edges.length>0){var e=t.edges[t.edges.length-1],n=t.cval_real;switch(e){case 0:return n&Cs?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.topleft,1],x:0,y:-1,o:0};case 1:return n&Ss?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 2:return n&Ss?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[t.topleft,1],x:0,y:-1,o:0};case 3:return n&Ms?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 4:return n&Cs?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};case 5:return n&Ss?{p:[t.topright,1],x:0,y:-1,o:1}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 6:return n&Ss?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};case 7:return n&Ms?{p:[t.topright,1],x:0,y:-1,o:1}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 8:return n&Ss?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[1,t.righttop],x:-1,y:0,o:1};case 9:return n&Ms?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 10:return n&Ms?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[1,t.righttop],x:-1,y:0,o:1};case 11:return n&Ns?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[0,t.lefttop],x:1,y:0,o:1};case 12:return n&Ss?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 13:return n&Ms?{p:[1,t.rightbottom],x:-1,y:0,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 14:return n&Ms?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 15:return n&Ns?{p:[1,t.rightbottom],x:-1,y:0,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 16:return n&Ss?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[0,t.leftbottom],x:1,y:0,o:0};case 17:return n&Ns?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[0,t.lefttop],x:1,y:0,o:1};case 18:return n&Ms?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 19:return n&Ns?{p:[t.bottomleft,0],x:0,y:1,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 20:return n&Ns?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[0,t.leftbottom],x:1,y:0,o:0};case 21:return n&Cs?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[t.topright,1],x:0,y:-1,o:1};case 22:return n&Ns?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 23:return n&Cs?{p:[0,t.lefttop],x:1,y:0,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};default:console.log(”MarchingSquaresJS-isoBands: edge index out of range!“),console.log(t)}}return null}(t.cells[o][s]),u=null,c=s,h=o;null!==a&&i.push([a.p[0]+c,a.p[1]+h]);do{if(null===(u=function(t,e,n,r){var i,o,s,a,u,c=t.cval;switch(e){case-1:switch®{case 0:i=ua[c],s=Gs[c],a=Bs[c],u=ks[c];break;default:i=aa[c],s=Ds[c],a=Fs[c],u=qs[c]}break;case 1:switch®{case 0:i=la[c],s=Zs[c],a=Ks[c],u=Qs[c];break;default:i=pa[c],s=Hs[c],a=Ws[c],u=Js[c]}break;default:switch(n){case-1:switch®{case 0:i=fa[c],s=Ls[c],a=Ps[c],u=Os[c];break;default:i=ga[c],s=Rs[c],a=Ts[c],u=As[c]}break;case 1:switch®{case 0:i=ha[c],s=zs[c],a=js[c],u=Xs[c];break;default:i=ca[c],s=Us[c],a=Ys[c],u=Vs[c]}}}if(o=t.edges.indexOf(i),void 0===t.edges[o])return null;switch(function(t,e){delete t.edges[e];for(var n=e+1;nn” “s” “a” “+u)),{p:[e,n],x:s,y:a,o:u}}(t.cells[h][c],a.x,a.y,a.o)))break;if(i.push([u.p[0]+c,u.p[1]+h]),c+=u.x,a=u,(h+=u.y)<0||h>=n||c<0||c>=r||void 0===t.cells[h][c]){var l=function(t,e,n,r,i,o){for(var s=t.cells[n][e],a=s.cval_real,u=e+r,c=n+i,h=[],l=!1;!l;){if(void 0===t.cells[c]||void 0===t.cells[c][u])if(c-=i,u-=r,a=(s=t.cells[c][u]).cval_real,-1===i)if(0===o)if(a&Ms)h.push([u,c]),r=-1,i=0,o=0;else{if(!(a&Ss)){h.push([u+s.bottomright,c]),r=0,i=1,o=1,l=!0;break}h.push([u+1,c]),r=1,i=0,o=0}else{if(!(a&Ms)){if(a&Ss){h.push([u+s.bottomright,c]),r=0,i=1,o=1,l=!0;break}h.push([u+s.bottomleft,c]),r=0,i=1,o=0,l=!0;break}h.push([u,c]),r=-1,i=0,o=0}else if(1===i)if(0===o){if(!(a&Cs)){if(a&Ns){h.push([u+s.topleft,c+1]),r=0,i=-1,o=0,l=!0;break}h.push([u+s.topright,c+1]),r=0,i=-1,o=1,l=!0;break}h.push([u+1,c+1]),r=1,i=0,o=1}else h.push([u+1,c+1]),r=1,i=0,o=1;else if(-1===r)if(0===o){if(!(a&Ns)){if(a&Ms){h.push([u,c+s.leftbottom]),r=1,i=0,o=0,l=!0;break}h.push([u,c+s.lefttop]),r=1,i=0,o=1,l=!0;break}h.push([u,c+1]),r=0,i=1,o=0}else{if(!(a&Ns)){console.log(”MarchingSquaresJS-isoBands: wtf“);break}h.push([u,c+1]),r=0,i=1,o=0}else{if(1!==r){console.log(”MarchingSquaresJS-isoBands: we came from nowhere!“);break}if(0===o){if(!(a&Ss)){h.push([u+1,c+s.rightbottom]),r=-1,i=0,o=0,l=!0;break}h.push([u+1,c]),r=0,i=-1,o=1}else{if(!(a&Ss)){if(a&Cs){h.push([u+1,c+s.righttop]),r=-1,i=0,o=1;break}h.push([u+1,c+s.rightbottom]),r=-1,i=0,o=0,l=!0;break}h.push([u+1,c]),r=0,i=-1,o=1}}else if(a=(s=t.cells[c][u]).cval_real,-1===r)if(0===o)if(void 0!==t.cells[c-1]&&void 0!==t.cells[c-1][u])r=0,i=-1,o=1;else{if(!(a&Ms)){h.push([u+s.bottomright,c]),r=0,i=1,o=1,l=!0;break}h.push([u,c])}else{if(!(a&Ns)){console.log(”MarchingSquaresJS-isoBands: found entry from top at “u”,“+c);break}console.log(”MarchingSquaresJS-isoBands: proceeding in x-direction!“)}else if(1===r){if(0===o){console.log(”MarchingSquaresJS-isoBands: wtf“);break}if(void 0!==t.cells[c+1]&&void 0!==t.cells[c+1][u])r=0,i=1,o=0;else{if(!(a&Cs)){h.push([u+s.topleft,c+1]),r=0,i=-1,o=0,l=!0;break}h.push([u+1,c+1]),r=1,i=0,o=1}}else if(-1===i){if(1!==o){console.log(”MarchingSquaresJS-isoBands: wtf“);break}if(void 0!==t.cells[c][u+1])r=1,i=0,o=1;else{if(!(a&Ss)){h.push([u+1,c+s.righttop]),r=-1,i=0,o=1,l=!0;break}h.push([u+1,c]),r=0,i=-1,o=1}}else{if(1!==i){console.log(”MarchingSquaresJS-isoBands: where did we came from???“);break}if(0!==o){console.log(”MarchingSquaresJS-isoBands: wtf“);break}if(void 0!==t.cells[c][u-1])r=-1,i=0,o=0;else{if(!(a&Ns)){h.push([u,c+s.leftbottom]),r=1,i=0,o=0,l=!0;break}h.push([u,c+1]),r=0,i=1,o=0}}if(c+=i,(u+=r)===e&&c===n)break}return{path:h,i:u,j:c,x:r,y:i,o:o}}(t,c-=u.x,h-=u.y,u.x,u.y,u.o);if(null===l)break;l.path.forEach((function(t){i.push(t)})),c=l.i,h=l.j,a=l}}while(void 0!==t.cells[h][c]&&t.cells[h][c].edges.length>0);e.push(i),i=[],t.cells[o][s].edges.length>0&&s–}return e}©),”function“==typeof Is.successCallback&&Is.successCallback(u),u}function tr(t,e,n){return(t-e)/(n-e)}function er(t){return t.constructor.toString().indexOf(”Array“)>-1}function nr(t,e,n){if(!I(n=n||{}))throw new Error(”options is invalid“);var r=n.pivot,i=n.mutate;if(!t)throw new Error(”geojson is required“);if(null==e||isNaN(e))throw new Error(”angle is required“);return 0===e||(r||(r=he(t)),!1!==i&&void 0!==i||(t=Ft(t)),S(t,(function(t){var n=Ze(r,t)+e,i=Qe(r,t),o=U(Vn(r,i,n));t[0]=o[0],t[1]=o[1]}))),t}function rr(t,e,n){if(!I(n=n||{}))throw new Error(”options is invalid“);var r=n.origin,i=n.mutate;if(!t)throw new Error(”geojson required“);if(”number“!=typeof e||0===e)throw new Error(”invalid factor“);var o=Array.isArray®||”object“==typeof r;return!0!==i&&(t=Ft(t)),”FeatureCollection“!==t.type||o?ir(t,e,r):(O(t,(function(n,i){t.features[i]=ir(n,e,r)})),t)}function ir(t,e,n){var i=”Point“===K(t);return n=function(t,e){if(null!=e||(e=”centroid“),Array.isArray(e)||”object“==typeof e)return X(e);var n=t.bbox?t.bbox:j(t),i=n[0],o=n[1],s=n[2],a=n[3];switch(e){case”sw“:case”southwest“:case”westsouth“:case”bottomleft“:return r([i,o]);case”se“:case”southeast“:case”eastsouth“:case”bottomright“:return r([s,o]);case”nw“:case”northwest“:case”westnorth“:case”topleft“:return r([i,a]);case”ne“:case”northeast“:case”eastnorth“:case”topright“:return r([s,a]);case”center“:return ce(t);case void 0:case null:case”centroid“:return he(t);default:throw new Error(”invalid origin“)}}(t,n),1===e||i||S(t,(function(t){var r=Qe(n,t),i=Ze(n,t),o=U(Vn(n,r*e,i));t[0]=o[0],t[1]=o[1],3===t.length&&(t[2]*=e)})),t}function or(t){var e=t[0],n=t[1];return[n[0]-e[0],n[1]-e[1]]}function sr(t,e){return t[0]*e[1]-e[0]*t[1]}function ar(t,e,n){var r=[],i=_(e,n),o=U(t),s=[];return o.forEach((function(t,e){if(e!==o.length-1){var n=function(t,e,n){var r=Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])),i=t[0]+n*(e[1]-t[1])/r,o=e[0]+n*(e[1]-t[1])/r;return[[i,t[1]+n*(t[0]-e[0])/r],[o,e[1]+n*(t[0]-e[0])/r]]}(t,o[e+1],i);if(r.push(n),e>0){var a=r[e-1],u=function(t,e){return!function(t,e){return 0===sr(or(t),or(e))}(t,e)&&function(t,e){var n=t[0],r=or(t),i=e[0],o=or(e),s=sr(r,o);return function(t,e){return[t[0]+e[0],t[1]+e[1]]}(n,function(t,e){return[t*e[0],t*e[1]]}(sr(function(t,e){return[t[0]-e[0],t[1]-e[1]]}(i,n),o)/s,r))}(t,e)}(n,a);!1!==u&&(a[1]=u,n[0]=u),s.push(a[0]),e===o.length-2&&(s.push(n[0]),s.push(n[1]))}2===o.length&&(s.push(n[0]),s.push(n[1]))}})),a(s,t.properties)}function ur(t,e,n){var r=e[0]-t[0],i=e[1]-t[1],o=n[0]-e[0],s=n[1]-e[1];return Math.sign(r*s-o*i)}function cr(t,e){return e.geometry.coordinates[0].every((function(e){return Mt(r(e),t)}))}function hr(t,e){for(var n=0;n=Math.abs(s)?o>0?t[0]<=n[0]&&n[0]<=e[0]:e[0]<=n[0]&&n[0]<=t[0]:s>0?t[1]<=n[1]&&n[1]<=e[1]:e[1]<=n[1]&&n[1]<=t[1])}(t.coordinates[n],t.coordinates[n+1],e.coordinates))return!0;return!1}function lr(t,e){return He(e,Pn(t)).features.length>0}function pr(t,e){return!(t[0]>e[0]||t[2]e[1]||t[3]0}function yr(t,e){for(var n=!1,i=!1,o=t.coordinates[0].length,s=0;s=Math.abs(a)?s>0?t[0]<=n[0]&&n[0]<=e[0]:e[0]<=n[0]&&n[0]<=t[0]:a>0?t[1]<=n[1]&&n[1]<=e[1]:e[1]<=n[1]&&n[1]<=t[1]:Math.abs(s)>=Math.abs(a)?s>0?t[0]0?t[1]0}function wr(t,e,n){n=n||[];for(var r=0;r0)){if(o/=p,p<0){if(o0){if(o>l)return;o>h&&(h=o)}if(o=r-u,p||!(o<0)){if(o/=p,p<0){if(o>l)return;o>h&&(h=o)}else if(p>0){if(o0)){if(o/=f,f<0){if(o0){if(o>l)return;o>h&&(h=o)}if(o=i-c,f||!(o<0)){if(o/=f,f<0){if(o>l)return;o>h&&(h=o)}else if(f>0){if(o0||l<1)||(h>0&&(t[0]=[u+h*p,c+h*f]),l<1&&(t[1]=[u+l*p,c+l*f]),!0)}}}}}function Br(t,e,n,r,i){var o=t[1];if(o)return!0;var s,a,u=t[0],c=t.left,h=t.right,l=c[0],p=c[1],f=h[0],g=h[1],d=(l+f)/2,y=(p+g)/2;if(g===p){if(d=r)return;if(l>f){if(u){if(u[1]>=i)return}else u=[d,n];o=[d,i]}else{if(u){if(u[1]1)if(l>f){if(u){if(u[1]>=i)return}else u=[(n-a)/s,n];o=[(i-a)/s,i]}else{if(u){if(u[1]=r)return}else u=[e,s*e+a];o=[r,s*r+a]}else{if(u){if(u[0]=-Va)){var f=u*u+c*c,g=h*h+l*l,d=(l*f-c*g)/p,y=(u*g-h*f)/p,_=Xa.pop()||new function(){Or(this),this.x=this.y=this.arc=this.site=this.cy=null};_.arc=t,_.site=i,_.x=d+s,_.y=(_.cy=y+a)+Math.sqrt(d*d+y*y),t.circle=_;for(var m=null,v=za._;v;)if(_.yYa)a=a.L;else{if(!((i=o-function(t,e){var n=t.N;if(n)return Jr(n,e);var r=t.site;return r[1]===e?r[0]:1/0}(a,s))>Ya)){r>-Ya?(e=a.P,n=a):i>-Ya?(e=a,n=a.N):e=n=a;break}if(!a.R){e=a;break}a=a.R}!function(t){ka[t.index]={site:t,halfedges:[]}}(t);var u=Yr(t);if(Ba.insert(e,u),e||n){if(e===n)return Ur(e),n=Yr(e.site),Ba.insert(u,n),u.edge=n.edge=Dr(e.site,u.site),Xr(e),void Xr(n);if(n){Ur(e),Ur(n);var c=e.site,h=c[0],l=c[1],p=t[0]-h,f=t[1]-l,g=n.site,d=g[0]-h,y=g[1]-l,_=2*(p*y-f*d),m=p*p+f*f,v=d*d+y*y,x=[(y*m-f*v)/_+h,(p*v-d*m)/_+l];qr(n.edge,c,g,x),u.edge=Dr(c,t,null,x),n.edge=Dr(t,g,null,x),Xr(e),Xr(n)}else u.edge=Dr(e.site,u.site)}}function Jr(t,e){var n=t.site,r=n[0],i=n[1],o=i-e;if(!o)return r;var s=t.P;if(!s)return-1/0;var a=(n=s.site)[0],u=n[1],c=u-e;if(!c)return a;var h=a-r,l=1/o-1/c,p=h/c;return l?(-p+Math.sqrt(p*p-2*l*(h*h/(-2*c)-u+c/2+i-o/2)))/l+r:(r+a)/2}function Zr(t,e,n){return(t[0]-n[0])*(e[1]-t[1])-(t[0]-e[0])*(n[1]-t[1])}function Kr(t,e){return e[1]-t[1]||e[0]-t[0]}function Qr(t,e){var n,r,i,o=t.sort(Kr).pop();for(ja=[],ka=new Array(t.length),Ba=new Pr,za=new Pr;;)if(i=Ga,o&&(!i||o[1]Ya||Math.abs(i[0][1]-i[1][1])>Ya)||delete ja[o]}(s,a,u,c),function(t,e,n,r){var i,o,s,a,u,c,h,l,p,f,g,d,y=ka.length,_=!0;for(i=0;iYa||Math.abs(d-p)>Ya)&&(u.splice(a,0,ja.push(Fr(s,f,Math.abs(g-t)Ya?[t,Math.abs(l-t)Ya?[Math.abs(p-r)Ya?[n,Math.abs(l-n)Ya?[Math.abs(p-e)=-270&&(d=-d),g<-180&&g>=-360&&(y=-y),”degrees“===s){var _=d*Math.cos(l)+y*Math.sin(l),m=y*Math.cos(l)-d*Math.sin(l);d=_,y=m}p.push([d+h[0],y+h[1]])}return p.push(p[0]),”degrees“===s?o([p],c):nr(o([p],c),a,{pivot:u})}function ei(t){var e=t*Math.PI/180;return Math.tan(e)}function ni(t,e){if(!I(e=e||{}))throw new Error(”options is invalid“);var n=e.properties,i=e.weight;if(!t)throw new Error(”geojson is required“);var o=0,s=0,a=0;return A(t,(function(t,e,n){var r=n[i];if(!b(r=null==r?1:r))throw new Error(”weight value must be a number for feature index “+e);(r=Number®)>0&&S(t,(function(t){o+=t[0]*r,s+=t[1]*r,a+=r}))})),r([o/a,s/a],n)}function ri(t,e,n,i){var o=n.properties.tolerance||.001,s=0,a=0,u=0,c=0;if(O(n,(function(e){var n=e.properties.weight,r=null==n?1:n;if(!b(r=Number®))throw new Error(”weight value must be a number“);if(r>0){c+=1;var i=r*Dt(e,t);0===i&&(i=1);var o=r/i;s+=e.geometry.coordinates[0]*o,a+=e.geometry.coordinates[1]*o,u+=o}})),c<1)throw new Error("no features to measure");var h=s/u,l=a/u;return 1===c||0===i||Math.abs(h-e[0])0?t+n[e-1]:t})),h.forEach((function(t){t=2*t*Math.PI/h[h.length-1];var e=Math.random();u.push([e*i*Math.sin(t),e*i*Math.cos(t)])})),u[u.length-1]=u[0],u=u.map(function(t){return function(e){return[e[0]+t[0],e[1]+t[1]]}}(oi(n))),s.push(o([u]))}return c(s)}function ui(t,e){if(!I(e=e||{}))throw new Error(”options is invalid“);var n=e.bbox,r=e.num_vertices,i=e.max_length,o=e.max_rotation;null!=t||(t=1),(!b®||r<2)&&(r=10),b(i)||(i=1e-4),b(o)||(o=Math.PI/8);for(var s=[],u=0;u1?t:null;case”MultiPolygon“:var e=[];if(F(t,(function(t){cn(t)>1&&e.push(t.geometry.coordinates)})),e.length)return{type:”MultiPolygon“,coordinates:e}}}function Ti(){this.reset()}function Ai(t,e,n){var r=t.s=e+n,i=r-e,o=r-i;t.t=e-o+(n-i)}function Di(t){return t>1?vf:t<-1?-vf:Math.asin(t)}function Fi(){}function qi(t,e){t&&Af.hasOwnProperty(t.type)&&Af[t.type](t,e)}function Gi(t,e,n){var r,i=-1,o=t.length-n;for(e.lineStart();++imf?t-Ef:t<-mf?t+Ef:t,e]}function Wi(t,e,n){return(t%=Ef)?e||n?Ff(Zi(t),Ki(e,n)):Zi(t):e||n?Ki(e,n):Hi}function Ji(t){return function(e,n){return[(e+=t)>mf?e-Ef:e<-mf?e+Ef:e,n]}}function Zi(t){var e=Ji(t);return e.invert=Ji(-t),e}function Ki(t,e){function n(t,e){var n=Sf(e),a=Sf(t)*n,u=Pf(t)*n,c=Pf(e),h=c*r+a*i;return[Cf(u*o-h*s,a*r-c*i),Di(h*o+u*s)]}var r=Sf(t),i=Pf(t),o=Sf(e),s=Pf(e);return n.invert=function(t,e){var n=Sf(e),a=Sf(t)*n,u=Pf(t)*n,c=Pf(e),h=c*o-u*s;return[Cf(u*o+c*s,a*r+h*i),Di(h*r-a*i)]},n}function Qi(t,e){(e=zi(e))[0]-=t,Vi(e);var n=function(t){return t>1?0:t<-1?mf:Math.acos(t)}(-e[1]);return((-e[2]<0?-n:n)+Ef-_f)%Ef}function $i(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function to(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r0)do{c.point(0===h||3===h?t:n,h>1?r:e)}while((h=(h+a+4)%4)!==l);else c.point(o[0],o[1])}function s(r,i){return If(r[0]-t)<_f?i>0?0:3:If(r[0]-n)<_f?i>0?2:1:If(r[1]-e)<_f?i>0?1:0:i>0?3:2}function a(t,e){return u(t.x,e.x)}function u(t,e){var n=s(t,1),r=s(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(s){function u(t,e){i(t,e)&&E.point(t,e)}function c(o,s){var a=i(o,s);if(l&&p.push([o,s]),v)f=o,g=s,d=a,v=!1,a&&(E.lineStart(),E.point(o,s));else if(a&&m)E.point(o,s);else{var u=[y=Math.max(Uf,Math.min(Xf,y)),_=Math.max(Uf,Math.min(Xf,_))],c=[o=Math.max(Uf,Math.min(Xf,o)),s=Math.max(Uf,Math.min(Xf,s))];Gf(u,c,t,e,n,r)?(m||(E.lineStart(),E.point(u[0],u[1])),E.point(c[0],c[1]),a||E.lineEnd(),x=!1):a&&(E.lineStart(),E.point(o,s),x=!1)}y=o,_=s,m=a}var h,l,p,f,g,d,y,_,m,v,x,E=s,w=qf(),b={point:u,lineStart:function(){b.point=c,l&&l.push(p=[]),v=!0,m=!1,y=_=NaN},lineEnd:function(){h&&(c(f,g),d&&m&&w.rejoin(),h.push(w.result())),b.point=u,m&&E.lineEnd()},polygonStart:function(){E=w,h=[],l=[],x=!0},polygonEnd:function(){var e=function(){for(var e=0,n=0,i=l.length;nr&&(p-o)*(r-s)>(f-s)*(t-o)&&++e:f<=r&&(p-o)*(r-s)<(f-s)*(t-o)&&--e;return e}(),n=x&&e,i=(h=jf(h)).length;(n||i)&&(s.polygonStart(),n&&(s.lineStart(),o(null,null,1,s),s.lineEnd()),i&&kf(h,a,e,o,s),s.polygonEnd()),E=s,h=l=p=null}};return b}}function no(t){return t.length>1}function ro(t,e){return((t=t.x)[0]<0?t[1]-vf-_f:vf-t[1])-((e=e.x)[0]<0?e[1]-vf-_f:vf-e[1])}function io(t){return function(e){var n=new oo;for(var r in t)n[r]=t[r];return n.stream=e,n}}function oo(){}function so(t,e,n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),null!=o&&t.clipExtent(null),Df(n,t.stream(Kf));var s=Kf.result(),a=Math.min(r/(s[1][0]-s[0][0]),i/(s[1][1]-s[0][1])),u=e[0][0](r-a*(s[1][0]+s[0][0]))/2,c=e[0][1](i-a*(s[1][1]+s[0][1]))/2;return null!=o&&t.clipExtent(o),t.scale(150*a).translate([u,c])}function ao(t,e){return[t,Lf(Rf((vf+e)/2))]}function uo(t,e){return[Lf(Rf((vf+e)/2)),-t]}function co(t,n,r,i){var o=t.properties||{},s=”Feature“===t.type?t.geometry:t;if(”GeometryCollection“===s.type){var a=[];return A(t,(function(t){var e=co(t,n,r,i);e&&a.push(e)})),c(a)}var u,h=j(t),l=h[1]>50&&h[3]>50;u=l?{type:s.type,coordinates:ho(s.coordinates,po(s))}:$e(s);var p,f=(new nh).read(u),g=d(y(n,r),”meters“),_=Hl.bufferOp(f,g);if(!function t(e){return Array.isArray(e[0])?t(e[0]):isNaN(e[0])}((_=(new rh).write(_)).coordinates))return(p=l?{type:_.type,coordinates:lo(_.coordinates,po(s))}:tn(_)).geometry?p:e(p,o)}function ho(t,e){return”object“!=typeof t[0]?e(t):t.map((function(t){return ho(t,e)}))}function lo(t,e){return”object“!=typeof t[0]?e.invert(t):t.map((function(t){return lo(t,e)}))}function po(t){var e=ce(t).geometry.coordinates.reverse(),n=e.map((function(t){return-t}));return ig().center(e).rotate(n).scale(wo)}function fo(){for(var t=new nh,e=t.read(JSON.stringify(arguments[0].geometry)),n=1;n=0&&(void 0===i||om/2;P&&(L-=m/4);for(var O=[],R=[],T=0;T<6;T++){var A=2*Math.PI/6*T;O.push(Math.cos(A)),R.push(Math.sin(A))}for(var D=[],F=0;F<=C;F++)for(var q=0;q<=M;q++){var G=F%2==1;if(!(0===q&&G||0===q&&P)){var B=F*E+a-S,k=q*w+u+L;if(G&&(k-=m/2),!0===i)(function(t,e,n,r,i,s){for(var a=[],u=0;u<6;u++){var c=[];c.push(t),c.push([t[0]+e*i[u],t[1]+n*s[u]]),c.push([t[0]+e*i[(u+1)%6],t[1]+n*s[(u+1)%6]]),c.push(t),a.push(o([c],r))}return a})([B,k],g/2,d/2,r,O,R).forEach((function(t){s?go(s,t)&&D.push(t):D.push(t)}));else{var z=function(t,e,n,r,i,s){for(var a=[],u=0;u<6;u++){var c=t[0]+e*i[u],h=t[1]+n*s[u];a.push([c,h])}return a.push(a[0].slice()),o([a],r)}([B,k],g/2,d/2,r,O,R);s?go(s,z)&&D.push(z):D.push(z)}}}return c(D)}function mo(t){if(t.features.length<=1)return t;var e=function(t){var e=Ro(),n=[];return F(t,(function(t,e){var r=j(t);n.push({minX:r[0],minY:r[1],maxX:r[2],maxY:r[3],geojson:t,index:e})})),e.load(n),e}(t),n=[],r={};return F(t,(function(t,i){if(r[i])return!0;for(e.remove({index:i},vo),r[i]=!0;;){var o=j(t),s=e.search({minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]});if(s.length>0){var a=s.map((function(t){return r[t.index]=!0,e.remove({index:t.index},vo),t.geojson}));a.push(t),t=fo.apply(this,a)}if(0===s.length)break}n.push(t)})),c(n)}function vo(t,e){return t.index===e.index}function xo(t,e,n){if(!I(n=n||{}))throw new Error(”options is invalid“);var r=n.properties,i=n.mask,s=[];if(null==e)throw new Error(”cellSide is required“);if(!b(e))throw new Error(”cellSide is invalid“);if(!t)throw new Error(”bbox is required“);if(!Array.isArray(t))throw new Error(”bbox must be array“);if(4!==t.length)throw new Error(”bbox must contain 4 numbers“);if(i&&-1===[”Polygon“,”MultiPolygon“].indexOf(K(i)))throw new Error(”options.mask must be a (Multi)Polygon“);for(var a=t[0],u=t[1],h=t[2],l=t[3],p=e/Dt([a,u],[h,u],n)*(h-a),f=e/Dt([a,u],[a,l],n)*(l-u),g=h-a,d=l-u,y=Math.floor(g/p),_=Math.floor(d/f),m=(d-_*f)/2,v=a+(g-y*p)/2,x=0;xe?1:0};i>r;){if(i-r>600){var s=i-r+1,a=n-r+1,u=Math.log(s),c=.5*Math.exp(2*u/3),h=.5*Math.sqrt(u*c*(s-c)/s)*(a-s/2<0?-1:1);t(e,n,Math.max(r,Math.floor(n-a*c/s+h)),Math.min(i,Math.floor(n+(s-a)*c/s+h)),o)}var l=e[n],p=r,f=i;for(rt(e,r,n),o(e[i],l)>0&&rt(e,r,i);p0;)f–}0===o(e[r],l)?rt(e,r,f):rt(e,++f,i),f<=n&&(r=f+1),n<=f&&(i=f-1)}},Ro=it;it.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,n=[],r=this.toBBox;if(!ft(t,e))return n;for(var i,o,s,a,u=[];e;){for(i=0,o=e.children.length;i=0&&o[e].children.length>this._maxEntries;)this._split(o,e),e–;this._adjustParentBBoxes(i,o,e)},_split:function(t,e){var n=t[e],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);var o=this._chooseSplitIndex(n,i,r),s=gt(n.children.splice(o,n.children.length-o));s.height=n.height,s.leaf=n.leaf,ot(n,this.toBBox),ot(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(n,s)},_splitRoot:function(t,e){this.data=gt([t,e]),this.data.height=t.height+1,this.data.leaf=!1,ot(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,n){var r,i,o,s,a,u,c,h;for(u=c=1/0,r=e;r<=n-e;r++)s=function(t,e){var n=Math.max(t.minX,e.minX),r=Math.max(t.minY,e.minY),i=Math.min(t.maxX,e.maxX),o=Math.min(t.maxY,e.maxY);return Math.max(0,i-n)*Math.max(0,o-r)}(i=st(t,0,r,this.toBBox),o=st(t,r,n,this.toBBox)),a=ht(i)+ht(o),s=e;i–)o=t.children[i],at(u,t.leaf?s(o):o),c+=lt(u);return c},_adjustParentBBoxes:function(t,e,n){for(var r=n;r>=0;r–)at(e[r],t)},_condense:function(t){for(var e,n=t.length-1;n>=0;n–)0===t[n].children.length?n>0?(e=t[n-1].children).splice(e.indexOf(t[n]),1):this.clear():ot(t[n],this.toBBox)},_initFormat:function(t){var e=[”return a“,” - b“,”;“];this.compareMinX=new Function(”a“,”b“,e.join(t[0])),this.compareMinY=new Function(”a“,”b“,e.join(t[1])),this.toBBox=new Function(”a“,”return {minX: a“t[0]”, minY: a“t[1]”, maxX: a“t[2]”, maxY: a“t[3]”};“)}};var To=function(t,e,n){var r=t*e,i=Ao*t,o=i-(i-t),s=t-o,a=Ao*e,u=a-(a-e),c=e-u,h=s*c-(r-o*u-s*u-o*c);return n?(n[0]=h,n[1]=r,n):[h,r]},Ao=+(Math.pow(2,27)+1),Do=function(t,e){var n=0|t.length,r=0|e.length;if(1===n&&1===r)return function(t,e){var n=t+e,r=n-t,i=t-(n-r)+(e-r);return i?[i,n]:[n]}(t[0],e[0]);var i,o,s=new Array(n+r),a=0,u=0,c=0,h=Math.abs,l=t[u],p=h(l),f=e[c],g=h(f);p=r?(i=l,(u+=1)=r?(i=l,(u+=1)>1;return[”sum(“,r(t.slice(0,e)),”,“,r(t.slice(e)),”)“].join(”“)}function i(t){if(2===t.length)return[[”sum(prod(“,t[0][0],”,“,t[1][1],”),prod(-“,t[0][1],”,“,t[1][0],”))“].join(”“)];for(var o=[],s=0;st”Exact“,p=[”function “,l,”(“,a.join(),”){var p=“,c,”,n=“,h,”,d=sub(p,n);return d[d.length-1];};return “,l].join(”“);return new Function(”sum“,”prod“,”scale“,”sub“,p)(Do,To,qo,Go)}var s=o(3),a=o(4),u=[function(){return 0},function(){return 0},function(t,e){return e[0]-t[0]},function(t,e,n){var r,i=(t[1]-n[1])*(e[0]-n[0]),o=(t[0]-n[0])*(e[1]-n[1]),a=i-o;if(i>0){if(o<=0)return a;r=i+o}else{if(!(i<0))return a;if(o>=0)return a;r=-(i+o)}var u=33306690738754716e-32*r;return a>=u||a<=-u?a:s(t,e,n)},function(t,e,n,r){var i=t[0]-r[0],o=e[0]-r[0],s=n[0]-r[0],u=t[1]-r[1],c=e[1]-r[1],h=n[1]-r[1],l=t[2]-r[2],p=e[2]-r[2],f=n[2]-r[2],g=o*h,d=s*c,y=s*u,_=i*h,m=i*c,v=o*u,x=l*(g-d)+p*(y-_)+f*(m-v),E=7771561172376103e-31*((Math.abs(g)+Math.abs(d))*Math.abs(l)+(Math.abs(y)+Math.abs(_))*Math.abs(p)+(Math.abs(m)+Math.abs(v))*Math.abs(f));return x>E||-x>E?x:a(t,e,n,r)}];!function(){for(;u.length<=5;)u.push(o(u.length));for(var e=[],n=["slow"],r=0;r<=5;++r)e.push("a"+r),n.push("o"+r);var i=["function getOrientation(",e.join(),"){switch(arguments.length){case 0:case 1:return 0;"];for(r=2;r<=5;++r)i.push("case ",r,":return o",r,"(",e.slice(0,r).join(),");");i.push("}var s=new Array(arguments.length);for(var i=0;i1&&zo(t[o[c-2]],t[o[c-1]],u)<=0;)c-=1,o.pop();for(o.push(a),c=s.length;c>1&&zo(t[s[c-2]],t[s[c-1]],u)>=0;)c-=1,s.pop();s.push(a)}n=new Array(s.length+o.length-2);for(var h=0,l=(r=0,o.length);r0;–p)n[h++]=s[p];return n},zo=Bo[3],jo=_t,Xo=_t;_t.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–,this.length>0&&(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];t>0;){var i=t-1>>1,o=e[i];if(n(r,o)>=0)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=0)break;e[t]=a,t=o}e[t]=i}},jo.default=Xo;var Uo=function(t,e){for(var n=t[0],r=t[1],i=!1,o=0,s=e.length-1;or!=h>r&&n<(c-a)*(r-u)/(h-u)+a&&(i=!i)}return i},Yo=Bo[3],Vo=mt,Ho=mt;Vo.default=Ho;var Wo=function(t){return t},Jo=function(t){if(null==t)return Wo;var e,n,r=t.scale[0],i=t.scale[1],o=t.translate[0],s=t.translate[1];return function(t,a){a||(e=n=0);var u=2,c=t.length,h=new Array(c);for(h[0]=(e+=t[0])*r+o,h[1]=(n+=t[1])*i+s;u=t)throw new Error(”full hashmap“);h=s[c=c+1&u]}return s[c]=r,a[c]=o,o},maybeSet:function(r,o){for(var c=e®&u,h=s[c],l=0;h!=i;){if(n(h,r))return a[c];if(++l>=t)throw new Error(”full hashmap“);h=s[c=c+1&u]}return s[c]=r,a[c]=o,o},get:function(r,o){for(var c=e®&u,h=s[c],l=0;h!=i;){if(n(h,r))return a[c];if(++l>=t)break;h=s[c=c+1&u]}return o},keys:function(){for(var t=[],e=0,n=s.length;e>7^rs[2]^rs[3])},os=function(t){var e,n,r,i=function(t){function e(t,e,n,r){if(p[n]!==t){p[n]=t;var i=f[n];if(i>=0){var o=g[n];i===e&&o===r||i===r&&o===e||(++y,d[n]=1)}else f[n]=e,g[n]=r}}function n(t){return is(u[t])}function r(t,e){return ts(u[t],u[e])}var i,o,s,a,u=t.coordinates,c=t.lines,h=t.rings,l=function(){for(var t=$o(1.4*u.length,n,r,Int32Array,-1,Int32Array),e=new Int32Array(u.length),i=0,o=u.length;i=t)throw new Error(”full hashset“);u=o[a=a+1&s]}return o[a]=r,!0},has:function®{for(var a=e®&s,u=o[a],c=0;u!=i;){if(n(u,r))return!0;if(++c>=t)break;u=o[a=a+1&s]}return!1},values:function(){for(var t=[],e=0,n=o.length;ea&&(a=e),nu&&(u=n)}function r(t){t.forEach(n)}function i(t){t.forEach®}var o=1/0,s=1/0,a=-1/0,u=-1/0,c={GeometryCollection:function(t){t.geometries.forEach(e)},Point:function(t){n(t.coordinates)},MultiPoint:function(t){t.coordinates.forEach(n)},LineString:function(t){r(t.arcs)},MultiLineString:function(t){t.arcs.forEach®},Polygon:function(t){t.arcs.forEach®},MultiPolygon:function(t){t.arcs.forEach(i)}};for(var h in t)e(t[h]);return a>=o&&u>=s?[o,s,a,u]:void 0}(t=function(t){var e,n={};for(e in t)n[e]=jt(t[e]);return n}(t)),s=e>0&&o&&function(t,e,n){function r(t){return[Math.round((t[0]-c)*f),Math.round((t[1]-h)*g)]}function i(t,e){for(var n,r,i,o,s,a=-1,u=0,l=t.length,p=new Array(l);++at&&(e.push®,n=i)}return e},as.prototype.vector=function(t){var e=this.pos(t+10),n=this.pos(t-10);return{angle:180*Math.atan2(e.y-n.y,e.x-n.x)/3.14,speed:Math.sqrt((n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y)+(n.z-e.z)*(n.z-e.z))}},as.prototype.pos=function(t){var e=t-this.delay;e<0&&(e=0),e>this.duration&&(e=this.duration-1);var n=e/this.duration;if(n>=1)return this.points[this.length-1];var r=Math.floor((this.points.length-1)*n);return function(t,e,n,r,i){var o=function(t){var e=t*t;return[e*t,3*e*(1-t),3*t*(1-t)*(1-t),(1-t)*(1-t)*(1-t)]}(t);return{x:i.x*o[0]+r.x*o[1]+n.x*o[2]+e.x*o[3],y:i.y*o[0]+r.y*o[1]+n.y*o[2]+e.y*o[3],z:i.z*o[0]+r.z*o[1]+n.z*o[2]+e.z*o[3]}}((this.length-1)*n-r,this.points[r],this.controls[r][1],this.controls[r+1][0],this.points[r+1])};var us=pe,cs=pe;pe.deviation=function(t,e,n,r){var i=e&&e.length,o=i?e[0]*n:t.length,s=Math.abs(Ce(t,0,o,n));if(i)for(var a=0,u=e.length;a0&&(r+=t[i-1].length,n.holes.push®)}return n},us.default=cs,Oe.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,n=[],r=this.toBBox;if(!ke(t,e))return n;for(var i,o,s,a,u=[];e;){for(i=0,o=e.children.length;i=0&&o[e].children.length>this._maxEntries;)this._split(o,e),e–;this._adjustParentBBoxes(i,o,e)},_split:function(t,e){var n=t[e],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);var o=this._chooseSplitIndex(n,i,r),s=ze(n.children.splice(o,n.children.length-o));s.height=n.height,s.leaf=n.leaf,Re(n,this.toBBox),Re(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(n,s)},_splitRoot:function(t,e){this.data=ze([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Re(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,n){var r,i,o,s,a,u,c,h;for(u=c=1/0,r=e;r<=n-e;r++)s=function(t,e){var n=Math.max(t.minX,e.minX),r=Math.max(t.minY,e.minY),i=Math.min(t.maxX,e.maxX),o=Math.min(t.maxY,e.maxY);return Math.max(0,i-n)*Math.max(0,o-r)}(i=Te(t,0,r,this.toBBox),o=Te(t,r,n,this.toBBox)),a=qe(i)+qe(o),s=e;i–)o=t.children[i],Ae(u,t.leaf?s(o):o),c+=Ge(u);return c},_adjustParentBBoxes:function(t,e,n){for(var r=n;r>=0;r–)Ae(e[r],t)},_condense:function(t){for(var e,n=t.length-1;n>=0;n–)0===t[n].children.length?n>0?(e=t[n-1].children).splice(e.indexOf(t[n]),1):this.clear():Re(t[n],this.toBBox)},_initFormat:function(t){var e=[”return a“,” - b“,”;“];this.compareMinX=new Function(”a“,”b“,e.join(t[0])),this.compareMinY=new Function(”a“,”b“,e.join(t[1])),this.toBBox=new Function(”a“,”return {minX: a“t[0]”, minY: a“t[1]”, maxX: a“t[2]”, maxY: a“t[3]”};“)}};var hs=Object.freeze({toMercator:$e,toWgs84:tn}),ls=6378137,ps=function(t){function e(){for(var t=[],e=0;e1)for(e=0;e=1||u<=0||c>=1||c<=0))){var d=g,y=!a[d];y&&(a[d]=!0),e?s.push(e(g,t,n,h,l,u,r,i,p,f,c,y)):s.push(g)}}function i(t,e){var n,r,i,s,a=o[t][e],u=o[t][e+1];return a[0]y[e.isect].coord?-1:1})),f=[];N.length>0;){var P=N.pop(),O=P.isect,R=P.parent,T=P.winding,A=f.length,D=[y[O].coord],F=O;if(y[O].ringAndEdge1Walkable)var q=y[O].ringAndEdge1,G=y[O].nxtIsectAlongRingAndEdge1;else q=y[O].ringAndEdge2,G=y[O].nxtIsectAlongRingAndEdge2;for(;!bn(y[O].coord,y[G].coord);){D.push(y[G].coord);var B=void 0;for(a=0;at[1]”,“},r=0;rt” and “+e)};xs.prototype.interpolate=function(t){var e=Math.sin((1-t)*this.g)/Math.sin(this.g),n=Math.sin(t*this.g)/Math.sin(this.g),r=e*Math.cos(this.start.y)*Math.cos(this.start.x)+n*Math.cos(this.end.y)*Math.cos(this.end.x),i=e*Math.cos(this.start.y)*Math.sin(this.start.x)+n*Math.cos(this.end.y)*Math.sin(this.end.x),o=e*Math.sin(this.start.y)+n*Math.sin(this.end.y),s=ys*Math.atan2(o,Math.sqrt(Math.pow(r,2)+Math.pow(i,2)));return[ys*Math.atan2(i,r),s]},xs.prototype.Arc=function(t,e){var n=[];if(!t||t<=2)n.push([this.start.lon,this.start.lat]),n.push([this.end.lon,this.end.lat]);else for(var r=1/(t-1),i=0;ip&&(d>h&&gh&&du&&(u=y)}var _=[];if(a&&u0&&Math.abs(x-n[v-1][0])>p){var E=parseFloat(n[v-1][0]),w=parseFloat(n[v-1][1]),b=parseFloat(n[v][0]),I=parseFloat(n[v][1]);if(E>-180&&E-180&&n[v-1][0]h&&E<180&&-180===b&&v+1h&&n[v-1][0]<180){m.push([180,n[v][1]]),v++,m.push([n[v][0],n[v][1]]);continue}if(Eh){var N=E;E=b,b=N;var C=w;w=I,I=C}if(E>h&&b=180&&Eh?180:-180,M]),(m=[]).push([n[v-1][0]>h?-180:180,M]),_.push(m)}else m=[],_.push(m);m.push([x,n[v][1]])}else m.push([n[v][0],n[v][1]])}}else{var L=[];_.push(L);for(var P=0;P=0&&i.coordinates[0]-t.coordinates[0]<0)return 1;if(r.coordinates[0]-t.coordinates[0]<0&&i.coordinates[0]-t.coordinates[0]>=0)return-1;if(r.coordinates[0]-t.coordinates[0]==0&&i.coordinates[0]-t.coordinates[0]==0)return r.coordinates[1]-t.coordinates[1]>=0||i.coordinates[1]-t.coordinates[1]>=0?r.coordinates[1]-i.coordinates[1]:i.coordinates[1]-r.coordinates[1];var o=ur(t.coordinates,r.coordinates,i.coordinates);return o<0?1:o>0?-1:Math.pow(r.coordinates[0]-t.coordinates[0],2)+Math.pow(r.coordinates[1]-t.coordinates[1],2)-(Math.pow(i.coordinates[0]-t.coordinates[0],2)+Math.pow(i.coordinates[1]-t.coordinates[1],2))})),this.outerEdgesSorted=!0)},ya.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},ya.prototype.getOuterEdge=function(t){return this.sortOuterEdges(),this.outerEdges[t]},ya.prototype.addInnerEdge=function(t){this.innerEdges.push(t)};var _a=function(t,e){this.from=t,this.to=e,this.next=void 0,this.label=void 0,this.symetric=void 0,this.ring=void 0,this.from.addOuterEdge(this),this.to.addInnerEdge(this)};_a.prototype.getSymetric=function(){return this.symetric||(this.symetric=new _a(this.to,this.from),this.symetric.symetric=this),this.symetric},_a.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},_a.prototype.isEqual=function(t){return this.from.id===t.from.id&&this.to.id===t.to.id},_a.prototype.toString=function(){return”Edge { “this.from.id” -> “this.to.id” }“},_a.prototype.toLineString=function(){return a([this.from.coordinates,this.to.coordinates])},_a.prototype.compareTo=function(t){return ur(t.from.coordinates,t.to.coordinates,this.to.coordinates)};var ma=function(){this.edges=[],this.polygon=void 0,this.envelope=void 0},va={length:{configurable:!0}};ma.prototype.push=function(t){this[this.edges.length]=t,this.edges.push(t),this.polygon=this.envelope=void 0},ma.prototype.get=function(t){return this.edges[t]},va.length.get=function(){return this.edges.length},ma.prototype.forEach=function(t){this.edges.forEach(t)},ma.prototype.map=function(t){return this.edges.map(t)},ma.prototype.some=function(t){return this.edges.some(t)},ma.prototype.isValid=function(){return!0},ma.prototype.isHole=function(){var t=this,e=this.edges.reduce((function(e,n,r){return n.from.coordinates[1]>t.edges[e].from.coordinates[1]&&(e=r),e}),0),n=(0===e?this.length:e)-1,r=(e+1)%this.length,i=ur(this.edges[n].from.coordinates,this.edges[e].from.coordinates,this.edges[r].from.coordinates);return 0===i?this.edges[n].from.coordinates[0]>this.edges[r].from.coordinates[0]:i>0},ma.prototype.toMultiPoint=function(){return l(this.edges.map((function(t){return t.from.coordinates})))},ma.prototype.toPolygon=function(){if(this.polygon)return this.polygon;var t=this.edges.map((function(t){return t.from.coordinates}));return t.push(this.edges[0].from.coordinates),this.polygon=o([t])},ma.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=ie(this.toPolygon())},ma.findEdgeRingContaining=function(t,e){var n,i,o=t.getEnvelope();return e.forEach((function(e){var s=e.getEnvelope();if(i&&(n=i.getEnvelope()),!function(t,e){var n=t.geometry.coordinates.map((function(t){return t[0]})),r=t.geometry.coordinates.map((function(t){return t[1]})),i=e.geometry.coordinates.map((function(t){return t[0]})),o=e.geometry.coordinates.map((function(t){return t[1]}));return Math.max(null,n)===Math.max(null,i)&&Math.max(null,r)===Math.max(null,o)&&Math.min(null,n)===Math.min(null,i)&&Math.min(null,r)===Math.min(null,o)}(s,o)&&cr(s,o)){var a=t.map((function(t){return t.from.coordinates})).find((function(t){return!e.some((function(e){return function(t,e){return t[0]===e[0]&&t[1]===e[1]}(t,e.from.coordinates)}))}));a&&e.inside(r(a))&&(i&&!cr(n,s)||(i=e))}})),i},ma.prototype.inside=function(t){return Mt(t,this.toPolygon())},Object.defineProperties(ma.prototype,va);var xa=function(){this.edges=[],this.nodes={}};xa.fromGeoJson=function(t){!function(t){if(!t)throw new Error(”No geojson passed“);if(”FeatureCollection“!==t.type&&”GeometryCollection“!==t.type&&”MultiLineString“!==t.type&&”LineString“!==t.type&&”Feature“!==t.type)throw new Error(”Invalid input type ‘“t.type”’. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature“)}(t);var e=new xa;return F(t,(function(t){H(t,”LineString“,”Graph::fromGeoJson“),M(t,(function(t,n){if(t){var r=e.getNode(t),i=e.getNode(n);e.addEdge(r,i)}return n}))})),e},xa.prototype.getNode=function(t){var e=ya.buildId(t),n=this.nodes[e];return n||(n=this.nodes[e]=new ya(t)),n},xa.prototype.addEdge=function(t,e){var n=new _a(t,e),r=n.getSymetric();this.edges.push(n),this.edges.push®},xa.prototype.deleteDangles=function(){var t=this;Object.keys(this.nodes).map((function(e){return t.nodes[e]})).forEach((function(e){return t._removeIfDangle(e)}))},xa.prototype._removeIfDangle=function(t){var e=this;if(t.innerEdges.length<=1){var n=t.getOuterEdges().map((function(t){return t.to}));this.removeNode(t),n.forEach((function(t){return e._removeIfDangle(t)}))}},xa.prototype.deleteCutEdges=function(){var t=this;this._computeNextCWEdges(),this._findLabeledEdgeRings(),this.edges.forEach((function(e){e.label===e.symetric.label&&(t.removeEdge(e.symetric),t.removeEdge(e))}))},xa.prototype._computeNextCWEdges=function(t){var e=this;void 0===t?Object.keys(this.nodes).forEach((function(t){return e._computeNextCWEdges(e.nodes[t])})):t.getOuterEdges().forEach((function(e,n){t.getOuterEdge((0===n?t.getOuterEdges().length:n)-1).symetric.next=e}))},xa.prototype._computeNextCCWEdges=function(t,e){for(var n,r,i=t.getOuterEdges(),o=i.length-1;o>=0;–o){var s=i[o],a=s.symetric,u=void 0,c=void 0;s.label===e&&(u=s),a.label===e&&(c=a),u&&c&&(c&&(r=c),u&&(r&&(r.next=u,r=void 0),n||(n=u)))}r&&(r.next=n)},xa.prototype._findLabeledEdgeRings=function(){var t=[],e=0;return this.edges.forEach((function(n){if(!(n.label>=0)){t.push(n);var r=n;do{r.label=e,r=r.next}while(!n.isEqual®);e++}})),t},xa.prototype.getEdgeRings=function(){var t=this;this._computeNextCWEdges(),this.edges.forEach((function(t){t.label=void 0})),this._findLabeledEdgeRings().forEach((function(e){t._findIntersectionNodes(e).forEach((function(n){t._computeNextCCWEdges(n,e.label)}))}));var e=[];return this.edges.forEach((function(n){n.ring||e.push(t._findEdgeRing(n))})),e},xa.prototype._findIntersectionNodes=function(t){var e=[],n=t,r=function(){var r=0;n.from.getOuterEdges().forEach((function(e){e.label===t.label&&++r})),r>1&&e.push(n.from),n=n.next};do{r()}while(!t.isEqual(n));return e},xa.prototype._findEdgeRing=function(t){var e=t,n=new ma;do{n.push(e),e.ring=n,e=e.next}while(!t.isEqual(e));return n},xa.prototype.removeNode=function(t){var e=this;t.getOuterEdges().forEach((function(t){return e.removeEdge(t)})),t.innerEdges.forEach((function(t){return e.removeEdge(t)})),delete this.nodes[t.id]},xa.prototype.removeEdge=function(t){this.edges=this.edges.filter((function(e){return!e.isEqual(t)})),t.deleteEdge()};var Ea=yt((function(t,e){function n(t){var e=[];for(var n in t)e.push(n);return e}(t.exports=”function“==typeof Object.keys?Object.keys:n).shim=n})),wa=(Ea.shim,yt((function(t,e){function n(t){return”[object Arguments]“==Object.prototype.toString.call(t)}function r(t){return t&&”object“==typeof t&&”number“==typeof t.length&&Object.prototype.hasOwnProperty.call(t,”callee“)&&!Object.prototype.propertyIsEnumerable.call(t,”callee“)||!1}var i=”[object Arguments]“==function(){return Object.prototype.toString.call(arguments)}();(e=t.exports=i?n:r).supported=n,e.unsupported=r}))),ba=(wa.supported,wa.unsupported,yt((function(t){function e(t){return null==t}function n(t){return!(!t||”object“!=typeof t||”number“!=typeof t.length||”function“!=typeof t.copy||”function“!=typeof t.slice||t.length>0&&”number“!=typeof t[0])}var r=Array.prototype.slice,i=t.exports=function(t,o,s){return s||(s={}),t===o||(t instanceof Date&&o instanceof Date?t.getTime()===o.getTime():!t||!o||”object“!=typeof t&&”object“!=typeof o?s.strict?t===o:t==o:function(t,o,s){var a,u;if(e(t)||e(o))return!1;if(t.prototype!==o.prototype)return!1;if(wa(t))return!!wa(o)&&(t=r.call(t),o=r.call(o),i(t,o,s));if(n(t)){if(!n(o))return!1;if(t.length!==o.length)return!1;for(a=0;a=0;a–)if(c[a]!=h[a])return!1;for(a=c.length-1;a>=0;a–)if(u=c[a],!i(t[u],o[u],s))return!1;return typeof t==typeof o}(t,o,s))}}))),Ia=function(t){this.precision=t&&t.precision?t.precision:17,this.direction=!(!t||!t.direction)&&t.direction,this.pseudoNode=!(!t||!t.pseudoNode)&&t.pseudoNode,this.objectComparator=t&&t.objectComparator?t.objectComparator:xr};Ia.prototype.compare=function(t,e){if(t.type!==e.type||!vr(t,e))return!1;switch(t.type){case”Point“:return this.compareCoord(t.coordinates,e.coordinates);case”LineString“:return this.compareLine(t.coordinates,e.coordinates,0,!1);case”Polygon“:return this.comparePolygon(t,e);case”Feature“:return this.compareFeature(t,e);default:if(0===t.type.indexOf(”Multi“)){var n=this,r=mr(t),i=mr(e);return r.every((function(t){return this.some((function(e){return n.compare(t,e)}))}),i)}}return!1},Ia.prototype.compareCoord=function(t,e){if(t.length!==e.length)return!1;for(var n=0;n=0&&(n=[].concat(t.slice(r,t.length),t.slice(1,r+1))),n},Ia.prototype.comparePath=function(t,e){var n=this;return t.every((function(t,e){return n.compareCoord(t,this[e])}),e)},Ia.prototype.comparePolygon=function(t,e){if(this.compareLine(t.coordinates[0],e.coordinates[0],1,!0)){var n=t.coordinates.slice(1,t.coordinates.length),r=e.coordinates.slice(1,e.coordinates.length),i=this;return n.every((function(t){return this.some((function(e){return i.compareLine(t,e,1,!0)}))}),r)}return!1},Ia.prototype.compareFeature=function(t,e){return!(t.id!==e.id||!this.objectComparator(t.properties,e.properties)||!this.compareBBox(t,e))&&this.compare(t.geometry,e.geometry)},Ia.prototype.compareBBox=function(t,e){return!!(!t.bbox&&!e.bbox||t.bbox&&e.bbox&&this.compareCoord(t.bbox,e.bbox))},Ia.prototype.removePseudo=function(t){return t};var Na=Ia,Ca=yt((function(t){function e(t,e,n,r){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(t,e,n,r)}e.prototype.run=function(t,e,n,r){this._init(t,e,n,r);for(var i=0;i=this.minPts&&(e=this._mergeArrays(e,i))}1!==this._assigned[r]&&this._addToCluster(r,t)}},e.prototype._addToCluster=function(t,e){this.clusters[e].push(t),this._assigned[t]=1},e.prototype._regionQuery=function(t){for(var e=[],n=0;n0){for(u=0;u=0);return t},e.prototype.assign=function(){for(var t,e=!1,n=this.dataset.length,r=0;ri&&(n=r):e=this.minPts)return n},e.prototype._regionQuery=function(t,e){e=e||this.epsilon;for(var n=[],r=0,i=this.dataset.length;r0,f=[];if(n)i=”kmrand“==n?function(t,e){for(var n={},r=[],i=e<<2,o=t.length,s=t[0].length>0;r.length0;){var a=t[Math.floor(Math.random()*o)],u=s?a.join(”_“):”“+a;n[u]||(n[u]=!0,r.push(a))}if(r.length0,s=t[Math.floor(Math.random()*i)];for(o&&s.join(”_“),r.push(s);r.length0;){var u=s.pop();if(u===n)return Ir(u);u.closed=!0;for(var c=t.neighbors(u),h=0,l=c.length;hthis.x” “this.y”]“},Cr.prototype.getCost=function(t){return t&&t.x!==this.x&&t.y!==this.y?1.41421*this.weight:this.weight},Cr.prototype.isWall=function(){return 0===this.weight},Sr.prototype={push:function(t){this.content.push(t),this.sinkDown(this.content.length-1)},pop:function(){var t=this.content[0],e=this.content.pop();return this.content.length>0&&(this.content[0]=e,this.bubbleUp(0)),t},remove:function(t){var e=this.content.indexOf(t),n=this.content.pop();e!==this.content.length-1&&(this.content[e]=n,this.scoreFunction(n)0;){var n=(t+1>>1)-1,r=this.content[n];if(!(this.scoreFunction(e)=a)return null;var u=t-i.site[0],c=e-i.site[1],h=u*u+c*c;do{i=o.cells[r=s],s=null,i.halfedges.forEach((function(n){var r=o.edges[n],a=r.left;if(a!==i.site&&a||(a=r.right)){var u=t-a[0],c=e-a[1],l=u*u+c*c;le.x?1:this.ye.y?1:0},nu.prototype.clone=function(){},nu.prototype.copy=function(){return new nu(this)},nu.prototype.toString=function(){return”(“this.x”, “this.y”, “this.z”)“},nu.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)},nu.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)},nu.prototype.hashCode=function(){var t=17;return 37*(t=37*t+nu.hashCode(this.x))+nu.hashCode(this.y)},nu.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},nu.prototype.interfaces_=function(){return[$a,tu,_i]},nu.prototype.getClass=function(){return nu},nu.hashCode=function(){if(1===arguments.length){var t=arguments[0],e=Ka.doubleToLongBits(t);return Math.trunc((e^e)>>>32)}},ru.DimensionalComparator.get=function(){return iu},ru.serialVersionUID.get=function(){return 0x5cbf2c235c7e5800},ru.NULL_ORDINATE.get=function(){return Ka.NaN},ru.X.get=function(){return 0},ru.Y.get=function(){return 1},ru.Z.get=function(){return 2},Object.defineProperties(nu,ru);var iu=function(t){if(this._dimensionsToTest=2,0===arguments.length);else if(1===arguments.length){var e=arguments[0];if(2!==e&&3!==e)throw new Za(”only 2 or 3 dimensions may be specified“);this._dimensionsToTest=e}};iu.prototype.compare=function(t,e){var n=t,r=e,i=iu.compare(n.x,r.x);if(0!==i)return i;var o=iu.compare(n.y,r.y);return 0!==o?o:this._dimensionsToTest<=2?0:iu.compare(n.z,r.z)},iu.prototype.interfaces_=function(){return[eu]},iu.prototype.getClass=function(){return iu},iu.compare=function(t,e){return te?1:Ka.isNaN(t)?Ka.isNaN(e)?0:-1:Ka.isNaN(e)?1:0};var ou=function(){};ou.prototype.create=function(){},ou.prototype.interfaces_=function(){return[]},ou.prototype.getClass=function(){return ou};var su=function(){},au={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};su.prototype.interfaces_=function(){return[]},su.prototype.getClass=function(){return su},su.toLocationSymbol=function(t){switch(t){case su.EXTERIOR:return”e“;case su.BOUNDARY:return”b“;case su.INTERIOR:return”i“;case su.NONE:return”-“}throw new Za(”Unknown location value: “+t)},au.INTERIOR.get=function(){return 0},au.BOUNDARY.get=function(){return 1},au.EXTERIOR.get=function(){return 2},au.NONE.get=function(){return-1},Object.defineProperties(su,au);var uu=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},cu=function(){},hu={LOG_10:{configurable:!0}};cu.prototype.interfaces_=function(){return[]},cu.prototype.getClass=function(){return cu},cu.log10=function(t){var e=Math.log(t);return Ka.isInfinite(e)||Ka.isNaN(e)?e:e/cu.LOG_10},cu.min=function(t,e,n,r){var i=t;return en?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 ro?o:r}},cu.wrap=function(t,e){return t<0?e- -t%e:t%e},cu.max=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2],r=t;return e>r&&(r=e),n>r&&(r=n),r}if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3],u=i;return o>u&&(u=o),s>u&&(u=s),a>u&&(u=a),u}},cu.average=function(t,e){return(t+e)/2},hu.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(cu,hu);var lu=function(t){this.str=t};lu.prototype.append=function(t){this.str+=t},lu.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},lu.prototype.toString=function(t){return this.str};var pu=function(t){this.value=t};pu.prototype.intValue=function(){return this.value},pu.prototype.compareTo=function(t){return this.valuet?1:0},pu.isNaN=function(t){return Number.isNaN(t)};var fu=function(){};fu.isWhitespace=function(t){return t<=32&&t>=0||127===t},fu.toUpperCase=function(t){return t.toUpperCase()};var gu=function t(){if(this._hi=0,this._lo=0,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®)}}else if(2===arguments.length){var i=arguments[0],o=arguments[1];this.init(i,o)}},du={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}};gu.prototype.le=function(t){return(this._hi9?(h=!0,l=”9“):l=”0“+c,s.append(l),n=n.subtract(gu.valueOf©).multiply(gu.TEN),h&&n.selfAdd(gu.TEN);var p=!0,f=gu.magnitude(n._hi);if(f<0&&Math.abs(f)>=a-u&&(p=!1),!p)break}return e[0]=r,s.toString()},gu.prototype.sqr=function(){return this.multiply(this)},gu.prototype.doubleValue=function(){return this._hi+this._lo},gu.prototype.subtract=function(){if(arguments[0]instanceof gu){var t=arguments[0];return this.add(t.negate())}if(”number“==typeof arguments[0]){var e=arguments[0];return this.add(-e)}},gu.prototype.equals=function(){if(1===arguments.length){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},gu.prototype.isZero=function(){return 0===this._hi&&0===this._lo},gu.prototype.selfSubtract=function(){if(arguments[0]instanceof gu){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)}},gu.prototype.getSpecialNumberString=function(){return this.isZero()?”0.0“:this.isNaN()?”NaN “:null},gu.prototype.min=function(t){return this.le(t)?this:t},gu.prototype.selfDivide=function(){if(1===arguments.length){if(arguments[0]instanceof gu){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,c=null,h=null,l=null;return u=this._hi/n,l=(i=(c=gu.SPLIT*u)-(i=c-u))*(s=(l=gu.SPLIT*n)-(s=l-n))-(h=u*n)+i*(a=n-s)+(o=u-i)*s+o*a,l=u+(c=(this._hi-h-l+this._lo-u*r)/n),this._hi=l,this._lo=u-l+c,this}},gu.prototype.dump=function(){return”DD<"this._hi“, ”this._lo“>”},gu.prototype.divide=function(){if(arguments[0]instanceof gu){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=gu.SPLIT*o)-(e=s-o)),u=e*(r=(u=gu.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 gu(u=o+s,o-u+s)}if(“number”==typeof arguments[0]){var c=arguments[0];return Ka.isNaN©?gu.createNaN():gu.copy(this).selfDivide(c,0)}},gu.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},gu.prototype.pow=function(t){if(0===t)return gu.valueOf(1);var e=new gu(this),n=gu.valueOf(1),r=Math.abs(t);if(r>1)for(;r>0;)r%2==1&&n.selfMultiply(e),(r/=2)>0&&(e=e.sqr());else n=e;return t<0?n.reciprocal():n},gu.prototype.ceil=function(){if(this.isNaN())return gu.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new gu(t,e)},gu.prototype.compareTo=function(t){var e=t;return this._hie._hi?1:this._loe._lo?1:0},gu.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},gu.prototype.setValue=function(){if(arguments[0]instanceof gu){var t=arguments[0];return this.init(t),this}if(“number”==typeof arguments[0]){var e=arguments[0];return this.init(e),this}},gu.prototype.max=function(t){return this.ge(t)?this:t},gu.prototype.sqrt=function(){if(this.isZero())return gu.valueOf(0);if(this.isNegative())return gu.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=gu.valueOf(e),r=this.subtract(n.sqr())._hi*(.5*t);return n.add®},gu.prototype.selfAdd=function(){if(1===arguments.length){if(arguments[0]instanceof gu){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 o=(i=this._hi+e)-(s=i-this._hi),r=(a=(o=e-s+(this._hi-o))this._lo)(i-(n=i+a)),this._hi=n+r,this._lo=r+(n-this._hi),this}}else if(2===arguments.length){var u=arguments[0],c=arguments[1],h=null,l=null,p=null,f=null,g=null,d=null,y=null;f=this._hi+u,l=this._lo+c,g=f-(d=f-this._hi),p=l-(y=l-this._lo);var _=(h=f+(d=(g=u-d+(this._hi-g))+l))+(d=(p=c-y+(this._lo-p))+(d+(f-h))),m=d+(h-_);return this.hi=,this._lo=m,this}},gu.prototype.selfMultiply=function(){if(1===arguments.length){if(arguments[0]instanceof gu){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,c=null;i=(u=gu.SPLIT*this._hi)-this._hi,c=gu.SPLIT*n,i=u-i,o=this._hi-i,s=c-n;var h=(u=this._hi*n)+(c=i*(s=c-s)-u+i*(a=n-s)+o*s+o*a+(this._hi*r+this._lo*n)),l=c+(i=u-h);return this._hi=h,this._lo=l,this}},gu.prototype.selfSqr=function(){return this.selfMultiply(this)},gu.prototype.floor=function(){if(this.isNaN())return gu.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new gu(t,e)},gu.prototype.negate=function(){return this.isNaN()?this:new gu(-this._hi,-this._lo)},gu.prototype.clone=function(){},gu.prototype.multiply=function(){if(arguments[0]instanceof gu){var t=arguments[0];return t.isNaN()?gu.createNaN():gu.copy(this).selfMultiply(t)}if(“number”==typeof arguments[0]){var e=arguments[0];return Ka.isNaN(e)?gu.createNaN():gu.copy(this).selfMultiply(e,0)}},gu.prototype.isNaN=function(){return Ka.isNaN(this._hi)},gu.prototype.intValue=function(){return Math.trunc(this._hi)},gu.prototype.toString=function(){var t=gu.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()},gu.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."+gu.stringOfChar("0",-r)+n;else if(-1===n.indexOf(".")){var o=r-n.length;i=n+gu.stringOfChar("0",o)+".0"}return this.isNegative()?"-"+i:i},gu.prototype.reciprocal=function(){var t,e,n,r,i=null,o=null,s=null,a=null;t=(n=1/this._hi)-(i=(s=gu.SPLIT*n)-(i=s-n)),o=(a=gu.SPLIT*this._hi)-this._hi;var u=n+(s=(1-(r=n*this._hi)-(a=i*(o=a-o)-r+i*(e=this._hi-o)+t*o+t*e)-n*this._lo)/this._hi);return new gu(u,n-u+s)},gu.prototype.toSciNotation=function(){if(this.isZero())return gu.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=gu.SCI_NOT_EXPONENT_CHAR+e[0];if("0"===n.charAt(0))throw new Error("Found leading zero: "+n);var i="";n.length>1&&(i=n.substring(1));var o=n.charAt(0)+“.”+i;return this.isNegative()?“-”+o+r:o+r},gu.prototype.abs=function(){return this.isNaN()?gu.NaN:this.isNegative()?this.negate():new gu(this)},gu.prototype.isPositive=function(){return(this._hi>0||0===this._hi)&&this._lo>0},gu.prototype.lt=function(t){return(this._hit._hi||this._hi===t._hi)&&this._lo>t._lo},gu.prototype.isNegative=function(){return(this._hi<0||0===this._hi)&&this._lo<0},gu.prototype.trunc=function(){return this.isNaN()?gu.NaN:this.isPositive()?this.floor():this.ceil()},gu.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},gu.prototype.interfaces_=function(){return[_i,$a,tu]},gu.prototype.getClass=function(){return gu},gu.sqr=function(t){return gu.valueOf(t).selfMultiply(t)},gu.valueOf=function(){if("string"==typeof arguments[0]){var t=arguments[0];return gu.parse(t)}if("number"==typeof arguments[0]){var e=arguments[0];return new gu(e)}},gu.sqrt=function(t){return gu.valueOf(t).sqrt()},gu.parse=function(t){for(var e=0,n=t.length;fu.isWhitespace(t.charAt(e));)e++;var r=!1;if(e=n);){var c=t.charAt(e);if(e++,fu.isDigit©){var h=c-“0”;o.selfMultiply(gu.TEN),o.selfAdd(h),s++}else{if(“.”!==c){if(“e”===c||“E”===c){var l=t.substring(e);try{u=pu.parseInt(l)}catch(e){throw e instanceof Error?new Error(“Invalid exponent ”l“ in string ”+t):e}break}throw new Error(“Unexpected character ‘”c“’ at position ”e“ in string ”+t)}a=s}}var p=o,f=s-a-u;if(0===f)p=o;else if(f>0){var g=gu.TEN.pow(f);p=o.divide(g)}else if(f<0){var d=gu.TEN.pow(-f);p=o.multiply(d)}return r?p.negate():p},gu.createNaN=function(){return new gu(Ka.NaN,Ka.NaN)},gu.copy=function(t){return new gu(t)},gu.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},gu.stringOfChar=function(t,e){for(var n=new lu,r=0;r0){if(o<=0)return yu.signum(s);r=i+o}else{if(!(i<0))return yu.signum(s);if(o>=0)return yu.signum(s);r=-i-o}var a=yu.DP_SAFE_EPSILON*r;return s>=a||-s>=a?yu.signum(s):2},yu.signum=function(t){return t>0?1:t<0?-1:0},_u.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(yu,_u);var mu=function(){},vu={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};vu.X.get=function(){return 0},vu.Y.get=function(){return 1},vu.Z.get=function(){return 2},vu.M.get=function(){return 3},mu.prototype.setOrdinate=function(t,e,n){},mu.prototype.size=function(){},mu.prototype.getOrdinate=function(t,e){},mu.prototype.getCoordinate=function(){},mu.prototype.getCoordinateCopy=function(t){},mu.prototype.getDimension=function(){},mu.prototype.getX=function(t){},mu.prototype.clone=function(){},mu.prototype.expandEnvelope=function(t){},mu.prototype.copy=function(){},mu.prototype.getY=function(t){},mu.prototype.toCoordinateArray=function(){},mu.prototype.interfaces_=function(){return[tu]},mu.prototype.getClass=function(){return mu},Object.defineProperties(mu,vu);var xu=function(){},Eu=function(t){function e(){t.call(this,"Projective point not representable on the Cartesian plane.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(xu),wu=function(){};wu.arraycopy=function(t,e,n,r,i){for(var o=0,s=e;se=arguments;this.x=e.x,this.y=e.y,this.w=1}else if(2===arguments.length){if(“number”==typeof arguments&&“number”==typeof arguments){var n=arguments,r=arguments;this.x=n,this.y=r,this.w=1}else if(argumentsinstanceof t&&argumentsinstanceof t){var i=arguments,o=arguments;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(argumentsinstanceof nu&&argumentsinstanceof nu){var s=arguments,a=arguments;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,c=arguments,h=arguments;this.x=u,this.y=c,this.w=h}else if(4===arguments.length){var l=arguments,p=arguments,f=arguments,g=arguments,d=l.y-p.y,y=p.x-l.x,_=l.x*p.y-p.x*l.y,m=f.y-g.y,v=g.x-f.x,x=f.x*g.y-g.x*f.y;this.x=y*x-v*_,this.y=m*_-d*x,this.w=d*v-m*y}};bu.prototype.getY=function(){var t=this.y/this.w;if(Ka.isNaN(t)||Ka.isInfinite(t))throw new Eu;return t},bu.prototype.getX=function(){var t=this.x/this.w;if(Ka.isNaN(t)||Ka.isInfinite(t))throw new Eu;return t},bu.prototype.getCoordinate=function(){var t=new nu;return t.x=this.getX(),t.y=this.getY(),t},bu.prototype.interfaces_=function(){return[]},bu.prototype.getClass=function(){return bu},bu.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,c=n.x*r.y-r.x*n.y,h=i*u-a*o,l=(o*c-u*s)/h,p=(a*s-i*c)/h;if(Ka.isNaN(l)||Ka.isInfinite(l)||Ka.isNaN(p)||Ka.isInfinite(p))throw new Eu;return new nu(l,p)};var Iu=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(argumentsinstanceof nu){var e=arguments;this.init(e.x,e.x,e.y,e.y)}else if(argumentsinstanceof t){var n=arguments;this.init(n)}}else if(2===arguments.length){var r=arguments,i=arguments;this.init(r.x,i.x,r.y,i.y)}else if(4===arguments.length){var o=arguments,s=arguments,a=arguments,u=arguments;this.init(o,s,a,u)}},Nu={serialVersionUID:{configurable:!0}};Iu.prototype.getArea=function(){return this.getWidth()*this.getHeight()},Iu.prototype.equals=function(t){if(!(t instanceof Iu))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()},Iu.prototype.intersection=function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new Iu;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 Iu(e,r,n,i)},Iu.prototype.isNull=function(){return this._maxx<this._minx},Iu.prototype.getMaxX=function(){return this._maxx},Iu.prototype.covers=function(){if(1===arguments.length){if(argumentsinstanceof nu){var t=arguments;return this.covers(t.x,t.y)}if(argumentsinstanceof Iu){var e=arguments;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,r=arguments;return!this.isNull()&&n>=this._minx&&n<=this._maxx&&r>=this._miny&&r<=this._maxy}},Iu.prototype.intersects=function(){if(1===arguments.length){if(argumentsinstanceof Iu){var t=arguments;return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)}if(argumentsinstanceof nu){var e=arguments;return this.intersects(e.x,e.y)}}else if(2===arguments.length){var n=arguments,r=arguments;return!this.isNull()&&!(n>this._maxx||n<this._minx||r>this._maxy||r<this._miny)}},Iu.prototype.getMinY=function(){return this._miny},Iu.prototype.getMinX=function(){return this._minx},Iu.prototype.expandToInclude=function(){if(1===arguments.length){if(argumentsinstanceof nu){var t=arguments;this.expandToInclude(t.x,t.y)}else if(argumentsinstanceof Iu){var e=arguments;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,r=arguments;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))}},Iu.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t<e?t:e},Iu.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},Iu.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},Iu.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},Iu.prototype.toString=function(){return“Env[”this._minx“ : ”this._maxx“, ”this._miny“ : ”this._maxy“]”},Iu.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},Iu.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},Iu.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e},Iu.prototype.expandBy=function(){if(1===arguments.length){var t=arguments;this.expandBy(t,t)}else if(2===arguments.length){var e=arguments,n=arguments;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()}},Iu.prototype.contains=function(){if(1===arguments.length){if(argumentsinstanceof Iu){var t=arguments;return this.covers(t)}if(argumentsinstanceof nu){var e=arguments;return this.covers(e)}}else if(2===arguments.length){var n=arguments,r=arguments;return this.covers(n,r)}},Iu.prototype.centre=function(){return this.isNull()?null:new nu((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},Iu.prototype.init=function(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(argumentsinstanceof nu){var t=arguments;this.init(t.x,t.x,t.y,t.y)}else if(argumentsinstanceof Iu){var e=arguments;this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(2===arguments.length){var n=arguments,r=arguments;this.init(n.x,r.x,n.y,r.y)}else if(4===arguments.length){var i=arguments,o=arguments,s=arguments,a=arguments;i<o?(this._minx=i,this._maxx=o):(this._minx=o,this._maxx=i),s<a?(this._miny=s,this._maxy=a):(this._miny=a,this._maxy=s)}},Iu.prototype.getMaxY=function(){return this._maxy},Iu.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)},Iu.prototype.hashCode=function(){var t=17;return 37*(t=37*(t=37*(t=37*t+nu.hashCode(this._minx))+nu.hashCode(this._maxx))+nu.hashCode(this._miny))+nu.hashCode(this._maxy)},Iu.prototype.interfaces_=function(){return},Iu.prototype.getClass=function(){return Iu},Iu.intersects=function(){if(3===arguments.length){var t=arguments,e=arguments,n=arguments;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,i=arguments,o=arguments,s=arguments,a=Math.min(o.x,s.x),u=Math.max(o.x,s.x),c=Math.min(r.x,i.x),h=Math.max(r.x,i.x);return!(c>u||h<a||(a=Math.min(o.y,s.y),u=Math.max(o.y,s.y),c=Math.min(r.y,i.y),h=Math.max(r.y,i.y),c>u||h<a))}},Nu.serialVersionUID.get=function(){return 0x51845cd552189800},Object.defineProperties(Iu,Nu);var Cu={typeStr:/^s*(w+)s*(s*(.*)s*)s*$/,emptyTypeStr:/^s*(w+)s*EMPTYs*$/,spaces:/s+/,parenComma:/)s*,s*(/,doubleParenComma:/)s*)s*,s*(s*(/,trimParens:/^s*(?(.*?))?s*$/},Su=function(t){this.geometryFactory=t||new Zc};Su.prototype.read=function(t){var e,n,r;t=t.replace(//g,“ ”);var i=Cu.typeStr.exec(t);if(-1!==t.search(“EMPTY”)&&((i=Cu.emptyTypeStr.exec(t))=void 0),i&&(n=i.toLowerCase(),r=i,Lu&&(e=Lu.apply(this,))),void 0===e)throw new Error(“Could not parse WKT ”+t);return e},Su.prototype.write=function(t){return this.extractGeometry(t)},Su.prototype.extractGeometry=function(t){var e=t.getGeometryType().toLowerCase();if(!Mu)return null;var n=e.toUpperCase();return t.isEmpty()?n+“ EMPTY”:n+“(”+Mu.apply(this,)+“)”};var Mu={coordinate:function(t){return t.x+“ ”+t.y},point:function(t){return Mu.coordinate.call(this,t._coordinates._coordinates)},multipoint:function(t){for(var e=[],n=0,r=t._geometries.length;n])+“)”);return e.join(“,”)},linestring:function(t){for(var e=[],n=0,r=t._points._coordinates.length;n]));return e.join(“,”)},linearring:function(t){for(var e=[],n=0,r=t._points._coordinates.length;n]));return e.join(“,”)},multilinestring:function(t){for(var e=[],n=0,r=t._geometries.length;n])+“)”);return e.join(“,”)},polygon:function(t){var e=[];e.push(“(”+Mu.linestring.apply(this,)+“)”);for(var n=0,r=t._holes.length;n])+“)”);return e.join(“,”)},multipolygon:function(t){for(var e=[],n=0,r=t._geometries.length;n])+“)”);return e.join(“,”)},geometrycollection:function(t){for(var e=[],n=0,r=t._geometries.length;n));return e.join(“,”)}},Lu={point:function(t){if(void 0===t)return this.geometryFactory.createPoint();var e=t.trim().split(Cu.spaces);return this.geometryFactory.createPoint(new nu(Number.parseFloat(e),Number.parseFloat(e)))},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.replace(Cu.trimParens,“$1”),r.push(Lu.point.apply(this,));return this.geometryFactory.createMultiPoint®},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.trim().split(Cu.spaces),r.push(new nu(Number.parseFloat(e),Number.parseFloat(e)));return this.geometryFactory.createLineString®},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.trim().split(Cu.spaces),r.push(new nu(Number.parseFloat(e),Number.parseFloat(e)));return this.geometryFactory.createLinearRing®},multilinestring:function(t){if(void 0===t)return this.geometryFactory.createMultiLineString();for(var e,n=t.trim().split(Cu.parenComma),r=[],i=0,o=n.length;i.replace(Cu.trimParens,“$1”),r.push(Lu.linestring.apply(this,));return this.geometryFactory.createMultiLineString®},polygon:function(t){if(void 0===t)return this.geometryFactory.createPolygon();for(var e,n,r,i,o=t.trim().split(Cu.parenComma),s=[],a=0,u=o.length;a.replace(Cu.trimParens,“$1”),n=Lu.linestring.apply(this,),r=this.geometryFactory.createLinearRing(n._points),0===a?i=r:s.push®;return this.geometryFactory.createPolygon(i,s)},multipolygon:function(t){if(void 0===t)return this.geometryFactory.createMultiPolygon();for(var e,n=t.trim().split(Cu.doubleParenComma),r=[],i=0,o=n.length;i.replace(Cu.trimParens,“$1”),r.push(Lu.polygon.apply(this,));return this.geometryFactory.createMultiPolygon®},geometrycollection:function(t){if(void 0===t)return this.geometryFactory.createGeometryCollection();for(var e=(t=t.replace(/,s*()/g,“|$1”)).trim().split(“|”),n=[],r=0,i=e.length;r));return this.geometryFactory.createGeometryCollection(n)}},Pu=function(t){this.parser=new Su(t)};Pu.prototype.write=function(t){return this.parser.write(t)},Pu.toLineString=function(t,e){if(2!==arguments.length)throw new Error(“Not implemented”);return“LINESTRING ( ”t.x“ ”t.y“, ”e.x“ ”e.y“ )”};var Ou=function(t){function e(e){t.call(this,e),this.name=“RuntimeException”,this.message=e,this.stack=(new t).stack}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),Ru=function(t){function e(){if(t.call(this),0===arguments.length)t.call(this);else if(1===arguments.length){var e=arguments;t.call(this,e)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ou),Tu=function(){};Tu.prototype.interfaces_=function(){return[]},Tu.prototype.getClass=function(){return Tu},Tu.shouldNeverReachHere=function(){if(0===arguments.length)Tu.shouldNeverReachHere(null);else if(1===arguments.length){var t=arguments;throw new Ru(“Should never reach here”+(null!==t?“: ”+t:“”))}},Tu.isTrue=function(){var t,e;if(1===arguments.length)t=arguments,Tu.isTrue(t,null);else if(2===arguments.length&&(t=arguments,e=arguments,!t))throw null===e?new Ru:new Ru(e)},Tu.equals=function(){var t,e,n;if(2===arguments.length)t=arguments,e=arguments,Tu.equals(t,e,null);else if(3===arguments.length&&(t=arguments,e=arguments,n=arguments,!e.equals(t)))throw new Ru(“Expected ”t“ but encountered ”e(null!==n?“: ”+n:“”))};var Au=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=new nu,this._intPt=new nu,this._pa=this._intPt,this._pb=this._intPt,this._result=0},Du={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};Au.prototype.getIndexAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intLineIndex[e]},Au.prototype.getTopologySummary=function(){var t=new lu;return this.isEndPoint()&&t.append(“ endpoint”),this._isProper&&t.append(“ proper”),this.isCollinear()&&t.append(“ collinear”),t.toString()},Au.prototype.computeIntersection=function(t,e,n,r){this._inputLines[0]=t,this._inputLines[1]=e,this._inputLines[0]=n,this._inputLines[1]=r,this._result=this.computeIntersect(t,e,n,r)},Au.prototype.getIntersectionNum=function(){return this._result},Au.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;this.getEdgeDistance(t,0)>this.getEdgeDistance(t,1)?(this._intLineIndex[0]=0,this._intLineIndex[1]=1):(this._intLineIndex[0]=1,this._intLineIndex[1]=0)}},Au.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},Au.prototype.setPrecisionModel=function(t){this._precisionModel=t},Au.prototype.isInteriorIntersection=function(){if(0===arguments.length)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(1===arguments.length){for(var t=arguments,e=0;e.equals2D(this._inputLines[0])&&!this._intPt.equals2D(this._inputLines[1]))return!0;return!1}},Au.prototype.getIntersection=function(t){return this._intPt},Au.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},Au.prototype.hasIntersection=function(){return this._result!==Au.NO_INTERSECTION},Au.prototype.getEdgeDistance=function(t,e){return Au.computeEdgeDistance(this._intPt,this._inputLines[0],this._inputLines[1])},Au.prototype.isCollinear=function(){return this._result===Au.COLLINEAR_INTERSECTION},Au.prototype.toString=function(){return Pu.toLineString(this._inputLines[0],this._inputLines[1])+“ - ”+Pu.toLineString(this._inputLines[0],this._inputLines[1])+this.getTopologySummary()},Au.prototype.getEndpoint=function(t,e){return this._inputLines[e]},Au.prototype.isIntersection=function(t){for(var e=0;e.equals2D(t))return!0;return!1},Au.prototype.getIntersectionAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[e]]},Au.prototype.interfaces_=function(){return[]},Au.prototype.getClass=function(){return Au},Au.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=r>i?r:i;else{var s=Math.abs(t.x-e.x),a=Math.abs(t.y-e.y);0!==(o=r>i?s:a)||t.equals(e)||(o=Math.max(s,a))}return Tu.isTrue(!(0===o&&!t.equals(e)),“Bad distance calculation”),o},Au.nonRobustComputeEdgeDistance=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,o=Math.sqrt(r*r+i*i);return Tu.isTrue(!(0===o&&!t.equals(e)),“Invalid distance calculation”),o},Du.DONT_INTERSECT.get=function(){return 0},Du.DO_INTERSECT.get=function(){return 1},Du.COLLINEAR.get=function(){return 2},Du.NO_INTERSECTION.get=function(){return 0},Du.POINT_INTERSECTION.get=function(){return 1},Du.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(Au,Du);var Fu=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isInSegmentEnvelopes=function(t){var e=new Iu(this._inputLines[0],this._inputLines[1]),n=new Iu(this._inputLines[0],this._inputLines[1]);return e.contains(t)&&n.contains(t)},e.prototype.computeIntersection=function(){if(3!==arguments.length)return t.prototype.computeIntersection.apply(this,arguments);var e=arguments,n=arguments,r=arguments;if(this._isProper=!1,Iu.intersects(n,r,e)&&0===Bu.orientationIndex(n,r,e)&&0===Bu.orientationIndex(r,n,e))return this._isProper=!0,(e.equals(n)||e.equals®)&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION},e.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},e.prototype.safeHCoordinateIntersection=function(t,n,r,i){var o=null;try{o=bu.intersection(t,n,r,i)}catch(s){if(!(s instanceof Eu))throw s;o=e.nearestEndpoint(t,n,r,i)}return o},e.prototype.intersection=function(t,n,r,i){var o=this.intersectionWithNormalization(t,n,r,i);return this.isInSegmentEnvelopes(o)||(o=new nu(e.nearestEndpoint(t,n,r,i))),null!==this._precisionModel&&this._precisionModel.makePrecise(o),o},e.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®<o&&(i=r),i},e.prototype.checkDD=function(t,e,n,r,i){var o=yu.intersection(t,e,n,r),s=this.isInSegmentEnvelopes(o);wu.out.println(“DD in env = ”s“ ——————— ”+o),i.distance(o)>1e-4&&wu.out.println(“Distance = ”+i.distance(o))},e.prototype.intersectionWithNormalization=function(t,e,n,r){var i=new nu(t),o=new nu(e),s=new nu(n),a=new nu®,u=new nu;this.normalizeToEnvCentre(i,o,s,a,u);var c=this.safeHCoordinateIntersection(i,o,s,a);return c.x+=u.x,c.y+=u.y,c},e.prototype.computeCollinearIntersection=function(e,n,r,i){var o=Iu.intersects(e,n,r),s=Iu.intersects(e,n,i),a=Iu.intersects(r,i,e),u=Iu.intersects(r,i,n);return o&&s?(this._intPt=r,this._intPt=i,t.COLLINEAR_INTERSECTION):a&&u?(this._intPt=e,this._intPt=n,t.COLLINEAR_INTERSECTION):o&&a?(this._intPt=r,this._intPt=e,!r.equals(e)||s||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):o&&u?(this._intPt=r,this._intPt=n,!r.equals(n)||s||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&a?(this._intPt=i,this._intPt=e,!i.equals(e)||o||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&u?(this._intPt=i,this._intPt=n,!i.equals(n)||o||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):t.NO_INTERSECTION},e.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,c=n.x<r.x?n.x:r.x,h=n.y<r.y?n.y:r.y,l=n.x>r.x?n.x:r.x,p=n.y>r.y?n.y:r.y,f=((o>c?o:c)+(a<l?a:l))/2,g=((s>h?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},e.prototype.computeIntersect=function(e,n,r,i){if(this._isProper=!1,!Iu.intersects(e,n,r,i))return t.NO_INTERSECTION;var o=Bu.orientationIndex(e,n,r),s=Bu.orientationIndex(e,n,i);if(o>0&&s>0||o<0&&s<0)return t.NO_INTERSECTION;var a=Bu.orientationIndex(r,i,e),u=Bu.orientationIndex(r,i,n);return a>0&&u>0||a<0&&u<0?t.NO_INTERSECTION:0===o&&0===s&&0===a&&0===u?this.computeCollinearIntersection(e,n,r,i):(0===o||0===s||0===a||0===u?(this._isProper=!1,e.equals2D(r)||e.equals2D(i)?this._intPt=e:n.equals2D®||n.equals2D(i)?this._intPt=n:0===o?this._intPt=new nu®:0===s?this._intPt=new nu(i):0===a?this._intPt=new nu(e):0===u&&(this._intPt=new nu(n))):(this._isProper=!0,this._intPt=this.intersection(e,n,r,i)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(t,e,n,r){var i=t,o=Bu.distancePointLine(t,n,r),s=Bu.distancePointLine(e,n,r);return s<o&&(o=s,i=e),(s=Bu.distancePointLine(n,t,e))<o&&(o=s,i=n),(s=Bu.distancePointLine(r,t,e))<o&&(o=s,i=r),i},e}(Au),qu=function(){};qu.prototype.interfaces_=function(){return[]},qu.prototype.getClass=function(){return qu},qu.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 qu.signOfDet2x2(r,i,o,s)},qu.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:e>0?n>0?-i:i:n>0?i:-i;if(0===e||0===n)return r>0?t>0?i:-i:t>0?-i:i;if(e>0?r>0?e<=r||(i=-i,o=t,t=n,n=o,o=e,e=r,r=o):e<=-r?(i=-i,n=-n,r=-r):(o=t,t=-n,n=o,o=e,e=-r,r=o):r>0?-e<=r?(i=-i,t=-t,e=-e):(o=-t,t=n,n=o,o=-e,e=r,r=o):e>=r?(t=-t,e=-e,n=-n,r=-r):(i=-i,o=-t,t=-n,n=o,o=-e,e=-r,r=o),t>0){if(!(n>0))return i;if(!(t<=n))return i}else{if(n>0)return-i;if(!(t>=n))return-i;i=-i,t=-t,n=-n}for(;;){if((r-=(s=Math.floor(n/t))*e)<0)return-i;if(r>e)return i;if(t>(n-=s*t)+n){if(e<r+r)return i}else{if(e>r+r)return-i;n=t-n,r=e-r,i=-i}if(0===r)return 0===n?0:-i;if(0===n)return i;if((e-=(s=Math.floor(t/n))*r)<0)return i;if(e>r)return-i;if(n>(t-=s*n)+t){if(r<e+e)return-i}else{if(r>e+e)return i;t=n-t,e=r-e,i=-i}if(0===e)return 0===t?0:i;if(0===t)return-i}};var Gu=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments;this._p=t};Gu.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 n>r&&(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=qu.signOfDet2x2(i,o,s,a);if(0===u)return this._isPointOnSegment=!0,null;a<o&&(u=-u),u>0&&this._crossingCount++}},Gu.prototype.isPointInPolygon=function(){return this.getLocation()!==su.EXTERIOR},Gu.prototype.getLocation=function(){return this._isPointOnSegment?su.BOUNDARY:this._crossingCount%2==1?su.INTERIOR:su.EXTERIOR},Gu.prototype.isOnSegment=function(){return this._isPointOnSegment},Gu.prototype.interfaces_=function(){return[]},Gu.prototype.getClass=function(){return Gu},Gu.locatePointInRing=function(){if(argumentsinstanceof nu&&uu(arguments,mu)){for(var t=arguments,e=arguments,n=new Gu(t),r=new nu,i=new nu,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(argumentsinstanceof nu&&argumentsinstanceof Array){for(var s=arguments,a=arguments,u=new Gu(s),c=1;c<a.length;c++){var h=a,l=a;if(u.countSegment(h,l),u.isOnSegment())return u.getLocation()}return u.getLocation()}};var Bu=function(){},ku={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};Bu.prototype.interfaces_=function(){return[]},Bu.prototype.getClass=function(){return Bu},Bu.orientationIndex=function(t,e,n){return yu.orientationIndex(t,e,n)},Bu.signedArea=function(){if(argumentsinstanceof Array){var t=arguments;if(t.length<3)return 0;for(var e=0,n=t.x,r=1;r<t.length-1;r++){var i=t.x-n,o=t.y;e+=i*(t.y-o)}return e/2}if(uu(arguments,mu)){var s=arguments,a=s.size();if(a<3)return 0;var u=new nu,c=new nu,h=new nu;s.getCoordinate(0,c),s.getCoordinate(1,h);var l=c.x;h.x-=l;for(var p=0,f=1;f<a-1;f++)u.y=c.y,c.x=h.x,c.y=h.y,s.getCoordinate(f+1,h),h.x-=l,p+=c.x*(u.y-h.y);return p/2}},Bu.distanceLineLine=function(t,e,n,r){if(t.equals(e))return Bu.distancePointLine(t,n,r);if(n.equals®)return Bu.distancePointLine(r,t,e);var i=!1;if(Iu.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||u>1||a<0||a>1)&&(i=!0)}}else i=!0;return i?cu.min(Bu.distancePointLine(t,n,r),Bu.distancePointLine(e,n,r),Bu.distancePointLine(n,t,e),Bu.distancePointLine(r,t,e)):0},Bu.isPointInRing=function(t,e){return Bu.locatePointInRing(t,e)!==su.EXTERIOR},Bu.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,r=new nu;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,c=a-i,h=u-o;n+=Math.sqrt(c*c+h*h),i=a,o=u}return n},Bu.isCCW=function(t){var e=t.length-1;if(e<3)throw new Za(“Ring has fewer than 4 points, so orientation cannot be determined”);for(var n=t,r=0,i=1;i<=e;i++){var o=t;o.y>n.y&&(n=o,r=i)}var s=r;do{(s-=1)<0&&(s=e)}while(t.equals2D(n)&&s!==r);var a=r;do{a=(a+1)%e}while(t.equals2D(n)&&a!==r);var u=t,c=t;if(u.equals2D(n)||c.equals2D(n)||u.equals2D©)return!1;var h=Bu.computeOrientation(u,n,c);return 0===h?u.x>c.x:h>0},Bu.locatePointInRing=function(t,e){return Gu.locatePointInRing(t,e)},Bu.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®},Bu.computeOrientation=function(t,e,n){return Bu.orientationIndex(t,e,n)},Bu.distancePointLine=function(){if(2===arguments.length){var t=arguments,e=arguments;if(0===e.length)throw new Za(“Line array must contain at least one vertex”);for(var n=t.distance(e),r=0;r<e.length-1;r++){var i=Bu.distancePointLine(t,e,e);i<n&&(n=i)}return n}if(3===arguments.length){var o=arguments,s=arguments,a=arguments;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),c=((o.x-s.x)*(a.x-s.x)+(o.y-s.y)*(a.y-s.y))/u;if(c<=0)return o.distance(s);if(c>=1)return o.distance(a);var h=((s.y-o.y)*(a.x-s.x)-(s.x-o.x)*(a.y-s.y))/u;return Math.abs(h)*Math.sqrt(u)}},Bu.isOnLine=function(t,e){for(var n=new Fu,r=1;r<e.length;r++){var i=e,o=e;if(n.computeIntersection(t,i,o),n.hasIntersection())return!0}return!1},ku.CLOCKWISE.get=function(){return-1},ku.RIGHT.get=function(){return Bu.CLOCKWISE},ku.COUNTERCLOCKWISE.get=function(){return 1},ku.LEFT.get=function(){return Bu.COUNTERCLOCKWISE},ku.COLLINEAR.get=function(){return 0},ku.STRAIGHT.get=function(){return Bu.COLLINEAR},Object.defineProperties(Bu,ku);var zu=function(){};zu.prototype.filter=function(t){},zu.prototype.interfaces_=function(){return[]},zu.prototype.getClass=function(){return zu};var ju=function(){var t=arguments;this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=t,this._SRID=t.getSRID()},Xu={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}};ju.prototype.isGeometryCollection=function(){return this.getSortIndex()===ju.SORTINDEX_GEOMETRYCOLLECTION},ju.prototype.getFactory=function(){return this._factory},ju.prototype.getGeometryN=function(t){return this},ju.prototype.getArea=function(){return 0},ju.prototype.isRectangle=function(){return!1},ju.prototype.equals=function(){if(argumentsinstanceof ju){var t=arguments;return null!==t&&this.equalsTopo(t)}if(argumentsinstanceof Object){var e=arguments;if(!(e instanceof ju))return!1;var n=e;return this.equalsExact(n)}},ju.prototype.equalsExact=function(t){return this===t||this.equalsExact(t,0)},ju.prototype.geometryChanged=function(){this.apply(ju.geometryChangedFilter)},ju.prototype.geometryChangedAction=function(){this._envelope=null},ju.prototype.equalsNorm=function(t){return null!==t&&this.norm().equalsExact(t.norm())},ju.prototype.getLength=function(){return 0},ju.prototype.getNumGeometries=function(){return 1},ju.prototype.compareTo=function(){if(1===arguments.length){var t=arguments,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,r=arguments;return this.getSortIndex()!==n.getSortIndex()?this.getSortIndex()-n.getSortIndex():this.isEmpty()&&n.isEmpty()?0:this.isEmpty()?-1:n.isEmpty()?1:this.compareToSameClass(n,r)}},ju.prototype.getUserData=function(){return this._userData},ju.prototype.getSRID=function(){return this._SRID},ju.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},ju.prototype.checkNotGeometryCollection=function(t){if(t.getSortIndex()===ju.SORTINDEX_GEOMETRYCOLLECTION)throw new Za(“This method does not support GeometryCollection arguments”)},ju.prototype.equal=function(t,e,n){return 0===n?t.equals(e):t.distance(e)<=n},ju.prototype.norm=function(){var t=this.copy();return t.normalize(),t},ju.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},ju.prototype.getEnvelopeInternal=function(){return null===this._envelope&&(this._envelope=this.computeEnvelopeInternal()),new Iu(this._envelope)},ju.prototype.setSRID=function(t){this._SRID=t},ju.prototype.setUserData=function(t){this._userData=t},ju.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},ju.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},ju.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===ju.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===ju.SORTINDEX_MULTIPOINT||this.getSortIndex()===ju.SORTINDEX_MULTILINESTRING||this.getSortIndex()===ju.SORTINDEX_MULTIPOLYGON},ju.prototype.interfaces_=function(){return},ju.prototype.getClass=function(){return ju},ju.hasNonEmptyElements=function(t){for(var e=0;e.isEmpty())return!0;return!1},ju.hasNullElements=function(t){for(var e=0;e)return!0;return!1},Xu.serialVersionUID.get=function(){return 0x799ea46522854c00},Xu.SORTINDEX_POINT.get=function(){return 0},Xu.SORTINDEX_MULTIPOINT.get=function(){return 1},Xu.SORTINDEX_LINESTRING.get=function(){return 2},Xu.SORTINDEX_LINEARRING.get=function(){return 3},Xu.SORTINDEX_MULTILINESTRING.get=function(){return 4},Xu.SORTINDEX_POLYGON.get=function(){return 5},Xu.SORTINDEX_MULTIPOLYGON.get=function(){return 6},Xu.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},Xu.geometryChangedFilter.get=function(){return Uu},Object.defineProperties(ju,Xu);var Uu=function(){};Uu.interfaces_=function(){return},Uu.filter=function(t){t.geometryChangedAction()};var Yu=function(){};Yu.prototype.filter=function(t){},Yu.prototype.interfaces_=function(){return[]},Yu.prototype.getClass=function(){return Yu};var Vu=function(){},Hu={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}};Vu.prototype.isInBoundary=function(t){},Vu.prototype.interfaces_=function(){return[]},Vu.prototype.getClass=function(){return Vu},Hu.Mod2BoundaryNodeRule.get=function(){return Wu},Hu.EndPointBoundaryNodeRule.get=function(){return Ju},Hu.MultiValentEndPointBoundaryNodeRule.get=function(){return Zu},Hu.MonoValentEndPointBoundaryNodeRule.get=function(){return Ku},Hu.MOD2_BOUNDARY_RULE.get=function(){return new Wu},Hu.ENDPOINT_BOUNDARY_RULE.get=function(){return new Ju},Hu.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new Zu},Hu.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new Ku},Hu.OGC_SFS_BOUNDARY_RULE.get=function(){return Vu.MOD2_BOUNDARY_RULE},Object.defineProperties(Vu,Hu);var Wu=function(){};Wu.prototype.isInBoundary=function(t){return t%2==1},Wu.prototype.interfaces_=function(){return},Wu.prototype.getClass=function(){return Wu};var Ju=function(){};Ju.prototype.isInBoundary=function(t){return t>0},Ju.prototype.interfaces_=function(){return},Ju.prototype.getClass=function(){return Ju};var Zu=function(){};Zu.prototype.isInBoundary=function(t){return t>1},Zu.prototype.interfaces_=function(){return},Zu.prototype.getClass=function(){return Zu};var Ku=function(){};Ku.prototype.isInBoundary=function(t){return 1===t},Ku.prototype.interfaces_=function(){return},Ku.prototype.getClass=function(){return Ku};var Qu=function(){};Qu.prototype.add=function(){},Qu.prototype.addAll=function(){},Qu.prototype.isEmpty=function(){},Qu.prototype.iterator=function(){},Qu.prototype.size=function(){},Qu.prototype.toArray=function(){},Qu.prototype.remove=function(){};var $u=function(t){function e(e){t.call(this),this.message=e||“”}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={name:{configurable:!0}};return n.name.get=function(){return“IndexOutOfBoundsException”},Object.defineProperties(e,n),e}(Error),tc=function(){};tc.prototype.hasNext=function(){},tc.prototype.next=function(){},tc.prototype.remove=function(){};var ec=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(){},e.prototype.set=function(){},e.prototype.isEmpty=function(){},e}(Qu);(mi.prototype=new Error).name=“NoSuchElementException”;var nc=function(t){function e(){t.call(this),this.array_=[],argumentsinstanceof Qu&&this.addAll(arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.ensureCapacity=function(){},e.prototype.interfaces_=function(){return},e.prototype.add=function(t){return 1===arguments.length?this.array_.push(t):this.array_.splice(arguments,arguments),!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_;return this.array_=e,n},e.prototype.iterator=function(){return new rc(this)},e.prototype.get=function(t){if(t<0||t>=this.size())throw new $u;return this.array_},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);return t},e.prototype.remove=function(t){for(var e=!1,n=0,r=this.array_.length;n===t){this.array_.splice(n,1),e=!0;break}return e},e}(ec),rc=function(t){function e(e){t.call(this),this.arrayList_=e,this.position_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new mi;return this.arrayList_.get(this.position_++)},e.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},e.prototype.set=function(t){return this.arrayList_.set(this.position_-1,t)},e.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},e}(tc),ic=function(t){function e(){if(t.call(this),0===arguments.length);else if(1===arguments.length){var e=arguments;this.ensureCapacity(e.length),this.add(e,!0)}else if(2===arguments.length){var n=arguments,r=arguments;this.ensureCapacity(n.length),this.add(n,r)}}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={coordArrayType:{configurable:!0}};return n.coordArrayType.get=function(){return new Array(0).fill(null)},e.prototype.getCoordinate=function(t){return this.get(t)},e.prototype.addAll=function(){if(2===arguments.length){for(var e=arguments,n=arguments,r=!1,i=e.iterator();i.hasNext();)this.add(i.next(),n),r=!0;return r}return t.prototype.addAll.apply(this,arguments)},e.prototype.clone=function(){for(var e=t.prototype.clone.call(this),n=0;n<this.size();n++)e.add(n,this.get(n).copy());return e},e.prototype.toCoordinateArray=function(){return this.toArray(e.coordArrayType)},e.prototype.add=function(){if(1===arguments.length){var e=arguments;t.prototype.add.call(this,e)}else if(2===arguments.length){if(argumentsinstanceof Array&&“boolean”==typeof arguments){var n=arguments,r=arguments;return this.add(n,r,!0),!0}if(argumentsinstanceof nu&&“boolean”==typeof arguments){var i=arguments;if(!arguments&&this.size()>=1&&this.get(this.size()-1).equals2D(i))return null;t.prototype.add.call(this,i)}else if(argumentsinstanceof Object&&“boolean”==typeof arguments){var o=arguments,s=arguments;return this.add(o,s),!0}}else if(3===arguments.length){if(“boolean”==typeof arguments&&argumentsinstanceof Array&&“boolean”==typeof arguments){var a=arguments,u=arguments;if(arguments)for(var c=0;c,u);else for(var h=a.length-1;h>=0;h–)this.add(a,u);return!0}if(“boolean”==typeof arguments&&Number.isInteger(arguments)&&argumentsinstanceof nu){var l=arguments,p=arguments;if(!arguments){var f=this.size();if(f>0){if(l>0&&this.get(l-1).equals2D(p))return null;if(l<f&&this.get(l).equals2D(p))return null}}t.prototype.add.call(this,l,p)}}else if(4===arguments.length){var g=arguments,d=arguments,y=arguments,_=arguments,m=1;y>_&&(m=-1);for(var v=y;v!==_;v+=m)this.add(g,d);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new nu(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,n),e}(nc),oc=function(){},sc={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};sc.ForwardComparator.get=function(){return ac},sc.BidirectionalComparator.get=function(){return uc},sc.coordArrayType.get=function(){return new Array(0).fill(null)},oc.prototype.interfaces_=function(){return[]},oc.prototype.getClass=function(){return oc},oc.isRing=function(t){return!(t.length<4||!t.equals2D(t))},oc.ptNotInList=function(t,e){for(var n=0;n<t.length;n++){var r=t;if(oc.indexOf(r,e)<0)return r}return null},oc.scroll=function(t,e){var n=oc.indexOf(e,t);if(n<0)return null;var r=new Array(t.length).fill(null);wu.arraycopy(t,n,r,0,t.length-n),wu.arraycopy(t,0,r,t.length-n,n),wu.arraycopy(r,0,t,0,t.length)},oc.equals=function(){if(2===arguments.length){var t=arguments,e=arguments;if(t===e)return!0;if(null===t||null===e)return!1;if(t.length!==e.length)return!1;for(var n=0;n.equals(e))return!1;return!0}if(3===arguments.length){var r=arguments,i=arguments,o=arguments;if(r===i)return!0;if(null===r||null===i)return!1;if(r.length!==i.length)return!1;for(var s=0;s,i))return!1;return!0}},oc.intersection=function(t,e){for(var n=new ic,r=0;r)&&n.add(t,!0);return n.toCoordinateArray()},oc.hasRepeatedPoints=function(t){for(var e=1;e.equals(t))return!0;return!1},oc.removeRepeatedPoints=function(t){return oc.hasRepeatedPoints(t)?new ic(t,!1).toCoordinateArray():t},oc.reverse=function(t){for(var e=t.length-1,n=Math.trunc(e/2),r=0;r<=n;r++){var i=t;t=t,t=i}},oc.removeNull=function(t){for(var e=0,n=0;n&&e++;var r=new Array(e).fill(null);if(0===e)return r;for(var i=0,o=0;o&&(r=t);return r},oc.copyDeep=function(){if(1===arguments.length){for(var t=arguments,e=new Array(t.length).fill(null),n=0;n=new nu(t);return e}if(5===arguments.length)for(var r=arguments,i=arguments,o=arguments,s=arguments,a=arguments,u=0;u=new nu(r)},oc.isEqualReversed=function(t,e){for(var n=0;n<t.length;n++){var r=t,i=e;if(0!==r.compareTo(i))return!1}return!0},oc.envelope=function(t){for(var e=new Iu,n=0;n);return e},oc.toCoordinateArray=function(t){return t.toArray(oc.coordArrayType)},oc.atLeastNCoordinatesOrNothing=function(t,e){return e.length>=t?e:[]},oc.indexOf=function(t,e){for(var n=0;n))return n;return-1},oc.increasingDirection=function(t){for(var e=0;e<Math.trunc(t.length/2);e++){var n=t.length-1-e,r=t.compareTo(t);if(0!==r)return r}return 1},oc.compare=function(t,e){for(var n=0;n<t.length&&n<e.length;){var r=t.compareTo(e);if(0!==r)return r;n++}return n<e.length?-1:n<t.length?1:0},oc.minCoordinate=function(t){for(var e=null,n=0;n)>0)&&(e=t);return e},oc.extract=function(t,e,n){e=cu.clamp(e,0,t.length);var r=(n=cu.clamp(n,-1,t.length))-e+1;n<0&&(r=0),e>=t.length&&(r=0),n<e&&(r=0);var i=new Array®.fill(null);if(0===r)return i;for(var o=0,s=e;s<=n;s++)i=t;return i},Object.defineProperties(oc,sc);var ac=function(){};ac.prototype.compare=function(t,e){return oc.compare(t,e)},ac.prototype.interfaces_=function(){return},ac.prototype.getClass=function(){return ac};var uc=function(){};uc.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=oc.compare(n,r);return oc.isEqualReversed(n,r)?0:i},uc.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=oc.increasingDirection(n),o=oc.increasingDirection®,s=i>0?0:n.length-1,a=o>0?0:n.length-1,u=0;u<n.length;u++){var c=n.compareTo(r);if(0!==c)return c;s+=i,a+=o}return 0},uc.prototype.interfaces_=function(){return},uc.prototype.getClass=function(){return uc};var cc=function(){};cc.prototype.get=function(){},cc.prototype.put=function(){},cc.prototype.size=function(){},cc.prototype.values=function(){},cc.prototype.entrySet=function(){};var hc=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(cc);(vi.prototype=new Error).name=“OperationNotSupported”,(xi.prototype=new Qu).contains=function(){};var lc=function(t){function e(){t.call(this),this.array_=[],argumentsinstanceof Qu&&this.addAll(arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.contains=function(t){for(var e=0,n=this.array_.length;e===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);return t},e.prototype.iterator=function(){return new pc(this)},e}(xi),pc=function(t){function e(e){t.call(this),this.hashSet_=e,this.position_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new mi;return this.hashSet_.array_},e.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},e.prototype.remove=function(){throw new vi},e}(tc),fc=0;(Ci.prototype=new hc).get=function(t){for(var e=this.root_;null!==e;){var n=t.compareTo(e.key);if(n<0)e=e.left;else{if(!(n>0))return e.value;e=e.right}}return null},Ci.prototype.put=function(t,e){if(null===this.root_)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:fc,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(!(r>0)){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:fc,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},Ci.prototype.fixAfterInsertion=function(t){for(t.color=1;null!=t&&t!==this.root_&&1===t.parent.color;)if(wi(t)===Ii(wi(wi(t)))){var e=Ni(wi(wi(t)));1===Ei(e)?(bi(wi(t),fc),bi(e,fc),bi(wi(wi(t)),1),t=wi(wi(t))):(t===Ni(wi(t))&&(t=wi(t),this.rotateLeft(t)),bi(wi(t),fc),bi(wi(wi(t)),1),this.rotateRight(wi(wi(t))))}else{var n=Ii(wi(wi(t)));1===Ei(n)?(bi(wi(t),fc),bi(n,fc),bi(wi(wi(t)),1),t=wi(wi(t))):(t===Ii(wi(t))&&(t=wi(t),this.rotateRight(t)),bi(wi(t),fc),bi(wi(wi(t)),1),this.rotateLeft(wi(wi(t))))}this.root_.color=fc},Ci.prototype.values=function(){var t=new nc,e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=Ci.successor(e));)t.add(e.value);return t},Ci.prototype.entrySet=function(){var t=new lc,e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=Ci.successor(e));)t.add(e);return t},Ci.prototype.rotateLeft=function(t){if(null!=t){var e=t.right;t.right=e.left,null!=e.left&&(e.left.parent=t),e.parent=t.parent,null===t.parent?this.root_=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}},Ci.prototype.rotateRight=function(t){if(null!=t){var e=t.left;t.left=e.right,null!=e.right&&(e.right.parent=t),e.parent=t.parent,null===t.parent?this.root_=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}},Ci.prototype.getFirstEntry=function(){var t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t},Ci.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;)r=n,n=n.parent;return n},Ci.prototype.size=function(){return this.size_};var gc=function(){};gc.prototype.interfaces_=function(){return[]},gc.prototype.getClass=function(){return gc},Si.prototype=new xi,(Mi.prototype=new Si).contains=function(t){for(var e=0,n=this.array_.length;e.compareTo(t))return!0;return!1},Mi.prototype.add=function(t){if(this.contains(t))return!1;for(var e=0,n=this.array_.length;e.compareTo(t))return this.array_.splice(e,0,t),!0;return this.array_.push(t),!0},Mi.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},Mi.prototype.remove=function(t){throw new vi},Mi.prototype.size=function(){return this.array_.length},Mi.prototype.isEmpty=function(){return 0===this.array_.length},Mi.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e);return t},Mi.prototype.iterator=function(){return new dc(this)};var dc=function(t){this.treeSet_=t,this.position_=0};dc.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new mi;return this.treeSet_.array_},dc.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},dc.prototype.remove=function(){throw new vi};var yc=function(){};yc.sort=function(){var t,e,n,r,i=arguments;if(1===arguments.length)r=function(t,e){return t.compareTo(e)},i.sort®;else if(2===arguments.length)n=arguments,r=function(t,e){return n.compare(t,e)},i.sort®;else if(3===arguments.length){(e=i.slice(arguments,arguments)).sort();var o=i.slice(0,arguments).concat(e,i.slice(arguments,i.length));for(i.splice(0,i.length),t=0;t)}else if(4===arguments.length)for(e=i.slice(arguments,arguments),n=arguments,r=function(t,e){return n.compare(t,e)},e.sort®,o=i.slice(0,arguments).concat(e,i.slice(arguments,i.length)),i.splice(0,i.length),t=0;t)},yc.asList=function(t){for(var e=new nc,n=0,r=t.length;n);return e};var _c=function(){},mc={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}};mc.P.get=function(){return 0},mc.L.get=function(){return 1},mc.A.get=function(){return 2},mc.FALSE.get=function(){return-1},mc.TRUE.get=function(){return-2},mc.DONTCARE.get=function(){return-3},mc.SYM_FALSE.get=function(){return“F”},mc.SYM_TRUE.get=function(){return“T”},mc.SYM_DONTCARE.get=function(){return“*”},mc.SYM_P.get=function(){return“0”},mc.SYM_L.get=function(){return“1”},mc.SYM_A.get=function(){return“2”},c.prototype.interfaces=function(){return[]},_c.prototype.getClass=function(){return _c},_c.toDimensionSymbol=function(t){switch(t){case _c.FALSE:return _c.SYM_FALSE;case _c.TRUE:return _c.SYM_TRUE;case _c.DONTCARE:return _c.SYM_DONTCARE;case _c.P:return _c.SYM_P;case _c.L:return _c.SYM_L;case _c.A:return _c.SYM_A}throw new Za(“Unknown dimension value: ”+t)},_c.toDimensionValue=function(t){switch(fu.toUpperCase(t)){case _c.SYM_FALSE:return _c.FALSE;case _c.SYM_TRUE:return _c.TRUE;case _c.SYM_DONTCARE:return _c.DONTCARE;case _c.SYM_P:return _c.P;case _c.SYM_L:return _c.L;case _c.SYM_A:return _c.A}throw new Za(“Unknown dimension symbol: ”+t)},Object.defineProperties(_c,mc);var vc=function(){};vc.prototype.filter=function(t){},vc.prototype.interfaces_=function(){return[]},vc.prototype.getClass=function(){return vc};var xc=function(){};xc.prototype.filter=function(t,e){},xc.prototype.isDone=function(){},xc.prototype.isGeometryChanged=function(){},xc.prototype.interfaces_=function(){return[]},xc.prototype.getClass=function(){return xc};var Ec=function(t){function e(e,n){if(t.call(this,n),this._geometries=e||[],t.hasNullElements(this._geometries))throw new Za(“geometries must not contain null elements”)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){for(var t=new Iu,e=0;e.getEnvelopeInternal());return t},e.prototype.getGeometryN=function(t){return this._geometries},e.prototype.getSortIndex=function(){return t.SORTINDEX_GEOMETRYCOLLECTION},e.prototype.getCoordinates=function(){for(var t=new Array(this.getNumPoints()).fill(null),e=-1,n=0;n<this._geometries.length;n++)for(var r=this._geometries.getCoordinates(),i=0;i=r;return t},e.prototype.getArea=function(){for(var t=0,e=0;e.getArea();return t},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments,n=arguments;if(!this.isEquivalentClass(e))return!1;var r=e;if(this._geometries.length!==r._geometries.length)return!1;for(var i=0;i.equalsExact(r._geometries,n))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=0;t.normalize();yc.sort(this._geometries)},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries.getCoordinate()},e.prototype.getBoundaryDimension=function(){for(var t=_c.FALSE,e=0;e.getBoundaryDimension());return t},e.prototype.getDimension=function(){for(var t=_c.FALSE,e=0;e.getDimension());return t},e.prototype.getLength=function(){for(var t=0,e=0;e.getLength();return t},e.prototype.getNumPoints=function(){for(var t=0,e=0;e.getNumPoints();return t},e.prototype.getNumGeometries=function(){return this._geometries.length},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),n=0;n=this._geometries.reverse();return this.getFactory().createGeometryCollection(e)},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments,e=new Mi(yc.asList(this._geometries)),n=new Mi(yc.asList(t._geometries));return this.compare(e,n)}if(2===arguments.length){for(var r=arguments,i=arguments,o=r,s=this.getNumGeometries(),a=o.getNumGeometries(),u=0;u<s&&u<a;){var c=this.getGeometryN(u),h=o.getGeometryN(u),l=c.compareToSameClass(h,i);if(0!==l)return l;u++}return u<s?1:u<a?-1:0}},e.prototype.apply=function(){if(uu(arguments,Yu))for(var t=arguments,e=0;e.apply(t);else if(uu(arguments,xc)){var n=arguments;if(0===this._geometries.length)return null;for(var r=0;r.apply(n),!n.isDone());r++);n.isGeometryChanged()&&this.geometryChanged()}else if(uu(arguments,vc)){var i=arguments;i.filter(this);for(var o=0;o.apply(i)}else if(uu(arguments,zu)){var s=arguments;s.filter(this);for(var a=0;a.apply(s)}},e.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),Tu.shouldNeverReachHere(),null},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._geometries=new Array(this._geometries.length).fill(null);for(var n=0;n=this._geometries.clone();return e},e.prototype.getGeometryType=function(){return“GeometryCollection”},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),n=0;n=this._geometries.copy();return new e(t,this._factory)},e.prototype.isEmpty=function(){for(var t=0;t.isEmpty())return!1;return!0},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x4f07bcb1f857d800},Object.defineProperties(e,n),e}(ju),wc=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return ju.SORTINDEX_MULTILINESTRING},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments,n=arguments;return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,n)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?_c.FALSE:0},e.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var t=0;t.isClosed())return!1;return!0},e.prototype.getDimension=function(){return 1},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),n=0;n=this._geometries.reverse();return this.getFactory().createMultiLineString(e)},e.prototype.getBoundary=function(){return new bc(this).getBoundary()},e.prototype.getGeometryType=function(){return“MultiLineString”},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),n=0;n=this._geometries.copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return 0x7155d2ab4afa8000},Object.defineProperties(e,n),e}(Ec),bc=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,1===arguments.length){var t=arguments,e=Vu.MOD2_BOUNDARY_RULE;this._geom=t,this._geomFact=t.getFactory(),this._bnRule=e}else if(2===arguments.length){var n=arguments,r=arguments;this._geom=n,this._geomFact=n.getFactory(),this._bnRule=r}};bc.prototype.boundaryMultiLineString=function(t){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var e=this.computeBoundaryCoordinates(t);return 1===e.length?this._geomFact.createPoint(e):this._geomFact.createMultiPointFromCoords(e)},bc.prototype.getBoundary=function(){return this._geom instanceof Mc?this.boundaryLineString(this._geom):this._geom instanceof wc?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},bc.prototype.boundaryLineString=function(t){return this._geom.isEmpty()?this.getEmptyMultiPoint():t.isClosed()?this._bnRule.isInBoundary(2)?t.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint()},bc.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},bc.prototype.computeBoundaryCoordinates=function(t){var e=new nc;this._endpointMap=new Ci;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 oc.toCoordinateArray(e)},bc.prototype.addEndpoint=function(t){var e=this._endpointMap.get(t);null===e&&(e=new Ic,this._endpointMap.put(t,e)),e.count++},bc.prototype.interfaces_=function(){return[]},bc.prototype.getClass=function(){return bc},bc.getBoundary=function(){if(1===arguments.length){var t=arguments;return new bc(t).getBoundary()}if(2===arguments.length){var e=arguments,n=arguments;return new bc(e,n).getBoundary()}};var Ic=function(){this.count=null};Ic.prototype.interfaces_=function(){return[]},Ic.prototype.getClass=function(){return Ic};var Nc=function(){},Cc={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};Nc.prototype.interfaces_=function(){return[]},Nc.prototype.getClass=function(){return Nc},Nc.chars=function(t,e){for(var n=new Array(e).fill(null),r=0;r=t;return String(n)},Nc.getStackTrace=function(){if(1===arguments.length){var t=arguments,e=new function(){},n=new function(){}(e);return t.printStackTrace(n),e.toString()}if(2===arguments.length){for(var r=arguments,i=arguments,o=“”,s=new function(){}(new function(){}(Nc.getStackTrace®)),a=0;a<i;a++)try{o+=s.readLine()+Nc.NEWLINE}catch(t){if(!(t instanceof Li))throw t;Tu.shouldNeverReachHere()}return o}},Nc.split=function(t,e){for(var n=e.length,r=new nc,i=“”+t,o=i.indexOf(e);o>=0;){var s=i.substring(0,o);r.add(s),o=(i=i.substring(o+n)).indexOf(e)}i.length>0&&r.add(i);for(var a=new Array(r.size()).fill(null),u=0;u=r.get(u);return a},Nc.toString=function(){if(1===arguments.length){var t=arguments;return Nc.SIMPLE_ORDINATE_FORMAT.format(t)}},Nc.spaces=function(t){return Nc.chars(“ ”,t)},Cc.NEWLINE.get=function(){return wu.getProperty(“line.separator”)},Cc.SIMPLE_ORDINATE_FORMAT.get=function(){return new function(){}(“0.#”)},Object.defineProperties(Nc,Cc);var Sc=function(){};Sc.prototype.interfaces_=function(){return[]},Sc.prototype.getClass=function(){return Sc},Sc.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))},Sc.isRing=function(t){var e=t.size();return 0===e||!(e<=3)&&t.getOrdinate(0,mu.X)===t.getOrdinate(e-1,mu.X)&&t.getOrdinate(0,mu.Y)===t.getOrdinate(e-1,mu.Y)},Sc.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)||Ka.isNaN(s)&&Ka.isNaN(a)))return!1}return!0},Sc.extend=function(t,e,n){var r=t.create(n,e.getDimension()),i=e.size();if(Sc.copy(e,0,r,0,i),i>0)for(var o=i;o<n;o++)Sc.copy(e,i-1,r,o,1);return r},Sc.reverse=function(t){for(var e=t.size()-1,n=Math.trunc(e/2),r=0;r<=n;r++)Sc.swap(t,r,e-r)},Sc.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)}},Sc.copy=function(t,e,n,r,i){for(var o=0;o<i;o++)Sc.copyCoord(t,e+o,n,r+o)},Sc.toString=function(){if(1===arguments.length){var t=arguments,e=t.size();if(0===e)return“()”;var n=t.getDimension(),r=new lu;r.append(“(”);for(var i=0;i<e;i++){i>0&&r.append(“ ”);for(var o=0;o<n;o++)o>0&&r.append(“,”),r.append(Nc.toString(t.getOrdinate(i,o)))}return r.append(“)”),r.toString()}},Sc.ensureValidRing=function(t,e){var n=e.size();return 0===n?e:n<=3?Sc.createClosedRing(t,e,4):e.getOrdinate(0,mu.X)===e.getOrdinate(n-1,mu.X)&&e.getOrdinate(0,mu.Y)===e.getOrdinate(n-1,mu.Y)?e:Sc.createClosedRing(t,e,n+1)},Sc.createClosedRing=function(t,e,n){var r=t.create(n,e.getDimension()),i=e.size();Sc.copy(e,0,r,0,i);for(var o=i;o<n;o++)Sc.copy(e,0,r,o,1);return r};var Mc=function(t){function e(e,n){t.call(this,n),this._points=null,this.init(e)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new Iu:this._points.expandEnvelope(new Iu)},e.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},e.prototype.getSortIndex=function(){return t.SORTINDEX_LINESTRING},e.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments,n=arguments;if(!this.isEquivalentClass(e))return!1;var r=e;if(this._points.size()!==r._points.size())return!1;for(var i=0;i<this._points.size();i++)if(!this.equal(this._points.getCoordinate(i),r._points.getCoordinate(i),n))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=0;t<Math.trunc(this._points.size()/2);t++){var e=this._points.size()-1-t;if(!this._points.getCoordinate(t).equals(this._points.getCoordinate(e)))return this._points.getCoordinate(t).compareTo(this._points.getCoordinate(e))>0&&Sc.reverse(this._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?_c.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 Bu.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var t=this._points.copy();return Sc.reverse(t),this.getFactory().createLineString(t)},e.prototype.compareToSameClass=function(){if(1===arguments.length){for(var t=arguments,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;return arguments.compare(this._points,i._points)}},e.prototype.apply=function(){if(uu(arguments,Yu))for(var t=arguments,e=0;e<this._points.size();e++)t.filter(this._points.getCoordinate(e));else if(uu(arguments,xc)){var n=arguments;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(uu(arguments,vc)||uu(arguments,zu))&&arguments.filter(this)},e.prototype.getBoundary=function(){return new bc(this).getBoundary()},e.prototype.isEquivalentClass=function(t){return t instanceof e},e.prototype.clone=function(){var e=t.prototype.clone.call(this);return e._points=this._points.clone(),e},e.prototype.getCoordinateN=function(t){return this._points.getCoordinate(t)},e.prototype.getGeometryType=function(){return“LineString”},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.getCoordinateSequence=function(){return this._points},e.prototype.isEmpty=function(){return 0===this._points.size()},e.prototype.init=function(t){if(null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),1===t.size())throw new Za(“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},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(e,n),e}(ju),Lc=function(){};Lc.prototype.interfaces_=function(){return[]},Lc.prototype.getClass=function(){return Lc};var Pc=function(t){function e(e,n){t.call(this,n),this._coordinates=e||null,this.init(this._coordinates)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new Iu;var t=new Iu;return t.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),t},e.prototype.getSortIndex=function(){return t.SORTINDEX_POINT},e.prototype.getCoordinates=function(){return this.isEmpty()?[]:},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments,n=arguments;return!!this.isEquivalentClass(e)&&(!(!this.isEmpty()||!e.isEmpty())||this.isEmpty()===e.isEmpty()&&this.equal(e.getCoordinate(),this.getCoordinate(),n))}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){},e.prototype.getCoordinate=function(){return 0!==this._coordinates.size()?this._coordinates.getCoordinate(0):null},e.prototype.getBoundaryDimension=function(){return _c.FALSE},e.prototype.getDimension=function(){return 0},e.prototype.getNumPoints=function(){return this.isEmpty()?0:1},e.prototype.reverse=function(){return this.copy()},e.prototype.getX=function(){if(null===this.getCoordinate())throw new Error(“getX called on empty Point”);return this.getCoordinate().x},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments;return this.getCoordinate().compareTo(t.getCoordinate())}if(2===arguments.length){var e=arguments;return arguments.compare(this._coordinates,e._coordinates)}},e.prototype.apply=function(){if(uu(arguments,Yu)){var t=arguments;if(this.isEmpty())return null;t.filter(this.getCoordinate())}else if(uu(arguments,xc)){var e=arguments;if(this.isEmpty())return null;e.filter(this._coordinates,0),e.isGeometryChanged()&&this.geometryChanged()}else(uu(arguments,vc)||uu(arguments,zu))&&arguments.filter(this)},e.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},e.prototype.clone=function(){var e=t.prototype.clone.call(this);return e._coordinates=this._coordinates.clone(),e},e.prototype.getGeometryType=function(){return“Point”},e.prototype.copy=function(){return new e(this._coordinates.copy(),this._factory)},e.prototype.getCoordinateSequence=function(){return this._coordinates},e.prototype.getY=function(){if(null===this.getCoordinate())throw new Error(“getY called on empty Point”);return this.getCoordinate().y},e.prototype.isEmpty=function(){return 0===this._coordinates.size()},e.prototype.init=function(t){null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),Tu.isTrue(t.size()<=1),this._coordinates=t},e.prototype.isSimple=function(){return!0},e.prototype.interfaces_=function(){return},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return 0x44077bad161cbc00},Object.defineProperties(e,n),e}(ju),Oc=function(){};Oc.prototype.interfaces_=function(){return[]},Oc.prototype.getClass=function(){return Oc};var Rc=function(t){function e(e,n,r){if(t.call(this,r),this._shell=null,this._holes=null,null===e&&(e=this.getFactory().createLinearRing()),null===n&&(n=[]),t.hasNullElements(n))throw new Za(“holes must not contain null elements”);if(e.isEmpty()&&t.hasNonEmptyElements(n))throw new Za(“shell is empty but holes are not”);this._shell=e,this._holes=n}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},e.prototype.getSortIndex=function(){return t.SORTINDEX_POLYGON},e.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var t=new Array(this.getNumPoints()).fill(null),e=-1,n=this._shell.getCoordinates(),r=0;r=n;for(var i=0;i<this._holes.length;i++)for(var o=this._holes.getCoordinates(),s=0;s=o;return t},e.prototype.getArea=function(){var t=0;t+=Math.abs(Bu.signedArea(this._shell.getCoordinateSequence()));for(var e=0;e.getCoordinateSequence()));return t},e.prototype.isRectangle=function(){if(0!==this.getNumInteriorRing())return!1;if(null===this._shell)return!1;if(5!==this._shell.getNumPoints())return!1;for(var t=this._shell.getCoordinateSequence(),e=this.getEnvelopeInternal(),n=0;n<5;n++){var 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),c=t.getY(a);if(u!==o==(c!==s))return!1;o=u,s=c}return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments,n=arguments;if(!this.isEquivalentClass(e))return!1;var r=e,i=this._shell,o=r._shell;if(!i.equalsExact(o,n))return!1;if(this._holes.length!==r._holes.length)return!1;for(var s=0;s.equalsExact(r._holes,n))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){if(0===arguments.length){this.normalize(this._shell,!0);for(var t=0;t,!1);yc.sort(this._holes)}else if(2===arguments.length){var e=arguments,n=arguments;if(e.isEmpty())return null;var r=new Array(e.getCoordinates().length-1).fill(null);wu.arraycopy(e.getCoordinates(),0,r,0,r.length);var i=oc.minCoordinate(e.getCoordinates());oc.scroll(r,i),wu.arraycopy(r,0,e.getCoordinates(),0,r.length),e.getCoordinates()=r,Bu.isCCW(e.getCoordinates())===n&&oc.reverse(e.getCoordinates())}},e.prototype.getCoordinate=function(){return this._shell.getCoordinate()},e.prototype.getNumInteriorRing=function(){return this._holes.length},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.getLength=function(){var t=0;t+=this._shell.getLength();for(var e=0;e.getLength();return t},e.prototype.getNumPoints=function(){for(var t=this._shell.getNumPoints(),e=0;e.getNumPoints();return t},e.prototype.reverse=function(){var t=this.copy();t._shell=this._shell.copy().reverse(),t._holes=new Array(this._holes.length).fill(null);for(var e=0;e=this._holes.copy().reverse();return t},e.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments,e=this._shell,n=t._shell;return e.compareToSameClass(n)}if(2===arguments.length){var r=arguments,i=arguments,o=r,s=this._shell,a=o._shell,u=s.compareToSameClass(a,i);if(0!==u)return u;for(var c=this.getNumInteriorRing(),h=o.getNumInteriorRing(),l=0;l<c&&l<h;){var p=this.getInteriorRingN(l),f=o.getInteriorRingN(l),g=p.compareToSameClass(f,i);if(0!==g)return g;l++}return l<c?1:l<h?-1:0}},e.prototype.apply=function(t){if(uu(t,Yu)){this._shell.apply(t);for(var e=0;e.apply(t)}else if(uu(t,xc)){if(this._shell.apply(t),!t.isDone())for(var n=0;n.apply(t),!t.isDone());n++);t.isGeometryChanged()&&this.geometryChanged()}else if(uu(t,vc))t.filter(this);else if(uu(t,zu)){t.filter(this),this._shell.apply(t);for(var r=0;r.apply(t)}},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var t=new Array(this._holes.length+1).fill(null);t=this._shell;for(var e=0;e=this._holes;return t.length<=1?this.getFactory().createLinearRing(t.getCoordinateSequence()):this.getFactory().createMultiLineString(t)},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._shell=this._shell.clone(),e._holes=new Array(this._holes.length).fill(null);for(var n=0;n=this._holes.clone();return e},e.prototype.getGeometryType=function(){return“Polygon”},e.prototype.copy=function(){for(var t=this._shell.copy(),n=new Array(this._holes.length).fill(null),r=0;r=this._holes.copy();return new e(t,n,this._factory)},e.prototype.getExteriorRing=function(){return this._shell},e.prototype.isEmpty=function(){return this._shell.isEmpty()},e.prototype.getInteriorRingN=function(t){return this._holes},e.prototype.interfaces_=function(){return},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(e,n),e}(ju),Tc=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return ju.SORTINDEX_MULTIPOINT},e.prototype.isValid=function(){return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments,n=arguments;return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,n)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getCoordinate=function(){if(1===arguments.length){var e=arguments;return this._geometries.getCoordinate()}return t.prototype.getCoordinate.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return _c.FALSE},e.prototype.getDimension=function(){return 0},e.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},e.prototype.getGeometryType=function(){return“MultiPoint”},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),n=0;n=this._geometries.copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x6fb1ed4162e0fc00},Object.defineProperties(e,n),e}(Ec),Ac=function(t){function e(e,n){e instanceof nu&&n instanceof Zc&&(e=n.getCoordinateSequenceFactory().create(e)),t.call(this,e,n),this.validateConstruction()}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return ju.SORTINDEX_LINEARRING},e.prototype.getBoundaryDimension=function(){return _c.FALSE},e.prototype.isClosed=function(){return!!this.isEmpty()||t.prototype.isClosed.call(this)},e.prototype.reverse=function(){var t=this._points.copy();return Sc.reverse(t),this.getFactory().createLinearRing(t)},e.prototype.validateConstruction=function(){if(!this.isEmpty()&&!t.prototype.isClosed.call(this))throw new Za(“Points of LinearRing do not form a closed linestring”);if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<e.MINIMUM_VALID_SIZE)throw new Za(“Invalid number of points in LinearRing (found ”+this.getCoordinateSequence().size()+“ - must be 0 or >= 4)”)},e.prototype.getGeometryType=function(){return“LinearRing”},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.MINIMUM_VALID_SIZE.get=function(){return 4},n.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,n),e}(Mc),Dc=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return ju.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments,n=arguments;return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,n)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),n=0;n=this._geometries.reverse();return this.getFactory().createMultiPolygon(e)},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var t=new nc,e=0;e<this._geometries.length;e++)for(var n=this._geometries.getBoundary(),r=0;r<n.getNumGeometries();r++)t.add(n.getGeometryN®);var i=new Array(t.size()).fill(null);return this.getFactory().createMultiLineString(t.toArray(i))},e.prototype.getGeometryType=function(){return“MultiPolygon”},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),n=0;n=this._geometries.copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(e,n),e}(Ec),Fc=function(t){this._factory=t||null,this._isUserDataCopied=!1},qc={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};Fc.prototype.setCopyUserData=function(t){this._isUserDataCopied=t},Fc.prototype.edit=function(t,e){if(null===t)return null;var n=this.editInternal(t,e);return this._isUserDataCopied&&n.setUserData(t.getUserData()),n},Fc.prototype.editInternal=function(t,e){return null===this._factory&&(this._factory=t.getFactory()),t instanceof Ec?this.editGeometryCollection(t,e):t instanceof Rc?this.editPolygon(t,e):t instanceof Pc||t instanceof Mc?e.edit(t,this._factory):(Tu.shouldNeverReachHere(“Unsupported Geometry class: ”+t.getClass().getName()),null)},Fc.prototype.editGeometryCollection=function(t,e){for(var n=e.edit(t,this._factory),r=new nc,i=0;i<n.getNumGeometries();i++){var o=this.edit(n.getGeometryN(i),e);null===o||o.isEmpty()||r.add(o)}return n.getClass()===Tc?this._factory.createMultiPoint(r.toArray([])):n.getClass()===wc?this._factory.createMultiLineString(r.toArray()):n.getClass()===Dc?this._factory.createMultiPolygon(r.toArray([])):this._factory.createGeometryCollection(r.toArray())},Fc.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 nc,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([]))},Fc.prototype.interfaces_=function(){return},Fc.prototype.getClass=function(){return Fc},Fc.GeometryEditorOperation=function(){},qc.NoOpGeometryOperation.get=function(){return Gc},qc.CoordinateOperation.get=function(){return Bc},qc.CoordinateSequenceOperation.get=function(){return kc},Object.defineProperties(Fc,qc);var Gc=function(){};Gc.prototype.edit=function(t,e){return t},Gc.prototype.interfaces_=function(){return},Gc.prototype.getClass=function(){return Gc};var Bc=function(){};Bc.prototype.edit=function(t,e){var n=this.editCoordinates(t.getCoordinates(),t);return null===n?t:t instanceof Ac?e.createLinearRing(n):t instanceof Mc?e.createLineString(n):t instanceof Pc?n.length>0?e.createPoint(n):e.createPoint():t},Bc.prototype.interfaces_=function(){return},Bc.prototype.getClass=function(){return Bc};var kc=function(){};kc.prototype.edit=function(t,e){return t instanceof Ac?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof Mc?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Pc?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t},kc.prototype.interfaces_=function(){return},kc.prototype.getClass=function(){return kc};var zc=function(){if(this._dimension=3,this._coordinates=null,1===arguments.length){if(argumentsinstanceof Array)this._coordinates=arguments,this._dimension=3;else if(Number.isInteger(arguments)){var t=arguments;this._coordinates=new Array(t).fill(null);for(var e=0;e=new nu}else if(uu(arguments,mu)){var n=arguments;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=n.getCoordinateCopy®}}else if(2===arguments.length)if(argumentsinstanceof Array&&Number.isInteger(arguments)){var i=arguments,o=arguments;this._coordinates=i,this._dimension=o,null===i&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments)&&Number.isInteger(arguments)){var s=arguments,a=arguments;this._coordinates=new Array(s).fill(null),this._dimension=a;for(var u=0;u=new nu}},jc={serialVersionUID:{configurable:!0}};zc.prototype.setOrdinate=function(t,e,n){switch(e){case mu.X:this._coordinates.x=n;break;case mu.Y:this._coordinates.y=n;break;case mu.Z:this._coordinates.z=n;break;default:throw new Za(“invalid ordinateIndex”)}},zc.prototype.size=function(){return this._coordinates.length},zc.prototype.getOrdinate=function(t,e){switch(e){case mu.X:return this._coordinates.x;case mu.Y:return this._coordinates.y;case mu.Z:return this._coordinates.z}return Ka.NaN},zc.prototype.getCoordinate=function(){if(1===arguments.length){var t=arguments;return this._coordinates}if(2===arguments.length){var e=arguments,n=arguments;n.x=this._coordinates.x,n.y=this._coordinates.y,n.z=this._coordinates.z}},zc.prototype.getCoordinateCopy=function(t){return new nu(this._coordinates)},zc.prototype.getDimension=function(){return this._dimension},zc.prototype.getX=function(t){return this._coordinates.x},zc.prototype.clone=function(){for(var t=new Array(this.size()).fill(null),e=0;e=this._coordinates.clone();return new zc(t,this._dimension)},zc.prototype.expandEnvelope=function(t){for(var e=0;e);return t},zc.prototype.copy=function(){for(var t=new Array(this.size()).fill(null),e=0;e=this._coordinates.copy();return new zc(t,this._dimension)},zc.prototype.toString=function(){if(this._coordinates.length>0){var t=new lu(17*this._coordinates.length);t.append(“(”),t.append(this._coordinates);for(var e=1;e<this._coordinates.length;e++)t.append(“, ”),t.append(this._coordinates);return t.append(“)”),t.toString()}return“()”},zc.prototype.getY=function(t){return this._coordinates.y},zc.prototype.toCoordinateArray=function(){return this._coordinates},zc.prototype.interfaces_=function(){return},zc.prototype.getClass=function(){return zc},jc.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(zc,jc);var Xc=function(){},Uc={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};Xc.prototype.readResolve=function(){return Xc.instance()},Xc.prototype.create=function(){if(1===arguments.length){if(argumentsinstanceof Array){var t=arguments;return new zc(t)}if(uu(arguments,mu)){var e=arguments;return new zc(e)}}else if(2===arguments.length){var n=arguments,r=arguments;return r>3&&(r=3),r<2?new zc(n):new zc(n,r)}},Xc.prototype.interfaces_=function(){return},Xc.prototype.getClass=function(){return Xc},Xc.instance=function(){return Xc.instanceObject},Uc.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},Uc.instanceObject.get=function(){return new Xc},Object.defineProperties(Xc,Uc);var Yc=function(t){function e(){t.call(this),this.map_=new Map}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return this.map_.get(t)||null},e.prototype.put=function(t,e){return this.map_.set(t,e),e},e.prototype.values=function(){for(var t=new nc,e=this.map_.values(),n=e.next();!n.done;)t.add(n.value),n=e.next();return t},e.prototype.entrySet=function(){var t=new lc;return this.map_.entries().forEach((function(e){return t.add(e)})),t},e.prototype.size=function(){return this.map_.size()},e}(cc),Vc=function t(){if(this._modelType=null,this._scale=null,0===arguments.length)this._modelType=t.FLOATING;else if(1===arguments.length)if(argumentsinstanceof Wc){var e=arguments;this._modelType=e,e===t.FIXED&&this.setScale(1)}else if(“number”==typeof arguments){var n=arguments;this._modelType=t.FIXED,this.setScale(n)}else if(argumentsinstanceof t){var r=arguments;this._modelType=r._modelType,this._scale=r._scale}},Hc={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Vc.prototype.equals=function(t){if(!(t instanceof Vc))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale},Vc.prototype.compareTo=function(t){var e=t,n=this.getMaximumSignificantDigits(),r=e.getMaximumSignificantDigits();return new pu(n).compareTo(new pu®)},Vc.prototype.getScale=function(){return this._scale},Vc.prototype.isFloating=function(){return this._modelType===Vc.FLOATING||this._modelType===Vc.FLOATING_SINGLE},Vc.prototype.getType=function(){return this._modelType},Vc.prototype.toString=function(){var t=“UNKNOWN”;return this._modelType===Vc.FLOATING?t=“Floating”:this._modelType===Vc.FLOATING_SINGLE?t=“Floating-Single”:this._modelType===Vc.FIXED&&(t=“Fixed (Scale=”+this.getScale()+“)”),t},Vc.prototype.makePrecise=function(){if(“number”==typeof arguments){var t=arguments;return Ka.isNaN(t)||this._modelType===Vc.FLOATING_SINGLE?t:this._modelType===Vc.FIXED?Math.round(t*this._scale)/this._scale:t}if(argumentsinstanceof nu){var e=arguments;if(this._modelType===Vc.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}},Vc.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===Vc.FLOATING?t=16:this._modelType===Vc.FLOATING_SINGLE?t=6:this._modelType===Vc.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},Vc.prototype.setScale=function(t){this._scale=Math.abs(t)},Vc.prototype.interfaces_=function(){return},Vc.prototype.getClass=function(){return Vc},Vc.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e},Hc.serialVersionUID.get=function(){return 0x6bee6404e9a25c00},Hc.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(Vc,Hc);var Wc=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},Jc={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};Wc.prototype.readResolve=function(){return Wc.nameToTypeMap.get(this._name)},Wc.prototype.toString=function(){return this._name},Wc.prototype.interfaces_=function(){return},Wc.prototype.getClass=function(){return Wc},Jc.serialVersionUID.get=function(){return-552860263173159e4},Jc.nameToTypeMap.get=function(){return new Yc},Object.defineProperties(Wc,Jc),Vc.Type=Wc,Vc.FIXED=new Wc(“FIXED”),Vc.FLOATING=new Wc(“FLOATING”),Vc.FLOATING_SINGLE=new Wc(“FLOATING SINGLE”);var Zc=function t(){this._precisionModel=new Vc,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),0===arguments.length||(1===arguments.length?uu(arguments,ou)?this._coordinateSequenceFactory=arguments:argumentsinstanceof Vc&&(this._precisionModel=arguments):2===arguments.length?(this._precisionModel=arguments,this._SRID=arguments):3===arguments.length&&(this._precisionModel=arguments,this._SRID=arguments,this._coordinateSequenceFactory=arguments))},Kc={serialVersionUID:{configurable:!0}};Zc.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new nu(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new nu(t.getMinX(),t.getMinY()),new nu(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new nu(t.getMinX(),t.getMinY()),new nu(t.getMinX(),t.getMaxY()),new nu(t.getMaxX(),t.getMaxY()),new nu(t.getMaxX(),t.getMinY()),new nu(t.getMinX(),t.getMinY())]),null)},Zc.prototype.createLineString=function(t){return t?t instanceof Array?new Mc(this.getCoordinateSequenceFactory().create(t),this):uu(t,mu)?new Mc(t,this):void 0:new Mc(this.getCoordinateSequenceFactory().create([]),this)},Zc.prototype.createMultiLineString=function(){if(0===arguments.length)return new wc(null,this);if(1===arguments.length){var t=arguments;return new wc(t,this)}},Zc.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(Zc.toGeometryArray(t));var a=t.iterator().next();if(t.size()>1){if(a instanceof Rc)return this.createMultiPolygon(Zc.toPolygonArray(t));if(a instanceof Mc)return this.createMultiLineString(Zc.toLineStringArray(t));if(a instanceof Pc)return this.createMultiPoint(Zc.toPointArray(t));Tu.shouldNeverReachHere(“Unhandled class: ”+a.getClass().getName())}return a},Zc.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)},Zc.prototype.createPoint=function(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(argumentsinstanceof nu){var t=arguments;return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create():null)}if(uu(arguments,mu)){var e=arguments;return new Pc(e,this)}}},Zc.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},Zc.prototype.createPolygon=function(){if(0===arguments.length)return new Rc(null,null,this);if(1===arguments.length){if(uu(arguments,mu)){var t=arguments;return this.createPolygon(this.createLinearRing(t))}if(argumentsinstanceof Array){var e=arguments;return this.createPolygon(this.createLinearRing(e))}if(argumentsinstanceof Ac){var n=arguments;return this.createPolygon(n,null)}}else if(2===arguments.length){var r=arguments,i=arguments;return new Rc(r,i,this)}},Zc.prototype.getSRID=function(){return this._SRID},Zc.prototype.createGeometryCollection=function(){if(0===arguments.length)return new Ec(null,this);if(1===arguments.length){var t=arguments;return new Ec(t,this)}},Zc.prototype.createGeometry=function(t){return new Fc(this).edit(t,{edit:function(){if(2===arguments.length){var t=arguments;return this._coordinateSequenceFactory.create(t)}}})},Zc.prototype.getPrecisionModel=function(){return this._precisionModel},Zc.prototype.createLinearRing=function(){if(0===arguments.length)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(argumentsinstanceof Array){var t=arguments;return this.createLinearRing(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(uu(arguments,mu)){var e=arguments;return new Ac(e,this)}}},Zc.prototype.createMultiPolygon=function(){if(0===arguments.length)return new Dc(null,this);if(1===arguments.length){var t=arguments;return new Dc(t,this)}},Zc.prototype.createMultiPoint=function(){if(0===arguments.length)return new Tc(null,this);if(1===arguments.length){if(argumentsinstanceof Array){var t=arguments;return new Tc(t,this)}if(argumentsinstanceof Array){var e=arguments;return this.createMultiPoint(null!==e?this.getCoordinateSequenceFactory().create(e):null)}if(uu(arguments,mu)){var n=arguments;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());Sc.copy(n,i,o,0,1),r=this.createPoint(o)}return this.createMultiPoint®}}},Zc.prototype.interfaces_=function(){return},Zc.prototype.getClass=function(){return Zc},Zc.toMultiPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Zc.toGeometryArray=function(t){if(null===t)return null;var e=new Array(t.size()).fill(null);return t.toArray(e)},Zc.getDefaultCoordinateSequenceFactory=function(){return Xc.instance()},Zc.toMultiLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Zc.toLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Zc.toMultiPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Zc.toLinearRingArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Zc.toPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Zc.toPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Zc.createPointFromInternalCoord=function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)},Kc.serialVersionUID.get=function(){return-0x5ea75f2051eeb400},Object.defineProperties(Zc,Kc);var Qc=,$c=function(t){this.geometryFactory=t||new Zc};$c.prototype.read=function(t){var e,n=(e=“string”==typeof t?JSON.parse(t):t).type;if(!th)throw new Error(“Unknown GeoJSON type: ”+e.type);return-1!==Qc.indexOf(n)?th.apply(this,):“GeometryCollection”===n?th.apply(this,):th.apply(this,)},$c.prototype.write=function(t){var e=t.getGeometryType();if(!eh)throw new Error(“Geometry is not supported”);return eh.apply(this,)};var th={Feature:function(t){var e={};for(var n in t)e=t;if(t.geometry){var r=t.geometry.type;if(!th)throw new Error(“Unknown GeoJSON type: ”+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=th.bbox.apply(this,)),e},FeatureCollection:function(t){var e={};if(t.features){e.features=[];for(var n=0;n))}return t.bbox&&(e.bbox=this.parse.bbox.apply(this,)),e},coordinates:function(t){for(var e=[],n=0;n<t.length;++n){var r=t;e.push(new nu(r,r))}return e},bbox:function(t){return this.geometryFactory.createLinearRing([new nu(t,t),new nu(t,t),new nu(t,t),new nu(t,t),new nu(t,t)])},Point:function(t){var e=new nu(t,t);return this.geometryFactory.createPoint(e)},MultiPoint:function(t){for(var e=[],n=0;n]));return this.geometryFactory.createMultiPoint(e)},LineString:function(t){var e=th.coordinates.apply(this,);return this.geometryFactory.createLineString(e)},MultiLineString:function(t){for(var e=[],n=0;n]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(t){for(var e=th.coordinates.apply(this,[t]),n=this.geometryFactory.createLinearRing(e),r=[],i=1;i<t.length;++i){var o=t,s=th.coordinates.apply(this,),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;e.push(th.Polygon.apply(this,))}return this.geometryFactory.createMultiPolygon(e)},GeometryCollection:function(t){for(var e=[],n=0;n<t.length;++n){var r=t;e.push(this.read®)}return this.geometryFactory.createGeometryCollection(e)}},eh={coordinate:function(t){return},Point:function(t){return{type:“Point”,coordinates:eh.coordinate.apply(this,)}},MultiPoint:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries,i=eh.Point.apply(this,);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;e.push(eh.coordinate.apply(this,))}return{type:“LineString”,coordinates:e}},MultiLineString:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries,i=eh.LineString.apply(this,);e.push(i.coordinates)}return{type:“MultiLineString”,coordinates:e}},Polygon:function(t){var e=[],n=eh.LineString.apply(this,);e.push(n.coordinates);for(var r=0;r<t._holes.length;++r){var i=t._holes,o=eh.LineString.apply(this,);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,i=eh.Polygon.apply(this,);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,i=r.getGeometryType();e.push(eh.apply(this,))}return{type:“GeometryCollection”,geometries:e}}},nh=function(t){this.geometryFactory=t||new Zc,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new $c(this.geometryFactory)};nh.prototype.read=function(t){var e=this.parser.read(t);return this.precisionModel.getType()===Vc.FIXED&&this.reducePrecision(e),e},nh.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);else if(t.geometries)for(e=0,n=t.geometries.length;e)};var rh=function(){this.parser=new $c(this.geometryFactory)};rh.prototype.write=function(t){return this.parser.write(t)};var ih=function(){},oh={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};ih.prototype.interfaces_=function(){return[]},ih.prototype.getClass=function(){return ih},ih.opposite=function(t){return t===ih.LEFT?ih.RIGHT:t===ih.RIGHT?ih.LEFT:t},oh.ON.get=function(){return 0},oh.LEFT.get=function(){return 1},oh.RIGHT.get=function(){return 2},Object.defineProperties(ih,oh),(Pi.prototype=new Error).name=“EmptyStackException”,(Oi.prototype=new ec).add=function(t){return this.array_.push(t),!0},Oi.prototype.get=function(t){if(t<0||t>=this.size())throw new Error;return this.array_},Oi.prototype.push=function(t){return this.array_.push(t),t},Oi.prototype.pop=function(t){if(0===this.array_.length)throw new Pi;return this.array_.pop()},Oi.prototype.peek=function(){if(0===this.array_.length)throw new Pi;return this.array_},Oi.prototype.empty=function(){return 0===this.array_.length},Oi.prototype.isEmpty=function(){return this.empty()},Oi.prototype.search=function(t){return this.array_.indexOf(t)},Oi.prototype.size=function(){return this.array_.length},Oi.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e);return t};var sh=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};sh.prototype.getCoordinate=function(){return this._minCoord},sh.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},sh.prototype.findRightmostEdgeAtVertex=function(){var t=this._minDe.getEdge().getCoordinates();Tu.isTrue(this._minIndex>0&&this._minIndex<t.length,“rightmost point expected to be interior vertex of edge”);var e=t,n=t,r=Bu.computeOrientation(this._minCoord,n,e),i=!1;(e.y<this._minCoord.y&&n.y<this._minCoord.y&&r===Bu.COUNTERCLOCKWISE||e.y>this._minCoord.y&&n.y>this._minCoord.y&&r===Bu.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)},sh.prototype.getRightmostSideOfSegment=function(t,e){var n=t.getEdge().getCoordinates();if(e<0||e+1>=n.length)return-1;if(n.y===n.y)return-1;var r=ih.LEFT;return n.y.y&&(r=ih.RIGHT),r},sh.prototype.getEdge=function(){return this._orientedDe},sh.prototype.checkForRightmostCoordinate=function(t){for(var e=t.getEdge().getCoordinates(),n=0;n.x>this._minCoord.x)&&(this._minDe=t,this._minIndex=n,this._minCoord=e)},sh.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)},sh.prototype.findEdge=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();n.isForward()&&this.checkForRightmostCoordinate(n)}Tu.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)===ih.LEFT&&(this._orientedDe=this._minDe.getSym())},sh.prototype.interfaces_=function(){return[]},sh.prototype.getClass=function(){return sh};var ah=function(t){function e(n,r){t.call(this,e.msgWithCoord(n,r)),this.pt=r?new nu®:null,this.name=“TopologyException”}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCoordinate=function(){return this.pt},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.msgWithCoord=function(t,e){return e?t:t+“ [ ”e“ ]”},e}(Ou),uh=function(){this.array_=[]};uh.prototype.addLast=function(t){this.array_.push(t)},uh.prototype.removeFirst=function(){return this.array_.shift()},uh.prototype.isEmpty=function(){return 0===this.array_.length};var ch=function(){this._finder=null,this._dirEdgeList=new nc,this._nodes=new nc,this._rightMostCoord=null,this._env=null,this._finder=new sh};ch.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();)t.next().setVisited(!1)},ch.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},ch.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 ah(“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)}},ch.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(ih.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)},ch.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},ch.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(ih.RIGHT)>=1&&e.getDepth(ih.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},ch.prototype.computeDepths=function(t){var e=new lc,n=new uh,r=t.getNode();for(n.addLast®,e.add®,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))}}}},ch.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.x<e._rightMostCoord.x?-1:this._rightMostCoord.x>e._rightMostCoord.x?1:0},ch.prototype.getEnvelope=function(){if(null===this._env){for(var t=new Iu,e=this._dirEdgeList.iterator();e.hasNext();)for(var n=e.next().getEdge().getCoordinates(),r=0;r);this._env=t}return this._env},ch.prototype.addReachable=function(t){var e=new Oi;for(e.add(t);!e.empty();){var n=e.pop();this.add(n,e)}},ch.prototype.copySymDepths=function(t){var e=t.getSym();e.setDepth(ih.LEFT,t.getDepth(ih.RIGHT)),e.setDepth(ih.RIGHT,t.getDepth(ih.LEFT))},ch.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®;var i=r.getSym().getNode();i.isVisited()||e.push(i)}},ch.prototype.getNodes=function(){return this._nodes},ch.prototype.getDirectedEdges=function(){return this._dirEdgeList},ch.prototype.interfaces_=function(){return},ch.prototype.getClass=function(){return ch};var hh=function t(){if(this.location=null,1===arguments.length){if(argumentsinstanceof Array){var e=arguments;this.init(e.length)}else if(Number.isInteger(arguments)){var n=arguments;this.init(1),this.location=n}else if(argumentsinstanceof t){var r=arguments;if(this.init(r.location.length),null!==r)for(var i=0;i=r.location}}else if(3===arguments.length){var o=arguments,s=arguments,a=arguments;this.init(3),this.location=o,this.location=s,this.location=a}};hh.prototype.setAllLocations=function(t){for(var e=0;e=t},hh.prototype.isNull=function(){for(var t=0;t!==su.NONE)return!1;return!0},hh.prototype.setAllLocationsIfNull=function(t){for(var e=0;e===su.NONE&&(this.location=t)},hh.prototype.isLine=function(){return 1===this.location.length},hh.prototype.merge=function(t){if(t.location.length>this.location.length){var e=new Array(3).fill(null);e=this.location,e=su.NONE,e=su.NONE,this.location=e}for(var n=0;n===su.NONE&&n=t.location)},hh.prototype.getLocations=function(){return this.location},hh.prototype.flip=function(){if(this.location.length<=1)return null;var t=this.location;this.location=this.location,this.location=t},hh.prototype.toString=function(){var t=new lu;return this.location.length>1&&t.append(su.toLocationSymbol(this.location)),t.append(su.toLocationSymbol(this.location)),this.location.length>1&&t.append(su.toLocationSymbol(this.location)),t.toString()},hh.prototype.setLocations=function(t,e,n){this.location=t,this.location=e,this.location=n},hh.prototype.get=function(t){return t:su.NONE},hh.prototype.isArea=function(){return this.location.length>1},hh.prototype.isAnyNull=function(){for(var t=0;t===su.NONE)return!0;return!1},hh.prototype.setLocation=function(){if(1===arguments.length){var t=arguments;this.setLocation(ih.ON,t)}else if(2===arguments.length){var e=arguments,n=arguments;this.location=n}},hh.prototype.init=function(t){this.location=new Array(t).fill(null),this.setAllLocations(su.NONE)},hh.prototype.isEqualOnSide=function(t,e){return this.location===t.location},hh.prototype.allPositionsEqual=function(t){for(var e=0;e!==t)return!1;return!0},hh.prototype.interfaces_=function(){return[]},hh.prototype.getClass=function(){return hh};var lh=function t(){if(this.elt=new Array(2).fill(null),1===arguments.length){if(Number.isInteger(arguments)){var e=arguments;this.elt=new hh(e),this.elt=new hh(e)}else if(argumentsinstanceof t){var n=arguments;this.elt=new hh(n.elt),this.elt=new hh(n.elt)}}else if(2===arguments.length){var r=arguments,i=arguments;this.elt=new hh(su.NONE),this.elt=new hh(su.NONE),this.elt.setLocation(i)}else if(3===arguments.length){var o=arguments,s=arguments,a=arguments;this.elt=new hh(o,s,a),this.elt=new hh(o,s,a)}else if(4===arguments.length){var u=arguments,c=arguments,h=arguments,l=arguments;this.elt=new hh(su.NONE,su.NONE,su.NONE),this.elt=new hh(su.NONE,su.NONE,su.NONE),this.elt.setLocations(c,h,l)}};lh.prototype.getGeometryCount=function(){var t=0;return this.elt.isNull()||t++,this.elt.isNull()||t++,t},lh.prototype.setAllLocations=function(t,e){this.elt.setAllLocations(e)},lh.prototype.isNull=function(t){return this.elt.isNull()},lh.prototype.setAllLocationsIfNull=function(){if(1===arguments.length){var t=arguments;this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)}else if(2===arguments.length){var e=arguments,n=arguments;this.elt.setAllLocationsIfNull(n)}},lh.prototype.isLine=function(t){return this.elt.isLine()},lh.prototype.merge=function(t){for(var e=0;e<2;e++)null===this.elt&&null!==t.elt?this.elt=new hh(t.elt):this.elt.merge(t.elt)},lh.prototype.flip=function(){this.elt.flip(),this.elt.flip()},lh.prototype.getLocation=function(){if(1===arguments.length){var t=arguments;return this.elt.get(ih.ON)}if(2===arguments.length){var e=arguments,n=arguments;return this.elt.get(n)}},lh.prototype.toString=function(){var t=new lu;return null!==this.elt&&(t.append(“A:”),t.append(this.elt.toString())),null!==this.elt&&(t.append(“ B:”),t.append(this.elt.toString())),t.toString()},lh.prototype.isArea=function(){if(0===arguments.length)return this.elt.isArea()||this.elt.isArea();if(1===arguments.length){var t=arguments;return this.elt.isArea()}},lh.prototype.isAnyNull=function(t){return this.elt.isAnyNull()},lh.prototype.setLocation=function(){if(2===arguments.length){var t=arguments,e=arguments;this.elt.setLocation(ih.ON,e)}else if(3===arguments.length){var n=arguments,r=arguments,i=arguments;this.elt.setLocation(r,i)}},lh.prototype.isEqualOnSide=function(t,e){return this.elt.isEqualOnSide(t.elt,e)&&this.elt.isEqualOnSide(t.elt,e)},lh.prototype.allPositionsEqual=function(t,e){return this.elt.allPositionsEqual(e)},lh.prototype.toLine=function(t){this.elt.isArea()&&(this.elt=new hh(this.elt.location))},lh.prototype.interfaces_=function(){return[]},lh.prototype.getClass=function(){return lh},lh.toLineLabel=function(t){for(var e=new lh(su.NONE),n=0;n<2;n++)e.setLocation(n,t.getLocation(n));return e};var ph=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new nc,this._pts=new nc,this._label=new lh(su.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new nc,this._geometryFactory=null;var t=arguments,e=arguments;this._geometryFactory=e,this.computePoints(t),this.computeRing()};ph.prototype.computeRing=function(){if(null!==this._ring)return null;for(var t=new Array(this._pts.size()).fill(null),e=0;e=this._pts.get(e);this._ring=this._geometryFactory.createLinearRing(t),this._isHole=Bu.isCCW(this._ring.getCoordinates())},ph.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},ph.prototype.computePoints=function(t){this._startDe=t;var e=t,n=!0;do{if(null===e)throw new ah(“Found null DirectedEdge”);if(e.getEdgeRing()===this)throw new ah(“Directed Edge visited twice during ring-building at ”+e.getCoordinate());this._edges.add(e);var r=e.getLabel();Tu.isTrue(r.isArea()),this.mergeLabel®,this.addPoints(e.getEdge(),e.isForward(),n),n=!1,this.setEdgeRing(e,this),e=this.getNext(e)}while(e!==this._startDe)},ph.prototype.getLinearRing=function(){return this._ring},ph.prototype.getCoordinate=function(t){return this._pts.get(t)},ph.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},ph.prototype.addPoints=function(t,e,n){var r=t.getCoordinates();if(e){var i=1;n&&(i=0);for(var o=i;o)}else{var s=r.length-2;n&&(s=r.length-1);for(var a=s;a>=0;a–)this._pts.add(r)}},ph.prototype.isHole=function(){return this._isHole},ph.prototype.setInResult=function(){var t=this._startDe;do{t.getEdge().setInResult(!0),t=t.getNext()}while(t!==this._startDe)},ph.prototype.containsPoint=function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!Bu.isPointInRing(t,e.getCoordinates()))return!1;for(var n=this._holes.iterator();n.hasNext();)if(n.next().containsPoint(t))return!1;return!0},ph.prototype.addHole=function(t){this._holes.add(t)},ph.prototype.isShell=function(){return null===this._shell},ph.prototype.getLabel=function(){return this._label},ph.prototype.getEdges=function(){return this._edges},ph.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},ph.prototype.getShell=function(){return this._shell},ph.prototype.mergeLabel=function(){if(1===arguments.length){var t=arguments;this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(2===arguments.length){var e=arguments,n=arguments,r=e.getLocation(n,ih.RIGHT);if(r===su.NONE)return null;if(this._label.getLocation(n)===su.NONE)return this._label.setLocation(n,r),null}},ph.prototype.setShell=function(t){this._shell=t,null!==t&&t.addHole(this)},ph.prototype.toPolygon=function(t){for(var e=new Array(this._holes.size()).fill(null),n=0;n=this._holes.get(n).getLinearRing();return t.createPolygon(this.getLinearRing(),e)},ph.prototype.interfaces_=function(){return[]},ph.prototype.getClass=function(){return ph};var fh=function(t){function e(){var e=arguments,n=arguments;t.call(this,e,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setEdgeRing=function(t,e){t.setMinEdgeRing(e)},e.prototype.getNext=function(t){return t.getNextMin()},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(ph),gh=function(t){function e(){var e=arguments,n=arguments;t.call(this,e,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildMinimalRings=function(){var t=new nc,e=this._startDe;do{if(null===e.getMinEdgeRing()){var n=new fh(e,this._geometryFactory);t.add(n)}e=e.getNext()}while(e!==this._startDe);return t},e.prototype.setEdgeRing=function(t,e){t.setEdgeRing(e)},e.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var t=this._startDe;do{t.getNode().getEdges().linkMinimalDirectedEdges(this),t=t.getNext()}while(t!==this._startDe)},e.prototype.getNext=function(t){return t.getNext()},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(ph),dh=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;this._label=t}};dh.prototype.setVisited=function(t){this._isVisited=t},dh.prototype.setInResult=function(t){this._isInResult=t},dh.prototype.isCovered=function(){return this._isCovered},dh.prototype.isCoveredSet=function(){return this._isCoveredSet},dh.prototype.setLabel=function(t){this._label=t},dh.prototype.getLabel=function(){return this._label},dh.prototype.setCovered=function(t){this._isCovered=t,this._isCoveredSet=!0},dh.prototype.updateIM=function(t){Tu.isTrue(this._label.getGeometryCount()>=2,“found partial label”),this.computeIM(t)},dh.prototype.isInResult=function(){return this._isInResult},dh.prototype.isVisited=function(){return this._isVisited},dh.prototype.interfaces_=function(){return[]},dh.prototype.getClass=function(){return dh};var yh=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var e=arguments,n=arguments;this._coord=e,this._edges=n,this._label=new lh(0,su.NONE)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isIncidentEdgeInResult=function(){for(var t=this.getEdges().getEdges().iterator();t.hasNext();)if(t.next().getEdge().isInResult())return!0;return!1},e.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},e.prototype.getCoordinate=function(){return this._coord},e.prototype.print=function(t){t.println(“node ”this._coord“ lbl: ”+this._label)},e.prototype.computeIM=function(t){},e.prototype.computeMergedLocation=function(t,e){var n=su.NONE;if(n=this._label.getLocation(e),!t.isNull(e)){var r=t.getLocation(e);n!==su.BOUNDARY&&(n=r)}return n},e.prototype.setLabel=function(){if(2!==arguments.length)return t.prototype.setLabel.apply(this,arguments);var e=arguments,n=arguments;null===this._label?this._label=new lh(e,n):this._label.setLocation(e,n)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){if(argumentsinstanceof e){var t=arguments;this.mergeLabel(t._label)}else if(argumentsinstanceof lh)for(var n=arguments,r=0;r<2;r++){var i=this.computeMergedLocation(n,r);this._label.getLocation®===su.NONE&&this._label.setLocation(r,i)}},e.prototype.add=function(t){this._edges.insert(t),t.setNode(this)},e.prototype.setLabelBoundary=function(t){if(null===this._label)return null;var e=su.NONE;null!==this._label&&(e=this._label.getLocation(t));var n=null;switch(e){case su.BOUNDARY:n=su.INTERIOR;break;case su.INTERIOR:default:n=su.BOUNDARY}this._label.setLocation(t,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(dh),_h=function(){this.nodeMap=new Ci,this.nodeFact=null;var t=arguments;this.nodeFact=t};_h.prototype.find=function(t){return this.nodeMap.get(t)},_h.prototype.addNode=function(){if(argumentsinstanceof nu){var t=arguments,e=this.nodeMap.get(t);return null===e&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}if(argumentsinstanceof yh){var n=arguments,r=this.nodeMap.get(n.getCoordinate());return null===r?(this.nodeMap.put(n.getCoordinate(),n),n):(r.mergeLabel(n),r)}},_h.prototype.print=function(t){for(var e=this.iterator();e.hasNext();)e.next().print(t)},_h.prototype.iterator=function(){return this.nodeMap.values().iterator()},_h.prototype.values=function(){return this.nodeMap.values()},_h.prototype.getBoundaryNodes=function(t){for(var e=new nc,n=this.iterator();n.hasNext();){var r=n.next();r.getLabel().getLocation(t)===su.BOUNDARY&&e.add®}return e},_h.prototype.add=function(t){var e=t.getCoordinate();this.addNode(e).add(t)},h.prototype.interfaces=function(){return[]},_h.prototype.getClass=function(){return _h};var mh=function(){},vh={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};mh.prototype.interfaces_=function(){return[]},mh.prototype.getClass=function(){return mh},mh.isNorthern=function(t){return t===mh.NE||t===mh.NW},mh.isOpposite=function(t,e){return t!==e&&2==(t-e+4)%4},mh.commonHalfPlane=function(t,e){if(t===e)return t;if(2==(t-e+4)%4)return-1;var n=t<e?t:e;return 0===n&&3===(t>e?t:e)?3:n},mh.isInHalfPlane=function(t,e){return e===mh.SE?t===mh.SE||t===mh.SW:t===e||t===e+1},mh.quadrant=function(){if(“number”==typeof arguments&&“number”==typeof arguments){var t=arguments,e=arguments;if(0===t&&0===e)throw new Za(“Cannot compute the quadrant for point ( ”t“, ”e“ )”);return t>=0?e>=0?mh.NE:mh.SE:e>=0?mh.NW:mh.SW}if(argumentsinstanceof nu&&argumentsinstanceof nu){var n=arguments,r=arguments;if(r.x===n.x&&r.y===n.y)throw new Za(“Cannot compute the quadrant for two identical points ”+n);return r.x>=n.x?r.y>=n.y?mh.NE:mh.SE:r.y>=n.y?mh.NW:mh.SW}},vh.NE.get=function(){return 0},vh.NW.get=function(){return 1},vh.SW.get=function(){return 2},vh.SE.get=function(){return 3},Object.defineProperties(mh,vh);var xh=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;this._edge=t}else if(3===arguments.length){var e=arguments,n=arguments,r=arguments;this._edge=e,this.init(n,r),this._label=null}else if(4===arguments.length){var i=arguments,o=arguments,s=arguments,a=arguments;this._edge=i,this.init(o,s),this._label=a}};xh.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:Bu.computeOrientation(t._p0,t._p1,this._p1)},xh.prototype.getDy=function(){return this._dy},xh.prototype.getCoordinate=function(){return this._p0},xh.prototype.setNode=function(t){this._node=t},xh.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)},xh.prototype.compareTo=function(t){var e=t;return this.compareDirection(e)},xh.prototype.getDirectedCoordinate=function(){return this._p1},xh.prototype.getDx=function(){return this._dx},xh.prototype.getLabel=function(){return this._label},xh.prototype.getEdge=function(){return this._edge},xh.prototype.getQuadrant=function(){return this._quadrant},xh.prototype.getNode=function(){return this._node},xh.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},xh.prototype.computeLabel=function(t){},xh.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=mh.quadrant(this._dx,this._dy),Tu.isTrue(!(0===this._dx&&0===this._dy),“EdgeEnd with identical endpoints found”)},xh.prototype.interfaces_=function(){return},xh.prototype.getClass=function(){return xh};var Eh=function(t){function e(){var e=arguments,n=arguments;if(t.call(this,e),this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=,this._isForward=n,n)this.init(e.getCoordinate(0),e.getCoordinate(1));else{var r=e.getNumPoints()-1;this.init(e.getCoordinate®,e.getCoordinate(r-1))}this.computeDirectedLabel()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getNextMin=function(){return this._nextMin},e.prototype.getDepth=function(t){return this._depth},e.prototype.setVisited=function(t){this._isVisited=t},e.prototype.computeDirectedLabel=function(){this._label=new lh(this._edge.getLabel()),this._isForward||this._label.flip()},e.prototype.getNext=function(){return this._next},e.prototype.setDepth=function(t,e){if(-999!==this._depth&&this._depth!==e)throw new ah(“assigned depths do not match”,this.getCoordinate());this._depth=e},e.prototype.isInteriorAreaEdge=function(){for(var t=!0,e=0;e<2;e++)this._label.isArea(e)&&this._label.getLocation(e,ih.LEFT)===su.INTERIOR&&this._label.getLocation(e,ih.RIGHT)===su.INTERIOR||(t=!1);return t},e.prototype.setNextMin=function(t){this._nextMin=t},e.prototype.print=function(e){t.prototype.print.call(this,e),e.print(“ ”this._depth[ih.LEFT]“/”+this._depth),e.print(“ (”+this.getDepthDelta()+“)”),this._isInResult&&e.print(“ inResult”)},e.prototype.setMinEdgeRing=function(t){this._minEdgeRing=t},e.prototype.isLineEdge=function(){var t=this._label.isLine(0)||this._label.isLine(1),e=!this._label.isArea(0)||this._label.allPositionsEqual(0,su.EXTERIOR),n=!this._label.isArea(1)||this._label.allPositionsEqual(1,su.EXTERIOR);return t&&e&&n},e.prototype.setEdgeRing=function(t){this._edgeRing=t},e.prototype.getMinEdgeRing=function(){return this._minEdgeRing},e.prototype.getDepthDelta=function(){var t=this._edge.getDepthDelta();return this._isForward||(t=-t),t},e.prototype.setInResult=function(t){this._isInResult=t},e.prototype.getSym=function(){return this._sym},e.prototype.isForward=function(){return this._isForward},e.prototype.getEdge=function(){return this._edge},e.prototype.printEdge=function(t){this.print(t),t.print(“ ”),this._isForward?this._edge.print(t):this._edge.printReverse(t)},e.prototype.setSym=function(t){this._sym=t},e.prototype.setVisitedEdge=function(t){this.setVisited(t),this._sym.setVisited(t)},e.prototype.setEdgeDepths=function(t,e){var n=this.getEdge().getDepthDelta();this._isForward||(n=-n);var r=1;t===ih.LEFT&&(r=-1);var i=ih.opposite(t),o=e+n*r;this.setDepth(t,e),this.setDepth(i,o)},e.prototype.getEdgeRing=function(){return this._edgeRing},e.prototype.isInResult=function(){return this._isInResult},e.prototype.setNext=function(t){this._next=t},e.prototype.isVisited=function(){return this._isVisited},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.depthFactor=function(t,e){return t===su.EXTERIOR&&e===su.INTERIOR?1:t===su.INTERIOR&&e===su.EXTERIOR?-1:0},e}(xh),wh=function(){};wh.prototype.createNode=function(t){return new yh(t,null)},wh.prototype.interfaces_=function(){return[]},wh.prototype.getClass=function(){return wh};var bh=function(){if(this._edges=new nc,this._nodes=null,this._edgeEndList=new nc,0===arguments.length)this._nodes=new _h(new wh);else if(1===arguments.length){var t=arguments;this._nodes=new _h(t)}};bh.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)}},bh.prototype.find=function(t){return this._nodes.find(t)},bh.prototype.addNode=function(){if(argumentsinstanceof yh){var t=arguments;return this._nodes.addNode(t)}if(argumentsinstanceof nu){var e=arguments;return this._nodes.addNode(e)}},bh.prototype.getNodeIterator=function(){return this._nodes.iterator()},bh.prototype.linkResultDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkResultDirectedEdges()},bh.prototype.debugPrintln=function(t){wu.out.println(t)},bh.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)===su.BOUNDARY},bh.prototype.linkAllDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkAllDirectedEdges()},bh.prototype.matchInSameDirection=function(t,e,n,r){return!!t.equals(n)&&Bu.computeOrientation(t,e,r)===Bu.COLLINEAR&&mh.quadrant(t,e)===mh.quadrant(n,r)},bh.prototype.getEdgeEnds=function(){return this._edgeEndList},bh.prototype.debugPrint=function(t){wu.out.print(t)},bh.prototype.getEdgeIterator=function(){return this._edges.iterator()},bh.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,i))return r;if(this.matchInSameDirection(t,e,i,i))return r}return null},bh.prototype.insertEdge=function(t){this._edges.add(t)},bh.prototype.findEdgeEnd=function(t){for(var e=this.getEdgeEnds().iterator();e.hasNext();){var n=e.next();if(n.getEdge()===t)return n}return null},bh.prototype.addEdges=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this._edges.add(n);var r=new Eh(n,!0),i=new Eh(n,!1);r.setSym(i),i.setSym®,this.add®,this.add(i)}},bh.prototype.add=function(t){this._nodes.add(t),this._edgeEndList.add(t)},bh.prototype.getNodes=function(){return this._nodes.values()},bh.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)&&e.equals(i))return r}return null},bh.prototype.interfaces_=function(){return[]},bh.prototype.getClass=function(){return bh},bh.linkResultDirectedEdges=function(t){for(var e=t.iterator();e.hasNext();)e.next().getEdges().linkResultDirectedEdges()};var Ih=function(){this._geometryFactory=null,this._shellList=new nc;var t=arguments;this._geometryFactory=t};Ih.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)}},Ih.prototype.computePolygons=function(t){for(var e=new nc,n=t.iterator();n.hasNext();){var r=n.next().toPolygon(this._geometryFactory);e.add®}return e},Ih.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 ah(“unable to assign hole to a shell”,r.getCoordinate(0));r.setShell(i)}}},Ih.prototype.buildMinimalEdgeRings=function(t,e,n){for(var r=new nc,i=t.iterator();i.hasNext();){var o=i.next();if(o.getMaxNodeDegree()>2){o.linkDirectedEdgesForMinimalEdgeRings();var s=o.buildMinimalRings(),a=this.findShell(s);null!==a?(this.placePolygonHoles(a,s),e.add(a)):n.addAll(s)}else r.add(o)}return r},Ih.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();)if(e.next().containsPoint(t))return!0;return!1},Ih.prototype.buildMaximalEdgeRings=function(t){for(var e=new nc,n=t.iterator();n.hasNext();){var r=n.next();if(r.isInResult()&&r.getLabel().isArea()&&null===r.getEdgeRing()){var i=new gh(r,this._geometryFactory);e.add(i),i.setInResult()}}return e},Ih.prototype.placePolygonHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();r.isHole()&&r.setShell(t)}},Ih.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},Ih.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(),c=u.getLinearRing(),h=c.getEnvelopeInternal();null!==o&&(s=o.getLinearRing().getEnvelopeInternal());var l=!1;h.contains®&&Bu.isPointInRing(i,c.getCoordinates())&&(l=!0),l&&(null===o||s.contains(h))&&(o=u)}return o},Ih.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 Tu.isTrue(e<=1,“found two shells in MinimalEdgeRing list”),n},Ih.prototype.add=function(){if(1===arguments.length){var t=arguments;this.add(t.getEdgeEnds(),t.getNodes())}else if(2===arguments.length){var e=arguments,n=arguments;bh.linkResultDirectedEdges(n);var r=this.buildMaximalEdgeRings(e),i=new nc,o=this.buildMinimalEdgeRings(r,this._shellList,i);this.sortShellsAndHoles(o,this._shellList,i),this.placeFreeHoles(this._shellList,i)}},Ih.prototype.interfaces_=function(){return[]},Ih.prototype.getClass=function(){return Ih};var Nh=function(){};Nh.prototype.getBounds=function(){},Nh.prototype.interfaces_=function(){return[]},Nh.prototype.getClass=function(){return Nh};var Ch=function(){this._bounds=null,this._item=null;var t=arguments,e=arguments;this._bounds=t,this._item=e};Ch.prototype.getItem=function(){return this._item},Ch.prototype.getBounds=function(){return this._bounds},Ch.prototype.interfaces_=function(){return},Ch.prototype.getClass=function(){return Ch};var Sh=function(){this._size=null,this._items=null,this._size=0,this._items=new nc,this._items.add(null)};Sh.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},Sh.prototype.size=function(){return this._size},Sh.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)},Sh.prototype.clear=function(){this._size=0,this._items.clear()},Sh.prototype.isEmpty=function(){return 0===this._size},Sh.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)},Sh.prototype.interfaces_=function(){return[]},Sh.prototype.getClass=function(){return Sh};var Mh=function(){};Mh.prototype.visitItem=function(t){},Mh.prototype.interfaces_=function(){return[]},Mh.prototype.getClass=function(){return Mh};var Lh=function(){};Lh.prototype.insert=function(t,e){},Lh.prototype.remove=function(t,e){},Lh.prototype.query=function(){},Lh.prototype.interfaces_=function(){return[]},Lh.prototype.getClass=function(){return Lh};var Ph=function(){if(this._childBoundables=new nc,this._bounds=null,this._level=null,0===arguments.length);else if(1===arguments.length){var t=arguments;this._level=t}},Oh={serialVersionUID:{configurable:!0}};Ph.prototype.getLevel=function(){return this._level},Ph.prototype.size=function(){return this._childBoundables.size()},Ph.prototype.getChildBoundables=function(){return this._childBoundables},Ph.prototype.addChildBoundable=function(t){Tu.isTrue(null===this._bounds),this._childBoundables.add(t)},Ph.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Ph.prototype.getBounds=function(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds},Ph.prototype.interfaces_=function(){return},Ph.prototype.getClass=function(){return Ph},Oh.serialVersionUID.get=function(){return 0x5a1e55ec41369800},Object.defineProperties(Ph,Oh);var Rh=function(){};Rh.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}},Rh.min=function(t){return Rh.sort(t),t.get(0)},Rh.sort=function(t,e){var n=t.toArray();e?yc.sort(n,e):yc.sort(n);for(var r=t.iterator(),i=0,o=n.length;i)},Rh.singletonList=function(t){var e=new nc;return e.add(t),e};var Th=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var t=arguments,e=arguments,n=arguments;this._boundable1=t,this._boundable2=e,this._itemDistance=n,this._distance=this.distance()};Th.prototype.expandToQueue=function(t,e){var n=Th.isComposite(this._boundable1),r=Th.isComposite(this._boundable2);if(n&&r)return Th.area(this._boundable1)>Th.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(n)return this.expand(this._boundable1,this._boundable2,t,e),null;if®return this.expand(this._boundable2,this._boundable1,t,e),null;throw new Za(“neither boundable is composite”)},Th.prototype.isLeaves=function(){return!(Th.isComposite(this._boundable1)||Th.isComposite(this._boundable2))},Th.prototype.compareTo=function(t){var e=t;return this._distance<e._distance?-1:this._distance>e._distance?1:0},Th.prototype.expand=function(t,e,n,r){for(var i=t.getChildBoundables().iterator();i.hasNext();){var o=i.next(),s=new Th(o,e,this._itemDistance);s.getDistance()<r&&n.add(s)}},Th.prototype.getBoundable=function(t){return 0===t?this._boundable1:this._boundable2},Th.prototype.getDistance=function(){return this._distance},Th.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},Th.prototype.interfaces_=function(){return},Th.prototype.getClass=function(){return Th},Th.area=function(t){return t.getBounds().getArea()},Th.isComposite=function(t){return t instanceof Ph};var Ah=function t(){if(this._root=null,this._built=!1,this._itemBoundables=new nc,this._nodeCapacity=null,0===arguments.length){var e=t.DEFAULT_NODE_CAPACITY;this._nodeCapacity=e}else if(1===arguments.length){var n=arguments;Tu.isTrue(n>1,“Node capacity must be greater than 1”),this._nodeCapacity=n}},Dh={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Ah.prototype.getNodeCapacity=function(){return this._nodeCapacity},Ah.prototype.lastNode=function(t){return t.get(t.size()-1)},Ah.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.getChildBoundables().iterator();e.hasNext();){var n=e.next();n instanceof Ph?t+=this.size(n):n instanceof Ch&&(t+=1)}return t}},Ah.prototype.removeItem=function(t,e){for(var n=null,r=t.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof Ch&&i.getItem()===e&&(n=i)}return null!==n&&(t.getChildBoundables().remove(n),!0)},Ah.prototype.itemsTree=function(){if(0===arguments.length){this.build();var t=this.itemsTree(this._root);return null===t?new nc:t}if(1===arguments.length){for(var e=arguments,n=new nc,r=e.getChildBoundables().iterator();r.hasNext();){var i=r.next();if(i instanceof Ph){var o=this.itemsTree(i);null!==o&&n.add(o)}else i instanceof Ch?n.add(i.getItem()):Tu.shouldNeverReachHere()}return n.size()<=0?null:n}},Ah.prototype.insert=function(t,e){Tu.isTrue(!this._built,“Cannot insert items into an STR packed R-tree after it has been built.”),this._itemBoundables.add(new Ch(t,e))},Ah.prototype.boundablesAtLevel=function(){if(1===arguments.length){var t=arguments,e=new nc;return this.boundablesAtLevel(t,this._root,e),e}if(3===arguments.length){var n=arguments,r=arguments,i=arguments;if(Tu.isTrue(n>-2),r.getLevel()===n)return i.add®,null;for(var o=r.getChildBoundables().iterator();o.hasNext();){var s=o.next();s instanceof Ph?this.boundablesAtLevel(n,s,i):(Tu.isTrue(s instanceof Ch),-1===n&&i.add(s))}return null}},Ah.prototype.query=function(){if(1===arguments.length){var t=arguments;this.build();var e=new nc;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.query(t,this._root,e),e}if(2===arguments.length){var n=arguments,r=arguments;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(uu(arguments,Mh)&&argumentsinstanceof Object&&argumentsinstanceof Ph)for(var i=arguments,o=arguments,s=arguments,a=o.getChildBoundables(),u=0;u<a.size();u++){var c=a.get(u);this.getIntersectsOp().intersects(c.getBounds(),i)&&(c instanceof Ph?this.query(i,c,s):c instanceof Ch?s.visitItem(c.getItem()):Tu.shouldNeverReachHere())}else if(uu(arguments,ec)&&argumentsinstanceof Object&&argumentsinstanceof Ph)for(var h=arguments,l=arguments,p=arguments,f=l.getChildBoundables(),g=0;g<f.size();g++){var d=f.get(g);this.getIntersectsOp().intersects(d.getBounds(),h)&&(d instanceof Ph?this.query(h,d,p):d instanceof Ch?p.add(d.getItem()):Tu.shouldNeverReachHere())}},Ah.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},Ah.prototype.getRoot=function(){return this.build(),this._root},Ah.prototype.remove=function(){if(2===arguments.length){var t=arguments,e=arguments;return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.remove(t,this._root,e)}if(3===arguments.length){var n=arguments,r=arguments,i=arguments,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 Ph&&(o=this.remove(n,u,i))){s=u;break}}return null!==s&&s.getChildBoundables().isEmpty()&&r.getChildBoundables().remove(s),o}},Ah.prototype.createHigherLevels=function(t,e){Tu.isTrue(!t.isEmpty());var n=this.createParentBoundables(t,e+1);return 1===n.size()?n.get(0):this.createHigherLevels(n,e+1)},Ah.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.getChildBoundables().iterator();e.hasNext();){var n=e.next();if(n instanceof Ph){var r=this.depth(n);r>t&&(t=r)}}return t+1}},Ah.prototype.createParentBoundables=function(t,e){Tu.isTrue(!t.isEmpty());var n=new nc;n.add(this.createNode(e));var r=new nc(t);Rh.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},Ah.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},Ah.prototype.interfaces_=function(){return},Ah.prototype.getClass=function(){return Ah},Ah.compareDoubles=function(t,e){return t>e?1:t<e?-1:0},Dh.IntersectsOp.get=function(){return Fh},Dh.serialVersionUID.get=function(){return-0x35ef64c82d4c5400},Dh.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(Ah,Dh);var Fh=function(){},qh=function(){};qh.prototype.distance=function(t,e){},qh.prototype.interfaces_=function(){return[]},qh.prototype.getClass=function(){return qh};var Gh=function(t){function e(n){n=n||e.DEFAULT_NODE_CAPACITY,t.call(this,n)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return e.prototype.createParentBoundablesFromVerticalSlices=function(t,e){Tu.isTrue(t.length>0);for(var n=new nc,r=0;r,e));return n},e.prototype.createNode=function(t){return new Bh(t)},e.prototype.size=function(){return 0===arguments.length?t.prototype.size.call(this):t.prototype.size.apply(this,arguments)},e.prototype.insert=function(){if(2!==arguments.length)return t.prototype.insert.apply(this,arguments);var e=arguments,n=arguments;if(e.isNull())return null;t.prototype.insert.call(this,e,n)},e.prototype.getIntersectsOp=function(){return e.intersectsOp},e.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=new nc;for(var s=0;i.hasNext()&&s<n;){var a=i.next();r.add(a),s++}}return r},e.prototype.query=function(){if(1===arguments.length){var e=arguments;return t.prototype.query.call(this,e)}if(2===arguments.length){var n=arguments,r=arguments;t.prototype.query.call(this,n,r)}else if(3===arguments.length)if(uu(arguments,Mh)&&argumentsinstanceof Object&&argumentsinstanceof Ph){var i=arguments,o=arguments,s=arguments;t.prototype.query.call(this,i,o,s)}else if(uu(arguments,ec)&&argumentsinstanceof Object&&argumentsinstanceof Ph){var a=arguments,u=arguments,c=arguments;t.prototype.query.call(this,a,u,c)}},e.prototype.getComparator=function(){return e.yComparator},e.prototype.createParentBoundablesFromVerticalSlice=function(e,n){return t.prototype.createParentBoundables.call(this,e,n)},e.prototype.remove=function(){if(2===arguments.length){var e=arguments,n=arguments;return t.prototype.remove.call(this,e,n)}return t.prototype.remove.apply(this,arguments)},e.prototype.depth=function(){return 0===arguments.length?t.prototype.depth.call(this):t.prototype.depth.apply(this,arguments)},e.prototype.createParentBoundables=function(t,n){Tu.isTrue(!t.isEmpty());var r=Math.trunc(Math.ceil(t.size()/this.getNodeCapacity())),i=new nc(t);Rh.sort(i,e.xComparator);var o=this.verticalSlices(i,Math.trunc(Math.ceil(Math.sqrt®)));return this.createParentBoundablesFromVerticalSlices(o,n)},e.prototype.nearestNeighbour=function(){if(1===arguments.length){if(uu(arguments,qh)){var t=arguments,n=new Th(this.getRoot(),this.getRoot(),t);return this.nearestNeighbour(n)}if(argumentsinstanceof Th){var r=arguments;return this.nearestNeighbour(r,Ka.POSITIVE_INFINITY)}}else if(2===arguments.length){if(argumentsinstanceof e&&uu(arguments,qh)){var i=arguments,o=arguments,s=new Th(this.getRoot(),i.getRoot(),o);return this.nearestNeighbour(s)}if(argumentsinstanceof Th&&“number”==typeof arguments){var a=arguments,u=arguments,c=null,h=new Sh;for(h.add(a);!h.isEmpty()&&u>0;){var l=h.poll(),p=l.getDistance();if(p>=u)break;l.isLeaves()?(u=p,c=l):l.expandToQueue(h,u)}return}}else if(3===arguments.length){var f=arguments,g=arguments,d=arguments,y=new Ch(f,g),_=new Th(this.getRoot(),y,d);return this.nearestNeighbour(_)}},e.prototype.interfaces_=function(){return},e.prototype.getClass=function(){return e},e.centreX=function(t){return e.avg(t.getMinX(),t.getMaxX())},e.avg=function(t,e){return(t+e)/2},e.centreY=function(t){return e.avg(t.getMinY(),t.getMaxY())},n.STRtreeNode.get=function(){return Bh},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return},compare:function(n,r){return t.compareDoubles(e.centreX(n.getBounds()),e.centreX(r.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return},compare:function(n,r){return t.compareDoubles(e.centreY(n.getBounds()),e.centreY(r.getBounds()))}}},n.intersectsOp.get=function(){return{interfaces_:function(){return},intersects:function(t,e){return t.intersects(e)}}},n.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,n),e}(Ah),Bh=function(t){function e(){var e=arguments;t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var t=null,e=this.getChildBoundables().iterator();e.hasNext();){var n=e.next();null===t?t=new Iu(n.getBounds()):t.expandToInclude(n.getBounds())}return t},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ph),kh=function(){};kh.prototype.interfaces_=function(){return[]},kh.prototype.getClass=function(){return kh},kh.relativeSign=function(t,e){return t<e?-1:t>e?1:0},kh.compare=function(t,e,n){if(e.equals2D(n))return 0;var r=kh.relativeSign(e.x,n.x),i=kh.relativeSign(e.y,n.y);switch(t){case 0:return kh.compareValue(r,i);case 1:return kh.compareValue(i,r);case 2:return kh.compareValue(i,-r);case 3:return kh.compareValue(-r,i);case 4:return kh.compareValue(-r,-i);case 5:return kh.compareValue(-i,-r);case 6:return kh.compareValue(-i,r);case 7:return kh.compareValue(r,-i)}return Tu.shouldNeverReachHere(“invalid octant value”),0},kh.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var zh=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments,e=arguments,n=arguments,r=arguments;this._segString=t,this.coord=new nu(e),this.segmentIndex=n,this._segmentOctant=r,this._isInterior=!e.equals2D(t.getCoordinate(n))};zh.prototype.getCoordinate=function(){return this.coord},zh.prototype.print=function(t){t.print(this.coord),t.print(“ seg # = ”+this.segmentIndex)},zh.prototype.compareTo=function(t){var e=t;return this.segmentIndex<e.segmentIndex?-1:this.segmentIndex>e.segmentIndex?1:this.coord.equals2D(e.coord)?0:kh.compare(this._segmentOctant,this.coord,e.coord)},zh.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t},zh.prototype.isInterior=function(){return this._isInterior},zh.prototype.interfaces_=function(){return},zh.prototype.getClass=function(){return zh};var jh=function(){this._nodeMap=new Ci,this._edge=null;var t=arguments;this._edge=t};jh.prototype.getSplitCoordinates=function(){var t=new ic;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()},jh.prototype.addCollapsedNodes=function(){var t=new nc;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)}},jh.prototype.print=function(t){t.println(“Intersections:”);for(var e=this.iterator();e.hasNext();)e.next().print(t)},jh.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®&&t.add(new pu(e+1))}},jh.prototype.addEdgeCoordinates=function(t,e,n){var r=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D®;n.add(new nu(t.coord),!1);for(var o=t.segmentIndex+1;o<=e.segmentIndex;o++)n.add(this._edge.getCoordinate(o));i&&n.add(new nu(e.coord))},jh.prototype.iterator=function(){return this._nodeMap.values().iterator()},jh.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}},jh.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=t.segmentIndex+1,!0)},jh.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 pu(e)),r=i}},jh.prototype.getEdge=function(){return this._edge},jh.prototype.addEndpoints=function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)},jh.prototype.createSplitEdge=function(t,e){var n=e.segmentIndex-t.segmentIndex+2,r=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D®;i||n–;var o=new Array(n).fill(null),s=0;o=new nu(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o=this._edge.getCoordinate(a);return i&&(o=new nu(e.coord)),new Vh(o,this._edge.getData())},jh.prototype.add=function(t,e){var n=new zh(this._edge,t,e,this._edge.getSegmentOctant(e)),r=this._nodeMap.get(n);return null!==r?(Tu.isTrue(r.coord.equals2D(t),“Found equal nodes with different coordinates”),r):(this._nodeMap.put(n,n),n)},jh.prototype.checkSplitEdgesCorrectness=function(t){var e=this._edge.getCoordinates(),n=t.get(0).getCoordinate(0);if(!n.equals2D(e))throw new Ou(“bad split edge start point at ”+n);var r=t.get(t.size()-1).getCoordinates(),i=r;if(!i.equals2D(e))throw new Ou(“bad split edge end point at ”+i)},jh.prototype.interfaces_=function(){return[]},jh.prototype.getClass=function(){return jh};var Xh=function(){};Xh.prototype.interfaces_=function(){return[]},Xh.prototype.getClass=function(){return Xh},Xh.octant=function(){if(“number”==typeof arguments&&“number”==typeof arguments){var t=arguments,e=arguments;if(0===t&&0===e)throw new Za(“Cannot compute the octant for point ( ”t“, ”e“ )”);var n=Math.abs(t),r=Math.abs(e);return t>=0?e>=0?n>=r?0:1:n>=r?7:6:e>=0?n>=r?3:2:n>=r?4:5}if(argumentsinstanceof nu&&argumentsinstanceof nu){var i=arguments,o=arguments,s=o.x-i.x,a=o.y-i.y;if(0===s&&0===a)throw new Za(“Cannot compute the octant for two identical points ”+i);return Xh.octant(s,a)}};var Uh=function(){};Uh.prototype.getCoordinates=function(){},Uh.prototype.size=function(){},Uh.prototype.getCoordinate=function(t){},Uh.prototype.isClosed=function(){},Uh.prototype.setData=function(t){},Uh.prototype.getData=function(){},Uh.prototype.interfaces_=function(){return[]},Uh.prototype.getClass=function(){return Uh};var Yh=function(){};Yh.prototype.addIntersection=function(t,e){},Yh.prototype.interfaces_=function(){return},Yh.prototype.getClass=function(){return Yh};var Vh=function(){this._nodeList=new jh(this),this._pts=null,this._data=null;var t=arguments,e=arguments;this._pts=t,this._data=e};Vh.prototype.getCoordinates=function(){return this._pts},Vh.prototype.size=function(){return this._pts.length},Vh.prototype.getCoordinate=function(t){return this._pts},Vh.prototype.isClosed=function(){return this._pts.equals(this._pts)},Vh.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},Vh.prototype.setData=function(t){this._data=t},Vh.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:Xh.octant(t,e)},Vh.prototype.getData=function(){return this._data},Vh.prototype.addIntersection=function(){if(2===arguments.length){var t=arguments,e=arguments;this.addIntersectionNode(t,e)}else if(4===arguments.length){var n=arguments,r=arguments,i=arguments,o=new nu(n.getIntersection(i));this.addIntersection(o,r)}},Vh.prototype.toString=function(){return Pu.toLineString(new zc(this._pts))},Vh.prototype.getNodeList=function(){return this._nodeList},Vh.prototype.addIntersectionNode=function(t,e){var n=e,r=n+1;if(r<this._pts.length){var i=this._pts;t.equals2D(i)&&(n=r)}return this._nodeList.add(t,n)},Vh.prototype.addIntersections=function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++)this.addIntersection(t,e,n,r)},Vh.prototype.interfaces_=function(){return},Vh.prototype.getClass=function(){return Vh},Vh.getNodedSubstrings=function(){if(1===arguments.length){var t=arguments,e=new nc;return Vh.getNodedSubstrings(t,e),e}if(2===arguments.length)for(var n=arguments,r=arguments,i=n.iterator();i.hasNext();)i.next().getNodeList().addSplitEdges®};var Hh=function(){if(this.p0=null,this.p1=null,0===arguments.length)this.p0=new nu,this.p1=new nu;else if(1===arguments.length){var t=arguments;this.p0=new nu(t.p0),this.p1=new nu(t.p1)}else if(2===arguments.length)this.p0=arguments,this.p1=arguments;else if(4===arguments.length){var e=arguments,n=arguments,r=arguments,i=arguments;this.p0=new nu(e,n),this.p1=new nu(r,i)}},Wh={serialVersionUID:{configurable:!0}};Hh.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},Hh.prototype.orientationIndex=function(){if(argumentsinstanceof Hh){var t=arguments,e=Bu.orientationIndex(this.p0,this.p1,t.p0),n=Bu.orientationIndex(this.p0,this.p1,t.p1);return e>=0&&n>=0||e<=0&&n<=0?Math.max(e,n):0}if(argumentsinstanceof nu){var r=arguments;return Bu.orientationIndex(this.p0,this.p1,r)}},Hh.prototype.toGeometry=function(t){return t.createLineString()},Hh.prototype.isVertical=function(){return this.p0.x===this.p1.x},Hh.prototype.equals=function(t){if(!(t instanceof Hh))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)},Hh.prototype.intersection=function(t){var e=new Fu;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},Hh.prototype.project=function(){if(argumentsinstanceof nu){var t=arguments;if(t.equals(this.p0)||t.equals(this.p1))return new nu(t);var e=this.projectionFactor(t),n=new nu;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(argumentsinstanceof Hh){var r=arguments,i=this.projectionFactor(r.p0),o=this.projectionFactor(r.p1);if(i>=1&&o>=1)return null;if(i<=0&&o<=0)return null;var s=this.project(r.p0);i<0&&(s=this.p0),i>1&&(s=this.p1);var a=this.project(r.p1);return o<0&&(a=this.p0),o>1&&(a=this.p1),new Hh(s,a)}},Hh.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},Hh.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},Hh.prototype.getCoordinate=function(t){return 0===t?this.p0:this.p1},Hh.prototype.distancePerpendicular=function(t){return Bu.distancePointLinePerpendicular(t,this.p0,this.p1)},Hh.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},Hh.prototype.midPoint=function(){return Hh.midPoint(this.p0,this.p1)},Hh.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?Ka.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/r},Hh.prototype.closestPoints=function(t){var e=this.intersection(t);if(null!==e)return;var n=new Array(2).fill(null),r=Ka.MAX_VALUE,i=null,o=this.closestPoint(t.p0);r=o.distance(t.p0),n=o,n=t.p0;var s=this.closestPoint(t.p1);(i=s.distance(t.p1))=s,n=t.p1);var a=t.closestPoint(this.p0);(i=a.distance(this.p0))=this.p0,n=a);var u=t.closestPoint(this.p1);return(i=u.distance(this.p1))=this.p1,n=u),n},Hh.prototype.closestPoint=function(t){var e=this.projectionFactor(t);return e>0&&e<1?this.project(t):this.p0.distance(t)<this.p1.distance(t)?this.p0:this.p1},Hh.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},Hh.prototype.getLength=function(){return this.p0.distance(this.p1)},Hh.prototype.compareTo=function(t){var e=t,n=this.p0.compareTo(e.p0);return 0!==n?n:this.p1.compareTo(e.p1)},Hh.prototype.reverse=function(){var t=this.p0;this.p0=this.p1,this.p1=t},Hh.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)},Hh.prototype.lineIntersection=function(t){try{return bu.intersection(this.p0,this.p1,t.p0,t.p1)}catch(t){if(!(t instanceof Eu))throw t}return null},Hh.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},Hh.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 nu(n-u,r+a)},Hh.prototype.setCoordinates=function(){if(1===arguments.length){var t=arguments;this.setCoordinates(t.p0,t.p1)}else if(2===arguments.length){var e=arguments,n=arguments;this.p0.x=e.x,this.p0.y=e.y,this.p1.x=n.x,this.p1.y=n.y}},Hh.prototype.segmentFraction=function(t){var e=this.projectionFactor(t);return e<0?e=0:(e>1||Ka.isNaN(e))&&(e=1),e},Hh.prototype.toString=function(){return“LINESTRING( ”this.p0.x“ ”this.p0.y“, ”this.p1.x“ ”this.p1.y“)”},Hh.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},Hh.prototype.distance=function(){if(argumentsinstanceof Hh){var t=arguments;return Bu.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}if(argumentsinstanceof nu){var e=arguments;return Bu.distancePointLine(e,this.p0,this.p1)}},Hh.prototype.pointAlong=function(t){var e=new nu;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},Hh.prototype.hashCode=function(){var t=Ka.doubleToLongBits(this.p0.x);t^=31*Ka.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),n=Ka.doubleToLongBits(this.p1.x);return n^=31*Ka.doubleToLongBits(this.p1.y),e^Math.trunc(n)^Math.trunc(n>>32)},Hh.prototype.interfaces_=function(){return},Hh.prototype.getClass=function(){return Hh},Hh.midPoint=function(t,e){return new nu((t.x+e.x)/2,(t.y+e.y)/2)},Wh.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(Hh,Wh);var Jh=function(){this.tempEnv1=new Iu,this.tempEnv2=new Iu,this._overlapSeg1=new Hh,this._overlapSeg2=new Hh};Jh.prototype.overlap=function(){if(2===arguments.length);else if(4===arguments.length){var t=arguments,e=arguments,n=arguments,r=arguments;t.getLineSegment(e,this._overlapSeg1),n.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}},Jh.prototype.interfaces_=function(){return[]},Jh.prototype.getClass=function(){return Jh};var Zh=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments,e=arguments,n=arguments,r=arguments;this._pts=t,this._start=e,this._end=n,this._context=r};Zh.prototype.getLineSegment=function(t,e){e.p0=this._pts,e.p1=this._pts},Zh.prototype.computeSelect=function(t,e,n,r){var i=this._pts,o=this._pts;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)},Zh.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=this._pts;return t},Zh.prototype.computeOverlaps=function(t,e){this.computeOverlapsInternal(this._start,this._end,t,t._start,t._end,e)},Zh.prototype.setId=function(t){this._id=t},Zh.prototype.select=function(t,e){this.computeSelect(t,this._start,this._end,e)},Zh.prototype.getEnvelope=function(){if(null===this._env){var t=this._pts,e=this._pts;this._env=new Iu(t,e)}return this._env},Zh.prototype.getEndIndex=function(){return this._end},Zh.prototype.getStartIndex=function(){return this._start},Zh.prototype.getContext=function(){return this._context},Zh.prototype.getId=function(){return this._id},Zh.prototype.computeOverlapsInternal=function(t,e,n,r,i,o){var s=this._pts,a=this._pts,u=n._pts,c=n._pts;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,c),!o.tempEnv1.intersects(o.tempEnv2))return null;var h=Math.trunc((t+e)/2),l=Math.trunc((r+i)/2);t<h&&(r<l&&this.computeOverlapsInternal(t,h,n,r,l,o),l<i&&this.computeOverlapsInternal(t,h,n,l,i,o)),h<e&&(r<l&&this.computeOverlapsInternal(h,e,n,r,l,o),l<i&&this.computeOverlapsInternal(h,e,n,l,i,o))},Zh.prototype.interfaces_=function(){return[]},Zh.prototype.getClass=function(){return Zh};var Kh=function(){};Kh.prototype.interfaces_=function(){return[]},Kh.prototype.getClass=function(){return Kh},Kh.getChainStartIndices=function(t){var e=0,n=new nc;n.add(new pu(e));do{var r=Kh.findChainEnd(t,e);n.add(new pu®),e=r}while(e<t.length-1);return Kh.toIntArray(n)},Kh.findChainEnd=function(t,e){for(var n=e;n.equals2D(t);)n++;if(n>=t.length-1)return t.length-1;for(var r=mh.quadrant(t,t),i=e+1;i.equals2D(t)||mh.quadrant(t,t)===r);)i++;return i-1},Kh.getChains=function(){if(1===arguments.length){var t=arguments;return Kh.getChains(t,null)}if(2===arguments.length){for(var e=arguments,n=arguments,r=new nc,i=Kh.getChainStartIndices(e),o=0;o<i.length-1;o++){var s=new Zh(e,i,i,n);r.add(s)}return r}},Kh.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),n=0;n=t.get(n).intValue();return e};var Qh=function(){};Qh.prototype.computeNodes=function(t){},Qh.prototype.getNodedSubstrings=function(){},Qh.prototype.interfaces_=function(){return[]},Qh.prototype.getClass=function(){return Qh};var $h=function(){if(this._segInt=null,0===arguments.length);else if(1===arguments.length){var t=arguments;this.setSegmentIntersector(t)}};$h.prototype.setSegmentIntersector=function(t){this._segInt=t},$h.prototype.interfaces_=function(){return},$h.prototype.getClass=function(){return $h};var tl=function(t){function e(e){e?t.call(this,e):t.call(this),this._monoChains=new nc,this._index=new Gh,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={SegmentOverlapAction:{configurable:!0}};return e.prototype.getMonotoneChains=function(){return this._monoChains},e.prototype.getNodedSubstrings=function(){return Vh.getNodedSubstrings(this._nodedSegStrings)},e.prototype.getIndex=function(){return this._index},e.prototype.add=function(t){for(var e=Kh.getChains(t.getCoordinates(),t).iterator();e.hasNext();){var n=e.next();n.setId(this._idCounter++),this._index.insert(n.getEnvelope(),n),this._monoChains.add(n)}},e.prototype.computeNodes=function(t){this._nodedSegStrings=t;for(var e=t.iterator();e.hasNext();)this.add(e.next());this.intersectChains()},e.prototype.intersectChains=function(){for(var t=new el(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}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.SegmentOverlapAction.get=function(){return el},Object.defineProperties(e,n),e}($h),el=function(t){function e(){t.call(this),this._si=null;var e=arguments;this._si=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(4!==arguments.length)return t.prototype.overlap.apply(this,arguments);var e=arguments,n=arguments,r=arguments,i=arguments,o=e.getContext(),s=r.getContext();this._si.processIntersections(o,n,s,i)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Jh),nl=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;this.setQuadrantSegments(e)}else if(2===arguments.length){var n=arguments,r=arguments;this.setQuadrantSegments(n),this.setEndCapStyle®}else if(4===arguments.length){var i=arguments,o=arguments,s=arguments,a=arguments;this.setQuadrantSegments(i),this.setEndCapStyle(o),this.setJoinStyle(s),this.setMitreLimit(a)}},rl={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}};nl.prototype.getEndCapStyle=function(){return this._endCapStyle},nl.prototype.isSingleSided=function(){return this._isSingleSided},nl.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,0===this._quadrantSegments&&(this._joinStyle=nl.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=nl.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==nl.JOIN_ROUND&&(this._quadrantSegments=nl.DEFAULT_QUADRANT_SEGMENTS)},nl.prototype.getJoinStyle=function(){return this._joinStyle},nl.prototype.setJoinStyle=function(t){this._joinStyle=t},nl.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},nl.prototype.getSimplifyFactor=function(){return this._simplifyFactor},nl.prototype.getQuadrantSegments=function(){return this._quadrantSegments},nl.prototype.setEndCapStyle=function(t){this._endCapStyle=t},nl.prototype.getMitreLimit=function(){return this._mitreLimit},nl.prototype.setMitreLimit=function(t){this._mitreLimit=t},nl.prototype.setSingleSided=function(t){this._isSingleSided=t},nl.prototype.interfaces_=function(){return[]},nl.prototype.getClass=function(){return nl},nl.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)},rl.CAP_ROUND.get=function(){return 1},rl.CAP_FLAT.get=function(){return 2},rl.CAP_SQUARE.get=function(){return 3},rl.JOIN_ROUND.get=function(){return 1},rl.JOIN_MITRE.get=function(){return 2},rl.JOIN_BEVEL.get=function(){return 3},rl.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},rl.DEFAULT_MITRE_LIMIT.get=function(){return 5},rl.DEFAULT_SIMPLIFY_FACTOR.get=function(){return.01},Object.defineProperties(nl,rl);var il=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=Bu.COUNTERCLOCKWISE,this._inputLine=t||null},ol={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};il.prototype.isDeletable=function(t,e,n,r){var i=this._inputLine,o=this._inputLine,s=this._inputLine;return!!this.isConcave(i,o,s)&&!!this.isShallow(i,o,s,r)&&this.isShallowSampled(i,o,t,n,r)},il.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=il.DELETE,i=!0,r=!0),t=i?n:e,e=this.findNextNonDeletedIndex(t),n=this.findNextNonDeletedIndex(e)}return r},il.prototype.isShallowConcavity=function(t,e,n,r){return Bu.computeOrientation(t,e,n)===this._angleOrientation&&Bu.distancePointLine(e,t,n)<r},il.prototype.isShallowSampled=function(t,e,n,r,i){var o=Math.trunc((r-n)/il.NUM_PTS_TO_CHECK);o<=0&&(o=1);for(var s=n;s,i))return!1;return!0},il.prototype.isConcave=function(t,e,n){return Bu.computeOrientation(t,e,n)===this._angleOrientation},il.prototype.simplify=function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=Bu.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var e=!1;do{e=this.deleteShallowConcavities()}while(e);return this.collapseLine()},il.prototype.findNextNonDeletedIndex=function(t){for(var e=t+1;e===il.DELETE;)e++;return e},il.prototype.isShallow=function(t,e,n,r){return Bu.distancePointLine(e,t,n)<r},il.prototype.collapseLine=function(){for(var t=new ic,e=0;e!==il.DELETE&&t.add(this._inputLine);return t.toCoordinateArray()},il.prototype.interfaces_=function(){return[]},il.prototype.getClass=function(){return il},il.simplify=function(t,e){return new il(t).simplify(e)},ol.INIT.get=function(){return 0},ol.DELETE.get=function(){return 1},ol.KEEP.get=function(){return 1},ol.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(il,ol);var sl=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new nc},al={COORDINATE_ARRAY_TYPE:{configurable:!0}};sl.prototype.getCoordinates=function(){return this._ptList.toArray(sl.COORDINATE_ARRAY_TYPE)},sl.prototype.setPrecisionModel=function(t){this._precisionModel=t},sl.prototype.addPt=function(t){var e=new nu(t);if(this._precisionModel.makePrecise(e),this.isRedundant(e))return null;this._ptList.add(e)},sl.prototype.revere=function(){},sl.prototype.addPts=function(t,e){if(e)for(var n=0;n);else for(var r=t.length-1;r>=0;r–)this.addPt(t)},sl.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},sl.prototype.toString=function(){return(new Zc).createLineString(this.getCoordinates()).toString()},sl.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var t=new nu(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1);if(t.equals(e))return null;this._ptList.add(t)},sl.prototype.setMinimumVertexDistance=function(t){this._minimimVertexDistance=t},sl.prototype.interfaces_=function(){return[]},sl.prototype.getClass=function(){return sl},al.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(sl,al);var ul=function(){},cl={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};ul.prototype.interfaces_=function(){return[]},ul.prototype.getClass=function(){return ul},ul.toDegrees=function(t){return 180*t/Math.PI},ul.normalize=function(t){for(;t>Math.PI;)t-=ul.PI_TIMES_2;for(;t<=-Math.PI;)t+=ul.PI_TIMES_2;return t},ul.angle=function(){if(1===arguments.length){var t=arguments;return Math.atan2(t.y,t.x)}if(2===arguments.length){var e=arguments,n=arguments,r=n.x-e.x,i=n.y-e.y;return Math.atan2(i,r)}},ul.isAcute=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},ul.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},ul.interiorAngle=function(t,e,n){var r=ul.angle(e,t),i=ul.angle(e,n);return Math.abs(i-r)},ul.normalizePositive=function(t){if(t<0){for(;t<0;)t+=ul.PI_TIMES_2;t>=ul.PI_TIMES_2&&(t=0)}else{for(;t>=ul.PI_TIMES_2;)t-=ul.PI_TIMES_2;t<0&&(t=0)}return t},ul.angleBetween=function(t,e,n){var r=ul.angle(e,t),i=ul.angle(e,n);return ul.diff(r,i)},ul.diff=function(t,e){var n=null;return(n=t<e?e-t:t-e)>Math.PI&&(n=2*Math.PI-n),n},ul.toRadians=function(t){return t*Math.PI/180},ul.getTurn=function(t,e){var n=Math.sin(e-t);return n>0?ul.COUNTERCLOCKWISE:n<0?ul.CLOCKWISE:ul.NONE},ul.angleBetweenOriented=function(t,e,n){var r=ul.angle(e,t),i=ul.angle(e,n)-r;return i<=-Math.PI?i+ul.PI_TIMES_2:i>Math.PI?i-ul.PI_TIMES_2:i},cl.PI_TIMES_2.get=function(){return 2*Math.PI},cl.PI_OVER_2.get=function(){return Math.PI/2},cl.PI_OVER_4.get=function(){return Math.PI/4},cl.COUNTERCLOCKWISE.get=function(){return Bu.COUNTERCLOCKWISE},cl.CLOCKWISE.get=function(){return Bu.CLOCKWISE},cl.NONE.get=function(){return Bu.COLLINEAR},Object.defineProperties(ul,cl);var hl=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 Hh,this._seg1=new Hh,this._offset0=new Hh,this._offset1=new Hh,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments,n=arguments,r=arguments;this._precisionModel=e,this._bufParams=n,this._li=new Fu,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===nl.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init®},ll={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}};hl.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=Bu.computeOrientation(this._s0,this._s1,this._s2),r=n===Bu.CLOCKWISE&&this._side===ih.LEFT||n===Bu.COUNTERCLOCKWISE&&this._side===ih.RIGHT;0===n?this.addCollinear(e):r?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)},hl.prototype.addLineEndCap=function(t,e){var n=new Hh(t,e),r=new Hh;this.computeOffsetSegment(n,ih.LEFT,this._distance,r);var i=new Hh;this.computeOffsetSegment(n,ih.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 nl.CAP_ROUND:this._segList.addPt(r.p1),this.addFilletArc(e,a+Math.PI/2,a-Math.PI/2,Bu.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case nl.CAP_FLAT:this._segList.addPt(r.p1),this._segList.addPt(i.p1);break;case nl.CAP_SQUARE:var u=new nu;u.x=Math.abs(this._distance)*Math.cos(a),u.y=Math.abs(this._distance)*Math.sin(a);var c=new nu(r.p1.x+u.x,r.p1.y+u.y),h=new nu(i.p1.x+u.x,i.p1.y+u.y);this._segList.addPt©,this._segList.addPt(h)}},hl.prototype.getCoordinates=function(){return this._segList.getCoordinates()},hl.prototype.addMitreJoin=function(t,e,n,r){var i=!0,o=null;try{o=bu.intersection(e.p0,e.p1,n.p0,n.p1),(r<=0?1:o.distance(t)/Math.abs®)>this._bufParams.getMitreLimit()&&(i=!1)}catch(t){if(!(t instanceof Eu))throw t;o=new nu(0,0),i=!1}i?this._segList.addPt(o):this.addLimitedMitreJoin(e,n,r,this._bufParams.getMitreLimit())},hl.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,c=n.y-t.y,h=Math.atan2(c,u);r===Bu.CLOCKWISE?a<=h&&(a+=2*Math.PI):a>=h&&(a-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,a,h,r,i),this._segList.addPt(n)},hl.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*hl.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===nl.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===nl.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))},hl.prototype.createSquare=function(t){this._segList.addPt(new nu(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new nu(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new nu(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new nu(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()},hl.prototype.addSegments=function(t,e){this._segList.addPts(t,e)},hl.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},hl.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},hl.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)},hl.prototype.addLimitedMitreJoin=function(t,e,n,r){var i=this._seg0.p1,o=ul.angle(i,this._seg0.p0),s=ul.angleBetweenOriented(this._seg0.p0,i,this._seg1.p1)/2,a=ul.normalize(o+s),u=ul.normalize(a+Math.PI),c=r*n,h=n-c*Math.abs(Math.sin(s)),l=i.x+c*Math.cos(u),p=i.y+c*Math.sin(u),f=new nu(l,p),g=new Hh(i,f),d=g.pointAlongOffset(1,h),y=g.pointAlongOffset(1,-h);this._side===ih.LEFT?(this._segList.addPt(d),this._segList.addPt(y)):(this._segList.addPt(y),this._segList.addPt(d))},hl.prototype.computeOffsetSegment=function(t,e,n,r){var i=e===ih.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,c=i*n*s/a;r.p0.x=t.p0.x-c,r.p0.y=t.p0.y+u,r.p1.x=t.p1.x-c,r.p1.y=t.p1.y+u},hl.prototype.addFilletArc=function(t,e,n,r,i){var o=r===Bu.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,c=0,h=new nu;c<s;){var l=e+o*c;h.x=t.x+i*Math.cos(l),h.y=t.y+i*Math.sin(l),this._segList.addPt(h),c+=u}},hl.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*hl.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var n=new nu((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 nu((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®}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},hl.prototype.createCircle=function(t){var e=new nu(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},hl.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)},hl.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new sl,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*hl.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},hl.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===nl.JOIN_BEVEL||this._bufParams.getJoinStyle()===nl.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,Bu.CLOCKWISE,this._distance))},hl.prototype.closeRing=function(){this._segList.closeRing()},hl.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},hl.prototype.interfaces_=function(){return[]},hl.prototype.getClass=function(){return hl},ll.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return.001},ll.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return.001},ll.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},ll.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(hl,ll);var pl=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments,e=arguments;this._precisionModel=t,this._bufParams=e};pl.prototype.getOffsetCurve=function(t,e){if(this._distance=e,0===e)return null;var n=e<0,r=Math.abs(e),i=this.getSegGen(r);t.length<=1?this.computePointCurve(t,i):this.computeOffsetCurve(t,n,i);var o=i.getCoordinates();return n&&oc.reverse(o),o},pl.prototype.computeSingleSidedBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var i=il.simplify(t,-r),o=i.length-1;n.initSideSegments(i,i,ih.LEFT),n.addFirstSegment();for(var s=o-2;s>=0;s–)n.addNextSegment(i,!0)}else{n.addSegments(t,!1);var a=il.simplify(t,r),u=a.length-1;n.initSideSegments(a,a,ih.LEFT),n.addFirstSegment();for(var c=2;c<=u;c++)n.addNextSegment(a,!0)}n.addLastSegment(),n.closeRing()},pl.prototype.computeRingBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);e===ih.RIGHT&&(r=-r);var i=il.simplify(t,r),o=i.length-1;n.initSideSegments(i,i,e);for(var s=1;s<=o;s++){var a=1!==s;n.addNextSegment(i,a)}n.closeRing()},pl.prototype.computeLineBufferCurve=function(t,e){var n=this.simplifyTolerance(this._distance),r=il.simplify(t,n),i=r.length-1;e.initSideSegments(r,r,ih.LEFT);for(var o=2;o<=i;o++)e.addNextSegment(r,!0);e.addLastSegment(),e.addLineEndCap(r,r);var s=il.simplify(t,-n),a=s.length-1;e.initSideSegments(s,s,ih.LEFT);for(var u=a-2;u>=0;u–)e.addNextSegment(s,!0);e.addLastSegment(),e.addLineEndCap(s,s),e.closeRing()},pl.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case nl.CAP_ROUND:e.createCircle(t);break;case nl.CAP_SQUARE:e.createSquare(t)}},pl.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided())return null;if(0===e)return null;var n=Math.abs(e),r=this.getSegGen(n);if(t.length<=1)this.computePointCurve(t,r);else if(this._bufParams.isSingleSided()){var i=e<0;this.computeSingleSidedBufferCurve(t,i,r)}else this.computeLineBufferCurve(t,r);return r.getCoordinates()},pl.prototype.getBufferParameters=function(){return this._bufParams},pl.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},pl.prototype.getRingCurve=function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(0===n)return pl.copyCoordinates(t);var r=this.getSegGen(n);return this.computeRingBufferCurve(t,e,r),r.getCoordinates()},pl.prototype.computeOffsetCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){var i=il.simplify(t,-r),o=i.length-1;n.initSideSegments(i,i,ih.LEFT),n.addFirstSegment();for(var s=o-2;s>=0;s–)n.addNextSegment(i,!0)}else{var a=il.simplify(t,r),u=a.length-1;n.initSideSegments(a,a,ih.LEFT),n.addFirstSegment();for(var c=2;c<=u;c++)n.addNextSegment(a,!0)}n.addLastSegment()},pl.prototype.getSegGen=function(t){return new hl(this._precisionModel,this._bufParams,t)},pl.prototype.interfaces_=function(){return[]},pl.prototype.getClass=function(){return pl},pl.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),n=0;n=new nu(t);return e};var fl=function(){this._subgraphs=null,this._seg=new Hh,this._cga=new Bu;var t=arguments;this._subgraphs=t},gl={DepthSegment:{configurable:!0}};fl.prototype.findStabbedSegments=function(){if(1===arguments.length){for(var t=arguments,e=new nc,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(uu(arguments,ec)&&argumentsinstanceof nu&&argumentsinstanceof Eh){for(var o=arguments,s=arguments,a=arguments,u=s.getEdge().getCoordinates(),c=0;c,this._seg.p1=u,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||Bu.computeOrientation(this._seg.p0,this._seg.p1,o)===Bu.RIGHT)){var h=s.getDepth(ih.LEFT);this._seg.p0.equals(u)||(h=s.getDepth(ih.RIGHT));var l=new dl(this._seg,h);a.add(l)}}else if(uu(arguments,ec)&&argumentsinstanceof nu&&uu(arguments,ec))for(var p=arguments,f=arguments,g=arguments,d=f.iterator();d.hasNext();){var y=d.next();y.isForward()&&this.findStabbedSegments(p,y,g)}},fl.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);return 0===e.size()?0:Rh.min(e)._leftDepth},fl.prototype.interfaces_=function(){return[]},fl.prototype.getClass=function(){return fl},gl.DepthSegment.get=function(){return dl},Object.defineProperties(fl,gl);var dl=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments,e=arguments;this._upwardSeg=new Hh(t),this._leftDepth=e};dl.prototype.compareTo=function(t){var e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(e._upwardSeg);return 0!==n||0!=(n=-1*e._upwardSeg.orientationIndex(this._upwardSeg))?n:this._upwardSeg.compareTo(e._upwardSeg)},dl.prototype.compareX=function(t,e){var n=t.p0.compareTo(e.p0);return 0!==n?n:t.p1.compareTo(e.p1)},dl.prototype.toString=function(){return this._upwardSeg.toString()},dl.prototype.interfaces_=function(){return},dl.prototype.getClass=function(){return dl};var yl=function(t,e,n){this.p0=t||null,this.p1=e||null,this.p2=n||null};yl.prototype.area=function(){return yl.area(this.p0,this.p1,this.p2)},yl.prototype.signedArea=function(){return yl.signedArea(this.p0,this.p1,this.p2)},yl.prototype.interpolateZ=function(t){if(null===t)throw new Za(“Supplied point is null.”);return yl.interpolateZ(t,this.p0,this.p1,this.p2)},yl.prototype.longestSideLength=function(){return yl.longestSideLength(this.p0,this.p1,this.p2)},yl.prototype.isAcute=function(){return yl.isAcute(this.p0,this.p1,this.p2)},yl.prototype.circumcentre=function(){return yl.circumcentre(this.p0,this.p1,this.p2)},yl.prototype.area3D=function(){return yl.area3D(this.p0,this.p1,this.p2)},yl.prototype.centroid=function(){return yl.centroid(this.p0,this.p1,this.p2)},yl.prototype.inCentre=function(){return yl.inCentre(this.p0,this.p1,this.p2)},yl.prototype.interfaces_=function(){return[]},yl.prototype.getClass=function(){return yl},yl.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)},yl.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2},yl.det=function(t,e,n,r){return t*r-e*n},yl.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,c=r.y-o,h=s*c-a*u,l=t.x-i,p=t.y-o,f=(c*l-a*p)/h,g=(-u*l+s*p)/h;return e.z+f*(n.z-e.z)+g*(r.z-e.z)},yl.longestSideLength=function(t,e,n){var r=t.distance(e),i=e.distance(n),o=n.distance(t),s=r;return i>s&&(s=i),o>s&&(s=o),s},yl.isAcute=function(t,e,n){return!!ul.isAcute(t,e,n)&&!!ul.isAcute(e,n,t)&&!!ul.isAcute(n,t,e)},yl.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,c=2*yl.det(o,s,a,u),h=yl.det(s,o*o+s*s,u,a*a+u*u),l=yl.det(o,o*o+s*s,a,a*a+u*u);return new nu(r-h/c,i+l/c)},yl.perpendicularBisector=function(t,e){var n=e.x-t.x,r=e.y-t.y,i=new bu(t.x+n/2,t.y+r/2,1),o=new bu(t.x-r+n/2,t.y+n+r/2,1);return new bu(i,o)},yl.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 nu(t.x+i*o,t.y+i*s)},yl.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,c=i*u-o*a,h=o*s-r*u,l=r*a-i*s,p=c*c+h*h+l*l;return Math.sqrt(p)/2},yl.centroid=function(t,e,n){var r=(t.x+e.x+n.x)/3,i=(t.y+e.y+n.y)/3;return new nu(r,i)},yl.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 nu(a,u)};var _l=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new nc;var t=arguments,e=arguments,n=arguments;this._inputGeom=t,this._distance=e,this._curveBuilder=n};_l.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,su.EXTERIOR,su.INTERIOR)},_l.prototype.addPolygon=function(t){var e=this._distance,n=ih.LEFT;this._distance<0&&(e=-this._distance,n=ih.RIGHT);var r=t.getExteriorRing(),i=oc.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,su.EXTERIOR,su.INTERIOR);for(var o=0;o<t.getNumInteriorRing();o++){var s=t.getInteriorRingN(o),a=oc.removeRepeatedPoints(s.getCoordinates());this._distance>0&&this.isErodedCompletely(s,-this._distance)||this.addPolygonRing(a,e,ih.opposite(n),su.INTERIOR,su.EXTERIOR)}},_l.prototype.isTriangleErodedCompletely=function(t,e){var n=new yl(t,t,t),r=n.inCentre();return Bu.distancePointLine(r,n.p0,n.p1)<Math.abs(e)},_l.prototype.addLineString=function(t){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var e=oc.removeRepeatedPoints(t.getCoordinates()),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,su.EXTERIOR,su.INTERIOR)},_l.prototype.addCurve=function(t,e,n){if(null===t||t.length<2)return null;var r=new Vh(t,new lh(0,su.BOUNDARY,e,n));this._curveList.add®},_l.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},_l.prototype.addPolygonRing=function(t,e,n,r,i){if(0===e&&t.length<Ac.MINIMUM_VALID_SIZE)return null;var o=r,s=i;t.length>=Ac.MINIMUM_VALID_SIZE&&Bu.isCCW(t)&&(o=i,s=r,n=ih.opposite(n));var a=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(a,o,s)},_l.prototype.add=function(t){if(t.isEmpty())return null;t instanceof Rc?this.addPolygon(t):t instanceof Mc?this.addLineString(t):t instanceof Pc?this.addPoint(t):(t instanceof Tc||t instanceof wc||t instanceof Dc||t instanceof Ec)&&this.addCollection(t)},_l.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},_l.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);this.add(n)}},l.prototype.interfaces=function(){return[]},_l.prototype.getClass=function(){return _l};var ml=function(){};ml.prototype.locate=function(t){},ml.prototype.interfaces_=function(){return[]},ml.prototype.getClass=function(){return ml};var vl=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var t=arguments;this._parent=t,this._atStart=!0,this._index=0,this._max=t.getNumGeometries()};vl.prototype.next=function(){if(this._atStart)return this._atStart=!1,vl.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 mi;var t=this._parent.getGeometryN(this._index++);return t instanceof Ec?(this._subcollectionIterator=new vl(t),this._subcollectionIterator.next()):t},vl.prototype.remove=function(){throw new Error(this.getClass().getName())},vl.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)},vl.prototype.interfaces_=function(){return},vl.prototype.getClass=function(){return vl},vl.isAtomic=function(t){return!(t instanceof Ec)};var xl=function(){this._geom=null;var t=arguments;this._geom=t};xl.prototype.locate=function(t){return xl.locate(t,this._geom)},xl.prototype.interfaces_=function(){return},xl.prototype.getClass=function(){return xl},xl.isPointInRing=function(t,e){return!!e.getEnvelopeInternal().intersects(t)&&Bu.isPointInRing(t,e.getCoordinates())},xl.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var n=e.getExteriorRing();if(!xl.isPointInRing(t,n))return!1;for(var r=0;r<e.getNumInteriorRing();r++){var i=e.getInteriorRingN®;if(xl.isPointInRing(t,i))return!1}return!0},xl.containsPoint=function(t,e){if(e instanceof Rc)return xl.containsPointInPolygon(t,e);if(e instanceof Ec)for(var n=new vl(e);n.hasNext();){var r=n.next();if(r!==e&&xl.containsPoint(t,r))return!0}return!1},xl.locate=function(t,e){return e.isEmpty()?su.EXTERIOR:xl.containsPoint(t,e)?su.INTERIOR:su.EXTERIOR};var El=function(){this._edgeMap=new Ci,this._edgeList=null,this._ptInAreaLocation=};El.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)},El.prototype.propagateSideLabels=function(t){for(var e=su.NONE,n=this.iterator();n.hasNext();){var r=n.next().getLabel();r.isArea(t)&&r.getLocation(t,ih.LEFT)!==su.NONE&&(e=r.getLocation(t,ih.LEFT))}if(e===su.NONE)return null;for(var i=e,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getLabel();if(a.getLocation(t,ih.ON)===su.NONE&&a.setLocation(t,ih.ON,i),a.isArea(t)){var u=a.getLocation(t,ih.LEFT),c=a.getLocation(t,ih.RIGHT);if(c!==su.NONE){if(c!==i)throw new ah(“side location conflict”,s.getCoordinate());u===su.NONE&&Tu.shouldNeverReachHere(“found single null side (at ”+s.getCoordinate()+“)”),i=u}else Tu.isTrue(a.getLocation(t,ih.LEFT)===su.NONE,“found single null side”),a.setLocation(t,ih.RIGHT,i),a.setLocation(t,ih.LEFT,i)}}},El.prototype.getCoordinate=function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null},El.prototype.print=function(t){wu.out.println(“EdgeEndStar: ”+this.getCoordinate());for(var e=this.iterator();e.hasNext();)e.next().print(t)},El.prototype.isAreaLabelsConsistent=function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},El.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,ih.LEFT);Tu.isTrue(r!==su.NONE,“Found unlabelled area edge”);for(var i=r,o=this.iterator();o.hasNext();){var s=o.next().getLabel();Tu.isTrue(s.isArea(t),“Found non-area edge”);var a=s.getLocation(t,ih.LEFT),u=s.getLocation(t,ih.RIGHT);if(a===u)return!1;if(u!==i)return!1;i=a}return!0},El.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},El.prototype.iterator=function(){return this.getEdges().iterator()},El.prototype.getEdges=function(){return null===this._edgeList&&(this._edgeList=new nc(this._edgeMap.values())),this._edgeList},El.prototype.getLocation=function(t,e,n){return this._ptInAreaLocation===su.NONE&&(this._ptInAreaLocation=xl.locate(e,n.getGeometry())),this._ptInAreaLocation},El.prototype.toString=function(){var t=new lu;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()},El.prototype.computeEdgeEndLabels=function(t){for(var e=this.iterator();e.hasNext();)e.next().computeLabel(t)},El.prototype.computeLabelling=function(t){this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var e=,n=this.iterator();n.hasNext();)for(var r=n.next().getLabel(),i=0;i<2;i++)r.isLine(i)&&r.getLocation(i)===su.BOUNDARY&&(e=!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 c=su.NONE;if(e)c=su.EXTERIOR;else{var h=s.getCoordinate();c=this.getLocation(u,h,t)}a.setAllLocationsIfNull(u,c)}},El.prototype.getDegree=function(){return this._edgeMap.size()},El.prototype.insertEdgeEnd=function(t,e){this._edgeMap.put(t,e),this._edgeList=null},El.prototype.interfaces_=function(){return[]},El.prototype.getClass=function(){return El};var wl=function(t){function e(){t.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.linkResultDirectedEdges=function(){this.getResultAreaEdges();for(var t=null,e=null,n=this._SCANNING_FOR_INCOMING,r=0;r<this._resultAreaEdgeList.size();r++){var i=this._resultAreaEdgeList.get®,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 ah(“no outgoing dirEdge found”,this.getCoordinate());Tu.isTrue(t.isInResult(),“unable to link last incoming dirEdge”),e.setNext(t)}},e.prototype.insert=function(t){var e=t;this.insertEdgeEnd(e,e)},e.prototype.getRightmostEdge=function(){var t=this.getEdges(),e=t.size();if(e<1)return null;var n=t.get(0);if(1===e)return n;var r=t.get(e-1),i=n.getQuadrant(),o=r.getQuadrant();return mh.isNorthern(i)&&mh.isNorthern(o)?n:mh.isNorthern(i)||mh.isNorthern(o)?0!==n.getDy()?n:0!==r.getDy()?r:(Tu.shouldNeverReachHere(“found two horizontal edges incident on node”),null):r},e.prototype.print=function(t){wu.out.println(“DirectedEdgeStar: ”+this.getCoordinate());for(var e=this.iterator();e.hasNext();){var n=e.next();t.print(“out ”),n.print(t),t.println(),t.print(“in ”),n.getSym().print(t),t.println()}},e.prototype.getResultAreaEdges=function(){if(null!==this._resultAreaEdgeList)return this._resultAreaEdgeList;this._resultAreaEdgeList=new nc;for(var t=this.iterator();t.hasNext();){var e=t.next();(e.isInResult()||e.getSym().isInResult())&&this._resultAreaEdgeList.add(e)}return this._resultAreaEdgeList},e.prototype.updateLabelling=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next().getLabel();n.setAllLocationsIfNull(0,t.getLocation(0)),n.setAllLocationsIfNull(1,t.getLocation(1))}},e.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var t=null,e=null,n=this._edgeList.size()-1;n>=0;n–){var r=this._edgeList.get(n),i=r.getSym();null===e&&(e=i),null!==t&&i.setNext(t),t=r}e.setNext(t)},e.prototype.computeDepths=function(){if(1===arguments.length){var t=arguments,e=this.findIndex(t),n=t.getDepth(ih.LEFT),r=t.getDepth(ih.RIGHT),i=this.computeDepths(e+1,this._edgeList.size(),n);if(this.computeDepths(0,e,i)!==r)throw new ah(“depth mismatch at ”+t.getCoordinate())}else if(3===arguments.length){for(var o=arguments,s=arguments,a=arguments,u=o;u<s;u++){var c=this._edgeList.get(u);c.setEdgeDepths(ih.RIGHT,a),a=c.getDepth(ih.LEFT)}return a}},e.prototype.mergeSymLabels=function(){for(var t=this.iterator();t.hasNext();){var e=t.next();e.getLabel().merge(e.getSym().getLabel())}},e.prototype.linkMinimalDirectedEdges=function(t){for(var e=null,n=null,r=this._SCANNING_FOR_INCOMING,i=this._resultAreaEdgeList.size()-1;i>=0;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&&(Tu.isTrue(null!==e,“found null for first outgoing dirEdge”),Tu.isTrue(e.getEdgeRing()===t,“unable to link last incoming dirEdge”),n.setNextMin(e))},e.prototype.getOutgoingDegree=function(){if(0===arguments.length){for(var t=0,e=this.iterator();e.hasNext();)e.next().isInResult()&&t++;return t}if(1===arguments.length){for(var n=arguments,r=0,i=this.iterator();i.hasNext();)i.next().getEdgeRing()===n&&r++;return r}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var t=su.NONE,e=this.iterator();e.hasNext();){var n=e.next(),r=n.getSym();if(!n.isLineEdge()){if(n.isInResult()){t=su.INTERIOR;break}if(r.isInResult()){t=su.EXTERIOR;break}}}if(t===su.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===su.INTERIOR):(s.isInResult()&&(i=su.EXTERIOR),a.isInResult()&&(i=su.INTERIOR))}},e.prototype.computeLabelling=function(e){t.prototype.computeLabelling.call(this,e),this._label=new lh(su.NONE);for(var n=this.iterator();n.hasNext();)for(var r=n.next().getEdge().getLabel(),i=0;i<2;i++){var o=r.getLocation(i);o!==su.INTERIOR&&o!==su.BOUNDARY||this._label.setLocation(i,su.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(El),bl=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createNode=function(t){return new yh(t,new wl)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(wh),Il=function t(){this._pts=null,this._orientation=null;var e=arguments;this._pts=e,this._orientation=t.orientation(e)};Il.prototype.compareTo=function(t){var e=t;return Il.compareOriented(this._pts,this._orientation,e._pts,e._orientation)},Il.prototype.interfaces_=function(){return},Il.prototype.getClass=function(){return Il},Il.orientation=function(t){return 1===oc.increasingDirection(t)},Il.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,c=r?0:n.length-1;;){var h=t.compareTo(n);if(0!==h)return h;var l=(u+=i)===s,p=(c+=o)===a;if(l&&!p)return-1;if(!l&&p)return 1;if(l&&p)return 0}};var Nl=function(){this._edges=new nc,this._ocaMap=new Ci};Nl.prototype.print=function(t){t.print(“MULTILINESTRING ( ”);for(var e=0;e<this._edges.size();e++){var n=this._edges.get(e);e>0&&t.print(“,”),t.print(“(”);for(var r=n.getCoordinates(),i=0;i0&&t.print(“,”),t.print(r.x+“ ”+r.y);t.println(“)”)}t.print(“) ”)},Nl.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())},Nl.prototype.findEdgeIndex=function(t){for(var e=0;e<this._edges.size();e++)if(this._edges.get(e).equals(t))return e;return-1},Nl.prototype.iterator=function(){return this._edges.iterator()},Nl.prototype.getEdges=function(){return this._edges},Nl.prototype.get=function(t){return this._edges.get(t)},Nl.prototype.findEqualEdge=function(t){var e=new Il(t.getCoordinates());return this._ocaMap.get(e)},Nl.prototype.add=function(t){this._edges.add(t);var e=new Il(t.getCoordinates());this._ocaMap.put(e,t)},Nl.prototype.interfaces_=function(){return[]},Nl.prototype.getClass=function(){return Nl};var Cl=function(){};Cl.prototype.processIntersections=function(t,e,n,r){},Cl.prototype.isDone=function(){},Cl.prototype.interfaces_=function(){return[]},Cl.prototype.getClass=function(){return Cl};var Sl=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;this._li=t};Sl.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&1===this._li.getIntersectionNum()){if(Sl.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},Sl.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Sl.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Sl.prototype.getLineIntersector=function(){return this._li},Sl.prototype.hasProperIntersection=function(){return this._hasProper},Sl.prototype.processIntersections=function(t,e,n,r){if(t===n&&e===r)return null;this.numTests++;var i=t.getCoordinates(),o=t.getCoordinates(),s=n.getCoordinates(),a=n.getCoordinates();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)))},Sl.prototype.hasIntersection=function(){return this._hasIntersection},Sl.prototype.isDone=function(){return!1},Sl.prototype.hasInteriorIntersection=function(){return this._hasInterior},Sl.prototype.interfaces_=function(){return},Sl.prototype.getClass=function(){return Sl},Sl.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var Ml=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments,e=arguments,n=arguments;this.coord=new nu(t),this.segmentIndex=e,this.dist=n};Ml.prototype.getSegmentIndex=function(){return this.segmentIndex},Ml.prototype.getCoordinate=function(){return this.coord},Ml.prototype.print=function(t){t.print(this.coord),t.print(“ seg # = ”+this.segmentIndex),t.println(“ dist = ”+this.dist)},Ml.prototype.compareTo=function(t){var e=t;return this.compare(e.segmentIndex,e.dist)},Ml.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&0===this.dist||this.segmentIndex===t},Ml.prototype.toString=function(){return this.coord+“ seg # = ”this.segmentIndex“ dist = ”+this.dist},Ml.prototype.getDistance=function(){return this.dist},Ml.prototype.compare=function(t,e){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<e?-1:this.dist>e?1:0},Ml.prototype.interfaces_=function(){return},Ml.prototype.getClass=function(){return Ml};var Ll=function(){this._nodeMap=new Ci,this.edge=null;var t=arguments;this.edge=t};Ll.prototype.print=function(t){t.println(“Intersections:”);for(var e=this.iterator();e.hasNext();)e.next().print(t)},Ll.prototype.iterator=function(){return this._nodeMap.values().iterator()},Ll.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}},Ll.prototype.addEndpoints=function(){var t=this.edge.pts.length-1;this.add(this.edge.pts,0,0),this.add(this.edge.pts,t,0)},Ll.prototype.createSplitEdge=function(t,e){var n=e.segmentIndex-t.segmentIndex+2,r=this.edge.pts,i=e.dist>0||!e.coord.equals2D®;i||n–;var o=new Array(n).fill(null),s=0;o=new nu(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o=this.edge.pts;return i&&(o=e.coord),new Al(o,new lh(this.edge._label))},Ll.prototype.add=function(t,e,n){var r=new Ml(t,e,n),i=this._nodeMap.get®;return null!==i?i:(this._nodeMap.put(r,r),r)},Ll.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();)if(e.next().coord.equals(t))return!0;return!1},Ll.prototype.interfaces_=function(){return[]},Ll.prototype.getClass=function(){return Ll};var Pl=function(){};Pl.prototype.getChainStartIndices=function(t){var e=0,n=new nc;n.add(new pu(e));do{var r=this.findChainEnd(t,e);n.add(new pu®),e=r}while(e<t.length-1);return Pl.toIntArray(n)},Pl.prototype.findChainEnd=function(t,e){for(var n=mh.quadrant(t,t),r=e+1;r,t)===n;)r++;return r-1},Pl.prototype.interfaces_=function(){return[]},Pl.prototype.getClass=function(){return Pl},Pl.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),n=0;n=t.get(n).intValue();return e};var Ol=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new Iu,this.env2=new Iu;var t=arguments;this.e=t,this.pts=t.getCoordinates();var e=new Pl;this.startIndex=e.getChainStartIndices(this.pts)};Ol.prototype.getCoordinates=function(){return this.pts},Ol.prototype.getMaxX=function(t){var e=this.pts[this.startIndex].x,n=this.pts[this.startIndex].x;return e>n?e:n},Ol.prototype.getMinX=function(t){var e=this.pts[this.startIndex].x,n=this.pts[this.startIndex].x;return e<n?e:n},Ol.prototype.computeIntersectsForChain=function(){if(4===arguments.length){var t=arguments,e=arguments,n=arguments,r=arguments;this.computeIntersectsForChain(this.startIndex,this.startIndex,e,e.startIndex,e.startIndex,r)}else if(6===arguments.length){var i=arguments,o=arguments,s=arguments,a=arguments,u=arguments,c=arguments,h=this.pts,l=this.pts,p=s.pts,f=s.pts;if(o-i==1&&u-a==1)return c.addIntersections(this.e,i,s.e,a),null;if(this.env1.init(h,l),this.env2.init(p,f),!this.env1.intersects(this.env2))return null;var g=Math.trunc((i+o)/2),d=Math.trunc((a+u)/2);i<g&&(a<d&&this.computeIntersectsForChain(i,g,s,a,d,c),d<u&&this.computeIntersectsForChain(i,g,s,d,u,c)),g<o&&(a<d&&this.computeIntersectsForChain(g,o,s,a,d,c),d<u&&this.computeIntersectsForChain(g,o,s,d,u,c))}},Ol.prototype.getStartIndexes=function(){return this.startIndex},Ol.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)},Ol.prototype.interfaces_=function(){return[]},Ol.prototype.getClass=function(){return Ol};var Rl=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[n]=t.NULL_VALUE},Tl={NULL_VALUE:{configurable:!0}};Rl.prototype.getDepth=function(t,e){return this._depth[e]},Rl.prototype.setDepth=function(t,e,n){this._depth[e]=n},Rl.prototype.isNull=function(){if(0===arguments.length){for(var t=0;t<2;t++)for(var e=0;e<3;e++)if(this._depth[e]!==Rl.NULL_VALUE)return!1;return!0}if(1===arguments.length){var n=arguments;return this._depth[1]===Rl.NULL_VALUE}if(2===arguments.length){var r=arguments,i=arguments;return this._depth[i]===Rl.NULL_VALUE}},Rl.prototype.normalize=function(){for(var t=0;t<2;t++)if(!this.isNull(t)){var e=this._depth[1];this._depth[2][2]),e<0&&(e=0);for(var n=1;n<3;n++){var r=0;this._depth[n]>e&&(r=1),this._depth[n]=r}}},Rl.prototype.getDelta=function(t){return this._depth[ih.RIGHT]-this._depth[ih.LEFT]},Rl.prototype.getLocation=function(t,e){return this._depth[e]<=0?su.EXTERIOR:su.INTERIOR},Rl.prototype.toString=function(){return“A: ”this._depth[0][1]“,”this._depth[0][2]“ B: ”this._depth[1][1]“,”+this._depth[2]},Rl.prototype.add=function(){if(1===arguments.length)for(var t=arguments,e=0;e<2;e++)for(var n=1;n<3;n++){var r=t.getLocation(e,n);r!==su.EXTERIOR&&r!==su.INTERIOR||(this.isNull(e,n)?this._depth[n]=Rl.depthAtLocation®:this._depth[n]+=Rl.depthAtLocation®)}else if(3===arguments.length){var i=arguments,o=arguments;arguments===su.INTERIOR&&this._depth[o]++}},Rl.prototype.interfaces_=function(){return[]},Rl.prototype.getClass=function(){return Rl},Rl.depthAtLocation=function(t){return t===su.EXTERIOR?0:t===su.INTERIOR?1:Rl.NULL_VALUE},Tl.NULL_VALUE.get=function(){return-1},Object.defineProperties(Rl,Tl);var Al=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new Ll(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Rl,this._depthDelta=0,1===arguments.length){var n=arguments;e.call(this,n,null)}else if(2===arguments.length){var r=arguments,i=arguments;this.pts=r,this._label=i}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var t=new Array(2).fill(null);return t=this.pts,t=this.pts,new e(t,lh.toLineLabel(this._label))},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(t){this._isIsolated=t},e.prototype.setName=function(t){this._name=t},e.prototype.equals=function(t){if(!(t instanceof e))return!1;var n=t;if(this.pts.length!==n.pts.length)return!1;for(var r=!0,i=!0,o=this.pts.length,s=0;s.equals2D(n.pts)||(r=!1),this.pts.equals2D(n.pts)||(i=!1),!r&&!i)return!1;return!0},e.prototype.getCoordinate=function(){if(0===arguments.length)return this.pts.length>0?this.pts:null;if(1===arguments.length){var t=arguments;return this.pts}},e.prototype.print=function(t){t.print(“edge ”this._name“: ”),t.print(“LINESTRING (”);for(var e=0;e0&&t.print(“,”),t.print(this.pts.x+“ ”+this.pts.y);t.print(“) ”this._label“ ”+this._depthDelta)},e.prototype.computeIM=function(t){e.updateIM(this._label,t)},e.prototype.isCollapsed=function(){return!!this._label.isArea()&&3===this.pts.length&&!!this.pts.equals(this.pts)},e.prototype.isClosed=function(){return this.pts.equals(this.pts)},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(t){t.print(“edge ”this._name“: ”);for(var e=this.pts.length-1;e>=0;e–)t.print(this.pts+“ ”);t.println(“”)},e.prototype.getMonotoneChainEdge=function(){return null===this._mce&&(this._mce=new Ol(this)),this._mce},e.prototype.getEnvelope=function(){if(null===this._env){this._env=new Iu;for(var t=0;t)}return this._env},e.prototype.addIntersection=function(t,e,n,r){var i=new nu(t.getIntersection®),o=e,s=t.getEdgeDistance(n,r),a=o+1;if(a<this.pts.length){var u=this.pts;i.equals2D(u)&&(o=a,s=0)}this.eiList.add(i,o,s)},e.prototype.toString=function(){var t=new lu;t.append(“edge ”this._name“: ”),t.append(“LINESTRING (”);for(var e=0;e0&&t.append(“,”),t.append(this.pts.x+“ ”+this.pts.y);return t.append(“) ”this._label“ ”+this._depthDelta),t.toString()},e.prototype.isPointwiseEqual=function(t){if(this.pts.length!==t.pts.length)return!1;for(var e=0;e.equals2D(t.pts))return!1;return!0},e.prototype.setDepthDelta=function(t){this._depthDelta=t},e.prototype.getEdgeIntersectionList=function(){return this.eiList},e.prototype.addIntersections=function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++)this.addIntersection(t,e,n,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.updateIM=function(){if(2!==arguments.length)return t.prototype.updateIM.apply(this,arguments);var e=arguments,n=arguments;n.setAtLeastIfValid(e.getLocation(0,ih.ON),e.getLocation(1,ih.ON),1),e.isArea()&&(n.setAtLeastIfValid(e.getLocation(0,ih.LEFT),e.getLocation(1,ih.LEFT),2),n.setAtLeastIfValid(e.getLocation(0,ih.RIGHT),e.getLocation(1,ih.RIGHT),2))},e}(dh),Dl=function(t){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new Nl,this._bufParams=t||null};Dl.prototype.setWorkingPrecisionModel=function(t){this._workingPrecisionModel=t},Dl.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 lh(t.getLabel())).flip(),n.merge®;var i=Dl.depthDelta®,o=e.getDepthDelta()+i;e.setDepthDelta(o)}else this._edgeList.add(t),t.setDepthDelta(Dl.depthDelta(t.getLabel()))},Dl.prototype.buildSubgraphs=function(t,e){for(var n=new nc,r=t.iterator();r.hasNext();){var i=r.next(),o=i.getRightmostCoordinate(),s=new fl(n).getDepth(o);i.computeDepth(s),i.findResultEdges(),n.add(i),e.add(i.getDirectedEdges(),i.getNodes())}},Dl.prototype.createSubgraphs=function(t){for(var e=new nc,n=t.getNodes().iterator();n.hasNext();){var r=n.next();if(!r.isVisited()){var i=new ch;i.create®,e.add(i)}}return Rh.sort(e,Rh.reverseOrder()),e},Dl.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},Dl.prototype.getNoder=function(t){if(null!==this._workingNoder)return this._workingNoder;var e=new tl,n=new Fu;return n.setPrecisionModel(t),e.setSegmentIntersector(new Sl(n)),e},Dl.prototype.buffer=function(t,e){var n=this._workingPrecisionModel;null===n&&(n=t.getPrecisionModel()),this._geomFact=t.getFactory();var r=new pl(n,this._bufParams),i=new _l(t,e,r).getCurves();if(i.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(i,n),this._graph=new bh(new bl),this._graph.addEdges(this._edgeList.getEdges());var o=this.createSubgraphs(this._graph),s=new Ih(this._geomFact);this.buildSubgraphs(o,s);var a=s.getPolygons();return a.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(a)},Dl.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.equals2D(o)){var s=i.getData(),a=new Al(i.getCoordinates(),new lh(s));this.insertUniqueEdge(a)}}},Dl.prototype.setNoder=function(t){this._workingNoder=t},Dl.prototype.interfaces_=function(){return[]},Dl.prototype.getClass=function(){return Dl},Dl.depthDelta=function(t){var e=t.getLocation(0,ih.LEFT),n=t.getLocation(0,ih.RIGHT);return e===su.INTERIOR&&n===su.EXTERIOR?1:e===su.EXTERIOR&&n===su.INTERIOR?-1:0},Dl.convertSegStrings=function(t){for(var e=new Zc,n=new nc;t.hasNext();){var r=t.next(),i=e.createLineString(r.getCoordinates());n.add(i)}return e.buildGeometry(n)};var Fl=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,2===arguments.length){var t=arguments,e=arguments;this._noder=t,this._scaleFactor=e,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(4===arguments.length){var n=arguments,r=arguments,i=arguments,o=arguments;this._noder=n,this._scaleFactor=r,this._offsetX=i,this._offsetY=o,this._isScaled=!this.isIntegerPrecision()}};Fl.prototype.rescale=function(){if(uu(arguments,Qu))for(var t=arguments.iterator();t.hasNext();){var e=t.next();this.rescale(e.getCoordinates())}else if(argumentsinstanceof Array){for(var n=arguments,r=0;r.x=n.x/this._scaleFactor+this._offsetX,n.y=n.y/this._scaleFactor+this._offsetY;2===n.length&&n.equals2D(n)&&wu.out.println(n)}},Fl.prototype.scale=function(){if(uu(arguments,Qu)){for(var t=arguments,e=new nc,n=t.iterator();n.hasNext();){var r=n.next();e.add(new Vh(this.scale(r.getCoordinates()),r.getData()))}return e}if(argumentsinstanceof Array){for(var i=arguments,o=new Array(i.length).fill(null),s=0;s=new nu(Math.round((i.x-this._offsetX)*this._scaleFactor),Math.round((i.y-this._offsetY)*this._scaleFactor),i.z);return oc.removeRepeatedPoints(o)}},Fl.prototype.isIntegerPrecision=function(){return 1===this._scaleFactor},Fl.prototype.getNodedSubstrings=function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t},Fl.prototype.computeNodes=function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)},Fl.prototype.interfaces_=function(){return},Fl.prototype.getClass=function(){return Fl};var ql=function(){this._li=new Fu,this._segStrings=null;var t=arguments;this._segStrings=t},Gl={fact:{configurable:!0}};ql.prototype.checkEndPtVertexIntersections=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();){var e=t.next().getCoordinates();this.checkEndPtVertexIntersections(e,this._segStrings),this.checkEndPtVertexIntersections(e,this._segStrings)}else if(2===arguments.length)for(var n=arguments,r=arguments.iterator();r.hasNext();)for(var i=r.next().getCoordinates(),o=1;o.equals(n))throw new Ou(“found endpt/interior pt intersection at index ”o“ :pt ”+n)},ql.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,o=arguments,s=i.getCoordinates(),a=o.getCoordinates(),u=0;u<s.length-1;u++)for(var c=0;c<a.length-1;c++)this.checkInteriorIntersections(i,u,o,c);else if(4===arguments.length){var h=arguments,l=arguments,p=arguments,f=arguments;if(h===p&&l===f)return null;var g=h.getCoordinates(),d=h.getCoordinates(),y=p.getCoordinates(),_=p.getCoordinates();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 Ou(“found non-noded intersection at ”g“-”d“ and ”y“-”+_)}},ql.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},ql.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.getCoordinates(),r=0;r,n,n)},ql.prototype.hasInteriorIntersection=function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++){var i=t.getIntersection®;if(!i.equals(e)&&!i.equals(n))return!0}return!1},ql.prototype.checkCollapse=function(t,e,n){if(t.equals(n))throw new Ou(“found non-noded collapse at ”+ql.fact.createLineString())},ql.prototype.interfaces_=function(){return[]},ql.prototype.getClass=function(){return ql},Gl.fact.get=function(){return new Zc},Object.defineProperties(ql,Gl);var Bl=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,e=arguments,n=arguments;if(this._originalPt=t,this._pt=t,this._scaleFactor=e,this._li=n,e<=0)throw new Za(“Scale factor must be non-zero”);1!==e&&(this._pt=new nu(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new nu,this._p1Scaled=new nu),this.initCorners(this._pt)},kl={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};Bl.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 Tu.isTrue(!(s&&a),“Found bad envelope test”),a},Bl.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=new nu(this._maxx,this._maxy),this._corner=new nu(this._minx,this._maxy),this._corner=new nu(this._minx,this._miny),this._corner=new nu(this._maxx,this._miny)},Bl.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))},Bl.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},Bl.prototype.getCoordinate=function(){return this._originalPt},Bl.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},Bl.prototype.getSafeEnvelope=function(){if(null===this._safeEnv){var t=Bl.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Iu(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},Bl.prototype.intersectsPixelClosure=function(t,e){return this._li.computeIntersection(t,e,this._corner,this._corner),!!(this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner,this._corner),this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner,this._corner),this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner,this._corner),this._li.hasIntersection()))))},Bl.prototype.intersectsToleranceSquare=function(t,e){var n=!1,r=!1;return this._li.computeIntersection(t,e,this._corner,this._corner),!!(this._li.isProper()||(this._li.computeIntersection(t,e,this._corner,this._corner),this._li.isProper()||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner,this._corner),this._li.isProper()||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(t,e,this._corner,this._corner),this._li.isProper()||n&&r||t.equals(this._pt)||e.equals(this._pt)))))},Bl.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)},Bl.prototype.interfaces_=function(){return[]},Bl.prototype.getClass=function(){return Bl},kl.SAFE_ENV_EXPANSION_FACTOR.get=function(){return.75},Object.defineProperties(Bl,kl);var zl=function(){this.tempEnv1=new Iu,this.selectedSegment=new Hh};zl.prototype.select=function(){if(1===arguments.length);else if(2===arguments.length){var t=arguments,e=arguments;t.getLineSegment(e,this.selectedSegment),this.select(this.selectedSegment)}},zl.prototype.interfaces_=function(){return[]},zl.prototype.getClass=function(){return zl};var jl=function(){this._index=null;var t=arguments;this._index=t},Xl={HotPixelSnapAction:{configurable:!0}};jl.prototype.snap=function(){if(1===arguments.length){var t=arguments;return this.snap(t,null,-1)}if(3===arguments.length){var e=arguments,n=arguments,r=arguments,i=e.getSafeEnvelope(),o=new Ul(e,n,r);return this._index.query(i,{interfaces_:function(){return},visitItem:function(t){t.select(i,o)}}),o.isNodeAdded()}},jl.prototype.interfaces_=function(){return[]},jl.prototype.getClass=function(){return jl},Xl.HotPixelSnapAction.get=function(){return Ul},Object.defineProperties(jl,Xl);var Ul=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var e=arguments,n=arguments,r=arguments;this._hotPixel=e,this._parentEdge=n,this._hotPixelVertexIndex=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(2!==arguments.length)return t.prototype.select.apply(this,arguments);var e=arguments,n=arguments,r=e.getContext();if(null!==this._parentEdge&&r===this._parentEdge&&n===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(r,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(zl),Yl=function(){this._li=null,this._interiorIntersections=null;var t=arguments;this._li=t,this._interiorIntersections=new nc};Yl.prototype.processIntersections=function(t,e,n,r){if(t===n&&e===r)return null;var i=t.getCoordinates(),o=t.getCoordinates(),s=n.getCoordinates(),a=n.getCoordinates();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)}},Yl.prototype.isDone=function(){return!1},Yl.prototype.getInteriorIntersections=function(){return this._interiorIntersections},Yl.prototype.interfaces_=function(){return},Yl.prototype.getClass=function(){return Yl};var Vl=function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var t=arguments;this._pm=t,this._li=new Fu,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()};Vl.prototype.checkCorrectness=function(t){var e=Vh.getNodedSubstrings(t),n=new ql(e);try{n.checkValid()}catch(t){if(!(t instanceof xu))throw t;t.printStackTrace()}},Vl.prototype.getNodedSubstrings=function(){return Vh.getNodedSubstrings(this._nodedSegStrings)},Vl.prototype.snapRound=function(t,e){var n=this.findInteriorIntersections(t,e);this.computeIntersectionSnaps(n),this.computeVertexSnaps(t)},Vl.prototype.findInteriorIntersections=function(t,e){var n=new Yl(e);return this._noder.setSegmentIntersector(n),this._noder.computeNodes(t),n.getInteriorIntersections()},Vl.prototype.computeVertexSnaps=function(){if(uu(arguments,Qu))for(var t=arguments.iterator();t.hasNext();){var e=t.next();this.computeVertexSnaps(e)}else if(argumentsinstanceof Vh)for(var n=arguments,r=n.getCoordinates(),i=0;i<r.length;i++){var o=new Bl(r,this._scaleFactor,this._li);this._pointSnapper.snap(o,n,i)&&n.addIntersection(r,i)}},Vl.prototype.computeNodes=function(t){this._nodedSegStrings=t,this._noder=new tl,this._pointSnapper=new jl(this._noder.getIndex()),this.snapRound(t,this._li)},Vl.prototype.computeIntersectionSnaps=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next(),r=new Bl(n,this._scaleFactor,this._li);this._pointSnapper.snap®}},Vl.prototype.interfaces_=function(){return},Vl.prototype.getClass=function(){return Vl};var Hl=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new nl,this._resultGeometry=null,this._saveException=null,1===arguments.length){var t=arguments;this._argGeom=t}else if(2===arguments.length){var e=arguments,n=arguments;this._argGeom=e,this._bufParams=n}},Wl={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};Hl.prototype.bufferFixedPrecision=function(t){var e=new Fl(new Vl(new Vc(1)),t.getScale()),n=new Dl(this._bufParams);n.setWorkingPrecisionModel(t),n.setNoder(e),this._resultGeometry=n.buffer(this._argGeom,this._distance)},Hl.prototype.bufferReducedPrecision=function(){var t=this;if(0===arguments.length){for(var e=Hl.MAX_PRECISION_DIGITS;e>=0;e–){try{t.bufferReducedPrecision(e)}catch(e){if(!(e instanceof ah))throw e;t._saveException=e}if(null!==t._resultGeometry)return null}throw this._saveException}if(1===arguments.length){var n=arguments,r=Hl.precisionScaleFactor(this._argGeom,this._distance,n),i=new Vc®;this.bufferFixedPrecision(i)}},Hl.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===Vc.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},Hl.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},Hl.prototype.bufferOriginalPrecision=function(){try{var t=new Dl(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof Ou))throw t;this._saveException=t}},Hl.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},Hl.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},Hl.prototype.interfaces_=function(){return[]},Hl.prototype.getClass=function(){return Hl},Hl.bufferOp=function(){if(2===arguments.length){var t=arguments,e=arguments;return new Hl(t).getResultGeometry(e)}if(3===arguments.length){if(Number.isInteger(arguments)&&argumentsinstanceof ju&&“number”==typeof arguments){var n=arguments,r=arguments,i=arguments,o=new Hl(n);return o.setQuadrantSegments(i),o.getResultGeometry®}if(argumentsinstanceof nl&&argumentsinstanceof ju&&“number”==typeof arguments){var s=arguments,a=arguments,u=arguments;return new Hl(s,u).getResultGeometry(a)}}else if(4===arguments.length){var c=arguments,h=arguments,l=arguments,p=arguments,f=new Hl©;return f.setQuadrantSegments(l),f.setEndCapStyle(p),f.getResultGeometry(h)}},Hl.precisionScaleFactor=function(t,e,n){var r=t.getEnvelopeInternal(),i=cu.max(Math.abs(r.getMaxX()),Math.abs(r.getMaxY()),Math.abs(r.getMinX()),Math.abs(r.getMinY()))+2*(e>0?e:0),o=n-Math.trunc(Math.log(i)/Math.log(10)+1);return Math.pow(10,o)},Wl.CAP_ROUND.get=function(){return nl.CAP_ROUND},Wl.CAP_BUTT.get=function(){return nl.CAP_FLAT},Wl.CAP_FLAT.get=function(){return nl.CAP_FLAT},Wl.CAP_SQUARE.get=function(){return nl.CAP_SQUARE},Wl.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(Hl,Wl);var Jl=function(){this._pt=[new nu,new nu],this._distance=Ka.NaN,this._isNull=!0};Jl.prototype.getCoordinates=function(){return this._pt},Jl.prototype.getCoordinate=function(t){return this._pt},Jl.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments;this.setMinimum(t._pt,t._pt)}else if(2===arguments.length){var e=arguments,n=arguments;if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r<this._distance&&this.initialize(e,n,r)}},Jl.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var t=arguments,e=arguments;this._pt.setCoordinate(t),this._pt.setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){var n=arguments,r=arguments,i=arguments;this._pt.setCoordinate(n),this._pt.setCoordinate®,this._distance=i,this._isNull=!1}},Jl.prototype.getDistance=function(){return this._distance},Jl.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments;this.setMaximum(t._pt,t._pt)}else if(2===arguments.length){var e=arguments,n=arguments;if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r>this._distance&&this.initialize(e,n,r)}},Jl.prototype.interfaces_=function(){return[]},Jl.prototype.getClass=function(){return Jl};var Zl=function(){};Zl.prototype.interfaces_=function(){return[]},Zl.prototype.getClass=function(){return Zl},Zl.computeDistance=function(){if(argumentsinstanceof Jl&&argumentsinstanceof Mc&&argumentsinstanceof nu)for(var t=arguments,e=arguments,n=arguments,r=t.getCoordinates(),i=new Hh,o=0;o<r.length-1;o++){i.setCoordinates(r,r);var s=i.closestPoint(e);n.setMinimum(s,e)}else if(argumentsinstanceof Jl&&argumentsinstanceof Rc&&argumentsinstanceof nu){var a=arguments,u=arguments,c=arguments;Zl.computeDistance(a.getExteriorRing(),u,c);for(var h=0;h<a.getNumInteriorRing();h++)Zl.computeDistance(a.getInteriorRingN(h),u,c)}else if(argumentsinstanceof Jl&&argumentsinstanceof ju&&argumentsinstanceof nu){var l=arguments,p=arguments,f=arguments;if(l instanceof Mc)Zl.computeDistance(l,p,f);else if(l instanceof Rc)Zl.computeDistance(l,p,f);else if(l instanceof Ec)for(var g=l,d=0;d<g.getNumGeometries();d++){var y=g.getGeometryN(d);Zl.computeDistance(y,p,f)}else f.setMinimum(l.getCoordinate(),p)}else if(argumentsinstanceof Jl&&argumentsinstanceof Hh&&argumentsinstanceof nu){var _=arguments,m=arguments,v=arguments,x=_.closestPoint(m);v.setMinimum(x,m)}};var Kl=function(t){this._maxPtDist=new Jl,this._inputGeom=t||null},Ql={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};Kl.prototype.computeMaxMidpointDistance=function(t){var e=new tp(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},Kl.prototype.computeMaxVertexDistance=function(t){var e=new $l(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},Kl.prototype.findDistance=function(t){return this.computeMaxVertexDistance(t),this.computeMaxMidpointDistance(t),this._maxPtDist.getDistance()},Kl.prototype.getDistancePoints=function(){return this._maxPtDist},Kl.prototype.interfaces_=function(){return[]},Kl.prototype.getClass=function(){return Kl},Ql.MaxPointDistanceFilter.get=function(){return $l},Ql.MaxMidpointDistanceFilter.get=function(){return tp},Object.defineProperties(Kl,Ql);var $l=function(t){this._maxPtDist=new Jl,this._minPtDist=new Jl,this._geom=t||null};$l.prototype.filter=function(t){this._minPtDist.initialize(),Zl.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},$l.prototype.getMaxPointDistance=function(){return this._maxPtDist},$l.prototype.interfaces_=function(){return},$l.prototype.getClass=function(){return $l};var tp=function(t){this._maxPtDist=new Jl,this._minPtDist=new Jl,this._geom=t||null};tp.prototype.filter=function(t,e){if(0===e)return null;var n=t.getCoordinate(e-1),r=t.getCoordinate(e),i=new nu((n.x+r.x)/2,(n.y+r.y)/2);this._minPtDist.initialize(),Zl.computeDistance(this._geom,i,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},tp.prototype.isDone=function(){return!1},tp.prototype.isGeometryChanged=function(){return!1},tp.prototype.getMaxPointDistance=function(){return this._maxPtDist},tp.prototype.interfaces_=function(){return},tp.prototype.getClass=function(){return tp};var ep=function(t){this._comps=t||null};ep.prototype.filter=function(t){t instanceof Rc&&this._comps.add(t)},ep.prototype.interfaces_=function(){return},ep.prototype.getClass=function(){return ep},ep.getPolygons=function(){if(1===arguments.length){var t=arguments;return ep.getPolygons(t,new nc)}if(2===arguments.length){var e=arguments,n=arguments;return e instanceof Rc?n.add(e):e instanceof Ec&&e.apply(new ep(n)),n}};var np=function(){if(this._lines=null,this._isForcedToLineString=!1,1===arguments.length){var t=arguments;this._lines=t}else if(2===arguments.length){var e=arguments,n=arguments;this._lines=e,this._isForcedToLineString=n}};np.prototype.filter=function(t){if(this._isForcedToLineString&&t instanceof Ac){var e=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(e),null}t instanceof Mc&&this._lines.add(t)},np.prototype.setForceToLineString=function(t){this._isForcedToLineString=t},np.prototype.interfaces_=function(){return},np.prototype.getClass=function(){return np},np.getGeometry=function(){if(1===arguments.length){var t=arguments;return t.getFactory().buildGeometry(np.getLines(t))}if(2===arguments.length){var e=arguments,n=arguments;return e.getFactory().buildGeometry(np.getLines(e,n))}},np.getLines=function(){if(1===arguments.length){var t=arguments;return np.getLines(t,!1)}if(2===arguments.length){if(uu(arguments,Qu)&&uu(arguments,Qu)){for(var e=arguments,n=arguments,r=e.iterator();r.hasNext();){var i=r.next();np.getLines(i,n)}return n}if(argumentsinstanceof ju&&“boolean”==typeof arguments){var o=arguments,s=arguments,a=new nc;return o.apply(new np(a,s)),a}if(argumentsinstanceof ju&&uu(arguments,Qu)){var u=arguments,c=arguments;return u instanceof Mc?c.add(u):u.apply(new np©),c}}else if(3===arguments.length){if(“boolean”==typeof arguments&&uu(arguments,Qu)&&uu(arguments,Qu)){for(var h=arguments,l=arguments,p=arguments,f=h.iterator();f.hasNext();){var g=f.next();np.getLines(g,l,p)}return l}if(“boolean”==typeof arguments&&argumentsinstanceof ju&&uu(arguments,Qu)){var d=arguments,y=arguments,_=arguments;return d.apply(new np(y,_)),y}}};var rp=function(){if(this._boundaryRule=Vu.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,0===arguments.length);else if(1===arguments.length){var t=arguments;if(null===t)throw new Za(“Rule must be non-null”);this._boundaryRule=t}};rp.prototype.locateInternal=function(){if(argumentsinstanceof nu&&argumentsinstanceof Rc){var t=arguments,e=arguments;if(e.isEmpty())return su.EXTERIOR;var n=e.getExteriorRing(),r=this.locateInPolygonRing(t,n);if(r===su.EXTERIOR)return su.EXTERIOR;if(r===su.BOUNDARY)return su.BOUNDARY;for(var i=0;i<e.getNumInteriorRing();i++){var o=e.getInteriorRingN(i),s=this.locateInPolygonRing(t,o);if(s===su.INTERIOR)return su.EXTERIOR;if(s===su.BOUNDARY)return su.BOUNDARY}return su.INTERIOR}if(argumentsinstanceof nu&&argumentsinstanceof Mc){var a=arguments,u=arguments;if(!u.getEnvelopeInternal().intersects(a))return su.EXTERIOR;var c=u.getCoordinates();return u.isClosed()||!a.equals(c)&&!a.equals(c)?Bu.isOnLine(a,c)?su.INTERIOR:su.EXTERIOR:su.BOUNDARY}if(argumentsinstanceof nu&&argumentsinstanceof Pc){var h=arguments;return arguments.getCoordinate().equals2D(h)?su.INTERIOR:su.EXTERIOR}},rp.prototype.locateInPolygonRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?Bu.locatePointInRing(t,e.getCoordinates()):su.EXTERIOR},rp.prototype.intersects=function(t,e){return this.locate(t,e)!==su.EXTERIOR},rp.prototype.updateLocationInfo=function(t){t===su.INTERIOR&&(this._isIn=!0),t===su.BOUNDARY&&this._numBoundaries++},rp.prototype.computeLocation=function(t,e){if(e instanceof Pc&&this.updateLocationInfo(this.locateInternal(t,e)),e instanceof Mc)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof Rc)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof wc)for(var n=e,r=0;r<n.getNumGeometries();r++){var i=n.getGeometryN®;this.updateLocationInfo(this.locateInternal(t,i))}else if(e instanceof Dc)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 Ec)for(var u=new vl(e);u.hasNext();){var c=u.next();c!==e&&this.computeLocation(t,c)}},rp.prototype.locate=function(t,e){return e.isEmpty()?su.EXTERIOR:e instanceof Mc||e instanceof Rc?this.locateInternal(t,e):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,e),this._boundaryRule.isInBoundary(this._numBoundaries)?su.BOUNDARY:this._numBoundaries>0||this._isIn?su.INTERIOR:su.EXTERIOR)},rp.prototype.interfaces_=function(){return[]},rp.prototype.getClass=function(){return rp};var ip=function t(){if(this._component=null,this._segIndex=null,this._pt=null,2===arguments.length){var e=arguments,n=arguments;t.call(this,e,t.INSIDE_AREA,n)}else if(3===arguments.length){var r=arguments,i=arguments,o=arguments;this._component=r,this._segIndex=i,this._pt=o}},op={INSIDE_AREA:{configurable:!0}};ip.prototype.isInsideArea=function(){return this._segIndex===ip.INSIDE_AREA},ip.prototype.getCoordinate=function(){return this._pt},ip.prototype.getGeometryComponent=function(){return this._component},ip.prototype.getSegmentIndex=function(){return this._segIndex},ip.prototype.interfaces_=function(){return[]},ip.prototype.getClass=function(){return ip},op.INSIDE_AREA.get=function(){return-1},Object.defineProperties(ip,op);var sp=function(t){this._pts=t||null};sp.prototype.filter=function(t){t instanceof Pc&&this._pts.add(t)},sp.prototype.interfaces_=function(){return},sp.prototype.getClass=function(){return sp},sp.getPoints=function(){if(1===arguments.length){var t=arguments;return t instanceof Pc?Rh.singletonList(t):sp.getPoints(t,new nc)}if(2===arguments.length){var e=arguments,n=arguments;return e instanceof Pc?n.add(e):e instanceof Ec&&e.apply(new sp(n)),n}};var ap=function(){this._locations=null;var t=arguments;this._locations=t};ap.prototype.filter=function(t){(t instanceof Pc||t instanceof Mc||t instanceof Rc)&&this._locations.add(new ip(t,0,t.getCoordinate()))},ap.prototype.interfaces_=function(){return},ap.prototype.getClass=function(){return ap},ap.getLocations=function(t){var e=new nc;return t.apply(new ap(e)),e};var up=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new rp,this._minDistanceLocation=null,this._minDistance=Ka.MAX_VALUE,2===arguments.length){var t=arguments,e=arguments;this._geom=,this._terminateDistance=0}else if(3===arguments.length){var n=arguments,r=arguments,i=arguments;this._geom=new Array(2).fill(null),this._geom=n,this._geom=r,this._terminateDistance=i}};up.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,n=arguments,r=1-e,i=ep.getPolygons(this._geom);if(i.size()>0){var o=ap.getLocations(this._geom);if(this.computeContainmentDistance(o,i,n),this._minDistance<=this._terminateDistance)return this._minDistanceLocation=n,this._minDistanceLocation=n,null}}else if(3===arguments.length)if(argumentsinstanceof Array&&uu(arguments,ec)&&uu(arguments,ec)){for(var s=arguments,a=arguments,u=arguments,c=0;c<s.size();c++)for(var h=s.get©,l=0;l<a.size();l++)if(this.computeContainmentDistance(h,a.get(l),u),this._minDistance<=this._terminateDistance)return null}else if(argumentsinstanceof Array&&argumentsinstanceof ip&&argumentsinstanceof Rc){var p=arguments,f=arguments,g=arguments,d=p.getCoordinate();if(su.EXTERIOR!==this._ptLocator.locate(d,f))return this._minDistance=0,g=p,g=new ip(f,d),null}},up.prototype.computeMinDistanceLinesPoints=function(t,e,n){for(var r=0;r<t.size();r++)for(var i=t.get®,o=0;o<e.size();o++){var s=e.get(o);if(this.computeMinDistance(i,s,n),this._minDistance<=this._terminateDistance)return null}},up.prototype.computeFacetDistance=function(){var t=new Array(2).fill(null),e=np.getLines(this._geom),n=np.getLines(this._geom),r=sp.getPoints(this._geom),i=sp.getPoints(this._geom);return this.computeMinDistanceLines(e,n,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t=null,t=null,this.computeMinDistanceLinesPoints(e,i,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t=null,t=null,this.computeMinDistanceLinesPoints(n,r,t),this.updateMinDistance(t,!0),this._minDistance<=this._terminateDistance?null:(t=null,t=null,this.computeMinDistancePoints(r,i,t),void this.updateMinDistance(t,!1))))},up.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},up.prototype.updateMinDistance=function(t,e){if(null===t)return null;e?(this._minDistanceLocation=t,this._minDistanceLocation=t):(this._minDistanceLocation=t,this._minDistanceLocation=t)},up.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation.getCoordinate(),this._minDistanceLocation.getCoordinate()]},up.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(argumentsinstanceof Array&&argumentsinstanceof Mc&&argumentsinstanceof Pc){var t=arguments,e=arguments,n=arguments;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=Bu.distancePointLine(i,r,r);if(s<this._minDistance){this._minDistance=s;var a=new Hh(r,r).closestPoint(i);n=new ip(t,o,a),n=new ip(e,0,i)}if(this._minDistance<=this._terminateDistance)return null}}else if(argumentsinstanceof Array&&argumentsinstanceof Mc&&argumentsinstanceof Mc){var u=arguments,c=arguments,h=arguments;if(u.getEnvelopeInternal().distance(c.getEnvelopeInternal())>this._minDistance)return null;for(var l=u.getCoordinates(),p=c.getCoordinates(),f=0;f<l.length-1;f++)for(var g=0;g<p.length-1;g++){var d=Bu.distanceLineLine(l,l,p,p);if(d<this._minDistance){this._minDistance=d;var y=new Hh(l,l),_=new Hh(p,p),m=y.closestPoints(_);h=new ip(u,f,m),h=new ip(c,g,m)}if(this._minDistance<=this._terminateDistance)return null}}},up.prototype.computeMinDistancePoints=function(t,e,n){for(var r=0;r<t.size();r++)for(var i=t.get®,o=0;o<e.size();o++){var s=e.get(o),a=i.getCoordinate().distance(s.getCoordinate());if(a=new ip(i,0,i.getCoordinate()),n=new ip(s,0,s.getCoordinate())),this._minDistance<=this._terminateDistance)return null}},up.prototype.distance=function(){if(null===this._geom||null===this._geom)throw new Za(“null geometries are not supported”);return this._geom.isEmpty()||this._geom.isEmpty()?0:(this.computeMinDistance(),this._minDistance)},up.prototype.computeMinDistanceLines=function(t,e,n){for(var r=0;r<t.size();r++)for(var i=t.get®,o=0;o<e.size();o++){var s=e.get(o);if(this.computeMinDistance(i,s,n),this._minDistance<=this._terminateDistance)return null}},up.prototype.interfaces_=function(){return[]},up.prototype.getClass=function(){return up},up.distance=function(t,e){return new up(t,e).distance()},up.isWithinDistance=function(t,e,n){return new up(t,e,n).distance()<=n},up.nearestPoints=function(t,e){return new up(t,e).nearestPoints()};var cp=function(){this._pt=[new nu,new nu],this._distance=Ka.NaN,this._isNull=!0};cp.prototype.getCoordinates=function(){return this._pt},cp.prototype.getCoordinate=function(t){return this._pt},cp.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments;this.setMinimum(t._pt,t._pt)}else if(2===arguments.length){var e=arguments,n=arguments;if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r<this._distance&&this.initialize(e,n,r)}},cp.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var t=arguments,e=arguments;this._pt.setCoordinate(t),this._pt.setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){var n=arguments,r=arguments,i=arguments;this._pt.setCoordinate(n),this._pt.setCoordinate®,this._distance=i,this._isNull=!1}},cp.prototype.toString=function(){return Pu.toLineString(this._pt,this._pt)},cp.prototype.getDistance=function(){return this._distance},cp.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments;this.setMaximum(t._pt,t._pt)}else if(2===arguments.length){var e=arguments,n=arguments;if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r>this._distance&&this.initialize(e,n,r)}},cp.prototype.interfaces_=function(){return[]},cp.prototype.getClass=function(){return cp};var hp=function(){};hp.prototype.interfaces_=function(){return[]},hp.prototype.getClass=function(){return hp},hp.computeDistance=function(){if(argumentsinstanceof cp&&argumentsinstanceof Mc&&argumentsinstanceof nu)for(var t=arguments,e=arguments,n=arguments,r=new Hh,i=t.getCoordinates(),o=0;o<i.length-1;o++){r.setCoordinates(i,i);var s=r.closestPoint(e);n.setMinimum(s,e)}else if(argumentsinstanceof cp&&argumentsinstanceof Rc&&argumentsinstanceof nu){var a=arguments,u=arguments,c=arguments;hp.computeDistance(a.getExteriorRing(),u,c);for(var h=0;h<a.getNumInteriorRing();h++)hp.computeDistance(a.getInteriorRingN(h),u,c)}else if(argumentsinstanceof cp&&argumentsinstanceof ju&&argumentsinstanceof nu){var l=arguments,p=arguments,f=arguments;if(l instanceof Mc)hp.computeDistance(l,p,f);else if(l instanceof Rc)hp.computeDistance(l,p,f);else if(l instanceof Ec)for(var g=l,d=0;d<g.getNumGeometries();d++){var y=g.getGeometryN(d);hp.computeDistance(y,p,f)}else f.setMinimum(l.getCoordinate(),p)}else if(argumentsinstanceof cp&&argumentsinstanceof Hh&&argumentsinstanceof nu){var _=arguments,m=arguments,v=arguments,x=_.closestPoint(m);v.setMinimum(x,m)}};var lp=function(){this._g0=null,this._g1=null,this._ptDist=new cp,this._densifyFrac=0;var t=arguments,e=arguments;this._g0=t,this._g1=e},pp={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};lp.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},lp.prototype.setDensifyFraction=function(t){if(t>1||t<=0)throw new Za(“Fraction is not in range (0.0 - 1.0]”);this._densifyFrac=t},lp.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},lp.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},lp.prototype.computeOrientedDistance=function(t,e,n){var r=new fp(e);if(t.apply®,n.setMaximum(r.getMaxPointDistance()),this._densifyFrac>0){var i=new gp(e,this._densifyFrac);t.apply(i),n.setMaximum(i.getMaxPointDistance())}},lp.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},lp.prototype.interfaces_=function(){return[]},lp.prototype.getClass=function(){return lp},lp.distance=function(){if(2===arguments.length){var t=arguments,e=arguments;return new lp(t,e).distance()}if(3===arguments.length){var n=arguments,r=arguments,i=arguments,o=new lp(n,r);return o.setDensifyFraction(i),o.distance()}},pp.MaxPointDistanceFilter.get=function(){return fp},pp.MaxDensifiedByFractionDistanceFilter.get=function(){return gp},Object.defineProperties(lp,pp);var fp=function(){this._maxPtDist=new cp,this._minPtDist=new cp,this._euclideanDist=new hp,this._geom=null;var t=arguments;this._geom=t};fp.prototype.filter=function(t){this._minPtDist.initialize(),hp.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},fp.prototype.getMaxPointDistance=function(){return this._maxPtDist},fp.prototype.interfaces_=function(){return},fp.prototype.getClass=function(){return fp};var gp=function(){this._maxPtDist=new cp,this._minPtDist=new cp,this._geom=null,this._numSubSegs=0;var t=arguments,e=arguments;this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};gp.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,c=new nu(a,u);this._minPtDist.initialize(),hp.computeDistance(this._geom,c,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}},gp.prototype.isDone=function(){return!1},gp.prototype.isGeometryChanged=function(){return!1},gp.prototype.getMaxPointDistance=function(){return this._maxPtDist},gp.prototype.interfaces_=function(){return},gp.prototype.getClass=function(){return gp};var dp=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},yp={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};dp.prototype.checkMaximumDistance=function(t,e,n){var r=new lp(e,t);if(r.setDensifyFraction(.25),this._maxDistanceFound=r.orientedDistance(),this._maxDistanceFound>n){this._isValid=!1;var i=r.getCoordinates();this._errorLocation=i,this._errorIndicator=t.getFactory().createLineString(i),this._errMsg=“Distance between buffer curve and input is too large (”this._maxDistanceFound“ at ”+Pu.toLineString(i,i)+“)”}},dp.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=dp.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-e,this._maxValidDistance=t+e,!(!this._input.isEmpty()&&!this._result.isEmpty())||(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),dp.VERBOSE&&wu.out.println(“Min Dist= ”this._minDistanceFound“ err= ”+(1-this._minDistanceFound/this._bufDistance)+“ Max Dist= ”this._maxDistanceFound“ err= ”+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},dp.prototype.checkNegativeValid=function(){if(!(this._input instanceof Rc||this._input instanceof Dc||this._input instanceof Ec))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)},dp.prototype.getErrorIndicator=function(){return this._errorIndicator},dp.prototype.checkMinimumDistance=function(t,e,n){var r=new up(t,e,n);if(this._minDistanceFound=r.distance(),this._minDistanceFound<n){this._isValid=!1;var i=r.nearestPoints();this._errorLocation=r.nearestPoints(),this._errorIndicator=t.getFactory().createLineString(i),this._errMsg=“Distance between buffer curve and input is too small (”this._minDistanceFound“ at ”+Pu.toLineString(i,i)+“ )”}},dp.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)},dp.prototype.getErrorLocation=function(){return this._errorLocation},dp.prototype.getPolygonLines=function(t){for(var e=new nc,n=new np(e),r=ep.getPolygons(t).iterator();r.hasNext();)r.next().apply(n);return t.getFactory().buildGeometry(e)},dp.prototype.getErrorMessage=function(){return this._errMsg},dp.prototype.interfaces_=function(){return[]},dp.prototype.getClass=function(){return dp},yp.VERBOSE.get=function(){return!1},yp.MAX_DISTANCE_DIFF_FRAC.get=function(){return.012},Object.defineProperties(dp,yp);var _p=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},mp={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};_p.prototype.isValid=function(){return this.checkPolygonal(),this._isValid?(this.checkExpectedEmpty(),this._isValid?(this.checkEnvelope(),this._isValid?(this.checkArea(),this._isValid?(this.checkDistance(),this._isValid):this._isValid):this._isValid):this._isValid):this._isValid},_p.prototype.checkEnvelope=function(){if(this._distance<0)return null;var t=this._distance*_p.MAX_ENV_DIFF_FRAC;0===t&&(t=.001);var e=new Iu(this._input.getEnvelopeInternal());e.expandBy(this._distance);var n=new Iu(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”)},_p.prototype.checkDistance=function(){var t=new dp(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”)},_p.prototype.checkArea=function(){var t=this._input.getArea(),e=this._result.getArea();this._distance>0&&t>e&&(this._isValid=!1,this._errorMsg=“Area of positive buffer is smaller than input”,this._errorIndicator=this._result),this._distance<0&&t<e&&(this._isValid=!1,this._errorMsg=“Area of negative buffer is larger than input”,this._errorIndicator=this._result),this.report(“Area”)},_p.prototype.checkPolygonal=function(){this._result instanceof Rc||this._result instanceof Dc||(this._isValid=!1),this._errorMsg=“Result is not polygonal”,this._errorIndicator=this._result,this.report(“Polygonal”)},_p.prototype.getErrorIndicator=function(){return this._errorIndicator},_p.prototype.getErrorLocation=function(){return this._errorLocation},_p.prototype.checkExpectedEmpty=function(){return this._input.getDimension()>=2||this._distance>0?null:(this._result.isEmpty()||(this._isValid=!1,this._errorMsg=“Result is non-empty”,this._errorIndicator=this._result),void this.report(“ExpectedEmpty”))},_p.prototype.report=function(t){if(!_p.VERBOSE)return null;wu.out.println(“Check ”t“: ”+(this._isValid?“passed”:“FAILED”))},_p.prototype.getErrorMessage=function(){return this._errorMsg},p.prototype.interfaces=function(){return[]},_p.prototype.getClass=function(){return _p},_p.isValidMsg=function(t,e,n){var r=new _p(t,e,n);return r.isValid()?null:r.getErrorMessage()},_p.isValid=function(t,e,n){return!!new _p(t,e,n).isValid()},mp.VERBOSE.get=function(){return!1},mp.MAX_ENV_DIFF_FRAC.get=function(){return.012},Object.defineProperties(_p,mp);var vp=function(){this._pts=null,this._data=null;var t=arguments,e=arguments;this._pts=t,this._data=e};vp.prototype.getCoordinates=function(){return this._pts},vp.prototype.size=function(){return this._pts.length},vp.prototype.getCoordinate=function(t){return this._pts},vp.prototype.isClosed=function(){return this._pts.equals(this._pts)},vp.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:Xh.octant(this.getCoordinate(t),this.getCoordinate(t+1))},vp.prototype.setData=function(t){this._data=t},vp.prototype.getData=function(){return this._data},vp.prototype.toString=function(){return Pu.toLineString(new zc(this._pts))},vp.prototype.interfaces_=function(){return},vp.prototype.getClass=function(){return vp};var xp=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new nc,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments;this._li=t,this._interiorIntersection=null};xp.prototype.getInteriorIntersection=function(){return this._interiorIntersection},xp.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},xp.prototype.getIntersectionSegments=function(){return this._intSegments},xp.prototype.count=function(){return this._intersectionCount},xp.prototype.getIntersections=function(){return this._intersections},xp.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},xp.prototype.setKeepIntersections=function(t){this._keepIntersections=t},xp.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(),o=t.getCoordinates(),s=n.getCoordinates(),a=n.getCoordinates();this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments=i,this._intSegments=o,this._intSegments=s,this._intSegments=a,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},xp.prototype.isEndSegment=function(t,e){return 0===e||e>=t.size()-2},xp.prototype.hasIntersection=function(){return null!==this._interiorIntersection},xp.prototype.isDone=function(){return!this._findAllIntersections&&null!==this._interiorIntersection},xp.prototype.interfaces_=function(){return},xp.prototype.getClass=function(){return xp},xp.createAllIntersectionsFinder=function(t){var e=new xp(t);return e.setFindAllIntersections(!0),e},xp.createAnyIntersectionFinder=function(t){return new xp(t)},xp.createIntersectionCounter=function(t){var e=new xp(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var Ep=function(){this._li=new Fu,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments;this._segStrings=t};Ep.prototype.execute=function(){if(null!==this._segInt)return null;this.checkInteriorIntersections()},Ep.prototype.getIntersections=function(){return this._segInt.getIntersections()},Ep.prototype.isValid=function(){return this.execute(),this._isValid},Ep.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},Ep.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new xp(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new tl;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},Ep.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new ah(this.getErrorMessage(),this._segInt.getInteriorIntersection())},Ep.prototype.getErrorMessage=function(){if(this._isValid)return“no intersections found”;var t=this._segInt.getIntersectionSegments();return“found non-noded intersection between ”+Pu.toLineString(t,t)+“ and ”+Pu.toLineString(t,t)},Ep.prototype.interfaces_=function(){return[]},Ep.prototype.getClass=function(){return Ep},Ep.computeIntersections=function(t){var e=new Ep(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var wp=function t(){this._nv=null;var e=arguments;this._nv=new Ep(t.toSegmentStrings(e))};wp.prototype.checkValid=function(){this._nv.checkValid()},wp.prototype.interfaces_=function(){return[]},wp.prototype.getClass=function(){return wp},wp.toSegmentStrings=function(t){for(var e=new nc,n=t.iterator();n.hasNext();){var r=n.next();e.add(new vp(r.getCoordinates(),r))}return e},wp.checkValid=function(t){new wp(t).checkValid()};var bp=function(t){this._mapOp=t};bp.prototype.map=function(t){for(var e=new nc,n=0;n<t.getNumGeometries();n++){var r=this._mapOp.map(t.getGeometryN(n));r.isEmpty()||e.add®}return t.getFactory().createGeometryCollection(Zc.toGeometryArray(e))},bp.prototype.interfaces_=function(){return[]},bp.prototype.getClass=function(){return bp},bp.map=function(t,e){return new bp(e).map(t)};var Ip=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new nc,this._resultLineList=new nc;var t=arguments,e=arguments,n=arguments;this._op=t,this._geometryFactory=e,this._ptLocator=n};Ip.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)}},Ip.prototype.labelIsolatedLine=function(t,e){var n=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(e));t.getLabel().setLocation(e,n)},Ip.prototype.build=function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList},Ip.prototype.collectLineEdge=function(t,e,n){var r=t.getLabel(),i=t.getEdge();t.isLineEdge()&&(t.isVisited()||!of.isResultOfOp(r,e)||i.isCovered()||(n.add(i),t.setVisitedEdge(!0)))},Ip.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)}}},Ip.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))}},Ip.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®,n.setInResult(!0)}},Ip.prototype.collectBoundaryTouchEdge=function(t,e,n){var r=t.getLabel();return t.isLineEdge()||t.isVisited()||t.isInteriorAreaEdge()||t.getEdge().isInResult()?null:(Tu.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void(of.isResultOfOp(r,e)&&e===of.INTERSECTION&&(n.add(t.getEdge()),t.setVisitedEdge(!0))))},Ip.prototype.interfaces_=function(){return[]},Ip.prototype.getClass=function(){return Ip};var Np=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new nc;var t=arguments,e=arguments;this._op=t,this._geometryFactory=e};Np.prototype.filterCoveredNodeToPoint=function(t){var e=t.getCoordinate();if(!this._op.isCoveredByLA(e)){var n=this._geometryFactory.createPoint(e);this._resultPointList.add(n)}},Np.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!==of.INTERSECTION)){var r=n.getLabel();of.isResultOfOp(r,t)&&this.filterCoveredNodeToPoint(n)}}},Np.prototype.build=function(t){return this.extractNonCoveredResultNodes(t),this._resultPointList},Np.prototype.interfaces_=function(){return[]},Np.prototype.getClass=function(){return Np};var Cp=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};Cp.prototype.transformPoint=function(t,e){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},Cp.prototype.transformPolygon=function(t,e){var n=!0,r=this.transformLinearRing(t.getExteriorRing(),t);null!==r&&r instanceof Ac&&!r.isEmpty()||(n=!1);for(var i=new nc,o=0;o<t.getNumInteriorRing();o++){var s=this.transformLinearRing(t.getInteriorRingN(o),t);null===s||s.isEmpty()||(s instanceof Ac||(n=!1),i.add(s))}if(n)return this._factory.createPolygon(r,i.toArray([]));var a=new nc;return null!==r&&a.add®,a.addAll(i),this._factory.buildGeometry(a)},Cp.prototype.createCoordinateSequence=function(t){return this._factory.getCoordinateSequenceFactory().create(t)},Cp.prototype.getInputGeometry=function(){return this._inputGeom},Cp.prototype.transformMultiLineString=function(t,e){for(var n=new nc,r=0;r<t.getNumGeometries();r++){var i=this.transformLineString(t.getGeometryN®,t);null!==i&&(i.isEmpty()||n.add(i))}return this._factory.buildGeometry(n)},Cp.prototype.transformCoordinates=function(t,e){return this.copy(t)},Cp.prototype.transformLineString=function(t,e){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},Cp.prototype.transformMultiPoint=function(t,e){for(var n=new nc,r=0;r<t.getNumGeometries();r++){var i=this.transformPoint(t.getGeometryN®,t);null!==i&&(i.isEmpty()||n.add(i))}return this._factory.buildGeometry(n)},Cp.prototype.transformMultiPolygon=function(t,e){for(var n=new nc,r=0;r<t.getNumGeometries();r++){var i=this.transformPolygon(t.getGeometryN®,t);null!==i&&(i.isEmpty()||n.add(i))}return this._factory.buildGeometry(n)},Cp.prototype.copy=function(t){return t.copy()},Cp.prototype.transformGeometryCollection=function(t,e){for(var n=new nc,r=0;r<t.getNumGeometries();r++){var i=this.transform(t.getGeometryN®);null!==i&&(this._pruneEmptyGeometry&&i.isEmpty()||n.add(i))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(Zc.toGeometryArray(n)):this._factory.buildGeometry(n)},Cp.prototype.transform=function(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof Pc)return this.transformPoint(t,null);if(t instanceof Tc)return this.transformMultiPoint(t,null);if(t instanceof Ac)return this.transformLinearRing(t,null);if(t instanceof Mc)return this.transformLineString(t,null);if(t instanceof wc)return this.transformMultiLineString(t,null);if(t instanceof Rc)return this.transformPolygon(t,null);if(t instanceof Dc)return this.transformMultiPolygon(t,null);if(t instanceof Ec)return this.transformGeometryCollection(t,null);throw new Za(“Unknown Geometry subtype: ”+t.getClass().getName())},Cp.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 r>0&&r<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)},Cp.prototype.interfaces_=function(){return[]},Cp.prototype.getClass=function(){return Cp};var Sp=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new Hh,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,argumentsinstanceof Mc&&“number”==typeof arguments){var e=arguments,n=arguments;t.call(this,e.getCoordinates(),n)}else if(argumentsinstanceof Array&&“number”==typeof arguments){var r=arguments,i=arguments;this._srcPts=r,this._isClosed=t.isClosed®,this._snapTolerance=i}};Sp.prototype.snapVertices=function(t,e){for(var n=this._isClosed?t.size()-1:t.size(),r=0;r<n;r++){var i=t.get®,o=this.findSnapForVertex(i,e);null!==o&&(t.set(r,new nu(o)),0===r&&this._isClosed&&t.set(t.size()-1,new nu(o)))}},Sp.prototype.findSnapForVertex=function(t,e){for(var n=0;n<e.length;n++){if(t.equals2D(e))return null;if(t.distance(e)<this._snapTolerance)return e}return null},Sp.prototype.snapTo=function(t){var e=new ic(this._srcPts);return this.snapVertices(e,t),this.snapSegments(e,t),e.toCoordinateArray()},Sp.prototype.snapSegments=function(t,e){if(0===e.length)return null;var n=e.length;e.equals2D(e)&&(n=e.length-1);for(var r=0;r<n;r++){var i=e,o=this.findSegmentIndexToSnap(i,t);o>=0&&t.add(o+1,new nu(i),!1)}},Sp.prototype.findSegmentIndexToSnap=function(t,e){for(var n=Ka.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},Sp.prototype.setAllowSnappingToSourceVertices=function(t){this._allowSnappingToSourceVertices=t},Sp.prototype.interfaces_=function(){return[]},Sp.prototype.getClass=function(){return Sp},Sp.isClosed=function(t){return!(t.length<=1)&&t.equals2D(t)};var Mp=function(t){this._srcGeom=t||null},Lp={SNAP_PRECISION_FACTOR:{configurable:!0}};Mp.prototype.snapTo=function(t,e){var n=this.extractTargetCoordinates(t);return new Pp(e,n).transform(this._srcGeom)},Mp.prototype.snapToSelf=function(t,e){var n=this.extractTargetCoordinates(this._srcGeom),r=new Pp(t,n,!0).transform(this._srcGeom),i=r;return e&&uu(i,Oc)&&(i=r.buffer(0)),i},Mp.prototype.computeSnapTolerance=function(t){return this.computeMinimumSegmentLength(t)/10},Mp.prototype.extractTargetCoordinates=function(t){for(var e=new Mi,n=t.getCoordinates(),r=0;r);return e.toArray(new Array(0).fill(null))},Mp.prototype.computeMinimumSegmentLength=function(t){for(var e=Ka.MAX_VALUE,n=0;n<t.length-1;n++){var r=t.distance(t);r<e&&(e=r)}return e},Mp.prototype.interfaces_=function(){return[]},Mp.prototype.getClass=function(){return Mp},Mp.snap=function(t,e,n){var r=new Array(2).fill(null),i=new Mp(t);r=i.snapTo(e,n);var o=new Mp(e);return r=o.snapTo(r,n),r},Mp.computeOverlaySnapTolerance=function(){if(1===arguments.length){var t=arguments,e=Mp.computeSizeBasedSnapTolerance(t),n=t.getPrecisionModel();if(n.getType()===Vc.FIXED){var r=1/n.getScale()*2/1.415;r>e&&(e=r)}return e}if(2===arguments.length){var i=arguments,o=arguments;return Math.min(Mp.computeOverlaySnapTolerance(i),Mp.computeOverlaySnapTolerance(o))}},Mp.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*Mp.SNAP_PRECISION_FACTOR},Mp.snapToSelf=function(t,e,n){return new Mp(t).snapToSelf(e,n)},Lp.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(Mp,Lp);var Pp=function(t){function e(e,n,r){t.call(this),this._snapTolerance=e||null,this._snapPts=n||null,this._isSelfSnap=void 0!==r&&r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(t,e){var n=new Sp(t,this._snapTolerance);return n.setAllowSnappingToSourceVertices(this._isSelfSnap),n.snapTo(e)},e.prototype.transformCoordinates=function(t,e){var n=t.toCoordinateArray(),r=this.snapLine(n,this._snapPts);return this._factory.getCoordinateSequenceFactory().create®},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Cp),Op=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Op.prototype.getCommon=function(){return Ka.longBitsToDouble(this._commonBits)},Op.prototype.add=function(t){var e=Ka.doubleToLongBits(t);return this._isFirst?(this._commonBits=e,this._commonSignExp=Op.signExpBits(this._commonBits),this._isFirst=!1,null):Op.signExpBits(e)!==this._commonSignExp?(this._commonBits=0,null):(this._commonMantissaBitsCount=Op.numCommonMostSigMantissaBits(this._commonBits,e),void(this._commonBits=Op.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))))},Op.prototype.toString=function(){if(1===arguments.length){var t=arguments,e=Ka.longBitsToDouble(t),n=“0000000000000000000000000000000000000000000000000000000000000000”+Ka.toBinaryString(t),r=n.substring(n.length-64);return r.substring(0,1)+“ ”+r.substring(1,12)+“(exp) ”+r.substring(12)+“ [ ”e“ ]”}},Op.prototype.interfaces_=function(){return[]},Op.prototype.getClass=function(){return Op},Op.getBit=function(t,e){return 0!=(t&1<<e)?1:0},Op.signExpBits=function(t){return t>>52},Op.zeroLowerBits=function(t,e){return t&~((1<<e)-1)},Op.numCommonMostSigMantissaBits=function(t,e){for(var n=0,r=52;r>=0;r–){if(Op.getBit(t,r)!==Op.getBit(e,r))return n;n++}return 52};var Rp=function(){this._commonCoord=null,this._ccFilter=new Ap},Tp={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Rp.prototype.addCommonBits=function(t){var e=new Dp(this._commonCoord);t.apply(e),t.geometryChanged()},Rp.prototype.removeCommonBits=function(t){if(0===this._commonCoord.x&&0===this._commonCoord.y)return t;var e=new nu(this._commonCoord);e.x=-e.x,e.y=-e.y;var n=new Dp(e);return t.apply(n),t.geometryChanged(),t},Rp.prototype.getCommonCoordinate=function(){return this._commonCoord},Rp.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},Rp.prototype.interfaces_=function(){return[]},Rp.prototype.getClass=function(){return Rp},Tp.CommonCoordinateFilter.get=function(){return Ap},Tp.Translater.get=function(){return Dp},Object.defineProperties(Rp,Tp);var Ap=function(){this._commonBitsX=new Op,this._commonBitsY=new Op};Ap.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},Ap.prototype.getCommonCoordinate=function(){return new nu(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},Ap.prototype.interfaces_=function(){return},Ap.prototype.getClass=function(){return Ap};var Dp=function(){this.trans=null;var t=arguments;this.trans=t};Dp.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)},Dp.prototype.isDone=function(){return!1},Dp.prototype.isGeometryChanged=function(){return!0},Dp.prototype.interfaces_=function(){return},Dp.prototype.getClass=function(){return Dp};var Fp=function(t,e){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom=t,this._geom=e,this.computeSnapTolerance()};Fp.prototype.selfSnap=function(t){return new Mp(t).snapTo(t,this._snapTolerance)},Fp.prototype.removeCommonBits=function(t){this._cbr=new Rp,this._cbr.add(t),this._cbr.add(t);var e=new Array(2).fill(null);return e=this._cbr.removeCommonBits(t.copy()),e=this._cbr.removeCommonBits(t.copy()),e},Fp.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},Fp.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),n=of.overlayOp(e,e,t);return this.prepareResult(n)},Fp.prototype.checkValid=function(t){t.isValid()||wu.out.println(“Snapped geometry is invalid”)},Fp.prototype.computeSnapTolerance=function(){this._snapTolerance=Mp.computeOverlaySnapTolerance(this._geom,this._geom)},Fp.prototype.snap=function(t){var e=this.removeCommonBits(t);return Mp.snap(e,e,this._snapTolerance)},Fp.prototype.interfaces_=function(){return[]},Fp.prototype.getClass=function(){return Fp},Fp.overlayOp=function(t,e,n){return new Fp(t,e).getResultGeometry(n)},Fp.union=function(t,e){return Fp.overlayOp(t,e,of.UNION)},Fp.intersection=function(t,e){return Fp.overlayOp(t,e,of.INTERSECTION)},Fp.symDifference=function(t,e){return Fp.overlayOp(t,e,of.SYMDIFFERENCE)},Fp.difference=function(t,e){return Fp.overlayOp(t,e,of.DIFFERENCE)};var qp=function(t,e){this._geom=new Array(2).fill(null),this._geom=t,this._geom=e};qp.prototype.getResultGeometry=function(t){var e=null,n=!1,r=null;try{e=of.overlayOp(this._geom,this._geom,t),n=!0}catch(t){if(!(t instanceof Ou))throw t;r=t}if(!n)try{e=Fp.overlayOp(this._geom,this._geom,t)}catch(t){throw t instanceof Ou?r:t}return e},qp.prototype.interfaces_=function(){return[]},qp.prototype.getClass=function(){return qp},qp.overlayOp=function(t,e,n){return new qp(t,e).getResultGeometry(n)},qp.union=function(t,e){return qp.overlayOp(t,e,of.UNION)},qp.intersection=function(t,e){return qp.overlayOp(t,e,of.INTERSECTION)},qp.symDifference=function(t,e){return qp.overlayOp(t,e,of.SYMDIFFERENCE)},qp.difference=function(t,e){return qp.overlayOp(t,e,of.DIFFERENCE)};var Gp=function(){this.mce=null,this.chainIndex=null;var t=arguments,e=arguments;this.mce=t,this.chainIndex=e};Gp.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},Gp.prototype.interfaces_=function(){return[]},Gp.prototype.getClass=function(){return Gp};var Bp=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,n=arguments;this._eventType=t.DELETE,this._xValue=e,this._insertEvent=n}else if(3===arguments.length){var r=arguments,i=arguments,o=arguments;this._eventType=t.INSERT,this._label=r,this._xValue=i,this._obj=o}},kp={INSERT:{configurable:!0},DELETE:{configurable:!0}};Bp.prototype.isDelete=function(){return this._eventType===Bp.DELETE},Bp.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},Bp.prototype.getObject=function(){return this._obj},Bp.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},Bp.prototype.getInsertEvent=function(){return this._insertEvent},Bp.prototype.isInsert=function(){return this._eventType===Bp.INSERT},Bp.prototype.isSameLabel=function(t){return null!==this._label&&this._label===t._label},Bp.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},Bp.prototype.interfaces_=function(){return},Bp.prototype.getClass=function(){return Bp},kp.INSERT.get=function(){return 1},kp.DELETE.get=function(){return 2},Object.defineProperties(Bp,kp);var zp=function(){};zp.prototype.interfaces_=function(){return[]},zp.prototype.getClass=function(){return zp};var jp=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,e=arguments,n=arguments;this._li=t,this._includeProper=e,this._recordIsolated=n};jp.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&1===this._li.getIntersectionNum()){if(jp.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},jp.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},jp.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},jp.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},jp.prototype.isBoundaryPointInternal=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next().getCoordinate();if(t.isIntersection®)return!0}return!1},jp.prototype.hasProperIntersection=function(){return this._hasProper},jp.prototype.hasIntersection=function(){return this._hasIntersection},jp.prototype.isDone=function(){return this._isDone},jp.prototype.isBoundaryPoint=function(t,e){return!(null===e||!this.isBoundaryPointInternal(t,e)&&!this.isBoundaryPointInternal(t,e))},jp.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes=t,this._bdyNodes=e},jp.prototype.addIntersections=function(t,e,n,r){if(t===n&&e===r)return null;this.numTests++;var i=t.getCoordinates(),o=t.getCoordinates(),s=n.getCoordinates(),a=n.getCoordinates();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))))},jp.prototype.interfaces_=function(){return[]},jp.prototype.getClass=function(){return jp},jp.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var Xp=function(t){function e(){t.call(this),this.events=new nc,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){Rh.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;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(argumentsinstanceof jp&&uu(arguments,ec)&&uu(arguments,ec)){var r=arguments,i=arguments,o=arguments;this.addEdges(r,r),this.addEdges(i,i),this.computeIntersections(o)}else if(“boolean”==typeof arguments&&uu(arguments,ec)&&argumentsinstanceof jp){var s=arguments,a=arguments;arguments?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 Gp(n,i),s=new Bp(e,n.getMinX(i),o);this.events.add(s),this.events.add(new Bp(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.iterator();t.hasNext();){var e=t.next();this.addEdge(e,e)}else if(2===arguments.length)for(var n=arguments,r=arguments,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}(zp),Up=function(){this._min=Ka.POSITIVE_INFINITY,this._max=Ka.NEGATIVE_INFINITY},Yp={NodeComparator:{configurable:!0}};Up.prototype.getMin=function(){return this._min},Up.prototype.intersects=function(t,e){return!(this._min>e||this._max<t)},Up.prototype.getMax=function(){return this._max},Up.prototype.toString=function(){return Pu.toLineString(new nu(this._min,0),new nu(this._max,0))},Up.prototype.interfaces_=function(){return[]},Up.prototype.getClass=function(){return Up},Yp.NodeComparator.get=function(){return Vp},Object.defineProperties(Up,Yp);var Vp=function(){};Vp.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:i>o?1:0},Vp.prototype.interfaces_=function(){return},Vp.prototype.getClass=function(){return Vp};var Hp=function(t){function e(){t.call(this),this._item=null;var e=arguments,n=arguments,r=arguments;this._min=e,this._max=n,this._item=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(t,e,n){if(!this.intersects(t,e))return null;n.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Up),Wp=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var e=arguments,n=arguments;this._node1=e,this._node2=n,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(t,e){this._min=Math.min(t._min,e._min),this._max=Math.max(t._max,e._max)},e.prototype.query=function(t,e,n){if(!this.intersects(t,e))return null;null!==this._node1&&this._node1.query(t,e,n),null!==this._node2&&this._node2.query(t,e,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Up),Jp=function(){this._leaves=new nc,this._root=null,this._level=0};Jp.prototype.buildTree=function(){Rh.sort(this._leaves,new Up.NodeComparator);for(var t=this._leaves,e=null,n=new nc;;){if(this.buildLevel(t,n),1===n.size())return n.get(0);e=t,t=n,n=e}},Jp.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 Hp(t,e,n))},Jp.prototype.query=function(t,e,n){this.init(),this._root.query(t,e,n)},Jp.prototype.buildRoot=function(){if(null!==this._root)return null;this._root=this.buildTree()},Jp.prototype.printNode=function(t){wu.out.println(Pu.toLineString(new nu(t._min,this._level),new nu(t._max,this._level)))},Jp.prototype.init=function(){if(null!==this._root)return null;this.buildRoot()},Jp.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®;else{var i=new Wp(t.get(n),t.get(n+1));e.add(i)}}},Jp.prototype.interfaces_=function(){return[]},Jp.prototype.getClass=function(){return Jp};var Zp=function(){this._items=new nc};Zp.prototype.visitItem=function(t){this._items.add(t)},Zp.prototype.getItems=function(){return this._items},Zp.prototype.interfaces_=function(){return},Zp.prototype.getClass=function(){return Zp};var Kp=function(){this._index=null;var t=arguments;if(!uu(t,Oc))throw new Za(“Argument must be Polygonal”);this._index=new tf(t)},Qp={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};Kp.prototype.locate=function(t){var e=new Gu(t),n=new $p(e);return this._index.query(t.y,t.y,n),e.getLocation()},Kp.prototype.interfaces_=function(){return},Kp.prototype.getClass=function(){return Kp},Qp.SegmentVisitor.get=function(){return $p},Qp.IntervalIndexedGeometry.get=function(){return tf},Object.defineProperties(Kp,Qp);var $p=function(){this._counter=null;var t=arguments;this._counter=t};$p.prototype.visitItem=function(t){var e=t;this._counter.countSegment(e.getCoordinate(0),e.getCoordinate(1))},$p.prototype.interfaces_=function(){return},$p.prototype.getClass=function(){return $p};var tf=function(){this._index=new Jp;var t=arguments;this.init(t)};tf.prototype.init=function(t){for(var e=np.getLines(t).iterator();e.hasNext();){var n=e.next().getCoordinates();this.addLine(n)}},tf.prototype.addLine=function(t){for(var e=1;e<t.length;e++){var n=new Hh(t,t),r=Math.min(n.p0.y,n.p1.y),i=Math.max(n.p0.y,n.p1.y);this._index.insert(r,i,n)}},tf.prototype.query=function(){if(2===arguments.length){var t=arguments,e=arguments,n=new Zp;return this._index.query(t,e,n),n.getItems()}if(3===arguments.length){var r=arguments,i=arguments,o=arguments;this._index.query(r,i,o)}},tf.prototype.interfaces_=function(){return[]},tf.prototype.getClass=function(){return tf};var ef=function(t){function e(){if(t.call(this),this._parentGeom=null,this._lineEdgeMap=new Yc,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new rp,2===arguments.length){var e=arguments,n=arguments,r=Vu.OGC_SFS_BOUNDARY_RULE;this._argIndex=e,this._parentGeom=n,this._boundaryNodeRule=r,null!==n&&this.add(n)}else if(3===arguments.length){var i=arguments,o=arguments,s=arguments;this._argIndex=i,this._parentGeom=o,this._boundaryNodeRule=s,null!==o&&this.add(o)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.insertBoundaryPoint=function(t,n){var r=this._nodes.addNode(n).getLabel(),i=1;r.getLocation(t,ih.ON)===su.BOUNDARY&&i++;var o=e.determineBoundary(this._boundaryNodeRule,i);r.setLocation(t,o)},e.prototype.computeSelfNodes=function(){if(2===arguments.length){var t=arguments,e=arguments;return this.computeSelfNodes(t,e,!1)}if(3===arguments.length){var n=arguments,r=arguments,i=arguments,o=new jp(n,!0,!1);o.setIsDoneIfProperInt(i);var s=this.createEdgeSetIntersector(),a=this._parentGeom instanceof Ac||this._parentGeom instanceof Rc||this._parentGeom instanceof Dc,u=r||!a;return s.computeIntersections(this._edges,o,u),this.addSelfIntersectionNodes(this._argIndex),o}},e.prototype.computeSplitEdges=function(t){for(var e=this._edges.iterator();e.hasNext();)e.next().eiList.addSplitEdges(t)},e.prototype.computeEdgeIntersections=function(t,e,n){var r=new jp(e,n,!0);return r.setBoundaryNodes(this.getBoundaryNodes(),t.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,t._edges,r),r},e.prototype.getGeometry=function(){return this._parentGeom},e.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},e.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},e.prototype.addPoint=function(){if(argumentsinstanceof Pc){var t=arguments.getCoordinate();this.insertPoint(this._argIndex,t,su.INTERIOR)}else if(argumentsinstanceof nu){var e=arguments;this.insertPoint(this._argIndex,e,su.INTERIOR)}},e.prototype.addPolygon=function(t){this.addPolygonRing(t.getExteriorRing(),su.EXTERIOR,su.INTERIOR);for(var e=0;e<t.getNumInteriorRing();e++){var n=t.getInteriorRingN(e);this.addPolygonRing(n,su.INTERIOR,su.EXTERIOR)}},e.prototype.addEdge=function(t){this.insertEdge(t);var e=t.getCoordinates();this.insertPoint(this._argIndex,e,su.BOUNDARY),this.insertPoint(this._argIndex,e,su.BOUNDARY)},e.prototype.addLineString=function(t){var e=oc.removeRepeatedPoints(t.getCoordinates());if(e.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=e,null;var n=new Al(e,new lh(this._argIndex,su.INTERIOR));this._lineEdgeMap.put(t,n),this.insertEdge(n),Tu.isTrue(e.length>=2,“found LineString with single point”),this.insertBoundaryPoint(this._argIndex,e),this.insertBoundaryPoint(this._argIndex,e)},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var t=this.getBoundaryNodes(),e=new Array(t.size()).fill(null),n=0,r=t.iterator();r.hasNext();){var i=r.next();e=i.getCoordinate().copy()}return e},e.prototype.getBoundaryNodes=function(){return null===this._boundaryNodes&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(t,e,n){if(this.isBoundaryNode(t,e))return null;n===su.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(t,e):this.insertPoint(t,e,n)},e.prototype.addPolygonRing=function(t,e,n){if(t.isEmpty())return null;var r=oc.removeRepeatedPoints(t.getCoordinates());if(r.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=r,null;var i=e,o=n;Bu.isCCW®&&(i=n,o=e);var s=new Al(r,new lh(this._argIndex,su.BOUNDARY,i,o));this._lineEdgeMap.put(t,s),this.insertEdge(s),this.insertPoint(this._argIndex,r,su.BOUNDARY)},e.prototype.insertPoint=function(t,e,n){var r=this._nodes.addNode(e),i=r.getLabel();null===i?r._label=new lh(t,n):i.setLocation(t,n)},e.prototype.createEdgeSetIntersector=function(){return new Xp},e.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)}},e.prototype.add=function(){if(1!==arguments.length)return t.prototype.add.apply(this,arguments);var e=arguments;if(e.isEmpty())return null;if(e instanceof Dc&&(this._useBoundaryDeterminationRule=!1),e instanceof Rc)this.addPolygon(e);else if(e instanceof Mc)this.addLineString(e);else if(e instanceof Pc)this.addPoint(e);else if(e instanceof Tc)this.addCollection(e);else if(e instanceof wc)this.addCollection(e);else if(e instanceof Dc)this.addCollection(e);else{if(!(e instanceof Ec))throw new Error(e.getClass().getName());this.addCollection(e)}},e.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);this.add(n)}},e.prototype.locate=function(t){return uu(this._parentGeom,Oc)&&this._parentGeom.getNumGeometries()>50?(null===this._areaPtLocator&&(this._areaPtLocator=new Kp(this._parentGeom)),this._areaPtLocator.locate(t)):this._ptLocator.locate(t,this._parentGeom)},e.prototype.findEdge=function(){if(1===arguments.length){var e=arguments;return this._lineEdgeMap.get(e)}return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(t,e){return t.isInBoundary(e)?su.BOUNDARY:su.INTERIOR},e}(bh),nf=function(){if(this._li=new Fu,this._resultPrecisionModel=null,this._arg=null,1===arguments.length){var t=arguments;this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg=new ef(0,t)}else if(2===arguments.length){var e=arguments,n=arguments,r=Vu.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(n.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg=new ef(0,e,r),this._arg=new ef(1,n,r)}else if(3===arguments.length){var i=arguments,o=arguments,s=arguments;i.getPrecisionModel().compareTo(o.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(o.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg=new ef(0,i,s),this._arg=new ef(1,o,s)}};nf.prototype.getArgGeometry=function(t){return this._arg.getGeometry()},nf.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},nf.prototype.interfaces_=function(){return[]},nf.prototype.getClass=function(){return nf};var rf=function(){};rf.prototype.interfaces_=function(){return[]},rf.prototype.getClass=function(){return rf},rf.map=function(){if(argumentsinstanceof ju&&uu(arguments,rf.MapOp)){for(var t=arguments,e=arguments,n=new nc,r=0;r<t.getNumGeometries();r++){var i=e.map(t.getGeometryN®);null!==i&&n.add(i)}return t.getFactory().buildGeometry(n)}if(uu(arguments,Qu)&&uu(arguments,rf.MapOp)){for(var o=arguments,s=arguments,a=new nc,u=o.iterator();u.hasNext();){var c=u.next(),h=s.map©;null!==h&&a.add(h)}return a}},rf.MapOp=function(){};var of=function(t){function e(){var e=arguments,n=arguments;t.call(this,e,n),this._ptLocator=new rp,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new Nl,this._resultPolyList=new nc,this._resultLineList=new nc,this._resultPointList=new nc,this._graph=new bh(new bl),this._geomFact=e.getFactory()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var n=e.getLabel(),r=t.getLabel();e.isPointwiseEqual(t)||(r=new lh(t.getLabel())).flip();var i=e.getDepth();i.isNull()&&i.add(n),i.add®,n.merge®}else this._edgeList.add(t)},e.prototype.getGraph=function(){return this._graph},e.prototype.cancelDuplicateResultEdges=function(){for(var t=this._graph.getEdgeEnds().iterator();t.hasNext();){var e=t.next(),n=e.getSym();e.isInResult()&&n.isInResult()&&(e.setInResult(!1),n.setInResult(!1))}},e.prototype.isCoveredByLA=function(t){return!!this.isCovered(t,this._resultLineList)||!!this.isCovered(t,this._resultPolyList)},e.prototype.computeGeometry=function(t,n,r,i){var o=new nc;return o.addAll(t),o.addAll(n),o.addAll®,o.isEmpty()?e.createEmptyResult(i,this._arg.getGeometry(),this._arg.getGeometry(),this._geomFact):this._geomFact.buildGeometry(o)},e.prototype.mergeSymLabels=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();)t.next().getEdges().mergeSymLabels()},e.prototype.isCovered=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();if(this._ptLocator.locate(t,r)!==su.EXTERIOR)return!0}return!1},e.prototype.replaceCollapsedEdges=function(){for(var t=new nc,e=this._edgeList.iterator();e.hasNext();){var n=e.next();n.isCollapsed()&&(e.remove(),t.add(n.getCollapsedEdge()))}this._edgeList.addAll(t)},e.prototype.updateNodeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),n=e.getEdges().getLabel();e.getLabel().merge(n)}},e.prototype.getResultGeometry=function(t){return this.computeOverlay(t),this._resultGeom},e.prototype.insertUniqueEdges=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this.insertUniqueEdge(n)}},e.prototype.computeOverlay=function(t){this.copyPoints(0),this.copyPoints(1),this._arg.computeSelfNodes(this._li,!1),this._arg.computeSelfNodes(this._li,!1),this._arg.computeEdgeIntersections(this._arg,this._li,!0);var e=new nc;this._arg.computeSplitEdges(e),this._arg.computeSplitEdges(e),this.insertUniqueEdges(e),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),wp.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(t),this.cancelDuplicateResultEdges();var n=new Ih(this._geomFact);n.add(this._graph),this._resultPolyList=n.getPolygons();var r=new Ip(this,this._geomFact,this._ptLocator);this._resultLineList=r.build(t);var i=new Np(this,this._geomFact,this._ptLocator);this._resultPointList=i.build(t),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,t)},e.prototype.labelIncompleteNode=function(t,e){var n=this._ptLocator.locate(t.getCoordinate(),this._arg.getGeometry());t.getLabel().setLocation(e,n)},e.prototype.copyPoints=function(t){for(var e=this._arg.getNodeIterator();e.hasNext();){var n=e.next();this._graph.addNode(n.getCoordinate()).setLabel(t,n.getLabel().getLocation(t))}},e.prototype.findResultAreaEdges=function(t){for(var n=this._graph.getEdgeEnds().iterator();n.hasNext();){var r=n.next(),i=r.getLabel();i.isArea()&&!r.isInteriorAreaEdge()&&e.isResultOfOp(i.getLocation(0,ih.RIGHT),i.getLocation(1,ih.RIGHT),t)&&r.setInResult(!0)}},e.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):(Tu.isTrue(!r.isNull(i,ih.LEFT),“depth of LEFT side has not been initialized”),n.setLocation(i,ih.LEFT,r.getLocation(i,ih.LEFT)),Tu.isTrue(!r.isNull(i,ih.RIGHT),“depth of RIGHT side has not been initialized”),n.setLocation(i,ih.RIGHT,r.getLocation(i,ih.RIGHT))))}}},e.prototype.computeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();)t.next().getEdges().computeLabelling(this._arg);this.mergeSymLabels(),this.updateNodeLabelling()},e.prototype.labelIncompleteNodes=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),n=e.getLabel();e.isIsolated()&&(n.isNull(0)?this.labelIncompleteNode(e,0):this.labelIncompleteNode(e,1)),e.getEdges().updateLabelling(n)}},e.prototype.isCoveredByA=function(t){return!!this.isCovered(t,this._resultPolyList)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(nf);of.overlayOp=function(t,e,n){return new of(t,e).getResultGeometry(n)},of.intersection=function(t,e){if(t.isEmpty()||e.isEmpty())return of.createEmptyResult(of.INTERSECTION,t,e,t.getFactory());if(t.isGeometryCollection()){var n=e;return bp.map(t,{interfaces_:function(){return},map:function(t){return t.intersection(n)}})}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),qp.overlayOp(t,e,of.INTERSECTION)},of.symDifference=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return of.createEmptyResult(of.SYMDIFFERENCE,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),qp.overlayOp(t,e,of.SYMDIFFERENCE)},of.resultDimension=function(t,e,n){var r=e.getDimension(),i=n.getDimension(),o=-1;switch(t){case of.INTERSECTION:o=Math.min(r,i);break;case of.UNION:o=Math.max(r,i);break;case of.DIFFERENCE:o=r;break;case of.SYMDIFFERENCE:o=Math.max(r,i)}return o},of.createEmptyResult=function(t,e,n,r){var i=null;switch(of.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},of.difference=function(t,e){return t.isEmpty()?of.createEmptyResult(of.DIFFERENCE,t,e,t.getFactory()):e.isEmpty()?t.copy():(t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),qp.overlayOp(t,e,of.DIFFERENCE))},of.isResultOfOp=function(){if(2===arguments.length){var t=arguments,e=arguments,n=t.getLocation(0),r=t.getLocation(1);return of.isResultOfOp(n,r,e)}if(3===arguments.length){var i=arguments,o=arguments,s=arguments;switch(i===su.BOUNDARY&&(i=su.INTERIOR),o===su.BOUNDARY&&(o=su.INTERIOR),s){case of.INTERSECTION:return i===su.INTERIOR&&o===su.INTERIOR;case of.UNION:return i===su.INTERIOR||o===su.INTERIOR;case of.DIFFERENCE:return i===su.INTERIOR&&o!==su.INTERIOR;case of.SYMDIFFERENCE:return i===su.INTERIOR&&o!==su.INTERIOR||i!==su.INTERIOR&&o===su.INTERIOR}return!1}},of.INTERSECTION=1,of.UNION=2,of.DIFFERENCE=3,of.SYMDIFFERENCE=4;var sf=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new rp,this._seg=new Hh;var t=arguments,e=arguments;this._g=t,this._boundaryDistanceTolerance=e,this._linework=this.extractLinework(t)};sf.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},sf.prototype.getLocation=function(t){return this.isWithinToleranceOfBoundary(t)?su.BOUNDARY:this._ptLocator.locate(t,this._g)},sf.prototype.extractLinework=function(t){var e=new af;t.apply(e);var n=e.getLinework(),r=Zc.toLineStringArray(n);return t.getFactory().createMultiLineString®},sf.prototype.interfaces_=function(){return[]},sf.prototype.getClass=function(){return sf};var af=function(){this._linework=null,this._linework=new nc};af.prototype.getLinework=function(){return this._linework},af.prototype.filter=function(t){if(t instanceof Rc){var e=t;this._linework.add(e.getExteriorRing());for(var n=0;n<e.getNumInteriorRing();n++)this._linework.add(e.getInteriorRingN(n))}},af.prototype.interfaces_=function(){return},af.prototype.getClass=function(){return af};var uf=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var t=arguments;this._g=t};uf.prototype.extractPoints=function(t,e,n){for(var r=t.getCoordinates(),i=0;i,r,e,n)},uf.prototype.setSidesToGenerate=function(t,e){this._doLeft=t,this._doRight=e},uf.prototype.getPoints=function(t){for(var e=new nc,n=np.getLines(this._g).iterator();n.hasNext();){var r=n.next();this.extractPoints(r,t,e)}return e},uf.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,c=(e.x+t.x)/2,h=(e.y+t.y)/2;if(this._doLeft){var l=new nu(c-u,h+a);r.add(l)}if(this._doRight){var p=new nu(c+u,h-a);r.add(p)}},uf.prototype.interfaces_=function(){return[]},uf.prototype.getClass=function(){return uf};var cf=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 nc;var e=arguments,n=arguments,r=arguments;this._boundaryDistanceTolerance=t.computeBoundaryDistanceTolerance(e,n),this._geom=,this._locFinder=[new sf(this._geom,this._boundaryDistanceTolerance),new sf(this._geom,this._boundaryDistanceTolerance),new sf(this._geom,this._boundaryDistanceTolerance)]},hf={TOLERANCE:{configurable:!0}};cf.prototype.reportResult=function(t,e,n){wu.out.println(“Overlay result invalid - A:”+su.toLocationSymbol(e)+“ B:”+su.toLocationSymbol(e)+“ expected:”+(n?“i”:“e”)+“ actual:”+su.toLocationSymbol(e))},cf.prototype.isValid=function(t){return this.addTestPts(this._geom),this.addTestPts(this._geom),this.checkValid(t)},cf.prototype.checkValid=function(){if(1===arguments.length){for(var t=arguments,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,i=arguments;return this._location=this._locFinder.getLocation(i),this._location=this._locFinder.getLocation(i),this._location=this._locFinder.getLocation(i),!!cf.hasLocation(this._location,su.BOUNDARY)||this.isValidResult(r,this._location)}},cf.prototype.addTestPts=function(t){var e=new uf(t);this._testCoords.addAll(e.getPoints(5*this._boundaryDistanceTolerance))},cf.prototype.isValidResult=function(t,e){var n=of.isResultOfOp(e,e,t),r=!(n^e===su.INTERIOR);return r||this.reportResult(t,e,n),r},cf.prototype.getInvalidLocation=function(){return this._invalidLocation},cf.prototype.interfaces_=function(){return[]},cf.prototype.getClass=function(){return cf},cf.hasLocation=function(t,e){for(var n=0;n<3;n++)if(t===e)return!0;return!1},cf.computeBoundaryDistanceTolerance=function(t,e){return Math.min(Mp.computeSizeBasedSnapTolerance(t),Mp.computeSizeBasedSnapTolerance(e))},cf.isValid=function(t,e,n,r){return new cf(t,e,r).isValid(n)},hf.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(cf,hf);var lf=function t(e){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=t.extractFactory(e),this._inputGeoms=e};lf.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®}},lf.prototype.combine=function(){for(var t=new nc,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)},lf.prototype.interfaces_=function(){return[]},lf.prototype.getClass=function(){return lf},lf.combine=function(){if(1===arguments.length){var t=arguments;return new lf(t).combine()}if(2===arguments.length){var e=arguments,n=arguments;return new lf(lf.createList(e,n)).combine()}if(3===arguments.length){var r=arguments,i=arguments,o=arguments;return new lf(lf.createList(r,i,o)).combine()}},lf.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},lf.createList=function(){if(2===arguments.length){var t=arguments,e=arguments,n=new nc;return n.add(t),n.add(e),n}if(3===arguments.length){var r=arguments,i=arguments,o=arguments,s=new nc;return s.add®,s.add(i),s.add(o),s}};var pf=function(){this._inputPolys=null,this._geomFactory=null;var t=arguments;this._inputPolys=t,null===this._inputPolys&&(this._inputPolys=new nc)},ff={STRTREE_NODE_CAPACITY:{configurable:!0}};pf.prototype.reduceToGeometries=function(t){for(var e=new nc,n=t.iterator();n.hasNext();){var r=n.next(),i=null;uu(r,ec)?i=this.unionTree®:r instanceof ju&&(i=r),e.add(i)}return e},pf.prototype.extractByEnvelope=function(t,e,n){for(var r=new nc,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®},pf.prototype.unionOptimized=function(t,e){var n=t.getEnvelopeInternal(),r=e.getEnvelopeInternal();if(!n.intersects®)return lf.combine(t,e);if(t.getNumGeometries()<=1&&e.getNumGeometries()<=1)return this.unionActual(t,e);var i=n.intersection®;return this.unionUsingEnvelopeIntersection(t,e,i)},pf.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 Gh(pf.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®},pf.prototype.binaryUnion=function(){if(1===arguments.length){var t=arguments;return this.binaryUnion(t,0,t.size())}if(3===arguments.length){var e=arguments,n=arguments,r=arguments;if(r-n<=1){var i=pf.getGeometry(e,n);return this.unionSafe(i,null)}if(r-n==2)return this.unionSafe(pf.getGeometry(e,n),pf.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)}},pf.prototype.repeatedUnion=function(t){for(var e=null,n=t.iterator();n.hasNext();){var r=n.next();e=null===e?r.copy():e.union®}return e},pf.prototype.unionSafe=function(t,e){return null===t&&null===e?null:null===t?e.copy():null===e?t.copy():this.unionOptimized(t,e)},pf.prototype.unionActual=function(t,e){return pf.restrictToPolygons(t.union(e))},pf.prototype.unionTree=function(t){var e=this.reduceToGeometries(t);return this.binaryUnion(e)},pf.prototype.unionUsingEnvelopeIntersection=function(t,e,n){var r=new nc,i=this.extractByEnvelope(n,t,r),o=this.extractByEnvelope(n,e,r),s=this.unionActual(i,o);return r.add(s),lf.combine®},pf.prototype.bufferUnion=function(){if(1===arguments.length){var t=arguments;return t.get(0).getFactory().buildGeometry(t).buffer(0)}if(2===arguments.length){var e=arguments,n=arguments;return e.getFactory().createGeometryCollection().buffer(0)}},pf.prototype.interfaces_=function(){return[]},pf.prototype.getClass=function(){return pf},pf.restrictToPolygons=function(t){if(uu(t,Oc))return t;var e=ep.getPolygons(t);return 1===e.size()?e.get(0):t.getFactory().createMultiPolygon(Zc.toPolygonArray(e))},pf.getGeometry=function(t,e){return e>=t.size()?null:t.get(e)},pf.union=function(t){return new pf(t).union()},ff.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(pf,ff);var gf=function(){};gf.prototype.interfaces_=function(){return[]},gf.prototype.getClass=function(){return gf},gf.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return of.createEmptyResult(of.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),qp.overlayOp(t,e,of.UNION)};var df=function(){return new Ti};Ti.prototype={constructor:Ti,reset:function(){this.s=this.t=0},add:function(t){Ai(yf,t,this.t),Ai(this,yf.s,this.s),this.s?this.t+=yf.t:this.s=yf.t},valueOf:function(){return this.s}};var yf=new Ti,_f=1e-6,mf=Math.PI,vf=mf/2,xf=mf/4,Ef=2*mf,wf=180/mf,bf=mf/180,If=Math.abs,Nf=Math.atan,Cf=Math.atan2,Sf=Math.cos,Mf=Math.exp,Lf=Math.log,Pf=Math.sin,Of=Math.sqrt,Rf=Math.tan,Tf={Feature:function(t,e){qi(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r.geometry,e)}},Af={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t,t,t)},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r,e.point(t,t,t)},LineString:function(t,e){Gi(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r,e,0)},Polygon:function(t,e){Bi(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r,e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r,e)}},Df=function(t,e){t&&Tf.hasOwnProperty(t.type)?Tf(t,e):qi(t,e)},Ff=(df(),df(),df(),function(t,e){function n(n,r){return n=t(n,r),e(n,n)}return t.invert&&e.invert&&(n.invert=function(n,r){return(n=e.invert(n,r))&&t.invert(n,n)}),n});Hi.invert=Hi;var qf=function(){var t,e=[];return{point:function(e,n){t.push()},lineStart:function(){e.push(t=[])},lineEnd:Fi,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}},Gf=function(t,e,n,r,i,o){var s,a=t,u=t,c=0,h=1,l=e-a,p=e-u;if(s=n-a,l||!(s>0)){if(s/=l,l<0){if(s<c)return;s<h&&(h=s)}else if(l>0){if(s>h)return;s>c&&(c=s)}if(s=i-a,l||!(s<0)){if(s/=l,l<0){if(s>h)return;s>c&&(c=s)}else if(l>0){if(s<c)return;s<h&&(h=s)}if(s=r-u,p||!(s>0)){if(s/=p,p<0){if(s<c)return;s<h&&(h=s)}else if(p>0){if(s>h)return;s>c&&(c=s)}if(s=o-u,p||!(s<0)){if(s/=p,p<0){if(s>h)return;s>c&&(c=s)}else if(p>0){if(s<c)return;s<h&&(h=s)}return c>0&&(t=a+c*l,t=u+c*p),h<1&&(e=a+h*l,e=u+h*p),!0}}}}},Bf=function(t,e){return If(t-e)<_f&&If(t-e)<_f},kf=function(t,e,n,r,i){var o,s,a=[],u=;if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,n,r=t,s=t;if(Bf(r,s)){for(i.lineStart(),o=0;o)[0],r);i.lineEnd()}else a.push(n=new $i(r,t,null,!0)),u.push(n.o=new $i(r,null,n,!1)),a.push(n=new $i(s,t,null,!1)),u.push(n.o=new $i(s,null,n,!0))}})),a.length){for(u.sort(e),to(a),to(u),o=0,s=u.length;o.e=n=!n;for(var c,h,l=a;;){for(var p=l,f=!0;p.v;)if((p=p.n)===l)return;c=p.z,i.lineStart();do{if(p.v=p.o.v=!0,p.e){if(f)for(o=0,s=c.length;o)[0],h);else r(p.x,p.n.x,1,i);p=p.n}else{if(f)for(c=p.p.z,o=c.length-1;o>=0;–o)i.point((h=c)[0],h);else r(p.x,p.p.x,-1,i);p=p.p}c=(p=p.o).z,f=!f}while(!p.v);i.lineEnd()}}},zf=function(t,e){return t<e?-1:t>e?1:t>=e?0:NaN},jf=(function(t){1===t.length&&(t=function(t){return function(e,n){return zf(t(e),n)}}(t))}(zf),function(t){for(var e,n,r,i=t.length,o=-1,s=0;++o.length;for(n=new Array(s);–i>=0;)for(e=(r=t).length;–e>=0;)n=r;return n}),Xf=1e9,Uf=-Xf,Yf=df(),Vf=(df(),function(t){return t}),Hf=(df(),df(),1/0),Wf=Hf,Jf=-Hf,Zf=Jf,Kf={point:function(t,e){t<Hf&&(Hf=t),t>Jf&&(Jf=t),e<Wf&&(Wf=e),e>Zf&&(Zf=e)},lineStart:Fi,lineEnd:Fi,polygonStart:Fi,polygonEnd:Fi,result:function(){var t=[,[Jf,Zf]];return Jf=Zf=-(Wf=Hf=1/0),t}},Qf=(df(),function(t,e,n,r){return function(i,o){function s(e,n){var r=i(e,n);t(e=r,n=r)&&o.point(e,n)}function a(t,e){var n=i(t,e);y.point(n,n)}function u(){E.point=a,y.lineStart()}function c(){E.point=s,y.lineEnd()}function h(t,e){d.push();var n=i(t,e);v.point(n,n)}function l(){v.lineStart(),d=[]}function p(){h(d[0],d[1]),v.lineEnd();var t,e,n,r,i=v.clean(),s=m.result(),a=s.length;if(d.pop(),f.push(d),d=null,a)if(1&i){if((e=(n=s).length-1)>0){for(x||(o.polygonStart(),x=!0),o.lineStart(),t=0;t)[0],r);o.lineEnd()}}else a>1&&2&i&&s.push(s.pop().concat(s.shift())),g.push(s.filter(no))}var f,g,d,y=e(o),_=i.invert(r,r),m=qf(),v=e(m),x=!1,E={point:s,lineStart:u,lineEnd:c,polygonStart:function(){E.point=h,E.lineStart=l,E.lineEnd=p,g=[],f=},polygonEnd:function(){E.point=s,E.lineStart=u,E.lineEnd=c,g=jf(g);var t=function(t,e){var n=e,r=e,i=,o=0,s=0;Yf.reset();for(var a=0,u=t.length;a).length)for(var c,h,l=c,p=l,f=l/2+xf,g=Pf(f),d=Sf(f),y=0;y<h;++y,p=m,g=x,d=E,l=_){var _=c,m=_,v=_/2+xf,x=Pf(v),E=Sf(v),w=m-p,b=w>=0?1:-1,I=b*w,N=I>mf,C=g*x;if(Yf.add(Cf(C*b*Pf(I),d*E+C*Sf(I))),o+=N?w+b*Ef:w,N^p>=n^m>=n){var S=Xi(zi(l),zi(_));Vi(S);var M=Xi(i,S);Vi(M);var L=(N^w>=0?-1:1)*Di(M);(r>L||r===L&&(S||S))&&(s+=N^w>=0?1:-1)}}return(o<-_f||o<_f&&Yf<-_f)^1&s}(f,_);g.length?(x||(o.polygonStart(),x=!0),kf(g,ro,t,n,o)):t&&(x||(o.polygonStart(),x=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),x&&(o.polygonEnd(),x=!1),g=f=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}};return E}}),$f=Qf((function(){return!0}),(function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,s){var a=o>0?mf:-mf,u=If(o-n);If(u-mf)<_f?(t.point(n,r=(r+s)/2>0?vf:-vf),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(a,r),t.point(o,r),e=0):i!==a&&u>=mf&&(If(n-i)<_f&&(n-=i*_f),If(o-a)<_f&&(o-=a*_f),r=function(t,e,n,r){var i,o,s=Pf(t-n);return If(s)>_f?Nf((Pf(e)*(o=Sf®)*Pf(n)-Pf®*(i=Sf(e))*Pf(t))/(i*o*s)):(e+r)/2}(n,r,o,s),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(a,r),e=0),t.point(n=o,r=s),i=a},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}}),(function(t,e,n,r){var i;if(null==t)i=n*vf,r.point(-mf,i),r.point(0,i),r.point(mf,i),r.point(mf,0),r.point(mf,-i),r.point(0,-i),r.point(-mf,-i),r.point(-mf,0),r.point(-mf,i);else if(If(t-e)>_f){var o=t<e?mf:-mf;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(e,e)}),[-mf,-vf]),tg=function(t,e){function n(t,e){return Sf(t)*Sf(e)>o}function r(t,e,n){var r=,i=Xi(zi(t),zi(e)),s=ji(i,i),a=i,u=s-a*a;if(!u)return!n&&t;var c=o*s/u,h=-o*a/u,l=Xi(r,i),p=Yi(r,c);Ui(p,Yi(i,h));var f=l,g=ji(p,f),d=ji(f,f),y=g*g-d*(ji(p,p)-1);if(!(y<0)){var _=Of(y),m=Yi(f,(-g-_)/d);if(Ui(m,p),m=ki(m),!n)return m;var v,x=t,E=e,w=t,b=e;E<x&&(v=x,x=E,E=v);var I=E-x,N=If(I-mf)<_f;if(!N&&b0^m<(If(m-x)<_f?w:b):w<=m&&m<=b:I>mf^(x<=m&&m<=E)){var C=Yi(f,(-g+_)/d);return Ui(C,p),}}}function i(e,n){var r=s?t:mf-t,i=0;return e<-r?i|=1:e>r&&(i|=2),n<-r?i|=4:n>r&&(i|=8),i}var o=Sf(t),s=o>0,a=If(o)>_f;return Qf(n,(function(t){var e,o,u,c,h;return{lineStart:function(){c=u=!1,h=1},point:function(l,p){var f,g=,d=n(l,p),y=s?d?0:i(l,p):d?i(l+(l<0?mf:-mf),p):0;if(!e&&(c=u=d)&&t.lineStart(),d!==u&&(!(f=r(e,g))||Bf(e,f)||Bf(g,f))&&(g+=_f,g+=_f,d=n(g,g)),d!==u)h=0,d?(t.lineStart(),f=r(g,e),t.point(f,f)):(f=r(e,g),t.point(f,f),t.lineEnd()),e=f;else if(a&&e&&s^d){var _;y&o||!(_=r(g,e,!0))||(h=0,s?(t.lineStart(),t.point([0][0],[0][1]),t.point([1][0],[1][1]),t.lineEnd()):(t.point([1][0],[1][1]),t.lineEnd(),t.lineStart(),t.point([0][0],[0][1])))}!d||e&&Bf(e,g)||t.point(g,g),e=g,u=d,o=y},lineEnd:function(){u&&t.lineEnd(),e=null},clean:function(){return h|(c&&u)<<1}}}),(function(n,r,i,o){!function(t,e,n,r,i,o){if(n){var s=Sf(e),a=Pf(e),u=r*n;null==i?(i=e+r*Ef,o=e-u/2):(i=Qi(s,i),o=Qi(s,o),(r>0?i<o:i>o)&&(i+=r*Ef));for(var c,h=i;r>0?h>o:h),t.point(c,c)}}(o,t,e,i,n,r)}),s?:[-mf,t-mf])};oo.prototype={constructor:oo,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var eg=Sf(30*bf),ng=function(t,e){return+e?function(t,e){function n(r,i,o,s,a,u,c,h,l,p,f,g,d,y){var _=c-r,m=h-i,v=_*_+m*m;if(v>4*e&&d–){var x=s+p,E=a+f,w=u+g,b=Of(x*x+E*E+w*w),I=Di(w/=b),N=If(If(w)-1)<_f||If(o-l)<_f?(o+l)/2:Cf(E,x),C=t(N,I),S=C,M=C,L=S-r,P=M-i,O=m*L-_*P;(O*O/v>e||If((_*L+m*P)/v-.5)>.3||s*p+a*f+u*g<eg)&&(n(r,i,o,s,a,u,S,M,N,x/=b,E/=b,w,d,y),y.point(S,M),n(S,M,N,x,E,w,c,h,l,p,f,g,d,y))}}return function(e){function r(n,r){n=t(n,r),e.point(n,n)}function i(){_=NaN,w.point=o,e.lineStart()}function o(r,i){var o=zi(),s=t(r,i);n(_,m,y,v,x,E,_=s,m=s,y=r,v=o,x=o,E=o,16,e),e.point(_,m)}function s(){w.point=r,e.lineEnd()}function a(){i(),w.point=u,w.lineEnd=c}function u(t,e){o(h=t,e),l=_,p=m,f=v,g=x,d=E,w.point=o}function c(){n(_,m,y,v,x,E,l,p,h,f,g,d,16,e),w.lineEnd=s,s()}var h,l,p,f,g,d,y,_,m,v,x,E,w={point:r,lineStart:i,lineEnd:s,polygonStart:function(){e.polygonStart(),w.lineStart=a},polygonEnd:function(){e.polygonEnd(),w.lineStart=i}};return w}}(t,e):function(t){return io({point:function(e,n){e=t(e,n),this.stream.point(e,e)}})}(t)},rg=io({point:function(t,e){this.stream.point(t*bf,e*bf)}});ao.invert=function(t,e){return},uo.invert=function(t,e){return};var ig=function(){var t=function(t){function e(){var e=mf*a(),s=o(function(t){function e(e){return(e=t(e*bf,e*bf))*=wf,e*=wf,e}return t=Wi(t*bf,t*bf,t.length>2?t*bf:0),e.invert=function(e){return(e=t.invert(e*bf,e*bf))*=wf,e*=wf,e},e}(o.rotate()).invert());return c(null==h?[[s-e,s-e],[s+e,s+e]]:t===ao?[[Math.max(s-e,h),n],[Math.min(s+e,r),i]]:[[h,Math.max(s-e,n)],[r,Math.min(s+e,i)]])}var n,r,i,o=function(t){return function(t){function e(t){return[(t=c(t*bf,t*bf))*d+s,a-t*d]}function n(t,e){return[(t=o(t,e))*d+s,a-t*d]}function r(){c=Ff(u=Wi(x,E,w),o);var t=o(m,v);return s=y-t*d,a=_+t*d,i()}function i(){return f=g=null,e}var o,s,a,u,c,h,l,p,f,g,d=150,y=480,_=250,m=0,v=0,x=0,E=0,w=0,b=null,I=$f,N=null,C=Vf,S=.5,M=ng(n,S);return e.stream=function(t){return f&&g===t?f:f=rg(I(u,M(C(g=t))))},e.clipAngle=function(t){return arguments.length?(I=+t?tg(b=t*bf,6*bf):(b=null,$f),i()):b*wf},e.clipExtent=function(t){return arguments.length?(C=null==t?(N=h=l=p=null,Vf):eo(N=+t[0],h=+t[1],l=+t[0],p=+t[1]),i()):null==N?null:[,[l,p]]},e.scale=function(t){return arguments.length?(d=+t,r()):d},e.translate=function(t){return arguments.length?(y=+t,_=+t,r()):},e.center=function(t){return arguments.length?(m=t%360*bf,v=t%360*bf,r()):},e.rotate=function(t){return arguments.length?(x=t%360*bf,E=t%360*bf,w=t.length>2?t%360*bf:0,r()):},e.precision=function(t){return arguments.length?(M=ng(n,S=t*t),i()):Of(S)},e.fitExtent=function(t,n){return so(e,t,n)},e.fitSize=function(t,n){return function(t,e,n){return so(t,[,e],n)}(e,t,n)},function(){return o=t.apply(this,arguments),e.invert=o.invert&&function(t){return(t=c.invert((t-s)/d,(a-t)/d))&&[t*wf,t*wf]},r()}}((function(){return t}))()}(t),s=o.center,a=o.scale,u=o.translate,c=o.clipExtent,h=null;return o.scale=function(t){return arguments.length?(a(t),e()):a()},o.translate=function(t){return arguments.length?(u(t),e()):u()},o.center=function(t){return arguments.length?(s(t),e()):s()},o.clipExtent=function(t){return arguments.length?(null==t?h=n=r=i=null:(h=+t[0],n=+t[1],r=+t[0],i=+t[1]),e()):null==h?null:[,[r,i]]},e()}(uo),e=t.center,n=t.rotate;return t.center=function(t){return arguments.length?e([-t,t]):[(t=e()),-t]},t.rotate=function(t){return arguments.length?n([t,t,t.length>2?t+90:90]):[(t=n()),t,t-90]},n().scale(159.155)};t.projection=hs,t.random=Ha,t.clusters=Wa,t.helpers=Co,t.invariant=Mo,t.meta=So,t.isolines=function(t,e,n){if(!I(n=n||{}))throw new Error(“options is invalid”);var r=n.zProperty||“elevation”,i=n.commonProperties||{},o=n.breaksProperties||[];if(W(t,“Point”,“Input must contain Points”),!e)throw new Error(“breaks is required”);if(!Array.isArray(e))throw new Error(“breaks must be an Array”);if(!I(i))throw new Error(“commonProperties must be an Object”);if(!Array.isArray(o))throw new Error(“breaksProperties must be an Array”);var s=function(t,e){if(!I(e=e||{}))throw new Error(“options is invalid”);var n=e.zProperty||“elevation”,r=e.flip,i=e.flags;W(t,“Point”,“input must contain Points”);for(var o=function(t,e){var n={};return O(t,(function(t){var e=U(t);n||(n=[]),n.push(t)})),Object.keys(n).map((function(t){return n.sort((function(t,e){return U(t)-U(e)}))})).sort((function(t,n){return e?U(t)[1]-U(n)[1]:U(n)[1]-U(t)[1]}))}(t,r),s=[],a=0;a<o.length;a++){for(var u=o,c=[],h=0;h<u.length;h++){var l=u;l.properties?c.push(l.properties):c.push(0),!0===i&&(l.properties.matrixPosition=)}s.push©}return s}(t,{zProperty:r,flip:!0});return c(function(t,e,n){var r=j(n),i=r-r,o=r-r,s=r,a=r,u=e.length-1,c=e.length-1,h=i/u,l=o/c,p=function(t){t=t*h+s,t=t*l+a};return t.forEach((function(t){S(t,p)})),t}(function(t,e,n,r,i){for(var o=[],s=1;s<e.length;s++){var a=+e,u=Object.assign({},r,i);u=a;var c=h(Q(t,a),u);o.push©}return o}(s,e,r,i,o),s,t))},t.convex=St,t.pointsWithinPolygon=Pt,t.concave=function(t,n){if(!I(n=n||{}))throw new Error(“options is invalid”);if(!t)throw new Error(“points is required”);var r=n.maxEdge||1/0;if(!b®)throw new Error(“maxEdge is invalid”);var i=Ot(function(t){var e=[],n={};return O(t,(function(t){if(t.geometry){var r=t.geometry.coordinates.join(“-”);n.hasOwnProperty®||(e.push(t),n=!0)}})),c(e)}(t));if(i.features=i.features.filter((function(t){var e=t.geometry.coordinates[0],i=t.geometry.coordinates[1],o=t.geometry.coordinates[2],s=Dt(e,i,n),a=Dt(i,o,n),u=Dt(e,o,n);return s<=r&&a<=r&&u<=r})),i.features.length<1)return null;var o=Wt(i,n);return 1===o.coordinates.length&&(o.coordinates=o.coordinates,o.type=“Polygon”),e(o)},t.collect=function(t,e,n,r){var i=Ro(6),o=e.features.map((function(t){return{minX:t.geometry.coordinates,minY:t.geometry.coordinates,maxX:t.geometry.coordinates,maxY:t.geometry.coordinates,property:t.properties}}));return i.load(o),t.features.forEach((function(t){t.properties||(t.properties={});var e=j(t),n=[];i.search({minX:e,minY:e,maxX:e,maxY:e}).forEach((function(e){Mt(,t)&&n.push(e.property)})),t.properties=n})),t},t.flip=function(t,e){if(!I(e=e||{}))throw new Error(“options is invalid”);var n=e.mutate;if(!t)throw new Error(“geojson is required”);return!1!==n&&void 0!==n||(t=Ft(t)),S(t,(function(t){var e=t,n=t;t=n,t=e})),t},t.simplify=function(t,e){if(!I(e=e||{}))throw new Error(“options is invalid”);var n=void 0!==e.tolerance?e.tolerance:1,r=e.highQuality||!1,i=e.mutate||!1;if(!t)throw new Error(“geojson is required”);if(n&&n<0)throw new Error(“invalid tolerance”);return!0!==i&&(t=Ft(t)),A(t,(function(t){!function(t,e,n){var r=t.type;if(“Point”===r||“MultiPoint”===r)return t;Jt(t,!0);var i=t.coordinates;switch®{case“LineString”:t.coordinates=te(i,e,n);break;case“MultiLineString”:t.coordinates=i.map((function(t){return te(t,e,n)}));break;case“Polygon”:t.coordinates=ee(i,e,n);break;case“MultiPolygon”:t.coordinates=i.map((function(t){return ee(t,e,n)}))}}(t,n,r)})),t},t.bezierSpline=ne,t.tag=function(t,e,n,r){return t=Ft(t),e=Ft(e),O(t,(function(t){t.properties||(t.properties={}),O(e,(function(e){void 0===t.properties&&Mt(t,e)&&(t.properties=e.properties)}))})),t},t.sample=function(t,e){if(!t)throw new Error(“featurecollection is required”);if(null==e)throw new Error(“num is required”);if(“number”!=typeof e)throw new Error(“num must be a number”);return c(function(t,e){for(var n,r,i=t.slice(0),o=t.length,s=o-e;o– >s;)n=i,i=i,i=n;return i.slice(s)}(t.features,e))},t.envelope=ie,t.square=oe,t.circle=ae,t.midpoint=function(t,e){return se(t,Dt(t,e)/2,ue(t,e))},t.center=ce,t.centerOfMass=function t(e,n){switch(K(e)){case“Point”:return e;case“Polygon”:var i=[];S(e,(function(t){i.push(t)}));var o,s,a,u,c,h,l,p,f=he(e,n),g=f.geometry.coordinates,d=0,y=0,_=0,m=i.map((function(t){return[t-g,t-g]}));for(o=0;o)[0],h=s,c=(a=m)[0],_+=p=u*(l=a)-c*h,d+=(u+c)*p,y+=(h+l)*p;if(0===_)return f;var v=1/(.5*_*6);return r([g+v*d,g+v*y],n);default:var x=St(e);return x?t(x,n):he(e,n)}},t.centroid=he,t.combine=function(t){function n(t,e,n){n?r.coordinates=r.coordinates.concat(t.geometry.coordinates):r.coordinates.push(t.geometry.coordinates),r.properties.push(t.properties)}var r={MultiPoint:{coordinates:[],properties:},MultiLineString:{coordinates:[],properties:},MultiPolygon:{coordinates:[],properties:}},i=Object.keys®.reduce((function(t,e){return t=e,t}),{});return O(t,(function(t){t.geometry&&(r?n(t,t.geometry.type,!0):i&&n(t,i,!1))})),c(Object.keys®.filter((function(t){return r.coordinates.length})).sort().map((function(t){return e({type:t,coordinates:r.coordinates},{collectedProperties:r.properties})})))},t.distance=Dt,t.explode=le,t.bbox=j,t.tesselate=function(t){if(!t.geometry||“Polygon”!==t.geometry.type&&“MultiPolygon”!==t.geometry.type)throw new Error(“input must be a Polygon or MultiPolygon”);var e={type:“FeatureCollection”,features:[]};return“Polygon”===t.geometry.type?e.features=Se(t.geometry.coordinates):t.geometry.coordinates.forEach((function(t){e.features=e.features.concat(Se(t))})),e},t.bboxPolygon=re,t.booleanPointInPolygon=Mt,t.nearestPoint=Me,t.nearestPointOnLine=Je,t.nearestPointToLine=function(t,e,n){if(!I(n=n||{}))throw new Error(“options is invalid”);var r=n.units,i=n.properties||{};if(!t)throw new Error(“points is required”);if(!(t=function(t){var e=[];switch(t.geometry?t.geometry.type:t.type){case“GeometryCollection”:return A(t,(function(t){“Point”===t.type&&e.push({type:“Feature”,properties:{},geometry:t})})),{type:“FeatureCollection”,features:e};case“FeatureCollection”:return t.features=t.features.filter((function(t){return“Point”===t.geometry.type})),t;default:throw new Error(“points must be a Point Collection”)}}(t)).features.length)throw new Error(“points must contain features”);if(!e)throw new Error(“line is required”);if(“LineString”!==K(e))throw new Error(“line must be a LineString”);var o=1/0,s=null;return O(t,(function(t){var n=on(t,e,{units:r});n<o&&(o=n,s=t)})),s&&(s.properties=Object.assign({dist:o},s.properties,i)),s},t.planepoint=function(t,e){var n=X(t),r=J(e).coordinates;if(r.length<4)throw new Error(“OuterRing of a Polygon must have 4 or more Positions.”);var i=e.properties||{},o=i.a,s=i.b,a=i.c,u=n,c=n,h=r[0],l=r[1],p=void 0!==o?o:r[2],f=r[0],g=r[1],d=void 0!==s?s:r[2],y=r[0],_=r[1],m=void 0!==a?a:r[2];return(m*(u-h)*(c-g)+p*(u-f)*(c-_)+d*(u-y)*(c-l)-d*(u-h)*(c-_)-m*(u-f)*(c-l)-p*(u-y)*(c-g))/((u-h)*(c-g)+(u-f)*(c-_)+(u-y)*(c-l)-(u-h)*(c-_)-(u-f)*(c-l)-(u-y)*(c-g))},t.tin=Ot,t.bearing=ue,t.destination=se,t.kinks=function(t){var e,n,i={type:“FeatureCollection”,features:[]};if(“LineString”===(n=“Feature”===t.type?t.geometry:t).type)e=;else if(“MultiLineString”===n.type)e=n.coordinates;else if(“MultiPolygon”===n.type)e=[].concat.apply(,n.coordinates);else{if(“Polygon”!==n.type)throw new Error(“Input must be a LineString, MultiLineString, Polygon, or MultiPolygon Feature or Geometry”);e=n.coordinates}return e.forEach((function(t){e.forEach((function(e){for(var n=0;n<t.length-1;n++)for(var o=n;o<e.length-1;o++){if(t===e){if(1===Math.abs(n-o))continue;if(0===n&&o===t.length-2&&t[0]===t[0]&&t[1]===t[1])continue}var s=function(t,e,n,r,i,o,s,a){var u,c,h,l,p={x:null,y:null,onLine1:!1,onLine2:!1};return 0==(u=(a-o)*(n-t)-(s-i)*(r-e))?null!==p.x&&null!==p.y&&p:(l=(n-t)*(c=e-o)-(r-e)*(h=t-i),c=((s-i)*c-(a-o)*h)/u,h=l/u,p.x=t+c*(n-t),p.y=e+c*(r-e),c>=0&&c<=1&&(p.onLine1=!0),h>=0&&h<=1&&(p.onLine2=!0),!(!p.onLine1||!p.onLine2)&&)}(t[0],t[1],t[0],t[1],e[0],e[1],e[0],e[1]);s&&i.features.push(r([s,s]))}}))})),i},t.pointOnFeature=an,t.area=cn,t.along=function(t,e,n){if(!I(n=n||{}))throw new Error(“options is invalid”);var i;if(“Feature”===t.type)i=t.geometry.coordinates;else{if(“LineString”!==t.type)throw new Error(“input must be a LineString Feature or Geometry”);i=t.coordinates}if(!b(e))throw new Error(“distance must be a number”);for(var o=0,s=0;s<i.length&&!(e>=o&&s===i.length-1);s++){if(o>=e){var a=e-o;if(a){var u=ue(i,i)-180;return se(i,a,u,n)}return r(i)}o+=Dt(i,i,n)}return r(i)},t.length=fn,t.lineSlice=function(t,e,n){var r=U(n);if(“LineString”!==K(n))throw new Error(“line must be a LineString”);for(var i,o=Je(n,t),s=Je(n,e),u=[(i=o.properties.index<=s.properties.index?:[s,o]).geometry.coordinates],c=i.properties.index+1;c.properties.index+1;c++)u.push(r);return u.push(i.geometry.coordinates),a(u,n.properties)},t.lineSliceAlong=gn,t.pointGrid=vn,t.truncate=xn,t.flatten=function(t){if(!t)throw new Error(“geojson is required”);var e=[];return F(t,(function(t){e.push(t)})),c(e)},t.lineIntersect=He,t.lineChunk=function(t,e,n){if(!I(n=n||{}))throw new Error(“options is invalid”);var r=n.units,i=n.reverse;if(!t)throw new Error(“geojson is required”);if(e<=0)throw new Error(“segmentLength must be greater than 0”);var o=[];return F(t,(function(t){i&&(t.geometry.coordinates=t.geometry.coordinates.reverse()),function(t,e,n,r){var i=fn(t,{units:n});if(i<=e)return r(t);var o=i/e;Number.isInteger(o)||(o=Math.floor(o)+1);for(var s=0;s<o;s++)r(gn(t,e*s,e*(s+1),{units:n}))}(t,e,r,(function(t){o.push(t)}))})),c(o)},t.unkinkPolygon=function(t){var e=[];return F(t,(function(t){“Polygon”===t.geometry.type&&O(ps(t),(function(n){e.push(o(n.geometry.coordinates,t.properties))}))})),c(e)},t.greatCircle=function(t,e,n){if(“object”!=typeof(n=n||{}))throw new Error(“options is invalid”);var r=n.properties,i=n.npoints,o=n.offset;return t=X(t),e=X(e),r=r||{},i=i||100,o=o||10,new xs({x:t,y:t},{x:e,y:e},r).Arc(i,{offset:o}).json()},t.lineSegment=Ve,t.lineSplit=function(t,e){if(!t)throw new Error(“line is required”);if(!e)throw new Error(“splitter is required”);var n=K(t),r=K(e);if(“LineString”!==n)throw new Error(“line must be LineString”);if(“FeatureCollection”===r)throw new Error(“splitter cannot be a FeatureCollection”);if(“GeometryCollection”===r)throw new Error(“splitter cannot be a GeometryCollection”);var i=xn(e,{precision:7});switch®{case“Point”:return Nn(t,i);case“MultiPoint”:return In(t,i);case“LineString”:case“MultiLineString”:case“Polygon”:case“MultiPolygon”:return In(t,He(t,i))}},t.lineArc=Mn,t.polygonToLine=Pn,t.lineToPolygon=Rn,t.bboxClip=function(t,e){var n=function(t){return t.geometry?t.geometry.type:t.type}(t),r=U(t),i=t.properties;switch(n){case“LineString”:case“MultiLineString”:var s=[];return“LineString”===n&&(r=),r.forEach((function(t){Es(t,e,s)})),1===s.length?a(s,i):h(s,i);case“Polygon”:return o(Gn(r,e),i);case“MultiPolygon”:return p(r.map((function(t){return Gn(t,e)})),i);default:throw new Error(“geometry ”n“ not supported”)}},t.lineOverlap=Xn,t.sector=function(t,e,n,r,i){if(!I(i=i||{}))throw new Error(“options is invalid”);if(!t)throw new Error(“center is required”);if(null==n)throw new Error(“bearing1 is required”);if(null==r)throw new Error(“bearing2 is required”);if(!e)throw new Error(“radius is required”);if(“object”!=typeof i)throw new Error(“options must be an object”);if(Yn(n)===Yn®)return ae(t,e,i);var s=U(t),a=[];return S(Mn(t,e,n,r,i),(function(t){a.push(t)})),a.push(s),o(a)},t.rhumbBearing=Ze,t.rhumbDistance=Qe,t.rhumbDestination=Vn,t.polygonTangents=function(t,e){var n,i,o,s=U(t),a=U(e);switch(K(e)){case“Polygon”:n=a[0],i=a[0],o=Wn(a[0],a[a.length-1],s);var u=Hn(a,s,o,void 0,n,i);n=u,i=u;break;case“MultiPolygon”:n=a[0],i=a[0],o=Wn(a[0],a[0][a[0].length-1],s),a.forEach((function(t){var e=Hn(t,s,o,void 0,n,i);n=e,i=e}))}return c()},t.rewind=function(t,e){if(!I(e=e||{}))throw new Error(“options is invalid”);var n=e.reverse||!1,r=e.mutate||!1;if(!t)throw new Error(“<geojson> is required”);if(“boolean”!=typeof n)throw new Error(“<reverse> must be a boolean”);if(“boolean”!=typeof r)throw new Error(“<mutate> must be a boolean”);!1===r&&(t=Ft(t));var i=[];switch(t.type){case“GeometryCollection”:return A(t,(function(t){Zn(t,n)})),t;case“FeatureCollection”:return O(t,(function(t){O(Zn(t,n),(function(t){i.push(t)}))})),c(i)}return Zn(t,n)},t.isobands=function(t,e,n){if(!I(n=n||{}))throw new Error(“options is invalid”);var r=n.zProperty||“elevation”,i=n.commonProperties||{},s=n.breaksProperties||[];if(W(t,“Point”,“Input must contain Points”),!e)throw new Error(“breaks is required”);if(!Array.isArray(e))throw new Error(“breaks is not an Array”);if(!I(i))throw new Error(“commonProperties is not an Object”);if(!Array.isArray(s))throw new Error(“breaksProperties is not an Array”);var a=function(t,e){if(!I(e=e||{}))throw new Error(“options is invalid”);var n=e.zProperty||“elevation”,r=e.flip,i=e.flags;W(t,“Point”,“input must contain Points”);for(var o=function(t,e){var n={};return O(t,(function(t){var e=U(t);n||(n=[]),n.push(t)})),Object.keys(n).map((function(t){return n.sort((function(t,e){return U(t)-U(e)}))})).sort((function(t,n){return e?U(t)[1]-U(n)[1]:U(n)[1]-U(t)[1]}))}(t,r),s=[],a=0;a<o.length;a++){for(var u=o,c=[],h=0;h<u.length;h++){var l=u;l.properties?c.push(l.properties):c.push(0),!0===i&&(l.properties.matrixPosition=)}s.push©}return s}(t,{zProperty:r,flip:!0}),u=function(t,e,n){for(var r=[],i=1;i<e.length;i++){var s=+e,a=+e,u=function(t){for(var e=t.map((function(t){return{lrCoordinates:t,grouped:!1}})),n=[];!function(t){for(var e=0;e.grouped)return!1;return!0}(e);)for(var r=0;r.grouped){var i=[];i.push(e.lrCoordinates),e.grouped=!0;for(var s=o([e.lrCoordinates]),a=r+1;a.grouped||function(t,e){for(var n=le(t),r=0;r,e))return!1;return!0}(o([e.lrCoordinates]),s)&&(i.push(e.lrCoordinates),e.grouped=!0);n.push(i)}return n}(function(t){var e=[],n=;t.forEach((function(t){var r=cn(o());n.push®,e.push({ring:t,area:r})})),n.sort((function(t,e){return e-t}));var r=[];return n.forEach((function(t){for(var n=0;n.area===t){r.push(e.ring),e.splice(n,1);break}})),r}($n(t,s,a-s))),c={};c.groupedRings=u,c=s+“-”+a,r.push©}return r}(a,e,r);return c((u=function(t,e,n){var r=j(n),i=r-r,o=r-r,s=r,a=r,u=e.length-1,c=e.length-1,h=i/u,l=o/c,p=function(t){t=t*h+s,t=t*l+a};return t.forEach((function(t){t.groupedRings.forEach((function(t){t.forEach((function(t){t.forEach(p)}))}))})),t}(u,a,t)).map((function(t,e){if(s&&!I(s))throw new Error(“Each mappedProperty is required to be an Object”);var n=Object.assign({},i,s);return n=t,p(t.groupedRings,n)})))},t.transformRotate=nr,t.transformScale=rr,t.transformTranslate=function(t,e,n,r){if(!I(r=r||{}))throw new Error(“options is invalid”);var i=r.units,o=r.zTranslation,s=r.mutate;if(!t)throw new Error(“geojson is required”);if(null==e||isNaN(e))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===e&&0===o)return t;if(null==n||isNaN(n))throw new Error(“direction is required”);return e<0&&(e=-e,n=-n),!1!==s&&void 0!==s||(t=Ft(t)),S(t,(function(t){var r=U(Vn(t,e,n,{units:i}));t=r,t=r,o&&3===t.length&&(t+=o)})),t},t.lineOffset=function(t,e,n){if(!I(n=n||{}))throw new Error(“options is invalid”);var r=n.units;if(!t)throw new Error(“geojson is required”);if(null==e||isNaN(e))throw new Error(“distance is required”);var i=K(t),o=t.properties;switch(i){case“LineString”:return ar(t,e,r);case“MultiLineString”:var s=[];return F(t,(function(t){s.push(ar(t,e,r).geometry.coordinates)})),h(s,o);default:throw new Error(“geometry ”i“ is not supported”)}},t.polygonize=function(t){var e=xa.fromGeoJson(t);e.deleteDangles(),e.deleteCutEdges();var n=[],r=;return e.getEdgeRings().filter((function(t){return t.isValid()})).forEach((function(t){t.isHole()?n.push(t):r.push(t)})),n.forEach((function(t){ma.findEdgeRingContaining(t,r)&&r.push(t)})),c(r.map((function(t){return t.toPolygon()})))},t.booleanDisjoint=function(t,e){var n;return F(t,(function(t){F(e,(function(e){if(!1===n)return!1;n=function(t,e){switch(t.type){case“Point”:switch(e.type){case“Point”:return!function(t,e){return t===e&&t===e}(t.coordinates,e.coordinates);case“LineString”:return!hr(e,t);case“Polygon”:return!Mt(t,e)}break;case“LineString”:switch(e.type){case“Point”:return!hr(t,e);case“LineString”:return!function(t,e){return He(t,e).features.length>0}(t,e);case“Polygon”:return!lr(e,t)}break;case“Polygon”:switch(e.type){case“Point”:return!Mt(e,t);case“LineString”:return!lr(t,e);case“Polygon”:return!function(t,e){for(var n=0;n.length;n++)if(Mt(t.coordinates[n],e))return!0;for(var r=0;r.length;r++)if(Mt(e.coordinates[r],t))return!0;return!1}(e,t)}}}(t.geometry,e.geometry)}))})),n},t.booleanContains=function(t,e){var n=K(t),r=K(e),i=J(t),o=J(e),s=U(t),a=U(e);switch(n){case“Point”:switch®{case“Point”:return fr(s,a);default:throw new Error(“feature2 ”r“ geometry not supported”)}case“MultiPoint”:switch®{case“Point”:return function(t,e){var n,r=!1;for(n=0;n,e.coordinates)){r=!0;break}return r}(i,o);case“MultiPoint”:return function(t,e){for(var n=0;n<e.coordinates.length;n++){for(var r=!1,i=0;i,t.coordinates)){r=!0;break}if(!r)return!1}return!0}(i,o);default:throw new Error(“feature2 ”r“ geometry not supported”)}case“LineString”:switch®{case“Point”:return dn(o,i,{ignoreEndVertices:!0});case“LineString”:return function(t,e){for(var n=!1,r=0;r<e.coordinates.length;r++)if(dn({type:“Point”,coordinates:e.coordinates},t,{ignoreEndVertices:!0})&&(n=!0),!dn({type:“Point”,coordinates:e.coordinates},t,{ignoreEndVertices:!1}))return!1;return n}(i,o);case“MultiPoint”:return function(t,e){for(var n=!1,r=0;r,t,{ignoreEndVertices:!0})&&(n=!0),!dn(e.coordinates,t))return!1;return!!n}(i,o);default:throw new Error(“feature2 ”r“ geometry not supported”)}case“Polygon”:switch®{case“Point”:return Mt(o,i,{ignoreBoundary:!0});case“LineString”:return function(t,e){var n=!1,r=0;if(!pr(j(t),j(e)))return!1;for(;r<e.coordinates.length-1;r++)if(Mt({type:“Point”,coordinates:function(t,e){return[(t+e)/2,(t+e)/2]}(e.coordinates,e.coordinates)},t,{ignoreBoundary:!0})){n=!0;break}return n}(i,o);case“Polygon”:return function(t,e){if(!pr(j(t),j(e)))return!1;for(var n=0;n.length;n++)if(!Mt(e.coordinates[n],t))return!1;return!0}(i,o);case“MultiPoint”:return function(t,e){for(var n=0;n,t,{ignoreBoundary:!0}))return!1;return!0}(i,o);default:throw new Error(“feature2 ”r“ geometry not supported”)}default:throw new Error(“feature1 ”n“ geometry not supported”)}},t.booleanCrosses=function(t,e){var n=K(t),r=K(e),i=J(t),o=J(e);switch(n){case“MultiPoint”:switch®{case“LineString”:return gr(i,o);case“Polygon”:return yr(i,o);default:throw new Error(“feature2 ”r“ geometry not supported”)}case“LineString”:switch®{case“MultiPoint”:return gr(o,i);case“LineString”:return function(t,e){if(He(t,e).features.length>0)for(var n=0;n<t.coordinates.length-1;n++)for(var r=0;r<e.coordinates.length-1;r++){var i=!0;if(0!==r&&r!==e.coordinates.length-2||(i=!1),_r(t.coordinates,t.coordinates,e.coordinates,i))return!0}return!1}(i,o);case“Polygon”:return dr(i,o);default:throw new Error(“feature2 ”r“ geometry not supported”)}case“Polygon”:switch®{case“MultiPoint”:return yr(o,i);case“LineString”:return dr(o,i);default:throw new Error(“feature2 ”r“ geometry not supported”)}default:throw new Error(“feature1 ”n“ geometry not supported”)}},t.booleanClockwise=Jn,t.booleanOverlap=Er,t.booleanPointOnLine=dn,t.booleanEqual=function(t,e){if(!t)throw new Error(“feature1 is required”);if(!e)throw new Error(“feature2 is required”);return K(t)===K(e)&&new Na({precision:6}).compare(Jt(t),Jt(e))},t.booleanWithin=yn,t.clone=Ft,t.cleanCoords=Jt,t.clustersDbscan=function(t,e,n){if(“object”!=typeof(n=n||{}))throw new Error(“options is invalid”);var r=n.minPoints,i=n.units;if(W(t,“Point”,“Input must contain Points”),null==e)throw new Error(“maxDistance is required”);if(!(Math.sign(e)>0))throw new Error(“Invalid maxDistance”);if(!(null==r||Math.sign®>0))throw new Error(“Invalid minPoints”);t=Ft(t),r=r||3;var o=new Pa.DBSCAN,s=-1;return o.run(T(t),E(e,i),r,Dt).forEach((function(e){s++,e.forEach((function(e){var n=t.features;n.properties||(n.properties={}),n.properties.cluster=s,n.properties.dbscan=“core”}))})),o.noise.forEach((function(e){var n=t.features;n.properties||(n.properties={}),n.properties.cluster?n.properties.dbscan=“edge”:n.properties.dbscan=“noise”})),t},t.clustersKmeans=function(t,e){if(“object”!=typeof(e=e||{}))throw new Error(“options is invalid”);var n=e.numberOfClusters,r=e.mutate;W(t,“Point”,“Input must contain Points”);var i=t.features.length;(n=n||Math.round(Math.sqrt(i/2)))>i&&(n=i),!1!==r&&void 0!==r||(t=Ft(t));var o=T(t),s=o.slice(0,n),a=Da(o,n,s),u={};return a.centroids.forEach((function(t,e){u=t})),O(t,(function(t,e){var n=a.idxs;t.properties.cluster=n,t.properties.centroid=u})),t},t.pointToLineDistance=on,t.booleanParallel=function(t,e){if(!t)throw new Error(“line1 is required”);if(!e)throw new Error(“line2 is required”);if(“LineString”!==br(t,“line1”))throw new Error(“line1 must be a LineString”);if(“LineString”!==br(e,“line2”))throw new Error(“line2 must be a LineString”);for(var n=Ve(Jt(t)).features,r=Ve(Jt(e)).features,i=0;i<n.length;i++){var o=n.geometry.coordinates;if(!r)break;if(!function(t,e){return m(Ze(t,t))===m(Ze(e,e))}(o,r.geometry.coordinates))return!1}return!0},t.shortestPath=function(t,n,i){if(!I(i=i||{}))throw new Error(“options is invalid”);var o=i.resolution,s=i.minDistance,u=i.obstacles||c([]);if(!t)throw new Error(“start is required”);if(!n)throw new Error(“end is required”);if(o&&!b(o)||o<=0)throw new Error(“options.resolution must be a number, greater than 0”);if(s)throw new Error(“options.minDistance is not yet implemented”);var h=X(t),l=X(n);switch(t=r(h),n=r(l),K(u)){case“FeatureCollection”:if(0===u.features.length)return a();break;case“Polygon”:u=c();break;default:throw new Error(“invalid obstacles”)}var p=u;p.features.push(t),p.features.push(n);var f=j(rr(re(j(p)),1.15));o||(o=Dt([f,f],[f,f],i)/100),p.features.pop(),p.features.pop();for(var g=f,d=f,y=f,_=f,m=o/Dt(,[y,d],i)*(y-g),v=o/Dt(,[g,_],i)*(_-d),x=y-g,E=_-d,w=(x-Math.floor(x/m)*m)/2,N=[],C=,S=[],M=,L=1/0,P=1/0,O=_-(E-Math.floor(E/v)*v)/2,R=0;O>=d;){for(var T=[],A=,D=g+w,F=0;D<=y;){var q=r(),G=function(t,e){for(var n=0;n))return!0;return!1}(q,u);T.push(G?0:1),A.push(D+“|”+O);var B=Dt(q,t);!G&&B<L&&(L=B,S={x:F,y:R});var k=Dt(q,n);!G&&k<P&&(P=k,M={x:F,y:R}),D+=m,F++}C.push(T),N.push(A),O-=v,R++}var z=new Nr(C,{diagonal:!0}),U=z.grid[S.x],Y=z.grid[M.x],V=;return Fa.search(z,U,Y).forEach((function(t){var e=N[t.y].split(“|”);V.push([+e,+e])})),V.push(l),Jt(a(V))},t.voronoi=function(t,e){if(!I(e=e||{}))throw new Error(“options is invalid”);var n=e.bbox||;if(!t)throw new Error(“points is required”);if(!Array.isArray(n))throw new Error(“bbox is invalid”);return W(t,“Point”,“points”),c(function(){function t(t){return new Qr(t.map((function(r,i){var o=;return o.index=i,o.data=r,o})),r)}var e=Mr,n=Lr,r=null;return t.polygons=function(e){return t(e).polygons()},t.links=function(e){return t(e).links()},t.triangles=function(e){return t(e).triangles()},t.x=function(n){return arguments.length?(e=“function”==typeof n?n:qa(+n),t):e},t.y=function(e){return arguments.length?(n=“function”==typeof e?e:qa(+e),t):n},t.extent=function(e){return arguments.length?(r=null==e?null:[[+e[0],+e[1]],[+e[0],+e[1]]],t):r&&[[r[0],r[1]],[r[0],r[1]]]},t.size=function(e){return arguments.length?(r=null==e?null:[,[+e,+e]],t):r&&[r[0]-r[0],r[1]-r[1]]},t}().x((function(t){return t.geometry.coordinates})).y((function(t){return t.geometry.coordinates})).extent([[n,n],[n,n]]).polygons(t.features).map($r))},t.ellipse=ti,t.centerMean=ni,t.centerMedian=function(t,e){if(!I(e=e||{}))throw new Error(“options is invalid”);var n=e.counter||10;if(!b(n))throw new Error(“counter must be a number”);var r=e.weight,i=ni(t,{weight:e.weight}),o=c([]);return O(t,(function(t){o.features.push(he(t,{weight:t.properties}))})),o.properties={tolerance:e.tolerance,medianCandidates:[]},ri(i.geometry.coordinates,,o,n)},t.standardDeviationalEllipse=function(t,e){if(!I(e=e||{}))throw new Error(“options is invalid”);var n=e.steps||64,r=e.weight,i=e.properties||{};if(!b(n))throw new Error(“steps must be a number”);if(!I(i))throw new Error(“properties must be a number”);var o=T(t).length,s=ni(t,{weight:r}),a=0,u=0,h=0;O(t,(function(t){var e=t.properties||1,n=ii(U(t),U(s));a+=Math.pow(n.x,2)*e,u+=Math.pow(n.y,2)*e,h+=n.x*n.y*e}));var l=a-u,p=Math.sqrt(Math.pow(l,2)+4*Math.pow(h,2)),f=2*h,g=Math.atan((l+p)/f),d=180*g/Math.PI,y=0,_=0,m=0;O(t,(function(t){var e=t.properties||1,n=ii(U(t),U(s));y+=Math.pow(n.x*Math.cos(g)-n.y*Math.sin(g),2)*e,_+=Math.pow(n.x*Math.sin(g)+n.y*Math.cos(g),2)*e,m+=e}));var v=Math.sqrt(2*y/m),x=Math.sqrt(2*_/m),E=ti(s,v,x,{units:“degrees”,angle:d,steps:n,properties:i}),w=Pt(t,c()),N={meanCenterCoordinates:U(s),semiMajorAxis:v,semiMinorAxis:x,numberOfFeatures:o,angle:d,percentageWithinEllipse:100*T(w).length/o};return E.properties.standardDeviationalEllipse=N,E},t.difference=function(t,n){var r=J(t),i=J(n),o=t.properties||{};if(r=Ri®,i=Ri(i),!r)return null;if(!i)return e(r,o);var s=new nh,a=s.read®,u=s.read(i),c=of.difference(a,u);return c.isEmpty()?null:e((new rh).write©,o)},t.buffer=function(t,e,n){var r=(n=n||{}).units,i=n.steps||64;if(!t)throw new Error(“geojson is required”);if(“object”!=typeof n)throw new Error(“options must be an object”);if(“number”!=typeof i)throw new Error(“steps must be an number”);if(void 0===e)throw new Error(“radius is required”);if(i<=0)throw new Error(“steps must be greater than 0”);i=i||64,r=r||“kilometers”;var o=[];switch(t.type){case“GeometryCollection”:return A(t,(function(t){var n=co(t,e,r,i);n&&o.push(n)})),c(o);case“FeatureCollection”:return O(t,(function(t){var n=co(t,e,r,i);n&&O(n,(function(t){t&&o.push(t)}))})),c(o)}return co(t,e,r,i)},t.union=fo,t.intersect=go,t.dissolve=function(t,e){if(!I(e=e||{}))throw new Error(“options is invalid”);var n=e.propertyName;W(t,“Polygon”,“dissolve”);var r=Ft(t),i=r.features,o=[];i.forEach((function(t,e){t.properties.origIndexPosition=e}));var s=Xe();for(var u in s.load®,i){var c=i,h=!1;if(s.search©.features.forEach((function(t){c=i;var e=t.properties.origIndexPosition;if(o.length>0&&0!==e)if(e>o)e-=o.length;else{var r=yo(e,o);0!==r&&(e-=r)}if(e!==+u){var l=i;l&&c&&(void 0!==n&&l.properties!==c.properties||Er(c,l)&&function(t,e){return He(a(T(t)),a(T(e))).features.length>0}(c,l)&&(i=fo(c,l),o.push(t.properties.origIndexPosition),o.sort((function(t,e){return t-e})),s.remove(t),i.splice(e,1),c.properties.origIndexPosition=u,s.remove(c,(function(t,e){return t.properties.origIndexPosition===e.properties.origIndexPosition})),h=!0))}})),h){if(!c)continue;c.properties.origIndexPosition=u,s.insert©,u–}}return i.forEach((function(t){delete t.properties.origIndexPosition,delete t.bbox})),r},t.hexGrid=_o,t.mask=function(t,e){var n=function(t){return o(t&&t.geometry.coordinates||[[,[-180,90],,[180,-90],]])}(e),r=function(t){var e=[],n=;return F(t,(function(t){var r=t.geometry.coordinates,i=r,s=r.slice(1);e.push(o()),s.forEach((function(t){n.push(o())}))})),[c(e),c(n)]}(t),i=r,s=r;return function(t,e,n){var r=[];return r.push(t.geometry.coordinates),F(e,(function(t){r.push(t.geometry.coordinates)})),F(n,(function(t){r.push(t.geometry.coordinates)})),o®}(n,i=mo(i),s=mo(s))},t.squareGrid=xo,t.triangleGrid=Eo,t.interpolate=function(t,e,n){if(“object”!=typeof(n=n||{}))throw new Error(“options is invalid”);var r=n.gridType,i=n.property,o=n.weight;if(!t)throw new Error(“points is required”);if(W(t,“Point”,“input must contain Points”),!e)throw new Error(“cellSize is required”);if(void 0!==o&&“number”!=typeof o)throw new Error(“weight must be a number”);i=i||“elevation”,r=r||“square”,o=o||1;var s,a=j(t);switch®{case“point”:case“points”:s=vn(a,e,n);break;case“square”:case“squares”:s=xo(a,e,n);break;case“hex”:case“hexes”:s=_o(a,e,n);break;case“triangle”:case“triangles”:s=Eo(a,e,n);break;default:throw new Error(“invalid gridType”)}var u=[];return O(s,(function(e){var s=0,a=0;O(t,(function(t){var u,c=Dt(“point”===r?e:he(e),t,n);if(void 0!==i&&(u=t.properties),void 0===u&&(u=t.geometry.coordinates),void 0===u)throw new Error(“zValue is missing”);0===c&&(s=u);var h=1/Math.pow(c,o);a+=h,s+=h*u}));var c=Ft(e);c.properties=s/a,u.push©})),c(u)},t.pointOnSurface=an,t.polygonToLineString=Pn,t.lineStringToPolygon=Rn,t.inside=Mt,t.within=Pt,t.bezier=ne,t.nearest=Me,t.pointOnLine=Je,t.lineDistance=fn,t.radians2degrees=v,t.degrees2radians=x,t.distanceToDegrees=_,t.distanceToRadians=y,t.radiansToDistance=d,t.bearingToAngle=m,t.convertDistance=E,t.toMercator=$e,t.toWgs84=tn,t.randomPosition=oi,t.randomPoint=si,t.randomPolygon=ai,t.randomLineString=ui,t.getCluster=hi,t.clusterEach=li,t.clusterReduce=pi,t.createBins=fi,t.applyFilter=gi,t.propertiesContainsFilter=di,t.filterProperties=yi,t.earthRadius=wo,t.factors=bo,t.unitsFactors=Io,t.areaFactors=No,t.feature=e,t.geometry=n,t.point=r,t.points=i,t.polygon=o,t.polygons=s,t.lineString=a,t.lineStrings=u,t.featureCollection=c,t.multiLineString=h,t.multiPoint=l,t.multiPolygon=p,t.geometryCollection=f,t.round=g,t.radiansToLength=d,t.lengthToRadians=y,t.lengthToDegrees=_,t.bearingToAzimuth=m,t.radiansToDegrees=v,t.degreesToRadians=x,t.convertLength=E,t.convertArea=w,t.isNumber=b,t.isObject=I,t.validateBBox=N,t.validateId=C,t.getCoord=X,t.getCoords=U,t.containsNumber=Y,t.geojsonType=V,t.featureOf=H,t.collectionOf=W,t.getGeom=J,t.getGeomType=Z,t.getType=K,t.coordEach=S,t.coordReduce=M,t.propEach=L,t.propReduce=P,t.featureEach=O,t.featureReduce=R,t.coordAll=T,t.geomEach=A,t.geomReduce=D,t.flattenEach=F,t.flattenReduce=q,t.segmentEach=G,t.segmentReduce=B,t.lineEach=k,t.lineReduce=z,Object.defineProperty(t,“__esModule”,{value:!0})}(e)}]);