map-core-func 0.1.41 → 0.1.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -155,4 +155,4 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
155
155
 
156
156
  See the Apache Version 2.0 License for specific language governing permissions
157
157
  and limitations under the License.
158
- ***************************************************************************** */function um(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}var lm=function(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null};function cm(t,e){return t>e?1:t<e?-1:0}function hm(t,e,r){for(var n=new lm(null,null),i=n,o=n;;){var s=r(t,e.key);if(s<0){if(null===e.left)break;if(r(t,e.left.key)<0){var a=e.left;if(e.left=a.right,a.right=e,null===(e=a).left)break}o.left=e,o=e,e=e.left}else{if(!(s>0))break;if(null===e.right)break;if(r(t,e.right.key)>0){a=e.right;if(e.right=a.left,a.left=e,null===(e=a).right)break}i.right=e,i=e,e=e.right}}return i.right=e.left,o.left=e.right,e.left=n.right,e.right=n.left,e}function fm(t,e,r,n){var i=new lm(t,e);if(null===r)return i.left=i.right=null,i;var o=n(t,(r=hm(t,r,n)).key);return o<0?(i.left=r.left,i.right=r,r.left=null):o>=0&&(i.right=r.right,i.left=r,r.right=null),i}function pm(t,e,r){var n=null,i=null;if(e){var o=r((e=hm(t,e,r)).key,t);0===o?(n=e.left,i=e.right):o<0?(i=e.right,e.right=null,n=e):(n=e.left,e.left=null,i=e)}return{left:n,right:i}}function gm(t,e,r,n,i){if(t){n(e+(r?"└── ":"├── ")+i(t)+"\n");var o=e+(r?" ":"│ ");t.left&&gm(t.left,o,!1,n,i),t.right&&gm(t.right,o,!0,n,i)}}var Am=function(){function t(t){void 0===t&&(t=cm),this._root=null,this._size=0,this._comparator=t}return t.prototype.insert=function(t,e){return this._size++,this._root=fm(t,e,this._root,this._comparator)},t.prototype.add=function(t,e){var r=new lm(t,e);null===this._root&&(r.left=r.right=null,this._size++,this._root=r);var n=this._comparator,i=hm(t,this._root,n),o=n(t,i.key);return 0===o?this._root=i:(o<0?(r.left=i.left,r.right=i,i.left=null):o>0&&(r.right=i.right,r.left=i,i.right=null),this._size++,this._root=r),this._root},t.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},t.prototype._remove=function(t,e,r){var n;return null===e?null:0===r(t,(e=hm(t,e,r)).key)?(null===e.left?n=e.right:(n=hm(t,e.left,r)).right=e.right,this._size--,n):e},t.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=hm(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},t.prototype.findStatic=function(t){for(var e=this._root,r=this._comparator;e;){var n=r(t,e.key);if(0===n)return e;e=n<0?e.left:e.right}return null},t.prototype.find=function(t){return this._root&&(this._root=hm(t,this._root,this._comparator),0!==this._comparator(t,this._root.key))?null:this._root},t.prototype.contains=function(t){for(var e=this._root,r=this._comparator;e;){var n=r(t,e.key);if(0===n)return!0;e=n<0?e.left:e.right}return!1},t.prototype.forEach=function(t,e){for(var r=this._root,n=[],i=!1;!i;)null!==r?(n.push(r),r=r.left):0!==n.length?(r=n.pop(),t.call(e,r),r=r.right):i=!0;return this},t.prototype.range=function(t,e,r,n){for(var i=[],o=this._comparator,s=this._root;0!==i.length||s;)if(s)i.push(s),s=s.left;else{if(o((s=i.pop()).key,e)>0)break;if(o(s.key,t)>=0&&r.call(n,s))return this;s=s.right}return this},t.prototype.keys=function(){var t=[];return this.forEach((function(e){var r=e.key;return t.push(r)})),t},t.prototype.values=function(){var t=[];return this.forEach((function(e){var r=e.data;return t.push(r)})),t},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.left;)t=t.left;return t},t.prototype.maxNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.right;)t=t.right;return t},t.prototype.at=function(t){for(var e=this._root,r=!1,n=0,i=[];!r;)if(e)i.push(e),e=e.left;else if(i.length>0){if(e=i.pop(),n===t)return e;n++,e=e.right}else r=!0;return null},t.prototype.next=function(t){var e=this._root,r=null;if(t.right){for(r=t.right;r.left;)r=r.left;return r}for(var n=this._comparator;e;){var i=n(t.key,e.key);if(0===i)break;i<0?(r=e,e=e.left):e=e.right}return r},t.prototype.prev=function(t){var e=this._root,r=null;if(null!==t.left){for(r=t.left;r.right;)r=r.right;return r}for(var n=this._comparator;e;){var i=n(t.key,e.key);if(0===i)break;i<0?e=e.left:(r=e,e=e.right)}return r},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return function(t){var e=t,r=[],n=!1,i=new lm(null,null),o=i;for(;!n;)e?(r.push(e),e=e.left):r.length>0?e=(e=o=o.next=r.pop()).right:n=!0;return o.next=null,i.next}(this._root)},t.prototype.load=function(t,e,r){void 0===e&&(e=[]),void 0===r&&(r=!1);var n=t.length,i=this._comparator;if(r&&vm(t,e,0,n-1,i),null===this._root)this._root=dm(t,e,0,n),this._size=n;else{var o=function(t,e,r){var n=new lm(null,null),i=n,o=t,s=e;for(;null!==o&&null!==s;)r(o.key,s.key)<0?(i.next=o,o=o.next):(i.next=s,s=s.next),i=i.next;null!==o?i.next=o:null!==s&&(i.next=s);return n.next}(this.toList(),function(t,e){for(var r=new lm(null,null),n=r,i=0;i<t.length;i++)n=n.next=new lm(t[i],e[i]);return n.next=null,r.next}(t,e),i);n=this._size+n,this._root=ym({head:o},0,n)}return this},t.prototype.isEmpty=function(){return null===this._root},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),t.prototype.toString=function(t){void 0===t&&(t=function(t){return String(t.key)});var e=[];return gm(this._root,"",!0,(function(t){return e.push(t)}),t),e.join("")},t.prototype.update=function(t,e,r){var n=this._comparator,i=pm(t,this._root,n),o=i.left,s=i.right;n(t,e)<0?s=fm(e,r,s,n):o=fm(e,r,o,n),this._root=function(t,e,r){return null===e?t:(null===t||((e=hm(t.key,e,r)).left=t),e)}(o,s,n)},t.prototype.split=function(t){return pm(t,this._root,this._comparator)},t.prototype[Symbol.iterator]=function(){var t,e,r;return um(this,(function(n){switch(n.label){case 0:t=this._root,e=[],r=!1,n.label=1;case 1:return r?[3,6]:null===t?[3,2]:(e.push(t),t=t.left,[3,5]);case 2:return 0===e.length?[3,4]:[4,t=e.pop()];case 3:return n.sent(),t=t.right,[3,5];case 4:r=!0,n.label=5;case 5:return[3,1];case 6:return[2]}}))},t}();function dm(t,e,r,n){var i=n-r;if(i>0){var o=r+Math.floor(i/2),s=t[o],a=e[o],u=new lm(s,a);return u.left=dm(t,e,r,o),u.right=dm(t,e,o+1,n),u}return null}function ym(t,e,r){var n=r-e;if(n>0){var i=e+Math.floor(n/2),o=ym(t,e,i),s=t.head;return s.left=o,t.head=t.head.next,s.right=ym(t,i+1,r),s}return null}function vm(t,e,r,n,i){if(!(r>=n)){for(var o=t[r+n>>1],s=r-1,a=n+1;;){do{s++}while(i(t[s],o)<0);do{a--}while(i(t[a],o)>0);if(s>=a)break;var u=t[s];t[s]=t[a],t[a]=u,u=e[s],e[s]=e[a],e[a]=u}vm(t,e,r,a,i),vm(t,e,a+1,n,i)}}function mm(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _m(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Im(t,e,r){return e&&_m(t.prototype,e),r&&_m(t,r),t}var Em=function(t,e){return t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y},xm=function(t,e){if(e.ur.x<t.ll.x||t.ur.x<e.ll.x||e.ur.y<t.ll.y||t.ur.y<e.ll.y)return null;var r=t.ll.x<e.ll.x?e.ll.x:t.ll.x,n=t.ur.x<e.ur.x?t.ur.x:e.ur.x;return{ll:{x:r,y:t.ll.y<e.ll.y?e.ll.y:t.ll.y},ur:{x:n,y:t.ur.y<e.ur.y?t.ur.y:e.ur.y}}},Cm=Number.EPSILON;void 0===Cm&&(Cm=Math.pow(2,-52));var wm=Cm*Cm,bm=function(t,e){if(-Cm<t&&t<Cm&&-Cm<e&&e<Cm)return 0;var r=t-e;return r*r<wm*t*e?0:t<e?-1:1},Bm=function(){function t(){mm(this,t),this.reset()}return Im(t,[{key:"reset",value:function(){this.xRounder=new Sm,this.yRounder=new Sm}},{key:"round",value:function(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}]),t}(),Sm=function(){function t(){mm(this,t),this.tree=new Am,this.round(0)}return Im(t,[{key:"round",value:function(t){var e=this.tree.add(t),r=this.tree.prev(e);if(null!==r&&0===bm(e.key,r.key))return this.tree.remove(t),r.key;var n=this.tree.next(e);return null!==n&&0===bm(e.key,n.key)?(this.tree.remove(t),n.key):t}}]),t}(),Mm=new Bm,Lm=function(t,e){return t.x*e.y-t.y*e.x},Nm=function(t,e){return t.x*e.x+t.y*e.y},Tm=function(t,e,r){var n={x:e.x-t.x,y:e.y-t.y},i={x:r.x-t.x,y:r.y-t.y},o=Lm(n,i);return bm(o,0)},Rm=function(t){return Math.sqrt(Nm(t,t))},Dm=function(t,e,r){var n={x:e.x-t.x,y:e.y-t.y},i={x:r.x-t.x,y:r.y-t.y};return Nm(i,n)/Rm(i)/Rm(n)},Pm=function(t,e,r){return 0===e.y?null:{x:t.x+e.x/e.y*(r-t.y),y:r}},Qm=function(t,e,r){return 0===e.x?null:{x:r,y:t.y+e.y/e.x*(r-t.x)}},km=function(){function t(e,r){mm(this,t),void 0===e.events?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=r}return Im(t,null,[{key:"compare",value:function(e,r){var n=t.comparePoints(e.point,r.point);return 0!==n?n:(e.point!==r.point&&e.link(r),e.isLeft!==r.isLeft?e.isLeft?1:-1:Fm.compare(e.segment,r.segment))}},{key:"comparePoints",value:function(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}}]),Im(t,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var e=t.point.events,r=0,n=e.length;r<n;r++){var i=e[r];this.point.events.push(i),i.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var t=this.point.events.length,e=0;e<t;e++){var r=this.point.events[e];if(void 0===r.segment.consumedBy)for(var n=e+1;n<t;n++){var i=this.point.events[n];void 0===i.consumedBy&&(r.otherSE.point.events===i.otherSE.point.events&&r.segment.consume(i.segment))}}}},{key:"getAvailableLinkedEvents",value:function(){for(var t=[],e=0,r=this.point.events.length;e<r;e++){var n=this.point.events[e];n!==this&&!n.segment.ringOut&&n.segment.isInResult()&&t.push(n)}return t}},{key:"getLeftmostComparator",value:function(t){var e=this,r=new Map,n=function(n){var i,o,s,a,u,l=n.otherSE;r.set(n,{sine:(i=e.point,o=t.point,s=l.point,a={x:o.x-i.x,y:o.y-i.y},u={x:s.x-i.x,y:s.y-i.y},Lm(u,a)/Rm(u)/Rm(a)),cosine:Dm(e.point,t.point,l.point)})};return function(t,e){r.has(t)||n(t),r.has(e)||n(e);var i=r.get(t),o=i.sine,s=i.cosine,a=r.get(e),u=a.sine,l=a.cosine;return o>=0&&u>=0?s<l?1:s>l?-1:0:o<0&&u<0?s<l?-1:s>l?1:0:u<o?-1:u>o?1:0}}}]),t}(),Om=0,Fm=function(){function t(e,r,n,i){mm(this,t),this.id=++Om,this.leftSE=e,e.segment=this,e.otherSE=r,this.rightSE=r,r.segment=this,r.otherSE=e,this.rings=n,this.windings=i}return Im(t,null,[{key:"compare",value:function(t,e){var r=t.leftSE.point.x,n=e.leftSE.point.x,i=t.rightSE.point.x,o=e.rightSE.point.x;if(o<r)return 1;if(i<n)return-1;var s=t.leftSE.point.y,a=e.leftSE.point.y,u=t.rightSE.point.y,l=e.rightSE.point.y;if(r<n){if(a<s&&a<u)return 1;if(a>s&&a>u)return-1;var c=t.comparePoint(e.leftSE.point);if(c<0)return 1;if(c>0)return-1;var h=e.comparePoint(t.rightSE.point);return 0!==h?h:-1}if(r>n){if(s<a&&s<l)return-1;if(s>a&&s>l)return 1;var f=e.comparePoint(t.leftSE.point);if(0!==f)return f;var p=t.comparePoint(e.rightSE.point);return p<0?1:p>0?-1:1}if(s<a)return-1;if(s>a)return 1;if(i<o){var g=e.comparePoint(t.rightSE.point);if(0!==g)return g}if(i>o){var A=t.comparePoint(e.rightSE.point);if(A<0)return 1;if(A>0)return-1}if(i!==o){var d=u-s,y=i-r,v=l-a,m=o-n;if(d>y&&v<m)return 1;if(d<y&&v>m)return-1}return i>o?1:i<o||u<l?-1:u>l?1:t.id<e.id?-1:t.id>e.id?1:0}}]),Im(t,[{key:"replaceRightSE",value:function(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var t=this.leftSE.point.y,e=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t<e?t:e},ur:{x:this.rightSE.point.x,y:t>e?t:e}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}},{key:"comparePoint",value:function(t){if(this.isAnEndpoint(t))return 0;var e=this.leftSE.point,r=this.rightSE.point,n=this.vector();if(e.x===r.x)return t.x===e.x?0:t.x<e.x?1:-1;var i=(t.y-e.y)/n.y,o=e.x+i*n.x;if(t.x===o)return 0;var s=(t.x-e.x)/n.x,a=e.y+s*n.y;return t.y===a?0:t.y<a?-1:1}},{key:"getIntersection",value:function(t){var e=this.bbox(),r=t.bbox(),n=xm(e,r);if(null===n)return null;var i=this.leftSE.point,o=this.rightSE.point,s=t.leftSE.point,a=t.rightSE.point,u=Em(e,s)&&0===this.comparePoint(s),l=Em(r,i)&&0===t.comparePoint(i),c=Em(e,a)&&0===this.comparePoint(a),h=Em(r,o)&&0===t.comparePoint(o);if(l&&u)return h&&!c?o:!h&&c?a:null;if(l)return c&&i.x===a.x&&i.y===a.y?null:i;if(u)return h&&o.x===s.x&&o.y===s.y?null:s;if(h&&c)return null;if(h)return o;if(c)return a;var f=function(t,e,r,n){if(0===e.x)return Qm(r,n,t.x);if(0===n.x)return Qm(t,e,r.x);if(0===e.y)return Pm(r,n,t.y);if(0===n.y)return Pm(t,e,r.y);var i=Lm(e,n);if(0==i)return null;var o={x:r.x-t.x,y:r.y-t.y},s=Lm(o,e)/i,a=Lm(o,n)/i;return{x:(t.x+a*e.x+(r.x+s*n.x))/2,y:(t.y+a*e.y+(r.y+s*n.y))/2}}(i,this.vector(),s,t.vector());return null===f?null:Em(n,f)?Mm.round(f.x,f.y):null}},{key:"split",value:function(e){var r=[],n=void 0!==e.events,i=new km(e,!0),o=new km(e,!1),s=this.rightSE;this.replaceRightSE(o),r.push(o),r.push(i);var a=new t(i,s,this.rings.slice(),this.windings.slice());return km.comparePoints(a.leftSE.point,a.rightSE.point)>0&&a.swapEvents(),km.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(i.checkForConsuming(),o.checkForConsuming()),r}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var e=0,r=this.windings.length;e<r;e++)this.windings[e]*=-1}},{key:"consume",value:function(e){for(var r=this,n=e;r.consumedBy;)r=r.consumedBy;for(;n.consumedBy;)n=n.consumedBy;var i=t.compare(r,n);if(0!==i){if(i>0){var o=r;r=n,n=o}if(r.prev===n){var s=r;r=n,n=s}for(var a=0,u=n.rings.length;a<u;a++){var l=n.rings[a],c=n.windings[a],h=r.rings.indexOf(l);-1===h?(r.rings.push(l),r.windings.push(c)):r.windings[h]+=c}n.rings=null,n.windings=null,n.consumedBy=r,n.leftSE.consumedBy=r.leftSE,n.rightSE.consumedBy=r.rightSE}}},{key:"prevInResult",value:function(){return void 0!==this._prevInResult||(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null),this._prevInResult}},{key:"beforeState",value:function(){if(void 0!==this._beforeState)return this._beforeState;if(this.prev){var t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}else this._beforeState={rings:[],windings:[],multiPolys:[]};return this._beforeState}},{key:"afterState",value:function(){if(void 0!==this._afterState)return this._afterState;var t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};for(var e=this._afterState.rings,r=this._afterState.windings,n=this._afterState.multiPolys,i=0,o=this.rings.length;i<o;i++){var s=this.rings[i],a=this.windings[i],u=e.indexOf(s);-1===u?(e.push(s),r.push(a)):r[u]+=a}for(var l=[],c=[],h=0,f=e.length;h<f;h++)if(0!==r[h]){var p=e[h],g=p.poly;if(-1===c.indexOf(g))if(p.isExterior)l.push(g);else{-1===c.indexOf(g)&&c.push(g);var A=l.indexOf(p.poly);-1!==A&&l.splice(A,1)}}for(var d=0,y=l.length;d<y;d++){var v=l[d].multiPoly;-1===n.indexOf(v)&&n.push(v)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(void 0!==this._isInResult)return this._isInResult;var t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch(Wm.type){case"union":var r=0===t.length,n=0===e.length;this._isInResult=r!==n;break;case"intersection":var i,o;t.length<e.length?(i=t.length,o=e.length):(i=e.length,o=t.length),this._isInResult=o===Wm.numMultiPolys&&i<o;break;case"xor":var s=Math.abs(t.length-e.length);this._isInResult=s%2==1;break;case"difference":var a=function(t){return 1===t.length&&t[0].isSubject};this._isInResult=a(t)!==a(e);break;default:throw new Error("Unrecognized operation type found ".concat(Wm.type))}return this._isInResult}}],[{key:"fromRing",value:function(e,r,n){var i,o,s,a=km.comparePoints(e,r);if(a<0)i=e,o=r,s=1;else{if(!(a>0))throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));i=r,o=e,s=-1}return new t(new km(i,!0),new km(o,!1),[n],[s])}}]),t}(),Gm=function(){function t(e,r,n){if(mm(this,t),!Array.isArray(e)||0===e.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=r,this.isExterior=n,this.segments=[],"number"!=typeof e[0][0]||"number"!=typeof e[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var i=Mm.round(e[0][0],e[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};for(var o=i,s=1,a=e.length;s<a;s++){if("number"!=typeof e[s][0]||"number"!=typeof e[s][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var u=Mm.round(e[s][0],e[s][1]);u.x===o.x&&u.y===o.y||(this.segments.push(Fm.fromRing(o,u,this)),u.x<this.bbox.ll.x&&(this.bbox.ll.x=u.x),u.y<this.bbox.ll.y&&(this.bbox.ll.y=u.y),u.x>this.bbox.ur.x&&(this.bbox.ur.x=u.x),u.y>this.bbox.ur.y&&(this.bbox.ur.y=u.y),o=u)}i.x===o.x&&i.y===o.y||this.segments.push(Fm.fromRing(o,i,this))}return Im(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,r=this.segments.length;e<r;e++){var n=this.segments[e];t.push(n.leftSE),t.push(n.rightSE)}return t}}]),t}(),Um=function(){function t(e,r){if(mm(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Gm(e[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(var n=1,i=e.length;n<i;n++){var o=new Gm(e[n],this,!1);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=r}return Im(t,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),e=0,r=this.interiorRings.length;e<r;e++)for(var n=this.interiorRings[e].getSweepEvents(),i=0,o=n.length;i<o;i++)t.push(n[i]);return t}}]),t}(),qm=function(){function t(e,r){if(mm(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{"number"==typeof e[0][0][0]&&(e=[e])}catch(t){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var n=0,i=e.length;n<i;n++){var o=new Um(e[n],this);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=r}return Im(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,r=this.polys.length;e<r;e++)for(var n=this.polys[e].getSweepEvents(),i=0,o=n.length;i<o;i++)t.push(n[i]);return t}}]),t}(),jm=function(){function t(e){mm(this,t),this.events=e;for(var r=0,n=e.length;r<n;r++)e[r].segment.ringOut=this;this.poly=null}return Im(t,null,[{key:"factory",value:function(e){for(var r=[],n=0,i=e.length;n<i;n++){var o=e[n];if(o.isInResult()&&!o.ringOut){for(var s=null,a=o.leftSE,u=o.rightSE,l=[a],c=a.point,h=[];s=a,a=u,l.push(a),a.point!==c;)for(;;){var f=a.getAvailableLinkedEvents();if(0===f.length){var p=l[0].point,g=l[l.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(p.x,",")+" ".concat(p.y,"]. Last matching segment found ends at")+" [".concat(g.x,", ").concat(g.y,"]."))}if(1===f.length){u=f[0].otherSE;break}for(var A=null,d=0,y=h.length;d<y;d++)if(h[d].point===a.point){A=d;break}if(null===A){h.push({index:l.length,point:a.point});var v=a.getLeftmostComparator(s);u=f.sort(v)[0].otherSE;break}var m=h.splice(A)[0],_=l.splice(m.index);_.unshift(_[0].otherSE),r.push(new t(_.reverse()))}r.push(new t(l))}}return r}}]),Im(t,[{key:"getGeom",value:function(){for(var t=this.events[0].point,e=[t],r=1,n=this.events.length-1;r<n;r++){var i=this.events[r].point,o=this.events[r+1].point;0!==Tm(i,t,o)&&(e.push(i),t=i)}if(1===e.length)return null;var s=e[0],a=e[1];0===Tm(s,t,a)&&e.shift(),e.push(e[0]);for(var u=this.isExteriorRing()?1:-1,l=this.isExteriorRing()?0:e.length-1,c=this.isExteriorRing()?e.length:-1,h=[],f=l;f!=c;f+=u)h.push([e[f].x,e[f].y]);return h}},{key:"isExteriorRing",value:function(){if(void 0===this._isExteriorRing){var t=this.enclosingRing();this._isExteriorRing=!t||!t.isExteriorRing()}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return void 0===this._enclosingRing&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var t=this.events[0],e=1,r=this.events.length;e<r;e++){var n=this.events[e];km.compare(t,n)>0&&(t=n)}for(var i=t.segment.prevInResult(),o=i?i.prevInResult():null;;){if(!i)return null;if(!o)return i.ringOut;if(o.ringOut!==i.ringOut)return o.ringOut.enclosingRing()!==i.ringOut?i.ringOut:i.ringOut.enclosingRing();i=o.prevInResult(),o=i?i.prevInResult():null}}}]),t}(),Vm=function(){function t(e){mm(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return Im(t,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(null===t[0])return null;for(var e=0,r=this.interiorRings.length;e<r;e++){var n=this.interiorRings[e].getGeom();null!==n&&t.push(n)}return t}}]),t}(),zm=function(){function t(e){mm(this,t),this.rings=e,this.polys=this._composePolys(e)}return Im(t,[{key:"getGeom",value:function(){for(var t=[],e=0,r=this.polys.length;e<r;e++){var n=this.polys[e].getGeom();null!==n&&t.push(n)}return t}},{key:"_composePolys",value:function(t){for(var e=[],r=0,n=t.length;r<n;r++){var i=t[r];if(!i.poly)if(i.isExteriorRing())e.push(new Vm(i));else{var o=i.enclosingRing();o.poly||e.push(new Vm(o)),o.poly.addInterior(i)}}return e}}]),t}(),Ym=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Fm.compare;mm(this,t),this.queue=e,this.tree=new Am(r),this.segments=[]}return Im(t,[{key:"process",value:function(t){var e=t.segment,r=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),r;var n=t.isLeft?this.tree.insert(e):this.tree.find(e);if(!n)throw new Error("Unable to find segment #".concat(e.id," ")+"[".concat(e.leftSE.point.x,", ").concat(e.leftSE.point.y,"] -> ")+"[".concat(e.rightSE.point.x,", ").concat(e.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var i=n,o=n,s=void 0,a=void 0;void 0===s;)null===(i=this.tree.prev(i))?s=null:void 0===i.key.consumedBy&&(s=i.key);for(;void 0===a;)null===(o=this.tree.next(o))?a=null:void 0===o.key.consumedBy&&(a=o.key);if(t.isLeft){var u=null;if(s){var l=s.getIntersection(e);if(null!==l&&(e.isAnEndpoint(l)||(u=l),!s.isAnEndpoint(l)))for(var c=this._splitSafely(s,l),h=0,f=c.length;h<f;h++)r.push(c[h])}var p=null;if(a){var g=a.getIntersection(e);if(null!==g&&(e.isAnEndpoint(g)||(p=g),!a.isAnEndpoint(g)))for(var A=this._splitSafely(a,g),d=0,y=A.length;d<y;d++)r.push(A[d])}if(null!==u||null!==p){var v=null;if(null===u)v=p;else if(null===p)v=u;else{v=km.comparePoints(u,p)<=0?u:p}this.queue.remove(e.rightSE),r.push(e.rightSE);for(var m=e.split(v),_=0,I=m.length;_<I;_++)r.push(m[_])}r.length>0?(this.tree.remove(e),r.push(t)):(this.segments.push(e),e.prev=s)}else{if(s&&a){var E=s.getIntersection(a);if(null!==E){if(!s.isAnEndpoint(E))for(var x=this._splitSafely(s,E),C=0,w=x.length;C<w;C++)r.push(x[C]);if(!a.isAnEndpoint(E))for(var b=this._splitSafely(a,E),B=0,S=b.length;B<S;B++)r.push(b[B])}}this.tree.remove(e)}return r}},{key:"_splitSafely",value:function(t,e){this.tree.remove(t);var r=t.rightSE;this.queue.remove(r);var n=t.split(e);return n.push(r),void 0===t.consumedBy&&this.tree.insert(t),n}}]),t}(),Hm="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,Xm="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,Jm=function(){function t(){mm(this,t)}return Im(t,[{key:"run",value:function(t,e,r){Wm.type=t,Mm.reset();for(var n=[new qm(e,!0)],i=0,o=r.length;i<o;i++)n.push(new qm(r[i],!1));if(Wm.numMultiPolys=n.length,"difference"===Wm.type)for(var s=n[0],a=1;a<n.length;)null!==xm(n[a].bbox,s.bbox)?a++:n.splice(a,1);if("intersection"===Wm.type)for(var u=0,l=n.length;u<l;u++)for(var c=n[u],h=u+1,f=n.length;h<f;h++)if(null===xm(c.bbox,n[h].bbox))return[];for(var p=new Am(km.compare),g=0,A=n.length;g<A;g++)for(var d=n[g].getSweepEvents(),y=0,v=d.length;y<v;y++)if(p.insert(d[y]),p.size>Hm)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var m=new Ym(p),_=p.size,I=p.pop();I;){var E=I.key;if(p.size===_){var x=E.segment;throw new Error("Unable to pop() ".concat(E.isLeft?"left":"right"," SweepEvent ")+"[".concat(E.point.x,", ").concat(E.point.y,"] from segment #").concat(x.id," ")+"[".concat(x.leftSE.point.x,", ").concat(x.leftSE.point.y,"] -> ")+"[".concat(x.rightSE.point.x,", ").concat(x.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(p.size>Hm)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(m.segments.length>Xm)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var C=m.process(E),w=0,b=C.length;w<b;w++){var B=C[w];void 0===B.consumedBy&&p.insert(B)}_=p.size,I=p.pop()}Mm.reset();var S=jm.factory(m.segments);return new zm(S).getGeom()}}]),t}(),Wm=new Jm,Km={union:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return Wm.run("union",t,r)},intersection:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return Wm.run("intersection",t,r)},xor:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return Wm.run("xor",t,r)},difference:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return Wm.run("difference",t,r)}};"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(t){if(null==this)throw new TypeError(this+" is not an object");var e=Object(this),r=Math.max(Math.min(e.length,9007199254740991),0)||0,n=1 in arguments&&parseInt(Number(arguments[1]),10)||0;n=n<0?Math.max(r+n,0):Math.min(n,r);var i=2 in arguments&&void 0!==arguments[2]?parseInt(Number(arguments[2]),10)||0:r;for(i=i<0?Math.max(r+arguments[2],0):Math.min(i,r);n<i;)e[n]=t,++n;return e},writable:!0}),Number.isFinite=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},Number.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(t){return t!=t},Math.trunc=Math.trunc||function(t){return t<0?Math.ceil(t):Math.floor(t)};var Zm=function(){};Zm.prototype.interfaces_=function(){return[]},Zm.prototype.getClass=function(){return Zm},Zm.prototype.equalsWithTolerance=function(t,e,r){return Math.abs(t-e)<=r};var $m=function(t){function e(e){t.call(this,e),this.name="IllegalArgumentException",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),t_=function(){},e_={MAX_VALUE:{configurable:!0}};t_.isNaN=function(t){return Number.isNaN(t)},t_.doubleToLongBits=function(t){return t},t_.longBitsToDouble=function(t){return t},t_.isInfinite=function(t){return!Number.isFinite(t)},e_.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(t_,e_);var r_=function(){},n_=function(){},i_=function(){};function o_(){}var s_=function t(){if(this.x=null,this.y=null,this.z=null,0===arguments.length)this.x=0,this.y=0,this.z=t.NULL_ORDINATE;else if(1===arguments.length){var e=arguments[0];this.x=e.x,this.y=e.y,this.z=e.z}else 2===arguments.length?(this.x=arguments[0],this.y=arguments[1],this.z=t.NULL_ORDINATE):3===arguments.length&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},a_={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};s_.prototype.setOrdinate=function(t,e){switch(t){case s_.X:this.x=e;break;case s_.Y:this.y=e;break;case s_.Z:this.z=e;break;default:throw new $m("Invalid ordinate index: "+t)}},s_.prototype.equals2D=function(){if(1===arguments.length){var t=arguments[0];return this.x===t.x&&this.y===t.y}if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!Zm.equalsWithTolerance(this.x,e.x,r)&&!!Zm.equalsWithTolerance(this.y,e.y,r)}},s_.prototype.getOrdinate=function(t){switch(t){case s_.X:return this.x;case s_.Y:return this.y;case s_.Z:return this.z}throw new $m("Invalid ordinate index: "+t)},s_.prototype.equals3D=function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||t_.isNaN(this.z))&&t_.isNaN(t.z)},s_.prototype.equals=function(t){return t instanceof s_&&this.equals2D(t)},s_.prototype.equalInZ=function(t,e){return Zm.equalsWithTolerance(this.z,t.z,e)},s_.prototype.compareTo=function(t){var e=t;return this.x<e.x?-1:this.x>e.x?1:this.y<e.y?-1:this.y>e.y?1:0},s_.prototype.clone=function(){},s_.prototype.copy=function(){return new s_(this)},s_.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},s_.prototype.distance3D=function(t){var e=this.x-t.x,r=this.y-t.y,n=this.z-t.z;return Math.sqrt(e*e+r*r+n*n)},s_.prototype.distance=function(t){var e=this.x-t.x,r=this.y-t.y;return Math.sqrt(e*e+r*r)},s_.prototype.hashCode=function(){var t=17;return t=37*(t=37*t+s_.hashCode(this.x))+s_.hashCode(this.y)},s_.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},s_.prototype.interfaces_=function(){return[r_,n_,o_]},s_.prototype.getClass=function(){return s_},s_.hashCode=function(){if(1===arguments.length){var t=t_.doubleToLongBits(arguments[0]);return Math.trunc((t^t)>>>32)}},a_.DimensionalComparator.get=function(){return u_},a_.serialVersionUID.get=function(){return 0x5cbf2c235c7e5800},a_.NULL_ORDINATE.get=function(){return t_.NaN},a_.X.get=function(){return 0},a_.Y.get=function(){return 1},a_.Z.get=function(){return 2},Object.defineProperties(s_,a_);var u_=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 $m("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};u_.prototype.compare=function(t,e){var r=t,n=e,i=u_.compare(r.x,n.x);if(0!==i)return i;var o=u_.compare(r.y,n.y);return 0!==o?o:this._dimensionsToTest<=2?0:u_.compare(r.z,n.z)},u_.prototype.interfaces_=function(){return[i_]},u_.prototype.getClass=function(){return u_},u_.compare=function(t,e){return t<e?-1:t>e?1:t_.isNaN(t)?t_.isNaN(e)?0:-1:t_.isNaN(e)?1:0};var l_=function(){};l_.prototype.create=function(){},l_.prototype.interfaces_=function(){return[]},l_.prototype.getClass=function(){return l_};var c_=function(){},h_={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};c_.prototype.interfaces_=function(){return[]},c_.prototype.getClass=function(){return c_},c_.toLocationSymbol=function(t){switch(t){case c_.EXTERIOR:return"e";case c_.BOUNDARY:return"b";case c_.INTERIOR:return"i";case c_.NONE:return"-"}throw new $m("Unknown location value: "+t)},h_.INTERIOR.get=function(){return 0},h_.BOUNDARY.get=function(){return 1},h_.EXTERIOR.get=function(){return 2},h_.NONE.get=function(){return-1},Object.defineProperties(c_,h_);var f_=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},p_=function(){},g_={LOG_10:{configurable:!0}};p_.prototype.interfaces_=function(){return[]},p_.prototype.getClass=function(){return p_},p_.log10=function(t){var e=Math.log(t);return t_.isInfinite(e)||t_.isNaN(e)?e:e/p_.LOG_10},p_.min=function(t,e,r,n){var i=t;return e<i&&(i=e),r<i&&(i=r),n<i&&(i=n),i},p_.clamp=function(){if("number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1],r=arguments[2];return t<e?e:t>r?r:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var n=arguments[0],i=arguments[1],o=arguments[2];return n<i?i:n>o?o:n}},p_.wrap=function(t,e){return t<0?e- -t%e:t%e},p_.max=function(){if(3===arguments.length){var t=arguments[1],e=arguments[2],r=arguments[0];return t>r&&(r=t),e>r&&(r=e),r}if(4===arguments.length){var n=arguments[1],i=arguments[2],o=arguments[3],s=arguments[0];return n>s&&(s=n),i>s&&(s=i),o>s&&(s=o),s}},p_.average=function(t,e){return(t+e)/2},g_.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(p_,g_);var A_=function(t){this.str=t};A_.prototype.append=function(t){this.str+=t},A_.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},A_.prototype.toString=function(t){return this.str};var d_=function(t){this.value=t};d_.prototype.intValue=function(){return this.value},d_.prototype.compareTo=function(t){return this.value<t?-1:this.value>t?1:0},d_.isNaN=function(t){return Number.isNaN(t)};var y_=function(){};y_.isWhitespace=function(t){return t<=32&&t>=0||127===t},y_.toUpperCase=function(t){return t.toUpperCase()};var v_=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 r=arguments[0];this.init(r)}else if("string"==typeof arguments[0]){t.call(this,t.parse(arguments[0]))}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.init(n,i)}},m_={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}};v_.prototype.le=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<=t._lo},v_.prototype.extractSignificantDigits=function(t,e){var r=this.abs(),n=v_.magnitude(r._hi),i=v_.TEN.pow(n);(r=r.divide(i)).gt(v_.TEN)?(r=r.divide(v_.TEN),n+=1):r.lt(v_.ONE)&&(r=r.multiply(v_.TEN),n-=1);for(var o=n+1,s=new A_,a=v_.MAX_PRINT_DIGITS-1,u=0;u<=a;u++){t&&u===o&&s.append(".");var l=Math.trunc(r._hi);if(l<0)break;var c=!1,h=0;l>9?(c=!0,h="9"):h="0"+l,s.append(h),r=r.subtract(v_.valueOf(l)).multiply(v_.TEN),c&&r.selfAdd(v_.TEN);var f=!0,p=v_.magnitude(r._hi);if(p<0&&Math.abs(p)>=a-u&&(f=!1),!f)break}return e[0]=n,s.toString()},v_.prototype.sqr=function(){return this.multiply(this)},v_.prototype.doubleValue=function(){return this._hi+this._lo},v_.prototype.subtract=function(){if(arguments[0]instanceof v_){var t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){var e=arguments[0];return this.add(-e)}},v_.prototype.equals=function(){if(1===arguments.length){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},v_.prototype.isZero=function(){return 0===this._hi&&0===this._lo},v_.prototype.selfSubtract=function(){if(arguments[0]instanceof v_){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)}},v_.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},v_.prototype.min=function(t){return this.le(t)?this:t},v_.prototype.selfDivide=function(){if(1===arguments.length){if(arguments[0]instanceof v_){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 r,n,i,o,s=arguments[0],a=arguments[1],u=null,l=null,c=null,h=null;return i=this._hi/s,h=(u=(c=v_.SPLIT*i)-(u=c-i))*(l=(h=v_.SPLIT*s)-(l=h-s))-(o=i*s)+u*(n=s-l)+(r=i-u)*l+r*n,h=i+(c=(this._hi-o-h+this._lo-i*a)/s),this._hi=h,this._lo=i-h+c,this}},v_.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},v_.prototype.divide=function(){if(arguments[0]instanceof v_){var t,e,r,n,i=arguments[0],o=null,s=null,a=null,u=null;return t=(r=this._hi/i._hi)-(o=(a=v_.SPLIT*r)-(o=a-r)),u=o*(s=(u=v_.SPLIT*i._hi)-(s=u-i._hi))-(n=r*i._hi)+o*(e=i._hi-s)+t*s+t*e,a=(this._hi-n-u+this._lo-r*i._lo)/i._hi,new v_(u=r+a,r-u+a)}if("number"==typeof arguments[0]){var l=arguments[0];return t_.isNaN(l)?v_.createNaN():v_.copy(this).selfDivide(l,0)}},v_.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},v_.prototype.pow=function(t){if(0===t)return v_.valueOf(1);var e=new v_(this),r=v_.valueOf(1),n=Math.abs(t);if(n>1)for(;n>0;)n%2==1&&r.selfMultiply(e),(n/=2)>0&&(e=e.sqr());else r=e;return t<0?r.reciprocal():r},v_.prototype.ceil=function(){if(this.isNaN())return v_.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new v_(t,e)},v_.prototype.compareTo=function(t){var e=t;return this._hi<e._hi?-1:this._hi>e._hi?1:this._lo<e._lo?-1:this._lo>e._lo?1:0},v_.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},v_.prototype.setValue=function(){if(arguments[0]instanceof v_){var t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){var e=arguments[0];return this.init(e),this}},v_.prototype.max=function(t){return this.ge(t)?this:t},v_.prototype.sqrt=function(){if(this.isZero())return v_.valueOf(0);if(this.isNegative())return v_.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,r=v_.valueOf(e),n=this.subtract(r.sqr())._hi*(.5*t);return r.add(n)},v_.prototype.selfAdd=function(){if(1===arguments.length){if(arguments[0]instanceof v_){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if("number"==typeof arguments[0]){var e,r,n,i,o,s=arguments[0],a=null;return a=(n=this._hi+s)-(i=n-this._hi),r=(o=(a=s-i+(this._hi-a))+this._lo)+(n-(e=n+o)),this._hi=e+r,this._lo=r+(e-this._hi),this}}else if(2===arguments.length){var u,l,c,h,f=arguments[0],p=arguments[1],g=null,A=null,d=null;c=this._hi+f,l=this._lo+p,A=c-(d=c-this._hi),g=l-(h=l-this._lo);var y=(u=c+(d=(A=f-d+(this._hi-A))+l))+(d=(g=p-h+(this._lo-g))+(d+(c-u))),v=d+(u-y);return this._hi=y,this._lo=v,this}},v_.prototype.selfMultiply=function(){if(1===arguments.length){if(arguments[0]instanceof v_){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 r,n,i=arguments[0],o=arguments[1],s=null,a=null,u=null,l=null;s=(u=v_.SPLIT*this._hi)-this._hi,l=v_.SPLIT*i,s=u-s,r=this._hi-s,a=l-i;var c=(u=this._hi*i)+(l=s*(a=l-a)-u+s*(n=i-a)+r*a+r*n+(this._hi*o+this._lo*i)),h=l+(s=u-c);return this._hi=c,this._lo=h,this}},v_.prototype.selfSqr=function(){return this.selfMultiply(this)},v_.prototype.floor=function(){if(this.isNaN())return v_.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new v_(t,e)},v_.prototype.negate=function(){return this.isNaN()?this:new v_(-this._hi,-this._lo)},v_.prototype.clone=function(){},v_.prototype.multiply=function(){if(arguments[0]instanceof v_){var t=arguments[0];return t.isNaN()?v_.createNaN():v_.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){var e=arguments[0];return t_.isNaN(e)?v_.createNaN():v_.copy(this).selfMultiply(e,0)}},v_.prototype.isNaN=function(){return t_.isNaN(this._hi)},v_.prototype.intValue=function(){return Math.trunc(this._hi)},v_.prototype.toString=function(){var t=v_.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()},v_.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),r=this.extractSignificantDigits(!0,e),n=e[0]+1,i=r;if("."===r.charAt(0))i="0"+r;else if(n<0)i="0."+v_.stringOfChar("0",-n)+r;else if(-1===r.indexOf(".")){var o=n-r.length;i=r+v_.stringOfChar("0",o)+".0"}return this.isNegative()?"-"+i:i},v_.prototype.reciprocal=function(){var t,e,r,n,i=null,o=null,s=null,a=null;t=(r=1/this._hi)-(i=(s=v_.SPLIT*r)-(i=s-r)),o=(a=v_.SPLIT*this._hi)-this._hi;var u=r+(s=(1-(n=r*this._hi)-(a=i*(o=a-o)-n+i*(e=this._hi-o)+t*o+t*e)-r*this._lo)/this._hi);return new v_(u,r-u+s)},v_.prototype.toSciNotation=function(){if(this.isZero())return v_.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),r=this.extractSignificantDigits(!1,e),n=v_.SCI_NOT_EXPONENT_CHAR+e[0];if("0"===r.charAt(0))throw new Error("Found leading zero: "+r);var i="";r.length>1&&(i=r.substring(1));var o=r.charAt(0)+"."+i;return this.isNegative()?"-"+o+n:o+n},v_.prototype.abs=function(){return this.isNaN()?v_.NaN:this.isNegative()?this.negate():new v_(this)},v_.prototype.isPositive=function(){return(this._hi>0||0===this._hi)&&this._lo>0},v_.prototype.lt=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<t._lo},v_.prototype.add=function(){if(arguments[0]instanceof v_){var t=arguments[0];return v_.copy(this).selfAdd(t)}if("number"==typeof arguments[0]){var e=arguments[0];return v_.copy(this).selfAdd(e)}},v_.prototype.init=function(){if(1===arguments.length){if("number"==typeof arguments[0]){var t=arguments[0];this._hi=t,this._lo=0}else if(arguments[0]instanceof v_){var e=arguments[0];this._hi=e._hi,this._lo=e._lo}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this._hi=r,this._lo=n}},v_.prototype.gt=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>t._lo},v_.prototype.isNegative=function(){return(this._hi<0||0===this._hi)&&this._lo<0},v_.prototype.trunc=function(){return this.isNaN()?v_.NaN:this.isPositive()?this.floor():this.ceil()},v_.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},v_.prototype.interfaces_=function(){return[o_,r_,n_]},v_.prototype.getClass=function(){return v_},v_.sqr=function(t){return v_.valueOf(t).selfMultiply(t)},v_.valueOf=function(){return"string"==typeof arguments[0]?v_.parse(arguments[0]):"number"==typeof arguments[0]?new v_(arguments[0]):void 0},v_.sqrt=function(t){return v_.valueOf(t).sqrt()},v_.parse=function(t){for(var e=0,r=t.length;y_.isWhitespace(t.charAt(e));)e++;var n=!1;if(e<r){var i=t.charAt(e);"-"!==i&&"+"!==i||(e++,"-"===i&&(n=!0))}for(var o=new v_,s=0,a=0,u=0;!(e>=r);){var l=t.charAt(e);if(e++,y_.isDigit(l)){var c=l-"0";o.selfMultiply(v_.TEN),o.selfAdd(c),s++}else{if("."!==l){if("e"===l||"E"===l){var h=t.substring(e);try{u=d_.parseInt(h)}catch(e){throw e instanceof Error?new Error("Invalid exponent "+h+" in string "+t):e}break}throw new Error("Unexpected character '"+l+"' at position "+e+" in string "+t)}a=s}}var f=o,p=s-a-u;if(0===p)f=o;else if(p>0){var g=v_.TEN.pow(p);f=o.divide(g)}else if(p<0){var A=v_.TEN.pow(-p);f=o.multiply(A)}return n?f.negate():f},v_.createNaN=function(){return new v_(t_.NaN,t_.NaN)},v_.copy=function(t){return new v_(t)},v_.magnitude=function(t){var e=Math.abs(t),r=Math.log(e)/Math.log(10),n=Math.trunc(Math.floor(r));return 10*Math.pow(10,n)<=e&&(n+=1),n},v_.stringOfChar=function(t,e){for(var r=new A_,n=0;n<e;n++)r.append(t);return r.toString()},m_.PI.get=function(){return new v_(3.141592653589793,12246467991473532e-32)},m_.TWO_PI.get=function(){return new v_(6.283185307179586,24492935982947064e-32)},m_.PI_2.get=function(){return new v_(1.5707963267948966,6123233995736766e-32)},m_.E.get=function(){return new v_(2.718281828459045,14456468917292502e-32)},m_.NaN.get=function(){return new v_(t_.NaN,t_.NaN)},m_.EPS.get=function(){return 123259516440783e-46},m_.SPLIT.get=function(){return 134217729},m_.MAX_PRINT_DIGITS.get=function(){return 32},m_.TEN.get=function(){return v_.valueOf(10)},m_.ONE.get=function(){return v_.valueOf(1)},m_.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},m_.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(v_,m_);var __=function(){},I_={DP_SAFE_EPSILON:{configurable:!0}};__.prototype.interfaces_=function(){return[]},__.prototype.getClass=function(){return __},__.orientationIndex=function(t,e,r){var n=__.orientationIndexFilter(t,e,r);if(n<=1)return n;var i=v_.valueOf(e.x).selfAdd(-t.x),o=v_.valueOf(e.y).selfAdd(-t.y),s=v_.valueOf(r.x).selfAdd(-e.x),a=v_.valueOf(r.y).selfAdd(-e.y);return i.selfMultiply(a).selfSubtract(o.selfMultiply(s)).signum()},__.signOfDet2x2=function(t,e,r,n){return t.multiply(n).selfSubtract(e.multiply(r)).signum()},__.intersection=function(t,e,r,n){var i=v_.valueOf(n.y).selfSubtract(r.y).selfMultiply(v_.valueOf(e.x).selfSubtract(t.x)),o=v_.valueOf(n.x).selfSubtract(r.x).selfMultiply(v_.valueOf(e.y).selfSubtract(t.y)),s=i.subtract(o),a=v_.valueOf(n.x).selfSubtract(r.x).selfMultiply(v_.valueOf(t.y).selfSubtract(r.y)),u=v_.valueOf(n.y).selfSubtract(r.y).selfMultiply(v_.valueOf(t.x).selfSubtract(r.x)),l=a.subtract(u).selfDivide(s).doubleValue(),c=v_.valueOf(t.x).selfAdd(v_.valueOf(e.x).selfSubtract(t.x).selfMultiply(l)).doubleValue(),h=v_.valueOf(e.x).selfSubtract(t.x).selfMultiply(v_.valueOf(t.y).selfSubtract(r.y)),f=v_.valueOf(e.y).selfSubtract(t.y).selfMultiply(v_.valueOf(t.x).selfSubtract(r.x)),p=h.subtract(f).selfDivide(s).doubleValue(),g=v_.valueOf(r.y).selfAdd(v_.valueOf(n.y).selfSubtract(r.y).selfMultiply(p)).doubleValue();return new s_(c,g)},__.orientationIndexFilter=function(t,e,r){var n=null,i=(t.x-r.x)*(e.y-r.y),o=(t.y-r.y)*(e.x-r.x),s=i-o;if(i>0){if(o<=0)return __.signum(s);n=i+o}else{if(!(i<0))return __.signum(s);if(o>=0)return __.signum(s);n=-i-o}var a=__.DP_SAFE_EPSILON*n;return s>=a||-s>=a?__.signum(s):2},__.signum=function(t){return t>0?1:t<0?-1:0},I_.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(__,I_);var E_=function(){},x_={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};x_.X.get=function(){return 0},x_.Y.get=function(){return 1},x_.Z.get=function(){return 2},x_.M.get=function(){return 3},E_.prototype.setOrdinate=function(t,e,r){},E_.prototype.size=function(){},E_.prototype.getOrdinate=function(t,e){},E_.prototype.getCoordinate=function(){},E_.prototype.getCoordinateCopy=function(t){},E_.prototype.getDimension=function(){},E_.prototype.getX=function(t){},E_.prototype.clone=function(){},E_.prototype.expandEnvelope=function(t){},E_.prototype.copy=function(){},E_.prototype.getY=function(t){},E_.prototype.toCoordinateArray=function(){},E_.prototype.interfaces_=function(){return[n_]},E_.prototype.getClass=function(){return E_},Object.defineProperties(E_,x_);var C_=function(){},w_=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}(C_),b_=function(){};b_.arraycopy=function(t,e,r,n,i){for(var o=0,s=e;s<e+i;s++)r[n+o]=t[s],o++},b_.getProperty=function(t){return{"line.separator":"\n"}[t]};var B_=function t(){if(this.x=null,this.y=null,this.w=null,0===arguments.length)this.x=0,this.y=0,this.w=1;else if(1===arguments.length){var e=arguments[0];this.x=e.x,this.y=e.y,this.w=1}else if(2===arguments.length){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var r=arguments[0],n=arguments[1];this.x=r,this.y=n,this.w=1}else if(arguments[0]instanceof t&&arguments[1]instanceof t){var i=arguments[0],o=arguments[1];this.x=i.y*o.w-o.y*i.w,this.y=o.x*i.w-i.x*o.w,this.w=i.x*o.y-o.x*i.y}else if(arguments[0]instanceof s_&&arguments[1]instanceof s_){var s=arguments[0],a=arguments[1];this.x=s.y-a.y,this.y=a.x-s.x,this.w=s.x*a.y-a.x*s.y}}else if(3===arguments.length){var u=arguments[0],l=arguments[1],c=arguments[2];this.x=u,this.y=l,this.w=c}else if(4===arguments.length){var h=arguments[0],f=arguments[1],p=arguments[2],g=arguments[3],A=h.y-f.y,d=f.x-h.x,y=h.x*f.y-f.x*h.y,v=p.y-g.y,m=g.x-p.x,_=p.x*g.y-g.x*p.y;this.x=d*_-m*y,this.y=v*y-A*_,this.w=A*m-v*d}};B_.prototype.getY=function(){var t=this.y/this.w;if(t_.isNaN(t)||t_.isInfinite(t))throw new w_;return t},B_.prototype.getX=function(){var t=this.x/this.w;if(t_.isNaN(t)||t_.isInfinite(t))throw new w_;return t},B_.prototype.getCoordinate=function(){var t=new s_;return t.x=this.getX(),t.y=this.getY(),t},B_.prototype.interfaces_=function(){return[]},B_.prototype.getClass=function(){return B_},B_.intersection=function(t,e,r,n){var i=t.y-e.y,o=e.x-t.x,s=t.x*e.y-e.x*t.y,a=r.y-n.y,u=n.x-r.x,l=r.x*n.y-n.x*r.y,c=i*u-a*o,h=(o*l-u*s)/c,f=(a*s-i*l)/c;if(t_.isNaN(h)||t_.isInfinite(h)||t_.isNaN(f)||t_.isInfinite(f))throw new w_;return new s_(h,f)};var S_=function t(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,0===arguments.length)this.init();else if(1===arguments.length){if(arguments[0]instanceof s_){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof t){var r=arguments[0];this.init(r)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(4===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2],u=arguments[3];this.init(o,s,a,u)}},M_={serialVersionUID:{configurable:!0}};S_.prototype.getArea=function(){return this.getWidth()*this.getHeight()},S_.prototype.equals=function(t){if(!(t instanceof S_))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()},S_.prototype.intersection=function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new S_;var e=this._minx>t._minx?this._minx:t._minx,r=this._miny>t._miny?this._miny:t._miny,n=this._maxx<t._maxx?this._maxx:t._maxx,i=this._maxy<t._maxy?this._maxy:t._maxy;return new S_(e,n,r,i)},S_.prototype.isNull=function(){return this._maxx<this._minx},S_.prototype.getMaxX=function(){return this._maxx},S_.prototype.covers=function(){if(1===arguments.length){if(arguments[0]instanceof s_){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof S_){var e=arguments[0];return!this.isNull()&&!e.isNull()&&(e.getMinX()>=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy)}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return!this.isNull()&&(r>=this._minx&&r<=this._maxx&&n>=this._miny&&n<=this._maxy)}},S_.prototype.intersects=function(){if(1===arguments.length){if(arguments[0]instanceof S_){var t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)}if(arguments[0]instanceof s_){var e=arguments[0];return this.intersects(e.x,e.y)}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return!this.isNull()&&!(r>this._maxx||r<this._minx||n>this._maxy||n<this._miny)}},S_.prototype.getMinY=function(){return this._miny},S_.prototype.getMinX=function(){return this._minx},S_.prototype.expandToInclude=function(){if(1===arguments.length){if(arguments[0]instanceof s_){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof S_){var e=arguments[0];if(e.isNull())return null;this.isNull()?(this._minx=e.getMinX(),this._maxx=e.getMaxX(),this._miny=e.getMinY(),this._maxy=e.getMaxY()):(e._minx<this._minx&&(this._minx=e._minx),e._maxx>this._maxx&&(this._maxx=e._maxx),e._miny<this._miny&&(this._miny=e._miny),e._maxy>this._maxy&&(this._maxy=e._maxy))}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.isNull()?(this._minx=r,this._maxx=r,this._miny=n,this._maxy=n):(r<this._minx&&(this._minx=r),r>this._maxx&&(this._maxx=r),n<this._miny&&(this._miny=n),n>this._maxy&&(this._maxy=n))}},S_.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t<e?t:e},S_.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},S_.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},S_.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},S_.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},S_.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},S_.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},S_.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e},S_.prototype.expandBy=function(){if(1===arguments.length){var t=arguments[0];this.expandBy(t,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=r,this._maxy+=r,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},S_.prototype.contains=function(){if(1===arguments.length){if(arguments[0]instanceof S_){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof s_){var e=arguments[0];return this.covers(e)}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return this.covers(r,n)}},S_.prototype.centre=function(){return this.isNull()?null:new s_((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},S_.prototype.init=function(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(arguments[0]instanceof s_){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof S_){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.init(r.x,n.x,r.y,n.y)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];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)}},S_.prototype.getMaxY=function(){return this._maxy},S_.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 r=0;return this._maxy<t._miny?r=t._miny-this._maxy:this._miny>t._maxy&&(r=this._miny-t._maxy),0===e?r:0===r?e:Math.sqrt(e*e+r*r)},S_.prototype.hashCode=function(){var t=17;return t=37*(t=37*(t=37*(t=37*t+s_.hashCode(this._minx))+s_.hashCode(this._maxx))+s_.hashCode(this._miny))+s_.hashCode(this._maxy)},S_.prototype.interfaces_=function(){return[r_,o_]},S_.prototype.getClass=function(){return S_},S_.intersects=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],r=arguments[2];return r.x>=(t.x<e.x?t.x:e.x)&&r.x<=(t.x>e.x?t.x:e.x)&&r.y>=(t.y<e.y?t.y:e.y)&&r.y<=(t.y>e.y?t.y:e.y)}if(4===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=Math.min(o.x,s.x),u=Math.max(o.x,s.x),l=Math.min(n.x,i.x),c=Math.max(n.x,i.x);return!(l>u)&&(!(c<a)&&(a=Math.min(o.y,s.y),u=Math.max(o.y,s.y),l=Math.min(n.y,i.y),c=Math.max(n.y,i.y),!(l>u)&&!(c<a)))}},M_.serialVersionUID.get=function(){return 0x51845cd552189800},Object.defineProperties(S_,M_);var L_={typeStr:/^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,emptyTypeStr:/^\s*(\w+)\s*EMPTY\s*$/,spaces:/\s+/,parenComma:/\)\s*,\s*\(/,doubleParenComma:/\)\s*\)\s*,\s*\(\s*\(/,trimParens:/^\s*\(?(.*?)\)?\s*$/},N_=function(t){this.geometryFactory=t||new dE};N_.prototype.read=function(t){var e,r,n;t=t.replace(/[\n\r]/g," ");var i=L_.typeStr.exec(t);if(-1!==t.search("EMPTY")&&((i=L_.emptyTypeStr.exec(t))[2]=void 0),i&&(r=i[1].toLowerCase(),n=i[2],R_[r]&&(e=R_[r].apply(this,[n]))),void 0===e)throw new Error("Could not parse WKT "+t);return e},N_.prototype.write=function(t){return this.extractGeometry(t)},N_.prototype.extractGeometry=function(t){var e=t.getGeometryType().toLowerCase();if(!T_[e])return null;var r=e.toUpperCase();return t.isEmpty()?r+" EMPTY":r+"("+T_[e].apply(this,[t])+")"};var T_={coordinate:function(t){return t.x+" "+t.y},point:function(t){return T_.coordinate.call(this,t._coordinates._coordinates[0])},multipoint:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push("("+T_.point.apply(this,[t._geometries[r]])+")");return e.join(",")},linestring:function(t){for(var e=[],r=0,n=t._points._coordinates.length;r<n;++r)e.push(T_.coordinate.apply(this,[t._points._coordinates[r]]));return e.join(",")},linearring:function(t){for(var e=[],r=0,n=t._points._coordinates.length;r<n;++r)e.push(T_.coordinate.apply(this,[t._points._coordinates[r]]));return e.join(",")},multilinestring:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push("("+T_.linestring.apply(this,[t._geometries[r]])+")");return e.join(",")},polygon:function(t){var e=[];e.push("("+T_.linestring.apply(this,[t._shell])+")");for(var r=0,n=t._holes.length;r<n;++r)e.push("("+T_.linestring.apply(this,[t._holes[r]])+")");return e.join(",")},multipolygon:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push("("+T_.polygon.apply(this,[t._geometries[r]])+")");return e.join(",")},geometrycollection:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push(this.extractGeometry(t._geometries[r]));return e.join(",")}},R_={point:function(t){if(void 0===t)return this.geometryFactory.createPoint();var e=t.trim().split(L_.spaces);return this.geometryFactory.createPoint(new s_(Number.parseFloat(e[0]),Number.parseFloat(e[1])))},multipoint:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiPoint();for(var r=t.trim().split(","),n=[],i=0,o=r.length;i<o;++i)e=r[i].replace(L_.trimParens,"$1"),n.push(R_.point.apply(this,[e]));return this.geometryFactory.createMultiPoint(n)},linestring:function(t){if(void 0===t)return this.geometryFactory.createLineString();for(var e,r=t.trim().split(","),n=[],i=0,o=r.length;i<o;++i)e=r[i].trim().split(L_.spaces),n.push(new s_(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLineString(n)},linearring:function(t){if(void 0===t)return this.geometryFactory.createLinearRing();for(var e,r=t.trim().split(","),n=[],i=0,o=r.length;i<o;++i)e=r[i].trim().split(L_.spaces),n.push(new s_(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLinearRing(n)},multilinestring:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiLineString();for(var r=t.trim().split(L_.parenComma),n=[],i=0,o=r.length;i<o;++i)e=r[i].replace(L_.trimParens,"$1"),n.push(R_.linestring.apply(this,[e]));return this.geometryFactory.createMultiLineString(n)},polygon:function(t){var e,r,n;if(void 0===t)return this.geometryFactory.createPolygon();for(var i,o=t.trim().split(L_.parenComma),s=[],a=0,u=o.length;a<u;++a)e=o[a].replace(L_.trimParens,"$1"),r=R_.linestring.apply(this,[e]),n=this.geometryFactory.createLinearRing(r._points),0===a?i=n:s.push(n);return this.geometryFactory.createPolygon(i,s)},multipolygon:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiPolygon();for(var r=t.trim().split(L_.doubleParenComma),n=[],i=0,o=r.length;i<o;++i)e=r[i].replace(L_.trimParens,"$1"),n.push(R_.polygon.apply(this,[e]));return this.geometryFactory.createMultiPolygon(n)},geometrycollection:function(t){if(void 0===t)return this.geometryFactory.createGeometryCollection();for(var e=(t=t.replace(/,\s*([A-Za-z])/g,"|$1")).trim().split("|"),r=[],n=0,i=e.length;n<i;++n)r.push(this.read(e[n]));return this.geometryFactory.createGeometryCollection(r)}},D_=function(t){this.parser=new N_(t)};D_.prototype.write=function(t){return this.parser.write(t)},D_.toLineString=function(t,e){if(2!==arguments.length)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"};var P_=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),Q_=function(t){function e(){if(t.call(this),0===arguments.length)t.call(this);else if(1===arguments.length){var e=arguments[0];t.call(this,e)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(P_),k_=function(){};k_.prototype.interfaces_=function(){return[]},k_.prototype.getClass=function(){return k_},k_.shouldNeverReachHere=function(){if(0===arguments.length)k_.shouldNeverReachHere(null);else if(1===arguments.length){var t=arguments[0];throw new Q_("Should never reach here"+(null!==t?": "+t:""))}},k_.isTrue=function(){var t;if(1===arguments.length)k_.isTrue(arguments[0],null);else if(2===arguments.length&&(t=arguments[1],!arguments[0]))throw null===t?new Q_:new Q_(t)},k_.equals=function(){var t,e,r;if(2===arguments.length)k_.equals(t=arguments[0],e=arguments[1],null);else if(3===arguments.length&&(t=arguments[0],r=arguments[2],!(e=arguments[1]).equals(t)))throw new Q_("Expected "+t+" but encountered "+e+(null!==r?": "+r:""))};var O_=function(){this._result=null,this._inputLines=Array(2).fill().map((function(){return Array(2)})),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new s_,this._intPt[1]=new s_,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},F_={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};O_.prototype.getIndexAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]},O_.prototype.getTopologySummary=function(){var t=new A_;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()},O_.prototype.computeIntersection=function(t,e,r,n){this._inputLines[0][0]=t,this._inputLines[0][1]=e,this._inputLines[1][0]=r,this._inputLines[1][1]=n,this._result=this.computeIntersect(t,e,r,n)},O_.prototype.getIntersectionNum=function(){return this._result},O_.prototype.computeIntLineIndex=function(){if(0===arguments.length)null===this._intLineIndex&&(this._intLineIndex=Array(2).fill().map((function(){return Array(2)})),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(1===arguments.length){var t=arguments[0];this.getEdgeDistance(t,0)>this.getEdgeDistance(t,1)?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}},O_.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},O_.prototype.setPrecisionModel=function(t){this._precisionModel=t},O_.prototype.isInteriorIntersection=function(){var t=this;if(0===arguments.length)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(1===arguments.length){for(var e=arguments[0],r=0;r<this._result;r++)if(!t._intPt[r].equals2D(t._inputLines[e][0])&&!t._intPt[r].equals2D(t._inputLines[e][1]))return!0;return!1}},O_.prototype.getIntersection=function(t){return this._intPt[t]},O_.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},O_.prototype.hasIntersection=function(){return this._result!==O_.NO_INTERSECTION},O_.prototype.getEdgeDistance=function(t,e){return O_.computeEdgeDistance(this._intPt[e],this._inputLines[t][0],this._inputLines[t][1])},O_.prototype.isCollinear=function(){return this._result===O_.COLLINEAR_INTERSECTION},O_.prototype.toString=function(){return D_.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+D_.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},O_.prototype.getEndpoint=function(t,e){return this._inputLines[t][e]},O_.prototype.isIntersection=function(t){for(var e=0;e<this._result;e++)if(this._intPt[e].equals2D(t))return!0;return!1},O_.prototype.getIntersectionAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][e]]},O_.prototype.interfaces_=function(){return[]},O_.prototype.getClass=function(){return O_},O_.computeEdgeDistance=function(t,e,r){var n=Math.abs(r.x-e.x),i=Math.abs(r.y-e.y),o=-1;if(t.equals(e))o=0;else if(t.equals(r))o=n>i?n:i;else{var s=Math.abs(t.x-e.x),a=Math.abs(t.y-e.y);0!==(o=n>i?s:a)||t.equals(e)||(o=Math.max(s,a))}return k_.isTrue(!(0===o&&!t.equals(e)),"Bad distance calculation"),o},O_.nonRobustComputeEdgeDistance=function(t,e,r){var n=t.x-e.x,i=t.y-e.y,o=Math.sqrt(n*n+i*i);return k_.isTrue(!(0===o&&!t.equals(e)),"Invalid distance calculation"),o},F_.DONT_INTERSECT.get=function(){return 0},F_.DO_INTERSECT.get=function(){return 1},F_.COLLINEAR.get=function(){return 2},F_.NO_INTERSECTION.get=function(){return 0},F_.POINT_INTERSECTION.get=function(){return 1},F_.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(O_,F_);var G_=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 S_(this._inputLines[0][0],this._inputLines[0][1]),r=new S_(this._inputLines[1][0],this._inputLines[1][1]);return e.contains(t)&&r.contains(t)},e.prototype.computeIntersection=function(){if(3!==arguments.length)return t.prototype.computeIntersection.apply(this,arguments);var e=arguments[0],r=arguments[1],n=arguments[2];if(this._isProper=!1,S_.intersects(r,n,e)&&0===j_.orientationIndex(r,n,e)&&0===j_.orientationIndex(n,r,e))return this._isProper=!0,(e.equals(r)||e.equals(n))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION},e.prototype.normalizeToMinimum=function(t,e,r,n,i){i.x=this.smallestInAbsValue(t.x,e.x,r.x,n.x),i.y=this.smallestInAbsValue(t.y,e.y,r.y,n.y),t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,r.x-=i.x,r.y-=i.y,n.x-=i.x,n.y-=i.y},e.prototype.safeHCoordinateIntersection=function(t,r,n,i){var o=null;try{o=B_.intersection(t,r,n,i)}catch(s){if(!(s instanceof w_))throw s;o=e.nearestEndpoint(t,r,n,i)}return o},e.prototype.intersection=function(t,r,n,i){var o=this.intersectionWithNormalization(t,r,n,i);return this.isInSegmentEnvelopes(o)||(o=new s_(e.nearestEndpoint(t,r,n,i))),null!==this._precisionModel&&this._precisionModel.makePrecise(o),o},e.prototype.smallestInAbsValue=function(t,e,r,n){var i=t,o=Math.abs(i);return Math.abs(e)<o&&(i=e,o=Math.abs(e)),Math.abs(r)<o&&(i=r,o=Math.abs(r)),Math.abs(n)<o&&(i=n),i},e.prototype.checkDD=function(t,e,r,n,i){var o=__.intersection(t,e,r,n),s=this.isInSegmentEnvelopes(o);b_.out.println("DD in env = "+s+" --------------------- "+o),i.distance(o)>1e-4&&b_.out.println("Distance = "+i.distance(o))},e.prototype.intersectionWithNormalization=function(t,e,r,n){var i=new s_(t),o=new s_(e),s=new s_(r),a=new s_(n),u=new s_;this.normalizeToEnvCentre(i,o,s,a,u);var l=this.safeHCoordinateIntersection(i,o,s,a);return l.x+=u.x,l.y+=u.y,l},e.prototype.computeCollinearIntersection=function(e,r,n,i){var o=S_.intersects(e,r,n),s=S_.intersects(e,r,i),a=S_.intersects(n,i,e),u=S_.intersects(n,i,r);return o&&s?(this._intPt[0]=n,this._intPt[1]=i,t.COLLINEAR_INTERSECTION):a&&u?(this._intPt[0]=e,this._intPt[1]=r,t.COLLINEAR_INTERSECTION):o&&a?(this._intPt[0]=n,this._intPt[1]=e,!n.equals(e)||s||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):o&&u?(this._intPt[0]=n,this._intPt[1]=r,!n.equals(r)||s||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&a?(this._intPt[0]=i,this._intPt[1]=e,!i.equals(e)||o||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&u?(this._intPt[0]=i,this._intPt[1]=r,!i.equals(r)||o||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(t,e,r,n,i){var o=t.x<e.x?t.x:e.x,s=t.y<e.y?t.y:e.y,a=t.x>e.x?t.x:e.x,u=t.y>e.y?t.y:e.y,l=r.x<n.x?r.x:n.x,c=r.y<n.y?r.y:n.y,h=r.x>n.x?r.x:n.x,f=r.y>n.y?r.y:n.y,p=((o>l?o:l)+(a<h?a:h))/2,g=((s>c?s:c)+(u<f?u:f))/2;i.x=p,i.y=g,t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,r.x-=i.x,r.y-=i.y,n.x-=i.x,n.y-=i.y},e.prototype.computeIntersect=function(e,r,n,i){if(this._isProper=!1,!S_.intersects(e,r,n,i))return t.NO_INTERSECTION;var o=j_.orientationIndex(e,r,n),s=j_.orientationIndex(e,r,i);if(o>0&&s>0||o<0&&s<0)return t.NO_INTERSECTION;var a=j_.orientationIndex(n,i,e),u=j_.orientationIndex(n,i,r);return a>0&&u>0||a<0&&u<0?t.NO_INTERSECTION:0===o&&0===s&&0===a&&0===u?this.computeCollinearIntersection(e,r,n,i):(0===o||0===s||0===a||0===u?(this._isProper=!1,e.equals2D(n)||e.equals2D(i)?this._intPt[0]=e:r.equals2D(n)||r.equals2D(i)?this._intPt[0]=r:0===o?this._intPt[0]=new s_(n):0===s?this._intPt[0]=new s_(i):0===a?this._intPt[0]=new s_(e):0===u&&(this._intPt[0]=new s_(r))):(this._isProper=!0,this._intPt[0]=this.intersection(e,r,n,i)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(t,e,r,n){var i=t,o=j_.distancePointLine(t,r,n),s=j_.distancePointLine(e,r,n);return s<o&&(o=s,i=e),(s=j_.distancePointLine(r,t,e))<o&&(o=s,i=r),(s=j_.distancePointLine(n,t,e))<o&&(o=s,i=n),i},e}(O_),U_=function(){};U_.prototype.interfaces_=function(){return[]},U_.prototype.getClass=function(){return U_},U_.orientationIndex=function(t,e,r){var n=e.x-t.x,i=e.y-t.y,o=r.x-e.x,s=r.y-e.y;return U_.signOfDet2x2(n,i,o,s)},U_.signOfDet2x2=function(t,e,r,n){var i=null,o=null,s=null;if(i=1,0===t||0===n)return 0===e||0===r?0:e>0?r>0?-i:i:r>0?i:-i;if(0===e||0===r)return n>0?t>0?i:-i:t>0?-i:i;if(e>0?n>0?e<=n||(i=-i,o=t,t=r,r=o,o=e,e=n,n=o):e<=-n?(i=-i,r=-r,n=-n):(o=t,t=-r,r=o,o=e,e=-n,n=o):n>0?-e<=n?(i=-i,t=-t,e=-e):(o=-t,t=r,r=o,o=-e,e=n,n=o):e>=n?(t=-t,e=-e,r=-r,n=-n):(i=-i,o=-t,t=-r,r=o,o=-e,e=-n,n=o),t>0){if(!(r>0))return i;if(!(t<=r))return i}else{if(r>0)return-i;if(!(t>=r))return-i;i=-i,t=-t,r=-r}for(;;){if((n-=(s=Math.floor(r/t))*e)<0)return-i;if(n>e)return i;if(t>(r-=s*t)+r){if(e<n+n)return i}else{if(e>n+n)return-i;r=t-r,n=e-n,i=-i}if(0===n)return 0===r?0:-i;if(0===r)return i;if((e-=(s=Math.floor(t/r))*n)<0)return i;if(e>n)return-i;if(r>(t-=s*r)+t){if(n<e+e)return-i}else{if(n>e+e)return i;t=r-t,e=n-e,i=-i}if(0===e)return 0===t?0:i;if(0===t)return-i}};var q_=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};q_.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 r=t.x,n=e.x;return r>n&&(r=e.x,n=t.x),this._p.x>=r&&this._p.x<=n&&(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=U_.signOfDet2x2(i,o,s,a);if(0===u)return this._isPointOnSegment=!0,null;a<o&&(u=-u),u>0&&this._crossingCount++}},q_.prototype.isPointInPolygon=function(){return this.getLocation()!==c_.EXTERIOR},q_.prototype.getLocation=function(){return this._isPointOnSegment?c_.BOUNDARY:this._crossingCount%2==1?c_.INTERIOR:c_.EXTERIOR},q_.prototype.isOnSegment=function(){return this._isPointOnSegment},q_.prototype.interfaces_=function(){return[]},q_.prototype.getClass=function(){return q_},q_.locatePointInRing=function(){if(arguments[0]instanceof s_&&f_(arguments[1],E_)){for(var t=arguments[1],e=new q_(arguments[0]),r=new s_,n=new s_,i=1;i<t.size();i++)if(t.getCoordinate(i,r),t.getCoordinate(i-1,n),e.countSegment(r,n),e.isOnSegment())return e.getLocation();return e.getLocation()}if(arguments[0]instanceof s_&&arguments[1]instanceof Array){for(var o=arguments[1],s=new q_(arguments[0]),a=1;a<o.length;a++){var u=o[a],l=o[a-1];if(s.countSegment(u,l),s.isOnSegment())return s.getLocation()}return s.getLocation()}};var j_=function(){},V_={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};j_.prototype.interfaces_=function(){return[]},j_.prototype.getClass=function(){return j_},j_.orientationIndex=function(t,e,r){return __.orientationIndex(t,e,r)},j_.signedArea=function(){if(arguments[0]instanceof Array){var t=arguments[0];if(t.length<3)return 0;for(var e=0,r=t[0].x,n=1;n<t.length-1;n++){var i=t[n].x-r,o=t[n+1].y;e+=i*(t[n-1].y-o)}return e/2}if(f_(arguments[0],E_)){var s=arguments[0],a=s.size();if(a<3)return 0;var u=new s_,l=new s_,c=new s_;s.getCoordinate(0,l),s.getCoordinate(1,c);var h=l.x;c.x-=h;for(var f=0,p=1;p<a-1;p++)u.y=l.y,l.x=c.x,l.y=c.y,s.getCoordinate(p+1,c),c.x-=h,f+=l.x*(u.y-c.y);return f/2}},j_.distanceLineLine=function(t,e,r,n){if(t.equals(e))return j_.distancePointLine(t,r,n);if(r.equals(n))return j_.distancePointLine(n,t,e);var i=!1;if(S_.intersects(t,e,r,n)){var o=(e.x-t.x)*(n.y-r.y)-(e.y-t.y)*(n.x-r.x);if(0===o)i=!0;else{var s=(t.y-r.y)*(n.x-r.x)-(t.x-r.x)*(n.y-r.y),a=((t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y))/o,u=s/o;(u<0||u>1||a<0||a>1)&&(i=!0)}}else i=!0;return i?p_.min(j_.distancePointLine(t,r,n),j_.distancePointLine(e,r,n),j_.distancePointLine(r,t,e),j_.distancePointLine(n,t,e)):0},j_.isPointInRing=function(t,e){return j_.locatePointInRing(t,e)!==c_.EXTERIOR},j_.computeLength=function(t){var e=t.size();if(e<=1)return 0;var r=0,n=new s_;t.getCoordinate(0,n);for(var i=n.x,o=n.y,s=1;s<e;s++){t.getCoordinate(s,n);var a=n.x,u=n.y,l=a-i,c=u-o;r+=Math.sqrt(l*l+c*c),i=a,o=u}return r},j_.isCCW=function(t){var e=t.length-1;if(e<3)throw new $m("Ring has fewer than 4 points, so orientation cannot be determined");for(var r=t[0],n=0,i=1;i<=e;i++){var o=t[i];o.y>r.y&&(r=o,n=i)}var s=n;do{(s-=1)<0&&(s=e)}while(t[s].equals2D(r)&&s!==n);var a=n;do{a=(a+1)%e}while(t[a].equals2D(r)&&a!==n);var u=t[s],l=t[a];if(u.equals2D(r)||l.equals2D(r)||u.equals2D(l))return!1;var c=j_.computeOrientation(u,r,l),h=!1;return h=0===c?u.x>l.x:c>0,h},j_.locatePointInRing=function(t,e){return q_.locatePointInRing(t,e)},j_.distancePointLinePerpendicular=function(t,e,r){var n=(r.x-e.x)*(r.x-e.x)+(r.y-e.y)*(r.y-e.y),i=((e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y))/n;return Math.abs(i)*Math.sqrt(n)},j_.computeOrientation=function(t,e,r){return j_.orientationIndex(t,e,r)},j_.distancePointLine=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(0===e.length)throw new $m("Line array must contain at least one vertex");for(var r=t.distance(e[0]),n=0;n<e.length-1;n++){var i=j_.distancePointLine(t,e[n],e[n+1]);i<r&&(r=i)}return r}if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];if(s.x===a.x&&s.y===a.y)return o.distance(s);var u=(a.x-s.x)*(a.x-s.x)+(a.y-s.y)*(a.y-s.y),l=((o.x-s.x)*(a.x-s.x)+(o.y-s.y)*(a.y-s.y))/u;if(l<=0)return o.distance(s);if(l>=1)return o.distance(a);var c=((s.y-o.y)*(a.x-s.x)-(s.x-o.x)*(a.y-s.y))/u;return Math.abs(c)*Math.sqrt(u)}},j_.isOnLine=function(t,e){for(var r=new G_,n=1;n<e.length;n++){var i=e[n-1],o=e[n];if(r.computeIntersection(t,i,o),r.hasIntersection())return!0}return!1},V_.CLOCKWISE.get=function(){return-1},V_.RIGHT.get=function(){return j_.CLOCKWISE},V_.COUNTERCLOCKWISE.get=function(){return 1},V_.LEFT.get=function(){return j_.COUNTERCLOCKWISE},V_.COLLINEAR.get=function(){return 0},V_.STRAIGHT.get=function(){return j_.COLLINEAR},Object.defineProperties(j_,V_);var z_=function(){};z_.prototype.filter=function(t){},z_.prototype.interfaces_=function(){return[]},z_.prototype.getClass=function(){return z_};var Y_=function(){var t=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=t,this._SRID=t.getSRID()},H_={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}};Y_.prototype.isGeometryCollection=function(){return this.getSortIndex()===Y_.SORTINDEX_GEOMETRYCOLLECTION},Y_.prototype.getFactory=function(){return this._factory},Y_.prototype.getGeometryN=function(t){return this},Y_.prototype.getArea=function(){return 0},Y_.prototype.isRectangle=function(){return!1},Y_.prototype.equals=function(){if(arguments[0]instanceof Y_){var t=arguments[0];return null!==t&&this.equalsTopo(t)}if(arguments[0]instanceof Object){var e=arguments[0];if(!(e instanceof Y_))return!1;var r=e;return this.equalsExact(r)}},Y_.prototype.equalsExact=function(t){return this===t||this.equalsExact(t,0)},Y_.prototype.geometryChanged=function(){this.apply(Y_.geometryChangedFilter)},Y_.prototype.geometryChangedAction=function(){this._envelope=null},Y_.prototype.equalsNorm=function(t){return null!==t&&this.norm().equalsExact(t.norm())},Y_.prototype.getLength=function(){return 0},Y_.prototype.getNumGeometries=function(){return 1},Y_.prototype.compareTo=function(){if(1===arguments.length){var t=arguments[0],e=t;return this.getSortIndex()!==e.getSortIndex()?this.getSortIndex()-e.getSortIndex():this.isEmpty()&&e.isEmpty()?0:this.isEmpty()?-1:e.isEmpty()?1:this.compareToSameClass(t)}if(2===arguments.length){var r=arguments[0],n=arguments[1];return this.getSortIndex()!==r.getSortIndex()?this.getSortIndex()-r.getSortIndex():this.isEmpty()&&r.isEmpty()?0:this.isEmpty()?-1:r.isEmpty()?1:this.compareToSameClass(r,n)}},Y_.prototype.getUserData=function(){return this._userData},Y_.prototype.getSRID=function(){return this._SRID},Y_.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},Y_.prototype.checkNotGeometryCollection=function(t){if(t.getSortIndex()===Y_.SORTINDEX_GEOMETRYCOLLECTION)throw new $m("This method does not support GeometryCollection arguments")},Y_.prototype.equal=function(t,e,r){return 0===r?t.equals(e):t.distance(e)<=r},Y_.prototype.norm=function(){var t=this.copy();return t.normalize(),t},Y_.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},Y_.prototype.getEnvelopeInternal=function(){return null===this._envelope&&(this._envelope=this.computeEnvelopeInternal()),new S_(this._envelope)},Y_.prototype.setSRID=function(t){this._SRID=t},Y_.prototype.setUserData=function(t){this._userData=t},Y_.prototype.compare=function(t,e){for(var r=t.iterator(),n=e.iterator();r.hasNext()&&n.hasNext();){var i=r.next(),o=n.next(),s=i.compareTo(o);if(0!==s)return s}return r.hasNext()?1:n.hasNext()?-1:0},Y_.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},Y_.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===Y_.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===Y_.SORTINDEX_MULTIPOINT||this.getSortIndex()===Y_.SORTINDEX_MULTILINESTRING||this.getSortIndex()===Y_.SORTINDEX_MULTIPOLYGON},Y_.prototype.interfaces_=function(){return[n_,r_,o_]},Y_.prototype.getClass=function(){return Y_},Y_.hasNonEmptyElements=function(t){for(var e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1},Y_.hasNullElements=function(t){for(var e=0;e<t.length;e++)if(null===t[e])return!0;return!1},H_.serialVersionUID.get=function(){return 0x799ea46522854c00},H_.SORTINDEX_POINT.get=function(){return 0},H_.SORTINDEX_MULTIPOINT.get=function(){return 1},H_.SORTINDEX_LINESTRING.get=function(){return 2},H_.SORTINDEX_LINEARRING.get=function(){return 3},H_.SORTINDEX_MULTILINESTRING.get=function(){return 4},H_.SORTINDEX_POLYGON.get=function(){return 5},H_.SORTINDEX_MULTIPOLYGON.get=function(){return 6},H_.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},H_.geometryChangedFilter.get=function(){return X_},Object.defineProperties(Y_,H_);var X_=function(){};X_.interfaces_=function(){return[z_]},X_.filter=function(t){t.geometryChangedAction()};var J_=function(){};J_.prototype.filter=function(t){},J_.prototype.interfaces_=function(){return[]},J_.prototype.getClass=function(){return J_};var W_=function(){},K_={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}};W_.prototype.isInBoundary=function(t){},W_.prototype.interfaces_=function(){return[]},W_.prototype.getClass=function(){return W_},K_.Mod2BoundaryNodeRule.get=function(){return Z_},K_.EndPointBoundaryNodeRule.get=function(){return $_},K_.MultiValentEndPointBoundaryNodeRule.get=function(){return tI},K_.MonoValentEndPointBoundaryNodeRule.get=function(){return eI},K_.MOD2_BOUNDARY_RULE.get=function(){return new Z_},K_.ENDPOINT_BOUNDARY_RULE.get=function(){return new $_},K_.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new tI},K_.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new eI},K_.OGC_SFS_BOUNDARY_RULE.get=function(){return W_.MOD2_BOUNDARY_RULE},Object.defineProperties(W_,K_);var Z_=function(){};Z_.prototype.isInBoundary=function(t){return t%2==1},Z_.prototype.interfaces_=function(){return[W_]},Z_.prototype.getClass=function(){return Z_};var $_=function(){};$_.prototype.isInBoundary=function(t){return t>0},$_.prototype.interfaces_=function(){return[W_]},$_.prototype.getClass=function(){return $_};var tI=function(){};tI.prototype.isInBoundary=function(t){return t>1},tI.prototype.interfaces_=function(){return[W_]},tI.prototype.getClass=function(){return tI};var eI=function(){};eI.prototype.isInBoundary=function(t){return 1===t},eI.prototype.interfaces_=function(){return[W_]},eI.prototype.getClass=function(){return eI};var rI=function(){};function nI(t){this.message=t||""}rI.prototype.add=function(){},rI.prototype.addAll=function(){},rI.prototype.isEmpty=function(){},rI.prototype.iterator=function(){},rI.prototype.size=function(){},rI.prototype.toArray=function(){},rI.prototype.remove=function(){},nI.prototype=new Error,nI.prototype.name="IndexOutOfBoundsException";var iI=function(){};iI.prototype.hasNext=function(){},iI.prototype.next=function(){},iI.prototype.remove=function(){};var oI=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}(rI);function sI(t){this.message=t||""}sI.prototype=new Error,sI.prototype.name="NoSuchElementException";var aI=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof rI&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.ensureCapacity=function(){},e.prototype.interfaces_=function(){return[t,rI]},e.prototype.add=function(t){return 1===arguments.length?this.array_.push(t):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.set=function(t,e){var r=this.array_[t];return this.array_[t]=e,r},e.prototype.iterator=function(){return new uI(this)},e.prototype.get=function(t){if(t<0||t>=this.size())throw new nI;return this.array_[t]},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t},e.prototype.remove=function(t){for(var e=!1,r=0,n=this.array_.length;r<n;r++)if(this.array_[r]===t){this.array_.splice(r,1),e=!0;break}return e},e}(oI),uI=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 sI;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}(iI),lI=function(t){function e(){if(t.call(this),0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.ensureCapacity(e.length),this.add(e,!0)}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.ensureCapacity(r.length),this.add(r,n)}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={coordArrayType:{configurable:!0}};return r.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[1],r=!1,n=arguments[0].iterator();n.hasNext();)this.add(n.next(),e),r=!0;return r}return t.prototype.addAll.apply(this,arguments)},e.prototype.clone=function(){for(var e=t.prototype.clone.call(this),r=0;r<this.size();r++)e.add(r,this.get(r).copy());return e},e.prototype.toCoordinateArray=function(){return this.toArray(e.coordArrayType)},e.prototype.add=function(){var e=this;if(1===arguments.length){var r=arguments[0];t.prototype.add.call(this,r)}else if(2===arguments.length){if(arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var n=arguments[0],i=arguments[1];return this.add(n,i,!0),!0}if(arguments[0]instanceof s_&&"boolean"==typeof arguments[1]){var o=arguments[0];if(!arguments[1])if(this.size()>=1)if(this.get(this.size()-1).equals2D(o))return null;t.prototype.add.call(this,o)}else if(arguments[0]instanceof Object&&"boolean"==typeof arguments[1]){var s=arguments[0],a=arguments[1];return this.add(s,a),!0}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var u=arguments[0],l=arguments[1];if(arguments[2])for(var c=0;c<u.length;c++)e.add(u[c],l);else for(var h=u.length-1;h>=0;h--)e.add(u[h],l);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof s_){var f=arguments[0],p=arguments[1];if(!arguments[2]){var g=this.size();if(g>0){if(f>0)if(this.get(f-1).equals2D(p))return null;if(f<g)if(this.get(f).equals2D(p))return null}}t.prototype.add.call(this,f,p)}}else if(4===arguments.length){var A=arguments[0],d=arguments[1],y=arguments[2],v=arguments[3],m=1;y>v&&(m=-1);for(var _=y;_!==v;_+=m)e.add(A[_],d);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new s_(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,r),e}(aI),cI=function(){},hI={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};hI.ForwardComparator.get=function(){return fI},hI.BidirectionalComparator.get=function(){return pI},hI.coordArrayType.get=function(){return new Array(0).fill(null)},cI.prototype.interfaces_=function(){return[]},cI.prototype.getClass=function(){return cI},cI.isRing=function(t){return!(t.length<4)&&!!t[0].equals2D(t[t.length-1])},cI.ptNotInList=function(t,e){for(var r=0;r<t.length;r++){var n=t[r];if(cI.indexOf(n,e)<0)return n}return null},cI.scroll=function(t,e){var r=cI.indexOf(e,t);if(r<0)return null;var n=new Array(t.length).fill(null);b_.arraycopy(t,r,n,0,t.length-r),b_.arraycopy(t,0,n,t.length-r,r),b_.arraycopy(n,0,t,0,t.length)},cI.equals=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(t===e)return!0;if(null===t||null===e)return!1;if(t.length!==e.length)return!1;for(var r=0;r<t.length;r++)if(!t[r].equals(e[r]))return!1;return!0}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];if(n===i)return!0;if(null===n||null===i)return!1;if(n.length!==i.length)return!1;for(var s=0;s<n.length;s++)if(0!==o.compare(n[s],i[s]))return!1;return!0}},cI.intersection=function(t,e){for(var r=new lI,n=0;n<t.length;n++)e.intersects(t[n])&&r.add(t[n],!0);return r.toCoordinateArray()},cI.hasRepeatedPoints=function(t){for(var e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1},cI.removeRepeatedPoints=function(t){return cI.hasRepeatedPoints(t)?new lI(t,!1).toCoordinateArray():t},cI.reverse=function(t){for(var e=t.length-1,r=Math.trunc(e/2),n=0;n<=r;n++){var i=t[n];t[n]=t[e-n],t[e-n]=i}},cI.removeNull=function(t){for(var e=0,r=0;r<t.length;r++)null!==t[r]&&e++;var n=new Array(e).fill(null);if(0===e)return n;for(var i=0,o=0;o<t.length;o++)null!==t[o]&&(n[i++]=t[o]);return n},cI.copyDeep=function(){if(1===arguments.length){for(var t=arguments[0],e=new Array(t.length).fill(null),r=0;r<t.length;r++)e[r]=new s_(t[r]);return e}if(5===arguments.length)for(var n=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=arguments[4],u=0;u<a;u++)o[s+u]=new s_(n[i+u])},cI.isEqualReversed=function(t,e){for(var r=0;r<t.length;r++){var n=t[r],i=e[t.length-r-1];if(0!==n.compareTo(i))return!1}return!0},cI.envelope=function(t){for(var e=new S_,r=0;r<t.length;r++)e.expandToInclude(t[r]);return e},cI.toCoordinateArray=function(t){return t.toArray(cI.coordArrayType)},cI.atLeastNCoordinatesOrNothing=function(t,e){return e.length>=t?e:[]},cI.indexOf=function(t,e){for(var r=0;r<e.length;r++)if(t.equals(e[r]))return r;return-1},cI.increasingDirection=function(t){for(var e=0;e<Math.trunc(t.length/2);e++){var r=t.length-1-e,n=t[e].compareTo(t[r]);if(0!==n)return n}return 1},cI.compare=function(t,e){for(var r=0;r<t.length&&r<e.length;){var n=t[r].compareTo(e[r]);if(0!==n)return n;r++}return r<e.length?-1:r<t.length?1:0},cI.minCoordinate=function(t){for(var e=null,r=0;r<t.length;r++)(null===e||e.compareTo(t[r])>0)&&(e=t[r]);return e},cI.extract=function(t,e,r){e=p_.clamp(e,0,t.length);var n=(r=p_.clamp(r,-1,t.length))-e+1;r<0&&(n=0),e>=t.length&&(n=0),r<e&&(n=0);var i=new Array(n).fill(null);if(0===n)return i;for(var o=0,s=e;s<=r;s++)i[o++]=t[s];return i},Object.defineProperties(cI,hI);var fI=function(){};fI.prototype.compare=function(t,e){return cI.compare(t,e)},fI.prototype.interfaces_=function(){return[i_]},fI.prototype.getClass=function(){return fI};var pI=function(){};pI.prototype.compare=function(t,e){var r=t,n=e;if(r.length<n.length)return-1;if(r.length>n.length)return 1;if(0===r.length)return 0;var i=cI.compare(r,n);return cI.isEqualReversed(r,n)?0:i},pI.prototype.OLDcompare=function(t,e){var r=t,n=e;if(r.length<n.length)return-1;if(r.length>n.length)return 1;if(0===r.length)return 0;for(var i=cI.increasingDirection(r),o=cI.increasingDirection(n),s=i>0?0:r.length-1,a=o>0?0:r.length-1,u=0;u<r.length;u++){var l=r[s].compareTo(n[a]);if(0!==l)return l;s+=i,a+=o}return 0},pI.prototype.interfaces_=function(){return[i_]},pI.prototype.getClass=function(){return pI};var gI=function(){};gI.prototype.get=function(){},gI.prototype.put=function(){},gI.prototype.size=function(){},gI.prototype.values=function(){},gI.prototype.entrySet=function(){};var AI=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}(gI);function dI(t){this.message=t||""}function yI(){}dI.prototype=new Error,dI.prototype.name="OperationNotSupported",yI.prototype=new rI,yI.prototype.contains=function(){};var vI=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof rI&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.contains=function(t){for(var e=0,r=this.array_.length;e<r;e++){if(this.array_[e]===t)return!0}return!1},e.prototype.add=function(t){return!this.contains(t)&&(this.array_.push(t),!0)},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.remove=function(t){throw new Error},e.prototype.size=function(){return this.array_.length},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t},e.prototype.iterator=function(){return new mI(this)},e}(yI),mI=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 sI;return this.hashSet_.array_[this.position_++]},e.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},e.prototype.remove=function(){throw new dI},e}(iI);function _I(t){return null===t?0:t.color}function II(t){return null===t?null:t.parent}function EI(t,e){null!==t&&(t.color=e)}function xI(t){return null===t?null:t.left}function CI(t){return null===t?null:t.right}function wI(){this.root_=null,this.size_=0}wI.prototype=new AI,wI.prototype.get=function(t){for(var e=this.root_;null!==e;){var r=t.compareTo(e.key);if(r<0)e=e.left;else{if(!(r>0))return e.value;e=e.right}}return null},wI.prototype.put=function(t,e){if(null===this.root_)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:0,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var r,n,i=this.root_;do{if(r=i,(n=t.compareTo(i.key))<0)i=i.left;else{if(!(n>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:r,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return n<0?r.left=s:r.right=s,this.fixAfterInsertion(s),this.size_++,null},wI.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=1;null!=t&&t!==this.root_&&1===t.parent.color;)if(II(t)===xI(II(II(t)))){var r=CI(II(II(t)));1===_I(r)?(EI(II(t),0),EI(r,0),EI(II(II(t)),1),t=II(II(t))):(t===CI(II(t))&&(t=II(t),e.rotateLeft(t)),EI(II(t),0),EI(II(II(t)),1),e.rotateRight(II(II(t))))}else{var n=xI(II(II(t)));1===_I(n)?(EI(II(t),0),EI(n,0),EI(II(II(t)),1),t=II(II(t))):(t===xI(II(t))&&(t=II(t),e.rotateRight(t)),EI(II(t),0),EI(II(II(t)),1),e.rotateLeft(II(II(t))))}this.root_.color=0},wI.prototype.values=function(){var t=new aI,e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=wI.successor(e));)t.add(e.value);return t},wI.prototype.entrySet=function(){var t=new vI,e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=wI.successor(e));)t.add(e);return t},wI.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}},wI.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}},wI.prototype.getFirstEntry=function(){var t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t},wI.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 r=t.parent,n=t;null!==r&&n===r.right;)n=r,r=r.parent;return r},wI.prototype.size=function(){return this.size_};var bI=function(){};function BI(){}function SI(){this.array_=[],arguments[0]instanceof rI&&this.addAll(arguments[0])}bI.prototype.interfaces_=function(){return[]},bI.prototype.getClass=function(){return bI},BI.prototype=new yI,SI.prototype=new BI,SI.prototype.contains=function(t){for(var e=0,r=this.array_.length;e<r;e++){if(0===this.array_[e].compareTo(t))return!0}return!1},SI.prototype.add=function(t){if(this.contains(t))return!1;for(var e=0,r=this.array_.length;e<r;e++){if(1===this.array_[e].compareTo(t))return this.array_.splice(e,0,t),!0}return this.array_.push(t),!0},SI.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},SI.prototype.remove=function(t){throw new dI},SI.prototype.size=function(){return this.array_.length},SI.prototype.isEmpty=function(){return 0===this.array_.length},SI.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t},SI.prototype.iterator=function(){return new MI(this)};var MI=function(t){this.treeSet_=t,this.position_=0};MI.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new sI;return this.treeSet_.array_[this.position_++]},MI.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},MI.prototype.remove=function(){throw new dI};var LI=function(){};LI.sort=function(){var t,e,r,n,i=arguments[0];if(1===arguments.length)n=function(t,e){return t.compareTo(e)},i.sort(n);else if(2===arguments.length)r=arguments[1],n=function(t,e){return r.compare(t,e)},i.sort(n);else if(3===arguments.length){(e=i.slice(arguments[1],arguments[2])).sort();var o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length));for(i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])}else if(4===arguments.length)for(e=i.slice(arguments[1],arguments[2]),r=arguments[3],n=function(t,e){return r.compare(t,e)},e.sort(n),o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length)),i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])},LI.asList=function(t){for(var e=new aI,r=0,n=t.length;r<n;r++)e.add(t[r]);return e};var NI=function(){},TI={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}};TI.P.get=function(){return 0},TI.L.get=function(){return 1},TI.A.get=function(){return 2},TI.FALSE.get=function(){return-1},TI.TRUE.get=function(){return-2},TI.DONTCARE.get=function(){return-3},TI.SYM_FALSE.get=function(){return"F"},TI.SYM_TRUE.get=function(){return"T"},TI.SYM_DONTCARE.get=function(){return"*"},TI.SYM_P.get=function(){return"0"},TI.SYM_L.get=function(){return"1"},TI.SYM_A.get=function(){return"2"},NI.prototype.interfaces_=function(){return[]},NI.prototype.getClass=function(){return NI},NI.toDimensionSymbol=function(t){switch(t){case NI.FALSE:return NI.SYM_FALSE;case NI.TRUE:return NI.SYM_TRUE;case NI.DONTCARE:return NI.SYM_DONTCARE;case NI.P:return NI.SYM_P;case NI.L:return NI.SYM_L;case NI.A:return NI.SYM_A}throw new $m("Unknown dimension value: "+t)},NI.toDimensionValue=function(t){switch(y_.toUpperCase(t)){case NI.SYM_FALSE:return NI.FALSE;case NI.SYM_TRUE:return NI.TRUE;case NI.SYM_DONTCARE:return NI.DONTCARE;case NI.SYM_P:return NI.P;case NI.SYM_L:return NI.L;case NI.SYM_A:return NI.A}throw new $m("Unknown dimension symbol: "+t)},Object.defineProperties(NI,TI);var RI=function(){};RI.prototype.filter=function(t){},RI.prototype.interfaces_=function(){return[]},RI.prototype.getClass=function(){return RI};var DI=function(){};DI.prototype.filter=function(t,e){},DI.prototype.isDone=function(){},DI.prototype.isGeometryChanged=function(){},DI.prototype.interfaces_=function(){return[]},DI.prototype.getClass=function(){return DI};var PI=function(t){function e(e,r){if(t.call(this,r),this._geometries=e||[],t.hasNullElements(this._geometries))throw new $m("geometries must not contain null elements")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){for(var t=new S_,e=0;e<this._geometries.length;e++)t.expandToInclude(this._geometries[e].getEnvelopeInternal());return t},e.prototype.getGeometryN=function(t){return this._geometries[t]},e.prototype.getSortIndex=function(){return t.SORTINDEX_GEOMETRYCOLLECTION},e.prototype.getCoordinates=function(){for(var t=new Array(this.getNumPoints()).fill(null),e=-1,r=0;r<this._geometries.length;r++)for(var n=this._geometries[r].getCoordinates(),i=0;i<n.length;i++)t[++e]=n[i];return t},e.prototype.getArea=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getArea();return t},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];if(!this.isEquivalentClass(e))return!1;var n=e;if(this._geometries.length!==n._geometries.length)return!1;for(var i=0;i<this._geometries.length;i++)if(!this._geometries[i].equalsExact(n._geometries[i],r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=0;t<this._geometries.length;t++)this._geometries[t].normalize();LI.sort(this._geometries)},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},e.prototype.getBoundaryDimension=function(){for(var t=NI.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getBoundaryDimension());return t},e.prototype.getDimension=function(){for(var t=NI.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getDimension());return t},e.prototype.getLength=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getLength();return t},e.prototype.getNumPoints=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getNumPoints();return t},e.prototype.getNumGeometries=function(){return this._geometries.length},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),r=0;r<this._geometries.length;r++)e[r]=this._geometries[r].reverse();return this.getFactory().createGeometryCollection(e)},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=new SI(LI.asList(this._geometries)),r=new SI(LI.asList(t._geometries));return this.compare(e,r)}if(2===arguments.length){for(var n=arguments[1],i=arguments[0],o=this.getNumGeometries(),s=i.getNumGeometries(),a=0;a<o&&a<s;){var u=this.getGeometryN(a),l=i.getGeometryN(a),c=u.compareToSameClass(l,n);if(0!==c)return c;a++}return a<o?1:a<s?-1:0}},e.prototype.apply=function(){var t=this;if(f_(arguments[0],J_))for(var e=arguments[0],r=0;r<this._geometries.length;r++)t._geometries[r].apply(e);else if(f_(arguments[0],DI)){var n=arguments[0];if(0===this._geometries.length)return null;for(var i=0;i<this._geometries.length&&(t._geometries[i].apply(n),!n.isDone());i++);n.isGeometryChanged()&&this.geometryChanged()}else if(f_(arguments[0],RI)){var o=arguments[0];o.filter(this);for(var s=0;s<this._geometries.length;s++)t._geometries[s].apply(o)}else if(f_(arguments[0],z_)){var a=arguments[0];a.filter(this);for(var u=0;u<this._geometries.length;u++)t._geometries[u].apply(a)}},e.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),k_.shouldNeverReachHere(),null},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._geometries=new Array(this._geometries.length).fill(null);for(var r=0;r<this._geometries.length;r++)e._geometries[r]=this._geometries[r].clone();return e},e.prototype.getGeometryType=function(){return"GeometryCollection"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.isEmpty=function(){for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isEmpty())return!1;return!0},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x4f07bcb1f857d800},Object.defineProperties(e,r),e}(Y_),QI=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return Y_.SORTINDEX_MULTILINESTRING},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?NI.FALSE:0},e.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isClosed())return!1;return!0},e.prototype.getDimension=function(){return 1},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),r=0;r<this._geometries.length;r++)e[t-1-r]=this._geometries[r].reverse();return this.getFactory().createMultiLineString(e)},e.prototype.getBoundary=function(){return new kI(this).getBoundary()},e.prototype.getGeometryType=function(){return"MultiLineString"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[bI]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return 0x7155d2ab4afa8000},Object.defineProperties(e,r),e}(PI),kI=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,1===arguments.length){var t=arguments[0],e=W_.MOD2_BOUNDARY_RULE;this._geom=t,this._geomFact=t.getFactory(),this._bnRule=e}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this._geom=r,this._geomFact=r.getFactory(),this._bnRule=n}};kI.prototype.boundaryMultiLineString=function(t){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var e=this.computeBoundaryCoordinates(t);return 1===e.length?this._geomFact.createPoint(e[0]):this._geomFact.createMultiPointFromCoords(e)},kI.prototype.getBoundary=function(){return this._geom instanceof XI?this.boundaryLineString(this._geom):this._geom instanceof QI?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},kI.prototype.boundaryLineString=function(t){return this._geom.isEmpty()?this.getEmptyMultiPoint():t.isClosed()?this._bnRule.isInBoundary(2)?t.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([t.getStartPoint(),t.getEndPoint()])},kI.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},kI.prototype.computeBoundaryCoordinates=function(t){var e=this,r=new aI;this._endpointMap=new wI;for(var n=0;n<t.getNumGeometries();n++){var i=t.getGeometryN(n);0!==i.getNumPoints()&&(e.addEndpoint(i.getCoordinateN(0)),e.addEndpoint(i.getCoordinateN(i.getNumPoints()-1)))}for(var o=this._endpointMap.entrySet().iterator();o.hasNext();){var s=o.next(),a=s.getValue().count;e._bnRule.isInBoundary(a)&&r.add(s.getKey())}return cI.toCoordinateArray(r)},kI.prototype.addEndpoint=function(t){var e=this._endpointMap.get(t);null===e&&(e=new OI,this._endpointMap.put(t,e)),e.count++},kI.prototype.interfaces_=function(){return[]},kI.prototype.getClass=function(){return kI},kI.getBoundary=function(){return 1===arguments.length?new kI(arguments[0]).getBoundary():2===arguments.length?new kI(arguments[0],arguments[1]).getBoundary():void 0};var OI=function(){this.count=null};function FI(){}function GI(){}OI.prototype.interfaces_=function(){return[]},OI.prototype.getClass=function(){return OI};var UI=function(){};function qI(){}function jI(){}function VI(){}var zI=function(){},YI={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};zI.prototype.interfaces_=function(){return[]},zI.prototype.getClass=function(){return zI},zI.chars=function(t,e){for(var r=new Array(e).fill(null),n=0;n<e;n++)r[n]=t;return String(r)},zI.getStackTrace=function(){if(1===arguments.length){var t=arguments[0],e=new qI,r=new FI;return t.printStackTrace(r),e.toString()}if(2===arguments.length){var n=arguments[1],i="";new GI(zI.getStackTrace(arguments[0]));for(var o=new VI,s=0;s<n;s++)try{i+=o.readLine()+zI.NEWLINE}catch(t){if(!(t instanceof jI))throw t;k_.shouldNeverReachHere()}return i}},zI.split=function(t,e){for(var r=e.length,n=new aI,i=""+t,o=i.indexOf(e);o>=0;){var s=i.substring(0,o);n.add(s),o=(i=i.substring(o+r)).indexOf(e)}i.length>0&&n.add(i);for(var a=new Array(n.size()).fill(null),u=0;u<a.length;u++)a[u]=n.get(u);return a},zI.toString=function(){if(1===arguments.length){var t=arguments[0];return zI.SIMPLE_ORDINATE_FORMAT.format(t)}},zI.spaces=function(t){return zI.chars(" ",t)},YI.NEWLINE.get=function(){return b_.getProperty("line.separator")},YI.SIMPLE_ORDINATE_FORMAT.get=function(){return new UI},Object.defineProperties(zI,YI);var HI=function(){};HI.prototype.interfaces_=function(){return[]},HI.prototype.getClass=function(){return HI},HI.copyCoord=function(t,e,r,n){for(var i=Math.min(t.getDimension(),r.getDimension()),o=0;o<i;o++)r.setOrdinate(n,o,t.getOrdinate(e,o))},HI.isRing=function(t){var e=t.size();return 0===e||!(e<=3)&&(t.getOrdinate(0,E_.X)===t.getOrdinate(e-1,E_.X)&&t.getOrdinate(0,E_.Y)===t.getOrdinate(e-1,E_.Y))},HI.isEqual=function(t,e){var r=t.size();if(r!==e.size())return!1;for(var n=Math.min(t.getDimension(),e.getDimension()),i=0;i<r;i++)for(var o=0;o<n;o++){var s=t.getOrdinate(i,o),a=e.getOrdinate(i,o);if(t.getOrdinate(i,o)!==e.getOrdinate(i,o)&&(!t_.isNaN(s)||!t_.isNaN(a)))return!1}return!0},HI.extend=function(t,e,r){var n=t.create(r,e.getDimension()),i=e.size();if(HI.copy(e,0,n,0,i),i>0)for(var o=i;o<r;o++)HI.copy(e,i-1,n,o,1);return n},HI.reverse=function(t){for(var e=t.size()-1,r=Math.trunc(e/2),n=0;n<=r;n++)HI.swap(t,n,e-n)},HI.swap=function(t,e,r){if(e===r)return null;for(var n=0;n<t.getDimension();n++){var i=t.getOrdinate(e,n);t.setOrdinate(e,n,t.getOrdinate(r,n)),t.setOrdinate(r,n,i)}},HI.copy=function(t,e,r,n,i){for(var o=0;o<i;o++)HI.copyCoord(t,e+o,r,n+o)},HI.toString=function(){if(1===arguments.length){var t=arguments[0],e=t.size();if(0===e)return"()";var r=t.getDimension(),n=new A_;n.append("(");for(var i=0;i<e;i++){i>0&&n.append(" ");for(var o=0;o<r;o++)o>0&&n.append(","),n.append(zI.toString(t.getOrdinate(i,o)))}return n.append(")"),n.toString()}},HI.ensureValidRing=function(t,e){var r=e.size();return 0===r?e:r<=3?HI.createClosedRing(t,e,4):e.getOrdinate(0,E_.X)===e.getOrdinate(r-1,E_.X)&&e.getOrdinate(0,E_.Y)===e.getOrdinate(r-1,E_.Y)?e:HI.createClosedRing(t,e,r+1)},HI.createClosedRing=function(t,e,r){var n=t.create(r,e.getDimension()),i=e.size();HI.copy(e,0,n,0,i);for(var o=i;o<r;o++)HI.copy(e,0,n,o,1);return n};var XI=function(t){function e(e,r){t.call(this,r),this._points=null,this.init(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new S_:this._points.expandEnvelope(new S_)},e.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},e.prototype.getSortIndex=function(){return t.SORTINDEX_LINESTRING},e.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];if(!this.isEquivalentClass(e))return!1;var n=e;if(this._points.size()!==n._points.size())return!1;for(var i=0;i<this._points.size();i++)if(!this.equal(this._points.getCoordinate(i),n._points.getCoordinate(i),r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=this,e=0;e<Math.trunc(this._points.size()/2);e++){var r=t._points.size()-1-e;if(!t._points.getCoordinate(e).equals(t._points.getCoordinate(r)))return t._points.getCoordinate(e).compareTo(t._points.getCoordinate(r))>0&&HI.reverse(t._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?NI.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 j_.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var t=this._points.copy();return HI.reverse(t),this.getFactory().createLineString(t)},e.prototype.compareToSameClass=function(){if(1===arguments.length){for(var t=arguments[0],e=0,r=0;e<this._points.size()&&r<t._points.size();){var n=this._points.getCoordinate(e).compareTo(t._points.getCoordinate(r));if(0!==n)return n;e++,r++}return e<this._points.size()?1:r<t._points.size()?-1:0}if(2===arguments.length){var i=arguments[0];return arguments[1].compare(this._points,i._points)}},e.prototype.apply=function(){if(f_(arguments[0],J_))for(var t=arguments[0],e=0;e<this._points.size();e++)t.filter(this._points.getCoordinate(e));else if(f_(arguments[0],DI)){var r=arguments[0];if(0===this._points.size())return null;for(var n=0;n<this._points.size()&&(r.filter(this._points,n),!r.isDone());n++);r.isGeometryChanged()&&this.geometryChanged()}else if(f_(arguments[0],RI)){arguments[0].filter(this)}else if(f_(arguments[0],z_)){arguments[0].filter(this)}},e.prototype.getBoundary=function(){return new kI(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 $m("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[bI]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(e,r),e}(Y_),JI=function(){};JI.prototype.interfaces_=function(){return[]},JI.prototype.getClass=function(){return JI};var WI=function(t){function e(e,r){t.call(this,r),this._coordinates=e||null,this.init(this._coordinates)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new S_;var t=new S_;return t.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),t},e.prototype.getSortIndex=function(){return t.SORTINDEX_POINT},e.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&(!(!this.isEmpty()||!e.isEmpty())||this.isEmpty()===e.isEmpty()&&this.equal(e.getCoordinate(),this.getCoordinate(),r))}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 NI.FALSE},e.prototype.getDimension=function(){return 0},e.prototype.getNumPoints=function(){return this.isEmpty()?0:1},e.prototype.reverse=function(){return this.copy()},e.prototype.getX=function(){if(null===this.getCoordinate())throw new Error("getX called on empty Point");return this.getCoordinate().x},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0];return this.getCoordinate().compareTo(t.getCoordinate())}if(2===arguments.length){var e=arguments[0];return arguments[1].compare(this._coordinates,e._coordinates)}},e.prototype.apply=function(){if(f_(arguments[0],J_)){var t=arguments[0];if(this.isEmpty())return null;t.filter(this.getCoordinate())}else if(f_(arguments[0],DI)){var e=arguments[0];if(this.isEmpty())return null;e.filter(this._coordinates,0),e.isGeometryChanged()&&this.geometryChanged()}else if(f_(arguments[0],RI)){arguments[0].filter(this)}else if(f_(arguments[0],z_)){arguments[0].filter(this)}},e.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},e.prototype.clone=function(){var e=t.prototype.clone.call(this);return e._coordinates=this._coordinates.clone(),e},e.prototype.getGeometryType=function(){return"Point"},e.prototype.copy=function(){return new e(this._coordinates.copy(),this._factory)},e.prototype.getCoordinateSequence=function(){return this._coordinates},e.prototype.getY=function(){if(null===this.getCoordinate())throw new Error("getY called on empty Point");return this.getCoordinate().y},e.prototype.isEmpty=function(){return 0===this._coordinates.size()},e.prototype.init=function(t){null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),k_.isTrue(t.size()<=1),this._coordinates=t},e.prototype.isSimple=function(){return!0},e.prototype.interfaces_=function(){return[JI]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return 0x44077bad161cbc00},Object.defineProperties(e,r),e}(Y_),KI=function(){};KI.prototype.interfaces_=function(){return[]},KI.prototype.getClass=function(){return KI};var ZI=function(t){function e(e,r,n){if(t.call(this,n),this._shell=null,this._holes=null,null===e&&(e=this.getFactory().createLinearRing()),null===r&&(r=[]),t.hasNullElements(r))throw new $m("holes must not contain null elements");if(e.isEmpty()&&t.hasNonEmptyElements(r))throw new $m("shell is empty but holes are not");this._shell=e,this._holes=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={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,r=this._shell.getCoordinates(),n=0;n<r.length;n++)t[++e]=r[n];for(var i=0;i<this._holes.length;i++)for(var o=this._holes[i].getCoordinates(),s=0;s<o.length;s++)t[++e]=o[s];return t},e.prototype.getArea=function(){var t=0;t+=Math.abs(j_.signedArea(this._shell.getCoordinateSequence()));for(var e=0;e<this._holes.length;e++)t-=Math.abs(j_.signedArea(this._holes[e].getCoordinateSequence()));return t},e.prototype.isRectangle=function(){if(0!==this.getNumInteriorRing())return!1;if(null===this._shell)return!1;if(5!==this._shell.getNumPoints())return!1;for(var t=this._shell.getCoordinateSequence(),e=this.getEnvelopeInternal(),r=0;r<5;r++){var n=t.getX(r);if(n!==e.getMinX()&&n!==e.getMaxX())return!1;var i=t.getY(r);if(i!==e.getMinY()&&i!==e.getMaxY())return!1}for(var o=t.getX(0),s=t.getY(0),a=1;a<=4;a++){var u=t.getX(a),l=t.getY(a);if(u!==o===(l!==s))return!1;o=u,s=l}return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];if(!this.isEquivalentClass(e))return!1;var n=e,i=this._shell,o=n._shell;if(!i.equalsExact(o,r))return!1;if(this._holes.length!==n._holes.length)return!1;for(var s=0;s<this._holes.length;s++)if(!this._holes[s].equalsExact(n._holes[s],r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){if(0===arguments.length){this.normalize(this._shell,!0);for(var t=0;t<this._holes.length;t++)this.normalize(this._holes[t],!1);LI.sort(this._holes)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(e.isEmpty())return null;var n=new Array(e.getCoordinates().length-1).fill(null);b_.arraycopy(e.getCoordinates(),0,n,0,n.length);var i=cI.minCoordinate(e.getCoordinates());cI.scroll(n,i),b_.arraycopy(n,0,e.getCoordinates(),0,n.length),e.getCoordinates()[n.length]=n[0],j_.isCCW(e.getCoordinates())===r&&cI.reverse(e.getCoordinates())}},e.prototype.getCoordinate=function(){return this._shell.getCoordinate()},e.prototype.getNumInteriorRing=function(){return this._holes.length},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.getLength=function(){var t=0;t+=this._shell.getLength();for(var e=0;e<this._holes.length;e++)t+=this._holes[e].getLength();return t},e.prototype.getNumPoints=function(){for(var t=this._shell.getNumPoints(),e=0;e<this._holes.length;e++)t+=this._holes[e].getNumPoints();return t},e.prototype.reverse=function(){var t=this.copy();t._shell=this._shell.copy().reverse(),t._holes=new Array(this._holes.length).fill(null);for(var e=0;e<this._holes.length;e++)t._holes[e]=this._holes[e].copy().reverse();return t},e.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=this._shell,r=t._shell;return e.compareToSameClass(r)}if(2===arguments.length){var n=arguments[1],i=arguments[0],o=this._shell,s=i._shell,a=o.compareToSameClass(s,n);if(0!==a)return a;for(var u=this.getNumInteriorRing(),l=i.getNumInteriorRing(),c=0;c<u&&c<l;){var h=this.getInteriorRingN(c),f=i.getInteriorRingN(c),p=h.compareToSameClass(f,n);if(0!==p)return p;c++}return c<u?1:c<l?-1:0}},e.prototype.apply=function(t){var e=this;if(f_(t,J_)){this._shell.apply(t);for(var r=0;r<this._holes.length;r++)e._holes[r].apply(t)}else if(f_(t,DI)){if(this._shell.apply(t),!t.isDone())for(var n=0;n<this._holes.length&&(e._holes[n].apply(t),!t.isDone());n++);t.isGeometryChanged()&&this.geometryChanged()}else if(f_(t,RI))t.filter(this);else if(f_(t,z_)){t.filter(this),this._shell.apply(t);for(var i=0;i<this._holes.length;i++)e._holes[i].apply(t)}},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var t=new Array(this._holes.length+1).fill(null);t[0]=this._shell;for(var e=0;e<this._holes.length;e++)t[e+1]=this._holes[e];return t.length<=1?this.getFactory().createLinearRing(t[0].getCoordinateSequence()):this.getFactory().createMultiLineString(t)},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._shell=this._shell.clone(),e._holes=new Array(this._holes.length).fill(null);for(var r=0;r<this._holes.length;r++)e._holes[r]=this._holes[r].clone();return e},e.prototype.getGeometryType=function(){return"Polygon"},e.prototype.copy=function(){for(var t=this._shell.copy(),r=new Array(this._holes.length).fill(null),n=0;n<r.length;n++)r[n]=this._holes[n].copy();return new e(t,r,this._factory)},e.prototype.getExteriorRing=function(){return this._shell},e.prototype.isEmpty=function(){return this._shell.isEmpty()},e.prototype.getInteriorRingN=function(t){return this._holes[t]},e.prototype.interfaces_=function(){return[KI]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(e,r),e}(Y_),$I=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return Y_.SORTINDEX_MULTIPOINT},e.prototype.isValid=function(){return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getCoordinate=function(){if(1===arguments.length){var e=arguments[0];return this._geometries[e].getCoordinate()}return t.prototype.getCoordinate.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return NI.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),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[JI]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x6fb1ed4162e0fc00},Object.defineProperties(e,r),e}(PI),tE=function(t){function e(e,r){e instanceof s_&&r instanceof dE&&(e=r.getCoordinateSequenceFactory().create(e)),t.call(this,e,r),this.validateConstruction()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return Y_.SORTINDEX_LINEARRING},e.prototype.getBoundaryDimension=function(){return NI.FALSE},e.prototype.isClosed=function(){return!!this.isEmpty()||t.prototype.isClosed.call(this)},e.prototype.reverse=function(){var t=this._points.copy();return HI.reverse(t),this.getFactory().createLinearRing(t)},e.prototype.validateConstruction=function(){if(!this.isEmpty()&&!t.prototype.isClosed.call(this))throw new $m("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<e.MINIMUM_VALID_SIZE)throw new $m("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},r.MINIMUM_VALID_SIZE.get=function(){return 4},r.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,r),e}(XI),eE=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return Y_.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}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),r=0;r<this._geometries.length;r++)e[r]=this._geometries[r].reverse();return this.getFactory().createMultiPolygon(e)},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var t=new aI,e=0;e<this._geometries.length;e++)for(var r=this._geometries[e].getBoundary(),n=0;n<r.getNumGeometries();n++)t.add(r.getGeometryN(n));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),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[KI]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(e,r),e}(PI),rE=function(t){this._factory=t||null,this._isUserDataCopied=!1},nE={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};rE.prototype.setCopyUserData=function(t){this._isUserDataCopied=t},rE.prototype.edit=function(t,e){if(null===t)return null;var r=this.editInternal(t,e);return this._isUserDataCopied&&r.setUserData(t.getUserData()),r},rE.prototype.editInternal=function(t,e){return null===this._factory&&(this._factory=t.getFactory()),t instanceof PI?this.editGeometryCollection(t,e):t instanceof ZI?this.editPolygon(t,e):t instanceof WI||t instanceof XI?e.edit(t,this._factory):(k_.shouldNeverReachHere("Unsupported Geometry class: "+t.getClass().getName()),null)},rE.prototype.editGeometryCollection=function(t,e){for(var r=e.edit(t,this._factory),n=new aI,i=0;i<r.getNumGeometries();i++){var o=this.edit(r.getGeometryN(i),e);null===o||o.isEmpty()||n.add(o)}return r.getClass()===$I?this._factory.createMultiPoint(n.toArray([])):r.getClass()===QI?this._factory.createMultiLineString(n.toArray([])):r.getClass()===eE?this._factory.createMultiPolygon(n.toArray([])):this._factory.createGeometryCollection(n.toArray([]))},rE.prototype.editPolygon=function(t,e){var r=e.edit(t,this._factory);if(null===r&&(r=this._factory.createPolygon(null)),r.isEmpty())return r;var n=this.edit(r.getExteriorRing(),e);if(null===n||n.isEmpty())return this._factory.createPolygon();for(var i=new aI,o=0;o<r.getNumInteriorRing();o++){var s=this.edit(r.getInteriorRingN(o),e);null===s||s.isEmpty()||i.add(s)}return this._factory.createPolygon(n,i.toArray([]))},rE.prototype.interfaces_=function(){return[]},rE.prototype.getClass=function(){return rE},rE.GeometryEditorOperation=function(){},nE.NoOpGeometryOperation.get=function(){return iE},nE.CoordinateOperation.get=function(){return oE},nE.CoordinateSequenceOperation.get=function(){return sE},Object.defineProperties(rE,nE);var iE=function(){};iE.prototype.edit=function(t,e){return t},iE.prototype.interfaces_=function(){return[rE.GeometryEditorOperation]},iE.prototype.getClass=function(){return iE};var oE=function(){};oE.prototype.edit=function(t,e){var r=this.editCoordinates(t.getCoordinates(),t);return null===r?t:t instanceof tE?e.createLinearRing(r):t instanceof XI?e.createLineString(r):t instanceof WI?r.length>0?e.createPoint(r[0]):e.createPoint():t},oE.prototype.interfaces_=function(){return[rE.GeometryEditorOperation]},oE.prototype.getClass=function(){return oE};var sE=function(){};sE.prototype.edit=function(t,e){return t instanceof tE?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof XI?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof WI?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t},sE.prototype.interfaces_=function(){return[rE.GeometryEditorOperation]},sE.prototype.getClass=function(){return sE};var aE=function(){var t=this;if(this._dimension=3,this._coordinates=null,1===arguments.length){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var e=arguments[0];this._coordinates=new Array(e).fill(null);for(var r=0;r<e;r++)t._coordinates[r]=new s_}else if(f_(arguments[0],E_)){var n=arguments[0];if(null===n)return this._coordinates=new Array(0).fill(null),null;this._dimension=n.getDimension(),this._coordinates=new Array(n.size()).fill(null);for(var i=0;i<this._coordinates.length;i++)t._coordinates[i]=n.getCoordinateCopy(i)}}else if(2===arguments.length)if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var o=arguments[0],s=arguments[1];this._coordinates=o,this._dimension=s,null===o&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var a=arguments[0],u=arguments[1];this._coordinates=new Array(a).fill(null),this._dimension=u;for(var l=0;l<a;l++)t._coordinates[l]=new s_}},uE={serialVersionUID:{configurable:!0}};aE.prototype.setOrdinate=function(t,e,r){switch(e){case E_.X:this._coordinates[t].x=r;break;case E_.Y:this._coordinates[t].y=r;break;case E_.Z:this._coordinates[t].z=r;break;default:throw new $m("invalid ordinateIndex")}},aE.prototype.size=function(){return this._coordinates.length},aE.prototype.getOrdinate=function(t,e){switch(e){case E_.X:return this._coordinates[t].x;case E_.Y:return this._coordinates[t].y;case E_.Z:return this._coordinates[t].z}return t_.NaN},aE.prototype.getCoordinate=function(){if(1===arguments.length){var t=arguments[0];return this._coordinates[t]}if(2===arguments.length){var e=arguments[0],r=arguments[1];r.x=this._coordinates[e].x,r.y=this._coordinates[e].y,r.z=this._coordinates[e].z}},aE.prototype.getCoordinateCopy=function(t){return new s_(this._coordinates[t])},aE.prototype.getDimension=function(){return this._dimension},aE.prototype.getX=function(t){return this._coordinates[t].x},aE.prototype.clone=function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].clone();return new aE(t,this._dimension)},aE.prototype.expandEnvelope=function(t){for(var e=0;e<this._coordinates.length;e++)t.expandToInclude(this._coordinates[e]);return t},aE.prototype.copy=function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].copy();return new aE(t,this._dimension)},aE.prototype.toString=function(){if(this._coordinates.length>0){var t=new A_(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var e=1;e<this._coordinates.length;e++)t.append(", "),t.append(this._coordinates[e]);return t.append(")"),t.toString()}return"()"},aE.prototype.getY=function(t){return this._coordinates[t].y},aE.prototype.toCoordinateArray=function(){return this._coordinates},aE.prototype.interfaces_=function(){return[E_,o_]},aE.prototype.getClass=function(){return aE},uE.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(aE,uE);var lE=function(){},cE={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};lE.prototype.readResolve=function(){return lE.instance()},lE.prototype.create=function(){if(1===arguments.length){if(arguments[0]instanceof Array)return new aE(arguments[0]);if(f_(arguments[0],E_))return new aE(arguments[0])}else if(2===arguments.length){var t=arguments[0],e=arguments[1];return e>3&&(e=3),e<2?new aE(t):new aE(t,e)}},lE.prototype.interfaces_=function(){return[l_,o_]},lE.prototype.getClass=function(){return lE},lE.instance=function(){return lE.instanceObject},cE.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},cE.instanceObject.get=function(){return new lE},Object.defineProperties(lE,cE);var hE=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 aI,e=this.map_.values(),r=e.next();!r.done;)t.add(r.value),r=e.next();return t},e.prototype.entrySet=function(){var t=new vI;return this.map_.entries().forEach((function(e){return t.add(e)})),t},e.prototype.size=function(){return this.map_.size()},e}(gI),fE=function t(){if(this._modelType=null,this._scale=null,0===arguments.length)this._modelType=t.FLOATING;else if(1===arguments.length)if(arguments[0]instanceof gE){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if("number"==typeof arguments[0]){var r=arguments[0];this._modelType=t.FIXED,this.setScale(r)}else if(arguments[0]instanceof t){var n=arguments[0];this._modelType=n._modelType,this._scale=n._scale}},pE={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};fE.prototype.equals=function(t){if(!(t instanceof fE))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale},fE.prototype.compareTo=function(t){var e=t,r=this.getMaximumSignificantDigits(),n=e.getMaximumSignificantDigits();return new d_(r).compareTo(new d_(n))},fE.prototype.getScale=function(){return this._scale},fE.prototype.isFloating=function(){return this._modelType===fE.FLOATING||this._modelType===fE.FLOATING_SINGLE},fE.prototype.getType=function(){return this._modelType},fE.prototype.toString=function(){var t="UNKNOWN";return this._modelType===fE.FLOATING?t="Floating":this._modelType===fE.FLOATING_SINGLE?t="Floating-Single":this._modelType===fE.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},fE.prototype.makePrecise=function(){if("number"==typeof arguments[0]){var t=arguments[0];return t_.isNaN(t)||this._modelType===fE.FLOATING_SINGLE?t:this._modelType===fE.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof s_){var e=arguments[0];if(this._modelType===fE.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}},fE.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===fE.FLOATING?t=16:this._modelType===fE.FLOATING_SINGLE?t=6:this._modelType===fE.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},fE.prototype.setScale=function(t){this._scale=Math.abs(t)},fE.prototype.interfaces_=function(){return[o_,r_]},fE.prototype.getClass=function(){return fE},fE.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e},pE.serialVersionUID.get=function(){return 0x6bee6404e9a25c00},pE.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(fE,pE);var gE=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},AE={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};gE.prototype.readResolve=function(){return gE.nameToTypeMap.get(this._name)},gE.prototype.toString=function(){return this._name},gE.prototype.interfaces_=function(){return[o_]},gE.prototype.getClass=function(){return gE},AE.serialVersionUID.get=function(){return-552860263173159e4},AE.nameToTypeMap.get=function(){return new hE},Object.defineProperties(gE,AE),fE.Type=gE,fE.FIXED=new gE("FIXED"),fE.FLOATING=new gE("FLOATING"),fE.FLOATING_SINGLE=new gE("FLOATING SINGLE");var dE=function t(){this._precisionModel=new fE,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),0===arguments.length||(1===arguments.length?f_(arguments[0],l_)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof fE&&(this._precisionModel=arguments[0]):2===arguments.length?(this._precisionModel=arguments[0],this._SRID=arguments[1]):3===arguments.length&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},yE={serialVersionUID:{configurable:!0}};dE.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new s_(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new s_(t.getMinX(),t.getMinY()),new s_(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new s_(t.getMinX(),t.getMinY()),new s_(t.getMinX(),t.getMaxY()),new s_(t.getMaxX(),t.getMaxY()),new s_(t.getMaxX(),t.getMinY()),new s_(t.getMinX(),t.getMinY())]),null)},dE.prototype.createLineString=function(t){return t?t instanceof Array?new XI(this.getCoordinateSequenceFactory().create(t),this):f_(t,E_)?new XI(t,this):void 0:new XI(this.getCoordinateSequenceFactory().create([]),this)},dE.prototype.createMultiLineString=function(){return 0===arguments.length?new QI(null,this):1===arguments.length?new QI(arguments[0],this):void 0},dE.prototype.buildGeometry=function(t){for(var e=null,r=!1,n=!1,i=t.iterator();i.hasNext();){var o=i.next(),s=o.getClass();null===e&&(e=s),s!==e&&(r=!0),o.isGeometryCollectionOrDerived()&&(n=!0)}if(null===e)return this.createGeometryCollection();if(r||n)return this.createGeometryCollection(dE.toGeometryArray(t));var a=t.iterator().next();if(t.size()>1){if(a instanceof ZI)return this.createMultiPolygon(dE.toPolygonArray(t));if(a instanceof XI)return this.createMultiLineString(dE.toLineStringArray(t));if(a instanceof WI)return this.createMultiPoint(dE.toPointArray(t));k_.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a},dE.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)},dE.prototype.createPoint=function(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof s_){var t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(f_(arguments[0],E_))return new WI(arguments[0],this)}},dE.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},dE.prototype.createPolygon=function(){if(0===arguments.length)return new ZI(null,null,this);if(1===arguments.length){if(f_(arguments[0],E_)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}if(arguments[0]instanceof tE){var r=arguments[0];return this.createPolygon(r,null)}}else if(2===arguments.length){return new ZI(arguments[0],arguments[1],this)}},dE.prototype.getSRID=function(){return this._SRID},dE.prototype.createGeometryCollection=function(){return 0===arguments.length?new PI(null,this):1===arguments.length?new PI(arguments[0],this):void 0},dE.prototype.createGeometry=function(t){return new rE(this).edit(t,{edit:function(){if(2===arguments.length){var t=arguments[0];return this._coordinateSequenceFactory.create(t)}}})},dE.prototype.getPrecisionModel=function(){return this._precisionModel},dE.prototype.createLinearRing=function(){if(0===arguments.length)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(f_(arguments[0],E_))return new tE(arguments[0],this)}},dE.prototype.createMultiPolygon=function(){return 0===arguments.length?new eE(null,this):1===arguments.length?new eE(arguments[0],this):void 0},dE.prototype.createMultiPoint=function(){if(0===arguments.length)return new $I(null,this);if(1===arguments.length){if(arguments[0]instanceof Array)return new $I(arguments[0],this);if(arguments[0]instanceof Array){var t=arguments[0];return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(f_(arguments[0],E_)){var e=arguments[0];if(null===e)return this.createMultiPoint(new Array(0).fill(null));for(var r=new Array(e.size()).fill(null),n=0;n<e.size();n++){var i=this.getCoordinateSequenceFactory().create(1,e.getDimension());HI.copy(e,n,i,0,1),r[n]=this.createPoint(i)}return this.createMultiPoint(r)}}},dE.prototype.interfaces_=function(){return[o_]},dE.prototype.getClass=function(){return dE},dE.toMultiPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},dE.toGeometryArray=function(t){if(null===t)return null;var e=new Array(t.size()).fill(null);return t.toArray(e)},dE.getDefaultCoordinateSequenceFactory=function(){return lE.instance()},dE.toMultiLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},dE.toLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},dE.toMultiPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},dE.toLinearRingArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},dE.toPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},dE.toPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},dE.createPointFromInternalCoord=function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)},yE.serialVersionUID.get=function(){return-0x5ea75f2051eeb400},Object.defineProperties(dE,yE);var vE=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],mE=function(t){this.geometryFactory=t||new dE};mE.prototype.read=function(t){var e,r=(e="string"==typeof t?JSON.parse(t):t).type;if(!_E[r])throw new Error("Unknown GeoJSON type: "+e.type);return-1!==vE.indexOf(r)?_E[r].apply(this,[e.coordinates]):"GeometryCollection"===r?_E[r].apply(this,[e.geometries]):_E[r].apply(this,[e])},mE.prototype.write=function(t){var e=t.getGeometryType();if(!IE[e])throw new Error("Geometry is not supported");return IE[e].apply(this,[t])};var _E={Feature:function(t){var e={};for(var r in t)e[r]=t[r];if(t.geometry){var n=t.geometry.type;if(!_E[n])throw new Error("Unknown GeoJSON type: "+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=_E.bbox.apply(this,[t.bbox])),e},FeatureCollection:function(t){var e={};if(t.features){e.features=[];for(var r=0;r<t.features.length;++r)e.features.push(this.read(t.features[r]))}return t.bbox&&(e.bbox=this.parse.bbox.apply(this,[t.bbox])),e},coordinates:function(t){for(var e=[],r=0;r<t.length;++r){var n=t[r];e.push(new s_(n[0],n[1]))}return e},bbox:function(t){return this.geometryFactory.createLinearRing([new s_(t[0],t[1]),new s_(t[2],t[1]),new s_(t[2],t[3]),new s_(t[0],t[3]),new s_(t[0],t[1])])},Point:function(t){var e=new s_(t[0],t[1]);return this.geometryFactory.createPoint(e)},MultiPoint:function(t){for(var e=[],r=0;r<t.length;++r)e.push(_E.Point.apply(this,[t[r]]));return this.geometryFactory.createMultiPoint(e)},LineString:function(t){var e=_E.coordinates.apply(this,[t]);return this.geometryFactory.createLineString(e)},MultiLineString:function(t){for(var e=[],r=0;r<t.length;++r)e.push(_E.LineString.apply(this,[t[r]]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(t){for(var e=_E.coordinates.apply(this,[t[0]]),r=this.geometryFactory.createLinearRing(e),n=[],i=1;i<t.length;++i){var o=t[i],s=_E.coordinates.apply(this,[o]),a=this.geometryFactory.createLinearRing(s);n.push(a)}return this.geometryFactory.createPolygon(r,n)},MultiPolygon:function(t){for(var e=[],r=0;r<t.length;++r){var n=t[r];e.push(_E.Polygon.apply(this,[n]))}return this.geometryFactory.createMultiPolygon(e)},GeometryCollection:function(t){for(var e=[],r=0;r<t.length;++r){var n=t[r];e.push(this.read(n))}return this.geometryFactory.createGeometryCollection(e)}},IE={coordinate:function(t){return[t.x,t.y]},Point:function(t){return{type:"Point",coordinates:IE.coordinate.apply(this,[t.getCoordinate()])}},MultiPoint:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=IE.Point.apply(this,[n]);e.push(i.coordinates)}return{type:"MultiPoint",coordinates:e}},LineString:function(t){for(var e=[],r=t.getCoordinates(),n=0;n<r.length;++n){var i=r[n];e.push(IE.coordinate.apply(this,[i]))}return{type:"LineString",coordinates:e}},MultiLineString:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=IE.LineString.apply(this,[n]);e.push(i.coordinates)}return{type:"MultiLineString",coordinates:e}},Polygon:function(t){var e=[],r=IE.LineString.apply(this,[t._shell]);e.push(r.coordinates);for(var n=0;n<t._holes.length;++n){var i=t._holes[n],o=IE.LineString.apply(this,[i]);e.push(o.coordinates)}return{type:"Polygon",coordinates:e}},MultiPolygon:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=IE.Polygon.apply(this,[n]);e.push(i.coordinates)}return{type:"MultiPolygon",coordinates:e}},GeometryCollection:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=n.getGeometryType();e.push(IE[i].apply(this,[n]))}return{type:"GeometryCollection",geometries:e}}},EE=function(t){this.geometryFactory=t||new dE,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new mE(this.geometryFactory)};EE.prototype.read=function(t){var e=this.parser.read(t);return this.precisionModel.getType()===fE.FIXED&&this.reducePrecision(e),e},EE.prototype.reducePrecision=function(t){var e,r;if(t.coordinate)this.precisionModel.makePrecise(t.coordinate);else if(t.points)for(e=0,r=t.points.length;e<r;e++)this.precisionModel.makePrecise(t.points[e]);else if(t.geometries)for(e=0,r=t.geometries.length;e<r;e++)this.reducePrecision(t.geometries[e])};var xE=function(){this.parser=new mE(this.geometryFactory)};xE.prototype.write=function(t){return this.parser.write(t)};var CE=function(){},wE={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};function bE(t){this.message=t||""}function BE(){this.array_=[]}CE.prototype.interfaces_=function(){return[]},CE.prototype.getClass=function(){return CE},CE.opposite=function(t){return t===CE.LEFT?CE.RIGHT:t===CE.RIGHT?CE.LEFT:t},wE.ON.get=function(){return 0},wE.LEFT.get=function(){return 1},wE.RIGHT.get=function(){return 2},Object.defineProperties(CE,wE),bE.prototype=new Error,bE.prototype.name="EmptyStackException",BE.prototype=new oI,BE.prototype.add=function(t){return this.array_.push(t),!0},BE.prototype.get=function(t){if(t<0||t>=this.size())throw new Error;return this.array_[t]},BE.prototype.push=function(t){return this.array_.push(t),t},BE.prototype.pop=function(t){if(0===this.array_.length)throw new bE;return this.array_.pop()},BE.prototype.peek=function(){if(0===this.array_.length)throw new bE;return this.array_[this.array_.length-1]},BE.prototype.empty=function(){return 0===this.array_.length},BE.prototype.isEmpty=function(){return this.empty()},BE.prototype.search=function(t){return this.array_.indexOf(t)},BE.prototype.size=function(){return this.array_.length},BE.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t};var SE=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};SE.prototype.getCoordinate=function(){return this._minCoord},SE.prototype.getRightmostSide=function(t,e){var r=this.getRightmostSideOfSegment(t,e);return r<0&&(r=this.getRightmostSideOfSegment(t,e-1)),r<0&&(this._minCoord=null,this.checkForRightmostCoordinate(t)),r},SE.prototype.findRightmostEdgeAtVertex=function(){var t=this._minDe.getEdge().getCoordinates();k_.isTrue(this._minIndex>0&&this._minIndex<t.length,"rightmost point expected to be interior vertex of edge");var e=t[this._minIndex-1],r=t[this._minIndex+1],n=j_.computeOrientation(this._minCoord,r,e),i=!1;(e.y<this._minCoord.y&&r.y<this._minCoord.y&&n===j_.COUNTERCLOCKWISE||e.y>this._minCoord.y&&r.y>this._minCoord.y&&n===j_.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)},SE.prototype.getRightmostSideOfSegment=function(t,e){var r=t.getEdge().getCoordinates();if(e<0||e+1>=r.length)return-1;if(r[e].y===r[e+1].y)return-1;var n=CE.LEFT;return r[e].y<r[e+1].y&&(n=CE.RIGHT),n},SE.prototype.getEdge=function(){return this._orientedDe},SE.prototype.checkForRightmostCoordinate=function(t){for(var e=this,r=t.getEdge().getCoordinates(),n=0;n<r.length-1;n++)(null===e._minCoord||r[n].x>e._minCoord.x)&&(e._minDe=t,e._minIndex=n,e._minCoord=r[n])},SE.prototype.findRightmostEdgeAtNode=function(){var t=this._minDe.getNode().getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},SE.prototype.findEdge=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next();r.isForward()&&this.checkForRightmostCoordinate(r)}k_.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)===CE.LEFT&&(this._orientedDe=this._minDe.getSym())},SE.prototype.interfaces_=function(){return[]},SE.prototype.getClass=function(){return SE};var ME=function(t){function e(r,n){t.call(this,e.msgWithCoord(r,n)),this.pt=n?new s_(n):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}(P_),LE=function(){this.array_=[]};LE.prototype.addLast=function(t){this.array_.push(t)},LE.prototype.removeFirst=function(){return this.array_.shift()},LE.prototype.isEmpty=function(){return 0===this.array_.length};var NE=function(){this._finder=null,this._dirEdgeList=new aI,this._nodes=new aI,this._rightMostCoord=null,this._env=null,this._finder=new SE};NE.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){t.next().setVisited(!1)}},NE.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},NE.prototype.computeNodeDepth=function(t){for(var e=null,r=t.getEdges().iterator();r.hasNext();){var n=r.next();if(n.isVisited()||n.getSym().isVisited()){e=n;break}}if(null===e)throw new ME("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)}},NE.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(CE.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)},NE.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},NE.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(CE.RIGHT)>=1&&e.getDepth(CE.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},NE.prototype.computeDepths=function(t){var e=new vI,r=new LE,n=t.getNode();for(r.addLast(n),e.add(n),t.setVisited(!0);!r.isEmpty();){var i=r.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)||(r.addLast(a),e.add(a))}}}},NE.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.x<e._rightMostCoord.x?-1:this._rightMostCoord.x>e._rightMostCoord.x?1:0},NE.prototype.getEnvelope=function(){if(null===this._env){for(var t=new S_,e=this._dirEdgeList.iterator();e.hasNext();)for(var r=e.next().getEdge().getCoordinates(),n=0;n<r.length-1;n++)t.expandToInclude(r[n]);this._env=t}return this._env},NE.prototype.addReachable=function(t){var e=new BE;for(e.add(t);!e.empty();){var r=e.pop();this.add(r,e)}},NE.prototype.copySymDepths=function(t){var e=t.getSym();e.setDepth(CE.LEFT,t.getDepth(CE.RIGHT)),e.setDepth(CE.RIGHT,t.getDepth(CE.LEFT))},NE.prototype.add=function(t,e){t.setVisited(!0),this._nodes.add(t);for(var r=t.getEdges().iterator();r.hasNext();){var n=r.next();this._dirEdgeList.add(n);var i=n.getSym().getNode();i.isVisited()||e.push(i)}},NE.prototype.getNodes=function(){return this._nodes},NE.prototype.getDirectedEdges=function(){return this._dirEdgeList},NE.prototype.interfaces_=function(){return[r_]},NE.prototype.getClass=function(){return NE};var TE=function t(){if(this.location=null,1===arguments.length){if(arguments[0]instanceof Array){var e=arguments[0];this.init(e.length)}else if(Number.isInteger(arguments[0])){var r=arguments[0];this.init(1),this.location[CE.ON]=r}else if(arguments[0]instanceof t){var n=arguments[0];if(this.init(n.location.length),null!==n)for(var i=0;i<this.location.length;i++)this.location[i]=n.location[i]}}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];this.init(3),this.location[CE.ON]=o,this.location[CE.LEFT]=s,this.location[CE.RIGHT]=a}};TE.prototype.setAllLocations=function(t){for(var e=0;e<this.location.length;e++)this.location[e]=t},TE.prototype.isNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==c_.NONE)return!1;return!0},TE.prototype.setAllLocationsIfNull=function(t){for(var e=0;e<this.location.length;e++)this.location[e]===c_.NONE&&(this.location[e]=t)},TE.prototype.isLine=function(){return 1===this.location.length},TE.prototype.merge=function(t){if(t.location.length>this.location.length){var e=new Array(3).fill(null);e[CE.ON]=this.location[CE.ON],e[CE.LEFT]=c_.NONE,e[CE.RIGHT]=c_.NONE,this.location=e}for(var r=0;r<this.location.length;r++)this.location[r]===c_.NONE&&r<t.location.length&&(this.location[r]=t.location[r])},TE.prototype.getLocations=function(){return this.location},TE.prototype.flip=function(){if(this.location.length<=1)return null;var t=this.location[CE.LEFT];this.location[CE.LEFT]=this.location[CE.RIGHT],this.location[CE.RIGHT]=t},TE.prototype.toString=function(){var t=new A_;return this.location.length>1&&t.append(c_.toLocationSymbol(this.location[CE.LEFT])),t.append(c_.toLocationSymbol(this.location[CE.ON])),this.location.length>1&&t.append(c_.toLocationSymbol(this.location[CE.RIGHT])),t.toString()},TE.prototype.setLocations=function(t,e,r){this.location[CE.ON]=t,this.location[CE.LEFT]=e,this.location[CE.RIGHT]=r},TE.prototype.get=function(t){return t<this.location.length?this.location[t]:c_.NONE},TE.prototype.isArea=function(){return this.location.length>1},TE.prototype.isAnyNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===c_.NONE)return!0;return!1},TE.prototype.setLocation=function(){if(1===arguments.length){var t=arguments[0];this.setLocation(CE.ON,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this.location[e]=r}},TE.prototype.init=function(t){this.location=new Array(t).fill(null),this.setAllLocations(c_.NONE)},TE.prototype.isEqualOnSide=function(t,e){return this.location[e]===t.location[e]},TE.prototype.allPositionsEqual=function(t){for(var e=0;e<this.location.length;e++)if(this.location[e]!==t)return!1;return!0},TE.prototype.interfaces_=function(){return[]},TE.prototype.getClass=function(){return TE};var RE=function t(){if(this.elt=new Array(2).fill(null),1===arguments.length){if(Number.isInteger(arguments[0])){var e=arguments[0];this.elt[0]=new TE(e),this.elt[1]=new TE(e)}else if(arguments[0]instanceof t){var r=arguments[0];this.elt[0]=new TE(r.elt[0]),this.elt[1]=new TE(r.elt[1])}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.elt[0]=new TE(c_.NONE),this.elt[1]=new TE(c_.NONE),this.elt[n].setLocation(i)}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];this.elt[0]=new TE(o,s,a),this.elt[1]=new TE(o,s,a)}else if(4===arguments.length){var u=arguments[0],l=arguments[1],c=arguments[2],h=arguments[3];this.elt[0]=new TE(c_.NONE,c_.NONE,c_.NONE),this.elt[1]=new TE(c_.NONE,c_.NONE,c_.NONE),this.elt[u].setLocations(l,c,h)}};RE.prototype.getGeometryCount=function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t},RE.prototype.setAllLocations=function(t,e){this.elt[t].setAllLocations(e)},RE.prototype.isNull=function(t){return this.elt[t].isNull()},RE.prototype.setAllLocationsIfNull=function(){if(1===arguments.length){var t=arguments[0];this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this.elt[e].setAllLocationsIfNull(r)}},RE.prototype.isLine=function(t){return this.elt[t].isLine()},RE.prototype.merge=function(t){for(var e=this,r=0;r<2;r++)null===e.elt[r]&&null!==t.elt[r]?e.elt[r]=new TE(t.elt[r]):e.elt[r].merge(t.elt[r])},RE.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},RE.prototype.getLocation=function(){if(1===arguments.length){var t=arguments[0];return this.elt[t].get(CE.ON)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return this.elt[e].get(r)}},RE.prototype.toString=function(){var t=new A_;return null!==this.elt[0]&&(t.append("A:"),t.append(this.elt[0].toString())),null!==this.elt[1]&&(t.append(" B:"),t.append(this.elt[1].toString())),t.toString()},RE.prototype.isArea=function(){if(0===arguments.length)return this.elt[0].isArea()||this.elt[1].isArea();if(1===arguments.length){var t=arguments[0];return this.elt[t].isArea()}},RE.prototype.isAnyNull=function(t){return this.elt[t].isAnyNull()},RE.prototype.setLocation=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.elt[t].setLocation(CE.ON,e)}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this.elt[r].setLocation(n,i)}},RE.prototype.isEqualOnSide=function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)},RE.prototype.allPositionsEqual=function(t,e){return this.elt[t].allPositionsEqual(e)},RE.prototype.toLine=function(t){this.elt[t].isArea()&&(this.elt[t]=new TE(this.elt[t].location[0]))},RE.prototype.interfaces_=function(){return[]},RE.prototype.getClass=function(){return RE},RE.toLineLabel=function(t){for(var e=new RE(c_.NONE),r=0;r<2;r++)e.setLocation(r,t.getLocation(r));return e};var DE=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new aI,this._pts=new aI,this._label=new RE(c_.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new aI,this._geometryFactory=null;var t=arguments[0],e=arguments[1];this._geometryFactory=e,this.computePoints(t),this.computeRing()};DE.prototype.computeRing=function(){if(null!==this._ring)return null;for(var t=new Array(this._pts.size()).fill(null),e=0;e<this._pts.size();e++)t[e]=this._pts.get(e);this._ring=this._geometryFactory.createLinearRing(t),this._isHole=j_.isCCW(this._ring.getCoordinates())},DE.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},DE.prototype.computePoints=function(t){var e=this;this._startDe=t;var r=t,n=!0;do{if(null===r)throw new ME("Found null DirectedEdge");if(r.getEdgeRing()===e)throw new ME("Directed Edge visited twice during ring-building at "+r.getCoordinate());e._edges.add(r);var i=r.getLabel();k_.isTrue(i.isArea()),e.mergeLabel(i),e.addPoints(r.getEdge(),r.isForward(),n),n=!1,e.setEdgeRing(r,e),r=e.getNext(r)}while(r!==this._startDe)},DE.prototype.getLinearRing=function(){return this._ring},DE.prototype.getCoordinate=function(t){return this._pts.get(t)},DE.prototype.computeMaxNodeDegree=function(){var t=this;this._maxNodeDegree=0;var e=this._startDe;do{var r=e.getNode().getEdges().getOutgoingDegree(t);r>t._maxNodeDegree&&(t._maxNodeDegree=r),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2},DE.prototype.addPoints=function(t,e,r){var n=t.getCoordinates();if(e){var i=1;r&&(i=0);for(var o=i;o<n.length;o++)this._pts.add(n[o])}else{var s=n.length-2;r&&(s=n.length-1);for(var a=s;a>=0;a--)this._pts.add(n[a])}},DE.prototype.isHole=function(){return this._isHole},DE.prototype.setInResult=function(){var t=this._startDe;do{t.getEdge().setInResult(!0),t=t.getNext()}while(t!==this._startDe)},DE.prototype.containsPoint=function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!j_.isPointInRing(t,e.getCoordinates()))return!1;for(var r=this._holes.iterator();r.hasNext();){if(r.next().containsPoint(t))return!1}return!0},DE.prototype.addHole=function(t){this._holes.add(t)},DE.prototype.isShell=function(){return null===this._shell},DE.prototype.getLabel=function(){return this._label},DE.prototype.getEdges=function(){return this._edges},DE.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},DE.prototype.getShell=function(){return this._shell},DE.prototype.mergeLabel=function(){if(1===arguments.length){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(2===arguments.length){var e=arguments[1],r=arguments[0].getLocation(e,CE.RIGHT);if(r===c_.NONE)return null;if(this._label.getLocation(e)===c_.NONE)return this._label.setLocation(e,r),null}},DE.prototype.setShell=function(t){this._shell=t,null!==t&&t.addHole(this)},DE.prototype.toPolygon=function(t){for(var e=new Array(this._holes.size()).fill(null),r=0;r<this._holes.size();r++)e[r]=this._holes.get(r).getLinearRing();return t.createPolygon(this.getLinearRing(),e)},DE.prototype.interfaces_=function(){return[]},DE.prototype.getClass=function(){return DE};var PE=function(t){function e(){var e=arguments[0],r=arguments[1];t.call(this,e,r)}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}(DE),QE=function(t){function e(){var e=arguments[0],r=arguments[1];t.call(this,e,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildMinimalRings=function(){var t=new aI,e=this._startDe;do{if(null===e.getMinEdgeRing()){var r=new PE(e,this._geometryFactory);t.add(r)}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}(DE),kE=function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._label=t}};kE.prototype.setVisited=function(t){this._isVisited=t},kE.prototype.setInResult=function(t){this._isInResult=t},kE.prototype.isCovered=function(){return this._isCovered},kE.prototype.isCoveredSet=function(){return this._isCoveredSet},kE.prototype.setLabel=function(t){this._label=t},kE.prototype.getLabel=function(){return this._label},kE.prototype.setCovered=function(t){this._isCovered=t,this._isCoveredSet=!0},kE.prototype.updateIM=function(t){k_.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(t)},kE.prototype.isInResult=function(){return this._isInResult},kE.prototype.isVisited=function(){return this._isVisited},kE.prototype.interfaces_=function(){return[]},kE.prototype.getClass=function(){return kE};var OE=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var e=arguments[0],r=arguments[1];this._coord=e,this._edges=r,this._label=new RE(0,c_.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 r=c_.NONE;if(r=this._label.getLocation(e),!t.isNull(e)){var n=t.getLocation(e);r!==c_.BOUNDARY&&(r=n)}return r},e.prototype.setLabel=function(){if(2!==arguments.length)return t.prototype.setLabel.apply(this,arguments);var e=arguments[0],r=arguments[1];null===this._label?this._label=new RE(e,r):this._label.setLocation(e,r)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var t=this;if(arguments[0]instanceof e){var r=arguments[0];this.mergeLabel(r._label)}else if(arguments[0]instanceof RE)for(var n=arguments[0],i=0;i<2;i++){var o=t.computeMergedLocation(n,i);t._label.getLocation(i)===c_.NONE&&t._label.setLocation(i,o)}},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=c_.NONE;null!==this._label&&(e=this._label.getLocation(t));var r=null;if(e===c_.BOUNDARY)r=c_.INTERIOR;else r=c_.BOUNDARY;this._label.setLocation(t,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(kE),FE=function(){this.nodeMap=new wI,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};FE.prototype.find=function(t){return this.nodeMap.get(t)},FE.prototype.addNode=function(){if(arguments[0]instanceof s_){var t=arguments[0],e=this.nodeMap.get(t);return null===e&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}if(arguments[0]instanceof OE){var r=arguments[0],n=this.nodeMap.get(r.getCoordinate());return null===n?(this.nodeMap.put(r.getCoordinate(),r),r):(n.mergeLabel(r),n)}},FE.prototype.print=function(t){for(var e=this.iterator();e.hasNext();){e.next().print(t)}},FE.prototype.iterator=function(){return this.nodeMap.values().iterator()},FE.prototype.values=function(){return this.nodeMap.values()},FE.prototype.getBoundaryNodes=function(t){for(var e=new aI,r=this.iterator();r.hasNext();){var n=r.next();n.getLabel().getLocation(t)===c_.BOUNDARY&&e.add(n)}return e},FE.prototype.add=function(t){var e=t.getCoordinate();this.addNode(e).add(t)},FE.prototype.interfaces_=function(){return[]},FE.prototype.getClass=function(){return FE};var GE=function(){},UE={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};GE.prototype.interfaces_=function(){return[]},GE.prototype.getClass=function(){return GE},GE.isNorthern=function(t){return t===GE.NE||t===GE.NW},GE.isOpposite=function(t,e){return t!==e&&2===(t-e+4)%4},GE.commonHalfPlane=function(t,e){if(t===e)return t;if(2===(t-e+4)%4)return-1;var r=t<e?t:e;return 0===r&&3===(t>e?t:e)?3:r},GE.isInHalfPlane=function(t,e){return e===GE.SE?t===GE.SE||t===GE.SW:t===e||t===e+1},GE.quadrant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new $m("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?GE.NE:GE.SE:e>=0?GE.NW:GE.SW}if(arguments[0]instanceof s_&&arguments[1]instanceof s_){var r=arguments[0],n=arguments[1];if(n.x===r.x&&n.y===r.y)throw new $m("Cannot compute the quadrant for two identical points "+r);return n.x>=r.x?n.y>=r.y?GE.NE:GE.SE:n.y>=r.y?GE.NW:GE.SW}},UE.NE.get=function(){return 0},UE.NW.get=function(){return 1},UE.SW.get=function(){return 2},UE.SE.get=function(){return 3},Object.defineProperties(GE,UE);var qE=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,1===arguments.length){var t=arguments[0];this._edge=t}else if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2];this._edge=e,this.init(r,n),this._label=null}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this._edge=i,this.init(o,s),this._label=a}};qE.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:j_.computeOrientation(t._p0,t._p1,this._p1)},qE.prototype.getDy=function(){return this._dy},qE.prototype.getCoordinate=function(){return this._p0},qE.prototype.setNode=function(t){this._node=t},qE.prototype.print=function(t){var e=Math.atan2(this._dy,this._dx),r=this.getClass().getName(),n=r.lastIndexOf("."),i=r.substring(n+1);t.print(" "+i+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+" "+this._label)},qE.prototype.compareTo=function(t){var e=t;return this.compareDirection(e)},qE.prototype.getDirectedCoordinate=function(){return this._p1},qE.prototype.getDx=function(){return this._dx},qE.prototype.getLabel=function(){return this._label},qE.prototype.getEdge=function(){return this._edge},qE.prototype.getQuadrant=function(){return this._quadrant},qE.prototype.getNode=function(){return this._node},qE.prototype.toString=function(){var t=Math.atan2(this._dy,this._dx),e=this.getClass().getName(),r=e.lastIndexOf(".");return" "+e.substring(r+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+" "+this._label},qE.prototype.computeLabel=function(t){},qE.prototype.init=function(t,e){this._p0=t,this._p1=e,this._dx=e.x-t.x,this._dy=e.y-t.y,this._quadrant=GE.quadrant(this._dx,this._dy),k_.isTrue(!(0===this._dx&&0===this._dy),"EdgeEnd with identical endpoints found")},qE.prototype.interfaces_=function(){return[r_]},qE.prototype.getClass=function(){return qE};var jE=function(t){function e(){var e=arguments[0],r=arguments[1];if(t.call(this,e),this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999],this._isForward=r,r)this.init(e.getCoordinate(0),e.getCoordinate(1));else{var n=e.getNumPoints()-1;this.init(e.getCoordinate(n),e.getCoordinate(n-1))}this.computeDirectedLabel()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getNextMin=function(){return this._nextMin},e.prototype.getDepth=function(t){return this._depth[t]},e.prototype.setVisited=function(t){this._isVisited=t},e.prototype.computeDirectedLabel=function(){this._label=new RE(this._edge.getLabel()),this._isForward||this._label.flip()},e.prototype.getNext=function(){return this._next},e.prototype.setDepth=function(t,e){if(-999!==this._depth[t]&&this._depth[t]!==e)throw new ME("assigned depths do not match",this.getCoordinate());this._depth[t]=e},e.prototype.isInteriorAreaEdge=function(){for(var t=this,e=!0,r=0;r<2;r++)t._label.isArea(r)&&t._label.getLocation(r,CE.LEFT)===c_.INTERIOR&&t._label.getLocation(r,CE.RIGHT)===c_.INTERIOR||(e=!1);return e},e.prototype.setNextMin=function(t){this._nextMin=t},e.prototype.print=function(e){t.prototype.print.call(this,e),e.print(" "+this._depth[CE.LEFT]+"/"+this._depth[CE.RIGHT]),e.print(" ("+this.getDepthDelta()+")"),this._isInResult&&e.print(" inResult")},e.prototype.setMinEdgeRing=function(t){this._minEdgeRing=t},e.prototype.isLineEdge=function(){var t=this._label.isLine(0)||this._label.isLine(1),e=!this._label.isArea(0)||this._label.allPositionsEqual(0,c_.EXTERIOR),r=!this._label.isArea(1)||this._label.allPositionsEqual(1,c_.EXTERIOR);return t&&e&&r},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 r=this.getEdge().getDepthDelta();this._isForward||(r=-r);var n=1;t===CE.LEFT&&(n=-1);var i=CE.opposite(t),o=e+r*n;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===c_.EXTERIOR&&e===c_.INTERIOR?1:t===c_.INTERIOR&&e===c_.EXTERIOR?-1:0},e}(qE),VE=function(){};VE.prototype.createNode=function(t){return new OE(t,null)},VE.prototype.interfaces_=function(){return[]},VE.prototype.getClass=function(){return VE};var zE=function(){if(this._edges=new aI,this._nodes=null,this._edgeEndList=new aI,0===arguments.length)this._nodes=new FE(new VE);else if(1===arguments.length){var t=arguments[0];this._nodes=new FE(t)}};zE.prototype.printEdges=function(t){t.println("Edges:");for(var e=0;e<this._edges.size();e++){t.println("edge "+e+":");var r=this._edges.get(e);r.print(t),r.eiList.print(t)}},zE.prototype.find=function(t){return this._nodes.find(t)},zE.prototype.addNode=function(){if(arguments[0]instanceof OE){var t=arguments[0];return this._nodes.addNode(t)}if(arguments[0]instanceof s_){var e=arguments[0];return this._nodes.addNode(e)}},zE.prototype.getNodeIterator=function(){return this._nodes.iterator()},zE.prototype.linkResultDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();){t.next().getEdges().linkResultDirectedEdges()}},zE.prototype.debugPrintln=function(t){b_.out.println(t)},zE.prototype.isBoundaryNode=function(t,e){var r=this._nodes.find(e);if(null===r)return!1;var n=r.getLabel();return null!==n&&n.getLocation(t)===c_.BOUNDARY},zE.prototype.linkAllDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();){t.next().getEdges().linkAllDirectedEdges()}},zE.prototype.matchInSameDirection=function(t,e,r,n){return!!t.equals(r)&&(j_.computeOrientation(t,e,n)===j_.COLLINEAR&&GE.quadrant(t,e)===GE.quadrant(r,n))},zE.prototype.getEdgeEnds=function(){return this._edgeEndList},zE.prototype.debugPrint=function(t){b_.out.print(t)},zE.prototype.getEdgeIterator=function(){return this._edges.iterator()},zE.prototype.findEdgeInSameDirection=function(t,e){for(var r=this,n=0;n<this._edges.size();n++){var i=r._edges.get(n),o=i.getCoordinates();if(r.matchInSameDirection(t,e,o[0],o[1]))return i;if(r.matchInSameDirection(t,e,o[o.length-1],o[o.length-2]))return i}return null},zE.prototype.insertEdge=function(t){this._edges.add(t)},zE.prototype.findEdgeEnd=function(t){for(var e=this.getEdgeEnds().iterator();e.hasNext();){var r=e.next();if(r.getEdge()===t)return r}return null},zE.prototype.addEdges=function(t){for(var e=this,r=t.iterator();r.hasNext();){var n=r.next();e._edges.add(n);var i=new jE(n,!0),o=new jE(n,!1);i.setSym(o),o.setSym(i),e.add(i),e.add(o)}},zE.prototype.add=function(t){this._nodes.add(t),this._edgeEndList.add(t)},zE.prototype.getNodes=function(){return this._nodes.values()},zE.prototype.findEdge=function(t,e){for(var r=0;r<this._edges.size();r++){var n=this._edges.get(r),i=n.getCoordinates();if(t.equals(i[0])&&e.equals(i[1]))return n}return null},zE.prototype.interfaces_=function(){return[]},zE.prototype.getClass=function(){return zE},zE.linkResultDirectedEdges=function(t){for(var e=t.iterator();e.hasNext();){e.next().getEdges().linkResultDirectedEdges()}};var YE=function(){this._geometryFactory=null,this._shellList=new aI;var t=arguments[0];this._geometryFactory=t};YE.prototype.sortShellsAndHoles=function(t,e,r){for(var n=t.iterator();n.hasNext();){var i=n.next();i.isHole()?r.add(i):e.add(i)}},YE.prototype.computePolygons=function(t){for(var e=new aI,r=t.iterator();r.hasNext();){var n=r.next().toPolygon(this._geometryFactory);e.add(n)}return e},YE.prototype.placeFreeHoles=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();if(null===n.getShell()){var i=this.findEdgeRingContaining(n,t);if(null===i)throw new ME("unable to assign hole to a shell",n.getCoordinate(0));n.setShell(i)}}},YE.prototype.buildMinimalEdgeRings=function(t,e,r){for(var n=new aI,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)):r.addAll(s)}else n.add(o)}return n},YE.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();){if(e.next().containsPoint(t))return!0}return!1},YE.prototype.buildMaximalEdgeRings=function(t){for(var e=new aI,r=t.iterator();r.hasNext();){var n=r.next();if(n.isInResult()&&n.getLabel().isArea()&&null===n.getEdgeRing()){var i=new QE(n,this._geometryFactory);e.add(i),i.setInResult()}}return e},YE.prototype.placePolygonHoles=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();n.isHole()&&n.setShell(t)}},YE.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},YE.prototype.findEdgeRingContaining=function(t,e){for(var r=t.getLinearRing(),n=r.getEnvelopeInternal(),i=r.getCoordinateN(0),o=null,s=null,a=e.iterator();a.hasNext();){var u=a.next(),l=u.getLinearRing(),c=l.getEnvelopeInternal();null!==o&&(s=o.getLinearRing().getEnvelopeInternal());var h=!1;c.contains(n)&&j_.isPointInRing(i,l.getCoordinates())&&(h=!0),h&&(null===o||s.contains(c))&&(o=u)}return o},YE.prototype.findShell=function(t){for(var e=0,r=null,n=t.iterator();n.hasNext();){var i=n.next();i.isHole()||(r=i,e++)}return k_.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),r},YE.prototype.add=function(){if(1===arguments.length){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(2===arguments.length){var e=arguments[0];zE.linkResultDirectedEdges(arguments[1]);var r=this.buildMaximalEdgeRings(e),n=new aI,i=this.buildMinimalEdgeRings(r,this._shellList,n);this.sortShellsAndHoles(i,this._shellList,n),this.placeFreeHoles(this._shellList,n)}},YE.prototype.interfaces_=function(){return[]},YE.prototype.getClass=function(){return YE};var HE=function(){};HE.prototype.getBounds=function(){},HE.prototype.interfaces_=function(){return[]},HE.prototype.getClass=function(){return HE};var XE=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};XE.prototype.getItem=function(){return this._item},XE.prototype.getBounds=function(){return this._bounds},XE.prototype.interfaces_=function(){return[HE,o_]},XE.prototype.getClass=function(){return XE};var JE=function(){this._size=null,this._items=null,this._size=0,this._items=new aI,this._items.add(null)};JE.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},JE.prototype.size=function(){return this._size},JE.prototype.reorder=function(t){for(var e=this,r=null,n=this._items.get(t);2*t<=this._size&&((r=2*t)!==e._size&&e._items.get(r+1).compareTo(e._items.get(r))<0&&r++,e._items.get(r).compareTo(n)<0);t=r)e._items.set(t,e._items.get(r));this._items.set(t,n)},JE.prototype.clear=function(){this._size=0,this._items.clear()},JE.prototype.isEmpty=function(){return 0===this._size},JE.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)},JE.prototype.interfaces_=function(){return[]},JE.prototype.getClass=function(){return JE};var WE=function(){};WE.prototype.visitItem=function(t){},WE.prototype.interfaces_=function(){return[]},WE.prototype.getClass=function(){return WE};var KE=function(){};KE.prototype.insert=function(t,e){},KE.prototype.remove=function(t,e){},KE.prototype.query=function(){},KE.prototype.interfaces_=function(){return[]},KE.prototype.getClass=function(){return KE};var ZE=function(){if(this._childBoundables=new aI,this._bounds=null,this._level=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._level=t}},$E={serialVersionUID:{configurable:!0}};ZE.prototype.getLevel=function(){return this._level},ZE.prototype.size=function(){return this._childBoundables.size()},ZE.prototype.getChildBoundables=function(){return this._childBoundables},ZE.prototype.addChildBoundable=function(t){k_.isTrue(null===this._bounds),this._childBoundables.add(t)},ZE.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},ZE.prototype.getBounds=function(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds},ZE.prototype.interfaces_=function(){return[HE,o_]},ZE.prototype.getClass=function(){return ZE},$E.serialVersionUID.get=function(){return 0x5a1e55ec41369800},Object.defineProperties(ZE,$E);var tx=function(){};tx.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}},tx.min=function(t){return tx.sort(t),t.get(0)},tx.sort=function(t,e){var r=t.toArray();e?LI.sort(r,e):LI.sort(r);for(var n=t.iterator(),i=0,o=r.length;i<o;i++)n.next(),n.set(r[i])},tx.singletonList=function(t){var e=new aI;return e.add(t),e};var ex=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var t=arguments[0],e=arguments[1],r=arguments[2];this._boundable1=t,this._boundable2=e,this._itemDistance=r,this._distance=this.distance()};ex.prototype.expandToQueue=function(t,e){var r=ex.isComposite(this._boundable1),n=ex.isComposite(this._boundable2);if(r&&n)return ex.area(this._boundable1)>ex.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(r)return this.expand(this._boundable1,this._boundable2,t,e),null;if(n)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new $m("neither boundable is composite")},ex.prototype.isLeaves=function(){return!(ex.isComposite(this._boundable1)||ex.isComposite(this._boundable2))},ex.prototype.compareTo=function(t){var e=t;return this._distance<e._distance?-1:this._distance>e._distance?1:0},ex.prototype.expand=function(t,e,r,n){for(var i=t.getChildBoundables().iterator();i.hasNext();){var o=i.next(),s=new ex(o,e,this._itemDistance);s.getDistance()<n&&r.add(s)}},ex.prototype.getBoundable=function(t){return 0===t?this._boundable1:this._boundable2},ex.prototype.getDistance=function(){return this._distance},ex.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},ex.prototype.interfaces_=function(){return[r_]},ex.prototype.getClass=function(){return ex},ex.area=function(t){return t.getBounds().getArea()},ex.isComposite=function(t){return t instanceof ZE};var rx=function t(){if(this._root=null,this._built=!1,this._itemBoundables=new aI,this._nodeCapacity=null,0===arguments.length){var e=t.DEFAULT_NODE_CAPACITY;this._nodeCapacity=e}else if(1===arguments.length){var r=arguments[0];k_.isTrue(r>1,"Node capacity must be greater than 1"),this._nodeCapacity=r}},nx={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};rx.prototype.getNodeCapacity=function(){return this._nodeCapacity},rx.prototype.lastNode=function(t){return t.get(t.size()-1)},rx.prototype.size=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.size(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var r=e.next();r instanceof ZE?t+=this.size(r):r instanceof XE&&(t+=1)}return t}},rx.prototype.removeItem=function(t,e){for(var r=null,n=t.getChildBoundables().iterator();n.hasNext();){var i=n.next();i instanceof XE&&i.getItem()===e&&(r=i)}return null!==r&&(t.getChildBoundables().remove(r),!0)},rx.prototype.itemsTree=function(){if(0===arguments.length){this.build();var t=this.itemsTree(this._root);return null===t?new aI:t}if(1===arguments.length){for(var e=arguments[0],r=new aI,n=e.getChildBoundables().iterator();n.hasNext();){var i=n.next();if(i instanceof ZE){var o=this.itemsTree(i);null!==o&&r.add(o)}else i instanceof XE?r.add(i.getItem()):k_.shouldNeverReachHere()}return r.size()<=0?null:r}},rx.prototype.insert=function(t,e){k_.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new XE(t,e))},rx.prototype.boundablesAtLevel=function(){if(1===arguments.length){var t=arguments[0],e=new aI;return this.boundablesAtLevel(t,this._root,e),e}if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];if(k_.isTrue(r>-2),n.getLevel()===r)return i.add(n),null;for(var o=n.getChildBoundables().iterator();o.hasNext();){var s=o.next();s instanceof ZE?this.boundablesAtLevel(r,s,i):(k_.isTrue(s instanceof XE),-1===r&&i.add(s))}return null}},rx.prototype.query=function(){var t=this;if(1===arguments.length){var e=arguments[0];this.build();var r=new aI;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,r),r}if(2===arguments.length){var n=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,i)}else if(3===arguments.length)if(f_(arguments[2],WE)&&arguments[0]instanceof Object&&arguments[1]instanceof ZE)for(var o=arguments[0],s=arguments[2],a=arguments[1].getChildBoundables(),u=0;u<a.size();u++){var l=a.get(u);t.getIntersectsOp().intersects(l.getBounds(),o)&&(l instanceof ZE?t.query(o,l,s):l instanceof XE?s.visitItem(l.getItem()):k_.shouldNeverReachHere())}else if(f_(arguments[2],oI)&&arguments[0]instanceof Object&&arguments[1]instanceof ZE)for(var c=arguments[0],h=arguments[2],f=arguments[1].getChildBoundables(),p=0;p<f.size();p++){var g=f.get(p);t.getIntersectsOp().intersects(g.getBounds(),c)&&(g instanceof ZE?t.query(c,g,h):g instanceof XE?h.add(g.getItem()):k_.shouldNeverReachHere())}},rx.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},rx.prototype.getRoot=function(){return this.build(),this._root},rx.prototype.remove=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.remove(t,this._root,e)}if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2],o=this.removeItem(n,i);if(o)return!0;for(var s=null,a=n.getChildBoundables().iterator();a.hasNext();){var u=a.next();if(this.getIntersectsOp().intersects(u.getBounds(),r)&&(u instanceof ZE&&(o=this.remove(r,u,i)))){s=u;break}}return null!==s&&s.getChildBoundables().isEmpty()&&n.getChildBoundables().remove(s),o}},rx.prototype.createHigherLevels=function(t,e){k_.isTrue(!t.isEmpty());var r=this.createParentBoundables(t,e+1);return 1===r.size()?r.get(0):this.createHigherLevels(r,e+1)},rx.prototype.depth=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var r=e.next();if(r instanceof ZE){var n=this.depth(r);n>t&&(t=n)}}return t+1}},rx.prototype.createParentBoundables=function(t,e){var r=this;k_.isTrue(!t.isEmpty());var n=new aI;n.add(this.createNode(e));var i=new aI(t);tx.sort(i,this.getComparator());for(var o=i.iterator();o.hasNext();){var s=o.next();r.lastNode(n).getChildBoundables().size()===r.getNodeCapacity()&&n.add(r.createNode(e)),r.lastNode(n).addChildBoundable(s)}return n},rx.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},rx.prototype.interfaces_=function(){return[o_]},rx.prototype.getClass=function(){return rx},rx.compareDoubles=function(t,e){return t>e?1:t<e?-1:0},nx.IntersectsOp.get=function(){return ix},nx.serialVersionUID.get=function(){return-0x35ef64c82d4c5400},nx.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(rx,nx);var ix=function(){},ox=function(){};ox.prototype.distance=function(t,e){},ox.prototype.interfaces_=function(){return[]},ox.prototype.getClass=function(){return ox};var sx=function(t){function e(r){r=r||e.DEFAULT_NODE_CAPACITY,t.call(this,r)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={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){k_.isTrue(t.length>0);for(var r=new aI,n=0;n<t.length;n++)r.addAll(this.createParentBoundablesFromVerticalSlice(t[n],e));return r},e.prototype.createNode=function(t){return new ax(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[0],r=arguments[1];if(e.isNull())return null;t.prototype.insert.call(this,e,r)},e.prototype.getIntersectsOp=function(){return e.intersectsOp},e.prototype.verticalSlices=function(t,e){for(var r=Math.trunc(Math.ceil(t.size()/e)),n=new Array(e).fill(null),i=t.iterator(),o=0;o<e;o++){n[o]=new aI;for(var s=0;i.hasNext()&&s<r;){var a=i.next();n[o].add(a),s++}}return n},e.prototype.query=function(){if(1===arguments.length){var e=arguments[0];return t.prototype.query.call(this,e)}if(2===arguments.length){var r=arguments[0],n=arguments[1];t.prototype.query.call(this,r,n)}else if(3===arguments.length)if(f_(arguments[2],WE)&&arguments[0]instanceof Object&&arguments[1]instanceof ZE){var i=arguments[0],o=arguments[1],s=arguments[2];t.prototype.query.call(this,i,o,s)}else if(f_(arguments[2],oI)&&arguments[0]instanceof Object&&arguments[1]instanceof ZE){var a=arguments[0],u=arguments[1],l=arguments[2];t.prototype.query.call(this,a,u,l)}},e.prototype.getComparator=function(){return e.yComparator},e.prototype.createParentBoundablesFromVerticalSlice=function(e,r){return t.prototype.createParentBoundables.call(this,e,r)},e.prototype.remove=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return t.prototype.remove.call(this,e,r)}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,r){k_.isTrue(!t.isEmpty());var n=Math.trunc(Math.ceil(t.size()/this.getNodeCapacity())),i=new aI(t);tx.sort(i,e.xComparator);var o=this.verticalSlices(i,Math.trunc(Math.ceil(Math.sqrt(n))));return this.createParentBoundablesFromVerticalSlices(o,r)},e.prototype.nearestNeighbour=function(){if(1===arguments.length){if(f_(arguments[0],ox)){var t=arguments[0],r=new ex(this.getRoot(),this.getRoot(),t);return this.nearestNeighbour(r)}if(arguments[0]instanceof ex){var n=arguments[0];return this.nearestNeighbour(n,t_.POSITIVE_INFINITY)}}else if(2===arguments.length){if(arguments[0]instanceof e&&f_(arguments[1],ox)){var i=arguments[0],o=arguments[1],s=new ex(this.getRoot(),i.getRoot(),o);return this.nearestNeighbour(s)}if(arguments[0]instanceof ex&&"number"==typeof arguments[1]){var a=arguments[0],u=arguments[1],l=null,c=new JE;for(c.add(a);!c.isEmpty()&&u>0;){var h=c.poll(),f=h.getDistance();if(f>=u)break;h.isLeaves()?(u=f,l=h):h.expandToQueue(c,u)}return[l.getBoundable(0).getItem(),l.getBoundable(1).getItem()]}}else if(3===arguments.length){var p=arguments[2],g=new XE(arguments[0],arguments[1]),A=new ex(this.getRoot(),g,p);return this.nearestNeighbour(A)[0]}},e.prototype.interfaces_=function(){return[KE,o_]},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())},r.STRtreeNode.get=function(){return ax},r.serialVersionUID.get=function(){return 0x39920f7d5f261e0},r.xComparator.get=function(){return{interfaces_:function(){return[i_]},compare:function(r,n){return t.compareDoubles(e.centreX(r.getBounds()),e.centreX(n.getBounds()))}}},r.yComparator.get=function(){return{interfaces_:function(){return[i_]},compare:function(r,n){return t.compareDoubles(e.centreY(r.getBounds()),e.centreY(n.getBounds()))}}},r.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(t,e){return t.intersects(e)}}},r.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,r),e}(rx),ax=function(t){function e(){var e=arguments[0];t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var t=null,e=this.getChildBoundables().iterator();e.hasNext();){var r=e.next();null===t?t=new S_(r.getBounds()):t.expandToInclude(r.getBounds())}return t},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(ZE),ux=function(){};ux.prototype.interfaces_=function(){return[]},ux.prototype.getClass=function(){return ux},ux.relativeSign=function(t,e){return t<e?-1:t>e?1:0},ux.compare=function(t,e,r){if(e.equals2D(r))return 0;var n=ux.relativeSign(e.x,r.x),i=ux.relativeSign(e.y,r.y);switch(t){case 0:return ux.compareValue(n,i);case 1:return ux.compareValue(i,n);case 2:return ux.compareValue(i,-n);case 3:return ux.compareValue(-n,i);case 4:return ux.compareValue(-n,-i);case 5:return ux.compareValue(-i,-n);case 6:return ux.compareValue(-i,n);case 7:return ux.compareValue(n,-i)}return k_.shouldNeverReachHere("invalid octant value"),0},ux.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var lx=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],r=arguments[2],n=arguments[3];this._segString=t,this.coord=new s_(e),this.segmentIndex=r,this._segmentOctant=n,this._isInterior=!e.equals2D(t.getCoordinate(r))};lx.prototype.getCoordinate=function(){return this.coord},lx.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},lx.prototype.compareTo=function(t){var e=t;return this.segmentIndex<e.segmentIndex?-1:this.segmentIndex>e.segmentIndex?1:this.coord.equals2D(e.coord)?0:ux.compare(this._segmentOctant,this.coord,e.coord)},lx.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t},lx.prototype.isInterior=function(){return this._isInterior},lx.prototype.interfaces_=function(){return[r_]},lx.prototype.getClass=function(){return lx};var cx=function(){this._nodeMap=new wI,this._edge=null;var t=arguments[0];this._edge=t};cx.prototype.getSplitCoordinates=function(){var t=new lI;this.addEndpoints();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next();this.addEdgeCoordinates(r,n,t),r=n}return t.toCoordinateArray()},cx.prototype.addCollapsedNodes=function(){var t=new aI;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var e=t.iterator();e.hasNext();){var r=e.next().intValue();this.add(this._edge.getCoordinate(r),r)}},cx.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){e.next().print(t)}},cx.prototype.findCollapsesFromExistingVertices=function(t){for(var e=0;e<this._edge.size()-2;e++){var r=this._edge.getCoordinate(e),n=this._edge.getCoordinate(e+2);r.equals2D(n)&&t.add(new d_(e+1))}},cx.prototype.addEdgeCoordinates=function(t,e,r){var n=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(n);r.add(new s_(t.coord),!1);for(var o=t.segmentIndex+1;o<=e.segmentIndex;o++)r.add(this._edge.getCoordinate(o));i&&r.add(new s_(e.coord))},cx.prototype.iterator=function(){return this._nodeMap.values().iterator()},cx.prototype.addSplitEdges=function(t){this.addEndpoints(),this.addCollapsedNodes();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next(),i=this.createSplitEdge(r,n);t.add(i),r=n}},cx.prototype.findCollapseIndex=function(t,e,r){if(!t.coord.equals2D(e.coord))return!1;var n=e.segmentIndex-t.segmentIndex;return e.isInterior()||n--,1===n&&(r[0]=t.segmentIndex+1,!0)},cx.prototype.findCollapsesFromInsertedNodes=function(t){for(var e=new Array(1).fill(null),r=this.iterator(),n=r.next();r.hasNext();){var i=r.next();this.findCollapseIndex(n,i,e)&&t.add(new d_(e[0])),n=i}},cx.prototype.getEdge=function(){return this._edge},cx.prototype.addEndpoints=function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)},cx.prototype.createSplitEdge=function(t,e){var r=e.segmentIndex-t.segmentIndex+2,n=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(n);i||r--;var o=new Array(r).fill(null),s=0;o[s++]=new s_(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this._edge.getCoordinate(a);return i&&(o[s]=new s_(e.coord)),new gx(o,this._edge.getData())},cx.prototype.add=function(t,e){var r=new lx(this._edge,t,e,this._edge.getSegmentOctant(e)),n=this._nodeMap.get(r);return null!==n?(k_.isTrue(n.coord.equals2D(t),"Found equal nodes with different coordinates"),n):(this._nodeMap.put(r,r),r)},cx.prototype.checkSplitEdgesCorrectness=function(t){var e=this._edge.getCoordinates(),r=t.get(0).getCoordinate(0);if(!r.equals2D(e[0]))throw new P_("bad split edge start point at "+r);var n=t.get(t.size()-1).getCoordinates(),i=n[n.length-1];if(!i.equals2D(e[e.length-1]))throw new P_("bad split edge end point at "+i)},cx.prototype.interfaces_=function(){return[]},cx.prototype.getClass=function(){return cx};var hx=function(){};hx.prototype.interfaces_=function(){return[]},hx.prototype.getClass=function(){return hx},hx.octant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new $m("Cannot compute the octant for point ( "+t+", "+e+" )");var r=Math.abs(t),n=Math.abs(e);return t>=0?e>=0?r>=n?0:1:r>=n?7:6:e>=0?r>=n?3:2:r>=n?4:5}if(arguments[0]instanceof s_&&arguments[1]instanceof s_){var i=arguments[0],o=arguments[1],s=o.x-i.x,a=o.y-i.y;if(0===s&&0===a)throw new $m("Cannot compute the octant for two identical points "+i);return hx.octant(s,a)}};var fx=function(){};fx.prototype.getCoordinates=function(){},fx.prototype.size=function(){},fx.prototype.getCoordinate=function(t){},fx.prototype.isClosed=function(){},fx.prototype.setData=function(t){},fx.prototype.getData=function(){},fx.prototype.interfaces_=function(){return[]},fx.prototype.getClass=function(){return fx};var px=function(){};px.prototype.addIntersection=function(t,e){},px.prototype.interfaces_=function(){return[fx]},px.prototype.getClass=function(){return px};var gx=function(){this._nodeList=new cx(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};gx.prototype.getCoordinates=function(){return this._pts},gx.prototype.size=function(){return this._pts.length},gx.prototype.getCoordinate=function(t){return this._pts[t]},gx.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},gx.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},gx.prototype.setData=function(t){this._data=t},gx.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:hx.octant(t,e)},gx.prototype.getData=function(){return this._data},gx.prototype.addIntersection=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(4===arguments.length){var r=arguments[1],n=arguments[3],i=new s_(arguments[0].getIntersection(n));this.addIntersection(i,r)}},gx.prototype.toString=function(){return D_.toLineString(new aE(this._pts))},gx.prototype.getNodeList=function(){return this._nodeList},gx.prototype.addIntersectionNode=function(t,e){var r=e,n=r+1;if(n<this._pts.length){var i=this._pts[n];t.equals2D(i)&&(r=n)}return this._nodeList.add(t,r)},gx.prototype.addIntersections=function(t,e,r){for(var n=0;n<t.getIntersectionNum();n++)this.addIntersection(t,e,r,n)},gx.prototype.interfaces_=function(){return[px]},gx.prototype.getClass=function(){return gx},gx.getNodedSubstrings=function(){if(1===arguments.length){var t=arguments[0],e=new aI;return gx.getNodedSubstrings(t,e),e}if(2===arguments.length)for(var r=arguments[1],n=arguments[0].iterator();n.hasNext();){n.next().getNodeList().addSplitEdges(r)}};var Ax=function(){if(this.p0=null,this.p1=null,0===arguments.length)this.p0=new s_,this.p1=new s_;else if(1===arguments.length){var t=arguments[0];this.p0=new s_(t.p0),this.p1=new s_(t.p1)}else if(2===arguments.length)this.p0=arguments[0],this.p1=arguments[1];else if(4===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2],i=arguments[3];this.p0=new s_(e,r),this.p1=new s_(n,i)}},dx={serialVersionUID:{configurable:!0}};Ax.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},Ax.prototype.orientationIndex=function(){if(arguments[0]instanceof Ax){var t=arguments[0],e=j_.orientationIndex(this.p0,this.p1,t.p0),r=j_.orientationIndex(this.p0,this.p1,t.p1);return e>=0&&r>=0||e<=0&&r<=0?Math.max(e,r):0}if(arguments[0]instanceof s_){var n=arguments[0];return j_.orientationIndex(this.p0,this.p1,n)}},Ax.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},Ax.prototype.isVertical=function(){return this.p0.x===this.p1.x},Ax.prototype.equals=function(t){if(!(t instanceof Ax))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)},Ax.prototype.intersection=function(t){var e=new G_;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},Ax.prototype.project=function(){if(arguments[0]instanceof s_){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new s_(t);var e=this.projectionFactor(t),r=new s_;return r.x=this.p0.x+e*(this.p1.x-this.p0.x),r.y=this.p0.y+e*(this.p1.y-this.p0.y),r}if(arguments[0]instanceof Ax){var n=arguments[0],i=this.projectionFactor(n.p0),o=this.projectionFactor(n.p1);if(i>=1&&o>=1)return null;if(i<=0&&o<=0)return null;var s=this.project(n.p0);i<0&&(s=this.p0),i>1&&(s=this.p1);var a=this.project(n.p1);return o<0&&(a=this.p0),o>1&&(a=this.p1),new Ax(s,a)}},Ax.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},Ax.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},Ax.prototype.getCoordinate=function(t){return 0===t?this.p0:this.p1},Ax.prototype.distancePerpendicular=function(t){return j_.distancePointLinePerpendicular(t,this.p0,this.p1)},Ax.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},Ax.prototype.midPoint=function(){return Ax.midPoint(this.p0,this.p1)},Ax.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,r=this.p1.y-this.p0.y,n=e*e+r*r;return n<=0?t_.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*r)/n},Ax.prototype.closestPoints=function(t){var e=this.intersection(t);if(null!==e)return[e,e];var r=new Array(2).fill(null),n=t_.MAX_VALUE,i=null,o=this.closestPoint(t.p0);n=o.distance(t.p0),r[0]=o,r[1]=t.p0;var s=this.closestPoint(t.p1);(i=s.distance(t.p1))<n&&(n=i,r[0]=s,r[1]=t.p1);var a=t.closestPoint(this.p0);(i=a.distance(this.p0))<n&&(n=i,r[0]=this.p0,r[1]=a);var u=t.closestPoint(this.p1);return(i=u.distance(this.p1))<n&&(n=i,r[0]=this.p1,r[1]=u),r},Ax.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},Ax.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},Ax.prototype.getLength=function(){return this.p0.distance(this.p1)},Ax.prototype.compareTo=function(t){var e=t,r=this.p0.compareTo(e.p0);return 0!==r?r:this.p1.compareTo(e.p1)},Ax.prototype.reverse=function(){var t=this.p0;this.p0=this.p1,this.p1=t},Ax.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)},Ax.prototype.lineIntersection=function(t){try{return B_.intersection(this.p0,this.p1,t.p0,t.p1)}catch(t){if(!(t instanceof w_))throw t}return null},Ax.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},Ax.prototype.pointAlongOffset=function(t,e){var r=this.p0.x+t*(this.p1.x-this.p0.x),n=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 s_(r-u,n+a)},Ax.prototype.setCoordinates=function(){if(1===arguments.length){var t=arguments[0];this.setCoordinates(t.p0,t.p1)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this.p0.x=e.x,this.p0.y=e.y,this.p1.x=r.x,this.p1.y=r.y}},Ax.prototype.segmentFraction=function(t){var e=this.projectionFactor(t);return e<0?e=0:(e>1||t_.isNaN(e))&&(e=1),e},Ax.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},Ax.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},Ax.prototype.distance=function(){if(arguments[0]instanceof Ax){var t=arguments[0];return j_.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof s_){var e=arguments[0];return j_.distancePointLine(e,this.p0,this.p1)}},Ax.prototype.pointAlong=function(t){var e=new s_;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},Ax.prototype.hashCode=function(){var t=t_.doubleToLongBits(this.p0.x);t^=31*t_.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),r=t_.doubleToLongBits(this.p1.x);return r^=31*t_.doubleToLongBits(this.p1.y),e^(Math.trunc(r)^Math.trunc(r>>32))},Ax.prototype.interfaces_=function(){return[r_,o_]},Ax.prototype.getClass=function(){return Ax},Ax.midPoint=function(t,e){return new s_((t.x+e.x)/2,(t.y+e.y)/2)},dx.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(Ax,dx);var yx=function(){this.tempEnv1=new S_,this.tempEnv2=new S_,this._overlapSeg1=new Ax,this._overlapSeg2=new Ax};yx.prototype.overlap=function(){if(2===arguments.length);else if(4===arguments.length){var t=arguments[1],e=arguments[2],r=arguments[3];arguments[0].getLineSegment(t,this._overlapSeg1),e.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}},yx.prototype.interfaces_=function(){return[]},yx.prototype.getClass=function(){return yx};var vx=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],r=arguments[2],n=arguments[3];this._pts=t,this._start=e,this._end=r,this._context=n};vx.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]},vx.prototype.computeSelect=function(t,e,r,n){var i=this._pts[e],o=this._pts[r];if(n.tempEnv1.init(i,o),r-e==1)return n.select(this,e),null;if(!t.intersects(n.tempEnv1))return null;var s=Math.trunc((e+r)/2);e<s&&this.computeSelect(t,e,s,n),s<r&&this.computeSelect(t,s,r,n)},vx.prototype.getCoordinates=function(){for(var t=new Array(this._end-this._start+1).fill(null),e=0,r=this._start;r<=this._end;r++)t[e++]=this._pts[r];return t},vx.prototype.computeOverlaps=function(t,e){this.computeOverlapsInternal(this._start,this._end,t,t._start,t._end,e)},vx.prototype.setId=function(t){this._id=t},vx.prototype.select=function(t,e){this.computeSelect(t,this._start,this._end,e)},vx.prototype.getEnvelope=function(){if(null===this._env){var t=this._pts[this._start],e=this._pts[this._end];this._env=new S_(t,e)}return this._env},vx.prototype.getEndIndex=function(){return this._end},vx.prototype.getStartIndex=function(){return this._start},vx.prototype.getContext=function(){return this._context},vx.prototype.getId=function(){return this._id},vx.prototype.computeOverlapsInternal=function(t,e,r,n,i,o){var s=this._pts[t],a=this._pts[e],u=r._pts[n],l=r._pts[i];if(e-t==1&&i-n==1)return o.overlap(this,t,r,n),null;if(o.tempEnv1.init(s,a),o.tempEnv2.init(u,l),!o.tempEnv1.intersects(o.tempEnv2))return null;var c=Math.trunc((t+e)/2),h=Math.trunc((n+i)/2);t<c&&(n<h&&this.computeOverlapsInternal(t,c,r,n,h,o),h<i&&this.computeOverlapsInternal(t,c,r,h,i,o)),c<e&&(n<h&&this.computeOverlapsInternal(c,e,r,n,h,o),h<i&&this.computeOverlapsInternal(c,e,r,h,i,o))},vx.prototype.interfaces_=function(){return[]},vx.prototype.getClass=function(){return vx};var mx=function(){};mx.prototype.interfaces_=function(){return[]},mx.prototype.getClass=function(){return mx},mx.getChainStartIndices=function(t){var e=0,r=new aI;r.add(new d_(e));do{var n=mx.findChainEnd(t,e);r.add(new d_(n)),e=n}while(e<t.length-1);return mx.toIntArray(r)},mx.findChainEnd=function(t,e){for(var r=e;r<t.length-1&&t[r].equals2D(t[r+1]);)r++;if(r>=t.length-1)return t.length-1;for(var n=GE.quadrant(t[r],t[r+1]),i=e+1;i<t.length;){if(!t[i-1].equals2D(t[i]))if(GE.quadrant(t[i-1],t[i])!==n)break;i++}return i-1},mx.getChains=function(){if(1===arguments.length)return mx.getChains(arguments[0],null);if(2===arguments.length){for(var t=arguments[0],e=arguments[1],r=new aI,n=mx.getChainStartIndices(t),i=0;i<n.length-1;i++){var o=new vx(t,n[i],n[i+1],e);r.add(o)}return r}},mx.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),r=0;r<e.length;r++)e[r]=t.get(r).intValue();return e};var _x=function(){};_x.prototype.computeNodes=function(t){},_x.prototype.getNodedSubstrings=function(){},_x.prototype.interfaces_=function(){return[]},_x.prototype.getClass=function(){return _x};var Ix=function(){if(this._segInt=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.setSegmentIntersector(t)}};Ix.prototype.setSegmentIntersector=function(t){this._segInt=t},Ix.prototype.interfaces_=function(){return[_x]},Ix.prototype.getClass=function(){return Ix};var Ex=function(t){function e(e){e?t.call(this,e):t.call(this),this._monoChains=new aI,this._index=new sx,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={SegmentOverlapAction:{configurable:!0}};return e.prototype.getMonotoneChains=function(){return this._monoChains},e.prototype.getNodedSubstrings=function(){return gx.getNodedSubstrings(this._nodedSegStrings)},e.prototype.getIndex=function(){return this._index},e.prototype.add=function(t){for(var e=this,r=mx.getChains(t.getCoordinates(),t).iterator();r.hasNext();){var n=r.next();n.setId(e._idCounter++),e._index.insert(n.getEnvelope(),n),e._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=this,e=new xx(this._segInt),r=this._monoChains.iterator();r.hasNext();)for(var n=r.next(),i=t._index.query(n.getEnvelope()).iterator();i.hasNext();){var o=i.next();if(o.getId()>n.getId()&&(n.computeOverlaps(o,e),t._nOverlaps++),t._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.SegmentOverlapAction.get=function(){return xx},Object.defineProperties(e,r),e}(Ix),xx=function(t){function e(){t.call(this),this._si=null;var e=arguments[0];this._si=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(4!==arguments.length)return t.prototype.overlap.apply(this,arguments);var e=arguments[1],r=arguments[2],n=arguments[3],i=arguments[0].getContext(),o=r.getContext();this._si.processIntersections(i,e,o,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(yx),Cx=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.setQuadrantSegments(e)}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.setQuadrantSegments(r),this.setEndCapStyle(n)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(o),this.setJoinStyle(s),this.setMitreLimit(a)}},wx={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}};Cx.prototype.getEndCapStyle=function(){return this._endCapStyle},Cx.prototype.isSingleSided=function(){return this._isSingleSided},Cx.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,0===this._quadrantSegments&&(this._joinStyle=Cx.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Cx.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==Cx.JOIN_ROUND&&(this._quadrantSegments=Cx.DEFAULT_QUADRANT_SEGMENTS)},Cx.prototype.getJoinStyle=function(){return this._joinStyle},Cx.prototype.setJoinStyle=function(t){this._joinStyle=t},Cx.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},Cx.prototype.getSimplifyFactor=function(){return this._simplifyFactor},Cx.prototype.getQuadrantSegments=function(){return this._quadrantSegments},Cx.prototype.setEndCapStyle=function(t){this._endCapStyle=t},Cx.prototype.getMitreLimit=function(){return this._mitreLimit},Cx.prototype.setMitreLimit=function(t){this._mitreLimit=t},Cx.prototype.setSingleSided=function(t){this._isSingleSided=t},Cx.prototype.interfaces_=function(){return[]},Cx.prototype.getClass=function(){return Cx},Cx.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)},wx.CAP_ROUND.get=function(){return 1},wx.CAP_FLAT.get=function(){return 2},wx.CAP_SQUARE.get=function(){return 3},wx.JOIN_ROUND.get=function(){return 1},wx.JOIN_MITRE.get=function(){return 2},wx.JOIN_BEVEL.get=function(){return 3},wx.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},wx.DEFAULT_MITRE_LIMIT.get=function(){return 5},wx.DEFAULT_SIMPLIFY_FACTOR.get=function(){return.01},Object.defineProperties(Cx,wx);var bx=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=j_.COUNTERCLOCKWISE,this._inputLine=t||null},Bx={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};bx.prototype.isDeletable=function(t,e,r,n){var i=this._inputLine[t],o=this._inputLine[e],s=this._inputLine[r];return!!this.isConcave(i,o,s)&&(!!this.isShallow(i,o,s,n)&&this.isShallowSampled(i,o,t,r,n))},bx.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,r=this.findNextNonDeletedIndex(e),n=this.findNextNonDeletedIndex(r),i=!1;n<this._inputLine.length;){var o=!1;t.isDeletable(e,r,n,t._distanceTol)&&(t._isDeleted[r]=bx.DELETE,o=!0,i=!0),e=o?n:r,r=t.findNextNonDeletedIndex(e),n=t.findNextNonDeletedIndex(r)}return i},bx.prototype.isShallowConcavity=function(t,e,r,n){return j_.computeOrientation(t,e,r)===this._angleOrientation&&j_.distancePointLine(e,t,r)<n},bx.prototype.isShallowSampled=function(t,e,r,n,i){var o=Math.trunc((n-r)/bx.NUM_PTS_TO_CHECK);o<=0&&(o=1);for(var s=r;s<n;s+=o)if(!this.isShallow(t,e,this._inputLine[s],i))return!1;return!0},bx.prototype.isConcave=function(t,e,r){var n=j_.computeOrientation(t,e,r)===this._angleOrientation;return n},bx.prototype.simplify=function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=j_.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var e=!1;do{e=this.deleteShallowConcavities()}while(e);return this.collapseLine()},bx.prototype.findNextNonDeletedIndex=function(t){for(var e=t+1;e<this._inputLine.length&&this._isDeleted[e]===bx.DELETE;)e++;return e},bx.prototype.isShallow=function(t,e,r,n){return j_.distancePointLine(e,t,r)<n},bx.prototype.collapseLine=function(){for(var t=new lI,e=0;e<this._inputLine.length;e++)this._isDeleted[e]!==bx.DELETE&&t.add(this._inputLine[e]);return t.toCoordinateArray()},bx.prototype.interfaces_=function(){return[]},bx.prototype.getClass=function(){return bx},bx.simplify=function(t,e){return new bx(t).simplify(e)},Bx.INIT.get=function(){return 0},Bx.DELETE.get=function(){return 1},Bx.KEEP.get=function(){return 1},Bx.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(bx,Bx);var Sx=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new aI},Mx={COORDINATE_ARRAY_TYPE:{configurable:!0}};Sx.prototype.getCoordinates=function(){return this._ptList.toArray(Sx.COORDINATE_ARRAY_TYPE)},Sx.prototype.setPrecisionModel=function(t){this._precisionModel=t},Sx.prototype.addPt=function(t){var e=new s_(t);if(this._precisionModel.makePrecise(e),this.isRedundant(e))return null;this._ptList.add(e)},Sx.prototype.revere=function(){},Sx.prototype.addPts=function(t,e){if(e)for(var r=0;r<t.length;r++)this.addPt(t[r]);else for(var n=t.length-1;n>=0;n--)this.addPt(t[n])},Sx.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},Sx.prototype.toString=function(){return(new dE).createLineString(this.getCoordinates()).toString()},Sx.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var t=new s_(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1);if(t.equals(e))return null;this._ptList.add(t)},Sx.prototype.setMinimumVertexDistance=function(t){this._minimimVertexDistance=t},Sx.prototype.interfaces_=function(){return[]},Sx.prototype.getClass=function(){return Sx},Mx.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(Sx,Mx);var Lx=function(){},Nx={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};Lx.prototype.interfaces_=function(){return[]},Lx.prototype.getClass=function(){return Lx},Lx.toDegrees=function(t){return 180*t/Math.PI},Lx.normalize=function(t){for(;t>Math.PI;)t-=Lx.PI_TIMES_2;for(;t<=-Math.PI;)t+=Lx.PI_TIMES_2;return t},Lx.angle=function(){if(1===arguments.length){var t=arguments[0];return Math.atan2(t.y,t.x)}if(2===arguments.length){var e=arguments[0],r=arguments[1],n=r.x-e.x,i=r.y-e.y;return Math.atan2(i,n)}},Lx.isAcute=function(t,e,r){var n=t.x-e.x,i=t.y-e.y;return n*(r.x-e.x)+i*(r.y-e.y)>0},Lx.isObtuse=function(t,e,r){var n=t.x-e.x,i=t.y-e.y;return n*(r.x-e.x)+i*(r.y-e.y)<0},Lx.interiorAngle=function(t,e,r){var n=Lx.angle(e,t),i=Lx.angle(e,r);return Math.abs(i-n)},Lx.normalizePositive=function(t){if(t<0){for(;t<0;)t+=Lx.PI_TIMES_2;t>=Lx.PI_TIMES_2&&(t=0)}else{for(;t>=Lx.PI_TIMES_2;)t-=Lx.PI_TIMES_2;t<0&&(t=0)}return t},Lx.angleBetween=function(t,e,r){var n=Lx.angle(e,t),i=Lx.angle(e,r);return Lx.diff(n,i)},Lx.diff=function(t,e){var r=null;return(r=t<e?e-t:t-e)>Math.PI&&(r=2*Math.PI-r),r},Lx.toRadians=function(t){return t*Math.PI/180},Lx.getTurn=function(t,e){var r=Math.sin(e-t);return r>0?Lx.COUNTERCLOCKWISE:r<0?Lx.CLOCKWISE:Lx.NONE},Lx.angleBetweenOriented=function(t,e,r){var n=Lx.angle(e,t),i=Lx.angle(e,r)-n;return i<=-Math.PI?i+Lx.PI_TIMES_2:i>Math.PI?i-Lx.PI_TIMES_2:i},Nx.PI_TIMES_2.get=function(){return 2*Math.PI},Nx.PI_OVER_2.get=function(){return Math.PI/2},Nx.PI_OVER_4.get=function(){return Math.PI/4},Nx.COUNTERCLOCKWISE.get=function(){return j_.COUNTERCLOCKWISE},Nx.CLOCKWISE.get=function(){return j_.CLOCKWISE},Nx.NONE.get=function(){return j_.COLLINEAR},Object.defineProperties(Lx,Nx);var Tx=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 Ax,this._seg1=new Ax,this._offset0=new Ax,this._offset1=new Ax,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],r=arguments[1],n=arguments[2];this._precisionModel=e,this._bufParams=r,this._li=new G_,this._filletAngleQuantum=Math.PI/2/r.getQuadrantSegments(),r.getQuadrantSegments()>=8&&r.getJoinStyle()===Cx.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(n)},Rx={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}};Tx.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 r=j_.computeOrientation(this._s0,this._s1,this._s2),n=r===j_.CLOCKWISE&&this._side===CE.LEFT||r===j_.COUNTERCLOCKWISE&&this._side===CE.RIGHT;0===r?this.addCollinear(e):n?this.addOutsideTurn(r,e):this.addInsideTurn(r,e)},Tx.prototype.addLineEndCap=function(t,e){var r=new Ax(t,e),n=new Ax;this.computeOffsetSegment(r,CE.LEFT,this._distance,n);var i=new Ax;this.computeOffsetSegment(r,CE.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 Cx.CAP_ROUND:this._segList.addPt(n.p1),this.addFilletArc(e,a+Math.PI/2,a-Math.PI/2,j_.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case Cx.CAP_FLAT:this._segList.addPt(n.p1),this._segList.addPt(i.p1);break;case Cx.CAP_SQUARE:var u=new s_;u.x=Math.abs(this._distance)*Math.cos(a),u.y=Math.abs(this._distance)*Math.sin(a);var l=new s_(n.p1.x+u.x,n.p1.y+u.y),c=new s_(i.p1.x+u.x,i.p1.y+u.y);this._segList.addPt(l),this._segList.addPt(c)}},Tx.prototype.getCoordinates=function(){return this._segList.getCoordinates()},Tx.prototype.addMitreJoin=function(t,e,r,n){var i=!0,o=null;try{o=B_.intersection(e.p0,e.p1,r.p0,r.p1),(n<=0?1:o.distance(t)/Math.abs(n))>this._bufParams.getMitreLimit()&&(i=!1)}catch(t){if(!(t instanceof w_))throw t;o=new s_(0,0),i=!1}i?this._segList.addPt(o):this.addLimitedMitreJoin(e,r,n,this._bufParams.getMitreLimit())},Tx.prototype.addFilletCorner=function(t,e,r,n,i){var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o),u=r.x-t.x,l=r.y-t.y,c=Math.atan2(l,u);n===j_.CLOCKWISE?a<=c&&(a+=2*Math.PI):a>=c&&(a-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,a,c,n,i),this._segList.addPt(r)},Tx.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*Tx.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===Cx.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===Cx.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))},Tx.prototype.createSquare=function(t){this._segList.addPt(new s_(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new s_(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new s_(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new s_(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()},Tx.prototype.addSegments=function(t,e){this._segList.addPts(t,e)},Tx.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},Tx.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},Tx.prototype.initSideSegments=function(t,e,r){this._s1=t,this._s2=e,this._side=r,this._seg1.setCoordinates(t,e),this.computeOffsetSegment(this._seg1,r,this._distance,this._offset1)},Tx.prototype.addLimitedMitreJoin=function(t,e,r,n){var i=this._seg0.p1,o=Lx.angle(i,this._seg0.p0),s=Lx.angleBetweenOriented(this._seg0.p0,i,this._seg1.p1)/2,a=Lx.normalize(o+s),u=Lx.normalize(a+Math.PI),l=n*r,c=r-l*Math.abs(Math.sin(s)),h=i.x+l*Math.cos(u),f=i.y+l*Math.sin(u),p=new s_(h,f),g=new Ax(i,p),A=g.pointAlongOffset(1,c),d=g.pointAlongOffset(1,-c);this._side===CE.LEFT?(this._segList.addPt(A),this._segList.addPt(d)):(this._segList.addPt(d),this._segList.addPt(A))},Tx.prototype.computeOffsetSegment=function(t,e,r,n){var i=e===CE.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*r*o/a,l=i*r*s/a;n.p0.x=t.p0.x-l,n.p0.y=t.p0.y+u,n.p1.x=t.p1.x-l,n.p1.y=t.p1.y+u},Tx.prototype.addFilletArc=function(t,e,r,n,i){var o=n===j_.CLOCKWISE?-1:1,s=Math.abs(e-r),a=Math.trunc(s/this._filletAngleQuantum+.5);if(a<1)return null;for(var u=s/a,l=0,c=new s_;l<s;){var h=e+o*l;c.x=t.x+i*Math.cos(h),c.y=t.y+i*Math.sin(h),this._segList.addPt(c),l+=u}},Tx.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*Tx.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var r=new s_((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(r);var n=new s_((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(n)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},Tx.prototype.createCircle=function(t){var e=new s_(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},Tx.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)},Tx.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Sx,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*Tx.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},Tx.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===Cx.JOIN_BEVEL||this._bufParams.getJoinStyle()===Cx.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,j_.CLOCKWISE,this._distance))},Tx.prototype.closeRing=function(){this._segList.closeRing()},Tx.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},Tx.prototype.interfaces_=function(){return[]},Tx.prototype.getClass=function(){return Tx},Rx.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return.001},Rx.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return.001},Rx.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},Rx.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(Tx,Rx);var Dx=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};Dx.prototype.getOffsetCurve=function(t,e){if(this._distance=e,0===e)return null;var r=e<0,n=Math.abs(e),i=this.getSegGen(n);t.length<=1?this.computePointCurve(t[0],i):this.computeOffsetCurve(t,r,i);var o=i.getCoordinates();return r&&cI.reverse(o),o},Dx.prototype.computeSingleSidedBufferCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);if(e){r.addSegments(t,!0);var i=bx.simplify(t,-n),o=i.length-1;r.initSideSegments(i[o],i[o-1],CE.LEFT),r.addFirstSegment();for(var s=o-2;s>=0;s--)r.addNextSegment(i[s],!0)}else{r.addSegments(t,!1);var a=bx.simplify(t,n),u=a.length-1;r.initSideSegments(a[0],a[1],CE.LEFT),r.addFirstSegment();for(var l=2;l<=u;l++)r.addNextSegment(a[l],!0)}r.addLastSegment(),r.closeRing()},Dx.prototype.computeRingBufferCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);e===CE.RIGHT&&(n=-n);var i=bx.simplify(t,n),o=i.length-1;r.initSideSegments(i[o-1],i[0],e);for(var s=1;s<=o;s++){var a=1!==s;r.addNextSegment(i[s],a)}r.closeRing()},Dx.prototype.computeLineBufferCurve=function(t,e){var r=this.simplifyTolerance(this._distance),n=bx.simplify(t,r),i=n.length-1;e.initSideSegments(n[0],n[1],CE.LEFT);for(var o=2;o<=i;o++)e.addNextSegment(n[o],!0);e.addLastSegment(),e.addLineEndCap(n[i-1],n[i]);var s=bx.simplify(t,-r),a=s.length-1;e.initSideSegments(s[a],s[a-1],CE.LEFT);for(var u=a-2;u>=0;u--)e.addNextSegment(s[u],!0);e.addLastSegment(),e.addLineEndCap(s[1],s[0]),e.closeRing()},Dx.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case Cx.CAP_ROUND:e.createCircle(t);break;case Cx.CAP_SQUARE:e.createSquare(t)}},Dx.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided())return null;if(0===e)return null;var r=Math.abs(e),n=this.getSegGen(r);if(t.length<=1)this.computePointCurve(t[0],n);else if(this._bufParams.isSingleSided()){var i=e<0;this.computeSingleSidedBufferCurve(t,i,n)}else this.computeLineBufferCurve(t,n);return n.getCoordinates()},Dx.prototype.getBufferParameters=function(){return this._bufParams},Dx.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},Dx.prototype.getRingCurve=function(t,e,r){if(this._distance=r,t.length<=2)return this.getLineCurve(t,r);if(0===r)return Dx.copyCoordinates(t);var n=this.getSegGen(r);return this.computeRingBufferCurve(t,e,n),n.getCoordinates()},Dx.prototype.computeOffsetCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);if(e){var i=bx.simplify(t,-n),o=i.length-1;r.initSideSegments(i[o],i[o-1],CE.LEFT),r.addFirstSegment();for(var s=o-2;s>=0;s--)r.addNextSegment(i[s],!0)}else{var a=bx.simplify(t,n),u=a.length-1;r.initSideSegments(a[0],a[1],CE.LEFT),r.addFirstSegment();for(var l=2;l<=u;l++)r.addNextSegment(a[l],!0)}r.addLastSegment()},Dx.prototype.getSegGen=function(t){return new Tx(this._precisionModel,this._bufParams,t)},Dx.prototype.interfaces_=function(){return[]},Dx.prototype.getClass=function(){return Dx},Dx.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),r=0;r<e.length;r++)e[r]=new s_(t[r]);return e};var Px=function(){this._subgraphs=null,this._seg=new Ax,this._cga=new j_;var t=arguments[0];this._subgraphs=t},Qx={DepthSegment:{configurable:!0}};Px.prototype.findStabbedSegments=function(){var t=this;if(1===arguments.length){for(var e=arguments[0],r=new aI,n=this._subgraphs.iterator();n.hasNext();){var i=n.next(),o=i.getEnvelope();e.y<o.getMinY()||e.y>o.getMaxY()||t.findStabbedSegments(e,i.getDirectedEdges(),r)}return r}if(3===arguments.length)if(f_(arguments[2],oI)&&arguments[0]instanceof s_&&arguments[1]instanceof jE)for(var s=arguments[0],a=arguments[1],u=arguments[2],l=a.getEdge().getCoordinates(),c=0;c<l.length-1;c++){if(t._seg.p0=l[c],t._seg.p1=l[c+1],t._seg.p0.y>t._seg.p1.y&&t._seg.reverse(),!(Math.max(t._seg.p0.x,t._seg.p1.x)<s.x||t._seg.isHorizontal()||s.y<t._seg.p0.y||s.y>t._seg.p1.y||j_.computeOrientation(t._seg.p0,t._seg.p1,s)===j_.RIGHT)){var h=a.getDepth(CE.LEFT);t._seg.p0.equals(l[c])||(h=a.getDepth(CE.RIGHT));var f=new kx(t._seg,h);u.add(f)}}else if(f_(arguments[2],oI)&&arguments[0]instanceof s_&&f_(arguments[1],oI))for(var p=arguments[0],g=arguments[2],A=arguments[1].iterator();A.hasNext();){var d=A.next();d.isForward()&&t.findStabbedSegments(p,d,g)}},Px.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);return 0===e.size()?0:tx.min(e)._leftDepth},Px.prototype.interfaces_=function(){return[]},Px.prototype.getClass=function(){return Px},Qx.DepthSegment.get=function(){return kx},Object.defineProperties(Px,Qx);var kx=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new Ax(t),this._leftDepth=e};kx.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 r=this._upwardSeg.orientationIndex(e._upwardSeg);return 0!==r||0!==(r=-1*e._upwardSeg.orientationIndex(this._upwardSeg))?r:this._upwardSeg.compareTo(e._upwardSeg)},kx.prototype.compareX=function(t,e){var r=t.p0.compareTo(e.p0);return 0!==r?r:t.p1.compareTo(e.p1)},kx.prototype.toString=function(){return this._upwardSeg.toString()},kx.prototype.interfaces_=function(){return[r_]},kx.prototype.getClass=function(){return kx};var Ox=function(t,e,r){this.p0=t||null,this.p1=e||null,this.p2=r||null};Ox.prototype.area=function(){return Ox.area(this.p0,this.p1,this.p2)},Ox.prototype.signedArea=function(){return Ox.signedArea(this.p0,this.p1,this.p2)},Ox.prototype.interpolateZ=function(t){if(null===t)throw new $m("Supplied point is null.");return Ox.interpolateZ(t,this.p0,this.p1,this.p2)},Ox.prototype.longestSideLength=function(){return Ox.longestSideLength(this.p0,this.p1,this.p2)},Ox.prototype.isAcute=function(){return Ox.isAcute(this.p0,this.p1,this.p2)},Ox.prototype.circumcentre=function(){return Ox.circumcentre(this.p0,this.p1,this.p2)},Ox.prototype.area3D=function(){return Ox.area3D(this.p0,this.p1,this.p2)},Ox.prototype.centroid=function(){return Ox.centroid(this.p0,this.p1,this.p2)},Ox.prototype.inCentre=function(){return Ox.inCentre(this.p0,this.p1,this.p2)},Ox.prototype.interfaces_=function(){return[]},Ox.prototype.getClass=function(){return Ox},Ox.area=function(t,e,r){return Math.abs(((r.x-t.x)*(e.y-t.y)-(e.x-t.x)*(r.y-t.y))/2)},Ox.signedArea=function(t,e,r){return((r.x-t.x)*(e.y-t.y)-(e.x-t.x)*(r.y-t.y))/2},Ox.det=function(t,e,r,n){return t*n-e*r},Ox.interpolateZ=function(t,e,r,n){var i=e.x,o=e.y,s=r.x-i,a=n.x-i,u=r.y-o,l=n.y-o,c=s*l-a*u,h=t.x-i,f=t.y-o,p=(l*h-a*f)/c,g=(-u*h+s*f)/c;return e.z+p*(r.z-e.z)+g*(n.z-e.z)},Ox.longestSideLength=function(t,e,r){var n=t.distance(e),i=e.distance(r),o=r.distance(t),s=n;return i>s&&(s=i),o>s&&(s=o),s},Ox.isAcute=function(t,e,r){return!!Lx.isAcute(t,e,r)&&(!!Lx.isAcute(e,r,t)&&!!Lx.isAcute(r,t,e))},Ox.circumcentre=function(t,e,r){var n=r.x,i=r.y,o=t.x-n,s=t.y-i,a=e.x-n,u=e.y-i,l=2*Ox.det(o,s,a,u),c=Ox.det(s,o*o+s*s,u,a*a+u*u),h=Ox.det(o,o*o+s*s,a,a*a+u*u);return new s_(n-c/l,i+h/l)},Ox.perpendicularBisector=function(t,e){var r=e.x-t.x,n=e.y-t.y,i=new B_(t.x+r/2,t.y+n/2,1),o=new B_(t.x-n+r/2,t.y+r+n/2,1);return new B_(i,o)},Ox.angleBisector=function(t,e,r){var n=e.distance(t),i=n/(n+e.distance(r)),o=r.x-t.x,s=r.y-t.y;return new s_(t.x+i*o,t.y+i*s)},Ox.area3D=function(t,e,r){var n=e.x-t.x,i=e.y-t.y,o=e.z-t.z,s=r.x-t.x,a=r.y-t.y,u=r.z-t.z,l=i*u-o*a,c=o*s-n*u,h=n*a-i*s,f=l*l+c*c+h*h,p=Math.sqrt(f)/2;return p},Ox.centroid=function(t,e,r){var n=(t.x+e.x+r.x)/3,i=(t.y+e.y+r.y)/3;return new s_(n,i)},Ox.inCentre=function(t,e,r){var n=e.distance(r),i=t.distance(r),o=t.distance(e),s=n+i+o,a=(n*t.x+i*e.x+o*r.x)/s,u=(n*t.y+i*e.y+o*r.y)/s;return new s_(a,u)};var Fx=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new aI;var t=arguments[0],e=arguments[1],r=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=r};Fx.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),r=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(r,c_.EXTERIOR,c_.INTERIOR)},Fx.prototype.addPolygon=function(t){var e=this,r=this._distance,n=CE.LEFT;this._distance<0&&(r=-this._distance,n=CE.RIGHT);var i=t.getExteriorRing(),o=cI.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance))return null;if(this._distance<=0&&o.length<3)return null;this.addPolygonRing(o,r,n,c_.EXTERIOR,c_.INTERIOR);for(var s=0;s<t.getNumInteriorRing();s++){var a=t.getInteriorRingN(s),u=cI.removeRepeatedPoints(a.getCoordinates());e._distance>0&&e.isErodedCompletely(a,-e._distance)||e.addPolygonRing(u,r,CE.opposite(n),c_.INTERIOR,c_.EXTERIOR)}},Fx.prototype.isTriangleErodedCompletely=function(t,e){var r=new Ox(t[0],t[1],t[2]),n=r.inCentre();return j_.distancePointLine(n,r.p0,r.p1)<Math.abs(e)},Fx.prototype.addLineString=function(t){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var e=cI.removeRepeatedPoints(t.getCoordinates()),r=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(r,c_.EXTERIOR,c_.INTERIOR)},Fx.prototype.addCurve=function(t,e,r){if(null===t||t.length<2)return null;var n=new gx(t,new RE(0,c_.BOUNDARY,e,r));this._curveList.add(n)},Fx.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},Fx.prototype.addPolygonRing=function(t,e,r,n,i){if(0===e&&t.length<tE.MINIMUM_VALID_SIZE)return null;var o=n,s=i;t.length>=tE.MINIMUM_VALID_SIZE&&j_.isCCW(t)&&(o=i,s=n,r=CE.opposite(r));var a=this._curveBuilder.getRingCurve(t,r,e);this.addCurve(a,o,s)},Fx.prototype.add=function(t){if(t.isEmpty())return null;t instanceof ZI?this.addPolygon(t):t instanceof XI?this.addLineString(t):t instanceof WI?this.addPoint(t):(t instanceof $I||t instanceof QI||t instanceof eE||t instanceof PI)&&this.addCollection(t)},Fx.prototype.isErodedCompletely=function(t,e){var r=t.getCoordinates();if(r.length<4)return e<0;if(4===r.length)return this.isTriangleErodedCompletely(r,e);var n=t.getEnvelopeInternal(),i=Math.min(n.getHeight(),n.getWidth());return e<0&&2*Math.abs(e)>i},Fx.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var r=t.getGeometryN(e);this.add(r)}},Fx.prototype.interfaces_=function(){return[]},Fx.prototype.getClass=function(){return Fx};var Gx=function(){};Gx.prototype.locate=function(t){},Gx.prototype.interfaces_=function(){return[]},Gx.prototype.getClass=function(){return Gx};var Ux=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var t=arguments[0];this._parent=t,this._atStart=!0,this._index=0,this._max=t.getNumGeometries()};Ux.prototype.next=function(){if(this._atStart)return this._atStart=!1,Ux.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 sI;var t=this._parent.getGeometryN(this._index++);return t instanceof PI?(this._subcollectionIterator=new Ux(t),this._subcollectionIterator.next()):t},Ux.prototype.remove=function(){throw new Error(this.getClass().getName())},Ux.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)},Ux.prototype.interfaces_=function(){return[iI]},Ux.prototype.getClass=function(){return Ux},Ux.isAtomic=function(t){return!(t instanceof PI)};var qx=function(){this._geom=null;var t=arguments[0];this._geom=t};qx.prototype.locate=function(t){return qx.locate(t,this._geom)},qx.prototype.interfaces_=function(){return[Gx]},qx.prototype.getClass=function(){return qx},qx.isPointInRing=function(t,e){return!!e.getEnvelopeInternal().intersects(t)&&j_.isPointInRing(t,e.getCoordinates())},qx.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var r=e.getExteriorRing();if(!qx.isPointInRing(t,r))return!1;for(var n=0;n<e.getNumInteriorRing();n++){var i=e.getInteriorRingN(n);if(qx.isPointInRing(t,i))return!1}return!0},qx.containsPoint=function(t,e){if(e instanceof ZI)return qx.containsPointInPolygon(t,e);if(e instanceof PI)for(var r=new Ux(e);r.hasNext();){var n=r.next();if(n!==e&&qx.containsPoint(t,n))return!0}return!1},qx.locate=function(t,e){return e.isEmpty()?c_.EXTERIOR:qx.containsPoint(t,e)?c_.INTERIOR:c_.EXTERIOR};var jx=function(){this._edgeMap=new wI,this._edgeList=null,this._ptInAreaLocation=[c_.NONE,c_.NONE]};jx.prototype.getNextCW=function(t){this.getEdges();var e=this._edgeList.indexOf(t),r=e-1;return 0===e&&(r=this._edgeList.size()-1),this._edgeList.get(r)},jx.prototype.propagateSideLabels=function(t){for(var e=c_.NONE,r=this.iterator();r.hasNext();){var n=r.next().getLabel();n.isArea(t)&&n.getLocation(t,CE.LEFT)!==c_.NONE&&(e=n.getLocation(t,CE.LEFT))}if(e===c_.NONE)return null;for(var i=e,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getLabel();if(a.getLocation(t,CE.ON)===c_.NONE&&a.setLocation(t,CE.ON,i),a.isArea(t)){var u=a.getLocation(t,CE.LEFT),l=a.getLocation(t,CE.RIGHT);if(l!==c_.NONE){if(l!==i)throw new ME("side location conflict",s.getCoordinate());u===c_.NONE&&k_.shouldNeverReachHere("found single null side (at "+s.getCoordinate()+")"),i=u}else k_.isTrue(a.getLocation(t,CE.LEFT)===c_.NONE,"found single null side"),a.setLocation(t,CE.RIGHT,i),a.setLocation(t,CE.LEFT,i)}}},jx.prototype.getCoordinate=function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null},jx.prototype.print=function(t){b_.out.println("EdgeEndStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){e.next().print(t)}},jx.prototype.isAreaLabelsConsistent=function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},jx.prototype.checkAreaLabelsConsistent=function(t){var e=this.getEdges();if(e.size()<=0)return!0;var r=e.size()-1,n=e.get(r).getLabel().getLocation(t,CE.LEFT);k_.isTrue(n!==c_.NONE,"Found unlabelled area edge");for(var i=n,o=this.iterator();o.hasNext();){var s=o.next().getLabel();k_.isTrue(s.isArea(t),"Found non-area edge");var a=s.getLocation(t,CE.LEFT),u=s.getLocation(t,CE.RIGHT);if(a===u)return!1;if(u!==i)return!1;i=a}return!0},jx.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},jx.prototype.iterator=function(){return this.getEdges().iterator()},jx.prototype.getEdges=function(){return null===this._edgeList&&(this._edgeList=new aI(this._edgeMap.values())),this._edgeList},jx.prototype.getLocation=function(t,e,r){return this._ptInAreaLocation[t]===c_.NONE&&(this._ptInAreaLocation[t]=qx.locate(e,r[t].getGeometry())),this._ptInAreaLocation[t]},jx.prototype.toString=function(){var t=new A_;t.append("EdgeEndStar: "+this.getCoordinate()),t.append("\n");for(var e=this.iterator();e.hasNext();){var r=e.next();t.append(r),t.append("\n")}return t.toString()},jx.prototype.computeEdgeEndLabels=function(t){for(var e=this.iterator();e.hasNext();){e.next().computeLabel(t)}},jx.prototype.computeLabelling=function(t){this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var e=[!1,!1],r=this.iterator();r.hasNext();)for(var n=r.next().getLabel(),i=0;i<2;i++)n.isLine(i)&&n.getLocation(i)===c_.BOUNDARY&&(e[i]=!0);for(var o=this.iterator();o.hasNext();)for(var s=o.next(),a=s.getLabel(),u=0;u<2;u++)if(a.isAnyNull(u)){var l=c_.NONE;if(e[u])l=c_.EXTERIOR;else{var c=s.getCoordinate();l=this.getLocation(u,c,t)}a.setAllLocationsIfNull(u,l)}},jx.prototype.getDegree=function(){return this._edgeMap.size()},jx.prototype.insertEdgeEnd=function(t,e){this._edgeMap.put(t,e),this._edgeList=null},jx.prototype.interfaces_=function(){return[]},jx.prototype.getClass=function(){return jx};var Vx=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(){var t=this;this.getResultAreaEdges();for(var e=null,r=null,n=this._SCANNING_FOR_INCOMING,i=0;i<this._resultAreaEdgeList.size();i++){var o=t._resultAreaEdgeList.get(i),s=o.getSym();if(o.getLabel().isArea())switch(null===e&&o.isInResult()&&(e=o),n){case t._SCANNING_FOR_INCOMING:if(!s.isInResult())continue;r=s,n=t._LINKING_TO_OUTGOING;break;case t._LINKING_TO_OUTGOING:if(!o.isInResult())continue;r.setNext(o),n=t._SCANNING_FOR_INCOMING}}if(n===this._LINKING_TO_OUTGOING){if(null===e)throw new ME("no outgoing dirEdge found",this.getCoordinate());k_.isTrue(e.isInResult(),"unable to link last incoming dirEdge"),r.setNext(e)}},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 r=t.get(0);if(1===e)return r;var n=t.get(e-1),i=r.getQuadrant(),o=n.getQuadrant();return GE.isNorthern(i)&&GE.isNorthern(o)?r:GE.isNorthern(i)||GE.isNorthern(o)?0!==r.getDy()?r:0!==n.getDy()?n:(k_.shouldNeverReachHere("found two horizontal edges incident on node"),null):n},e.prototype.print=function(t){b_.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){var r=e.next();t.print("out "),r.print(t),t.println(),t.print("in "),r.getSym().print(t),t.println()}},e.prototype.getResultAreaEdges=function(){if(null!==this._resultAreaEdgeList)return this._resultAreaEdgeList;this._resultAreaEdgeList=new aI;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 r=e.next().getLabel();r.setAllLocationsIfNull(0,t.getLocation(0)),r.setAllLocationsIfNull(1,t.getLocation(1))}},e.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var t=null,e=null,r=this._edgeList.size()-1;r>=0;r--){var n=this._edgeList.get(r),i=n.getSym();null===e&&(e=i),null!==t&&i.setNext(t),t=n}e.setNext(t)},e.prototype.computeDepths=function(){if(1===arguments.length){var t=arguments[0],e=this.findIndex(t),r=t.getDepth(CE.LEFT),n=t.getDepth(CE.RIGHT),i=this.computeDepths(e+1,this._edgeList.size(),r);if(this.computeDepths(0,e,i)!==n)throw new ME("depth mismatch at "+t.getCoordinate())}else if(3===arguments.length){for(var o=arguments[1],s=arguments[2],a=arguments[0];a<o;a++){var u=this._edgeList.get(a);u.setEdgeDepths(CE.RIGHT,s),s=u.getDepth(CE.LEFT)}return s}},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=this,r=null,n=null,i=this._SCANNING_FOR_INCOMING,o=this._resultAreaEdgeList.size()-1;o>=0;o--){var s=e._resultAreaEdgeList.get(o),a=s.getSym();switch(null===r&&s.getEdgeRing()===t&&(r=s),i){case e._SCANNING_FOR_INCOMING:if(a.getEdgeRing()!==t)continue;n=a,i=e._LINKING_TO_OUTGOING;break;case e._LINKING_TO_OUTGOING:if(s.getEdgeRing()!==t)continue;n.setNextMin(s),i=e._SCANNING_FOR_INCOMING}}i===this._LINKING_TO_OUTGOING&&(k_.isTrue(null!==r,"found null for first outgoing dirEdge"),k_.isTrue(r.getEdgeRing()===t,"unable to link last incoming dirEdge"),n.setNextMin(r))},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 r=arguments[0],n=0,i=this.iterator();i.hasNext();){i.next().getEdgeRing()===r&&n++}return n}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var t=c_.NONE,e=this.iterator();e.hasNext();){var r=e.next(),n=r.getSym();if(!r.isLineEdge()){if(r.isInResult()){t=c_.INTERIOR;break}if(n.isInResult()){t=c_.EXTERIOR;break}}}if(t===c_.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===c_.INTERIOR):(s.isInResult()&&(i=c_.EXTERIOR),a.isInResult()&&(i=c_.INTERIOR))}},e.prototype.computeLabelling=function(e){t.prototype.computeLabelling.call(this,e),this._label=new RE(c_.NONE);for(var r=this.iterator();r.hasNext();)for(var n=r.next().getEdge().getLabel(),i=0;i<2;i++){var o=n.getLocation(i);o!==c_.INTERIOR&&o!==c_.BOUNDARY||this._label.setLocation(i,c_.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(jx),zx=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 OE(t,new Vx)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(VE),Yx=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};Yx.prototype.compareTo=function(t){var e=t;return Yx.compareOriented(this._pts,this._orientation,e._pts,e._orientation)},Yx.prototype.interfaces_=function(){return[r_]},Yx.prototype.getClass=function(){return Yx},Yx.orientation=function(t){return 1===cI.increasingDirection(t)},Yx.compareOriented=function(t,e,r,n){for(var i=e?1:-1,o=n?1:-1,s=e?t.length:-1,a=n?r.length:-1,u=e?0:t.length-1,l=n?0:r.length-1;;){var c=t[u].compareTo(r[l]);if(0!==c)return c;var h=(u+=i)===s,f=(l+=o)===a;if(h&&!f)return-1;if(!h&&f)return 1;if(h&&f)return 0}};var Hx=function(){this._edges=new aI,this._ocaMap=new wI};Hx.prototype.print=function(t){t.print("MULTILINESTRING ( ");for(var e=0;e<this._edges.size();e++){var r=this._edges.get(e);e>0&&t.print(","),t.print("(");for(var n=r.getCoordinates(),i=0;i<n.length;i++)i>0&&t.print(","),t.print(n[i].x+" "+n[i].y);t.println(")")}t.print(") ")},Hx.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())},Hx.prototype.findEdgeIndex=function(t){for(var e=0;e<this._edges.size();e++)if(this._edges.get(e).equals(t))return e;return-1},Hx.prototype.iterator=function(){return this._edges.iterator()},Hx.prototype.getEdges=function(){return this._edges},Hx.prototype.get=function(t){return this._edges.get(t)},Hx.prototype.findEqualEdge=function(t){var e=new Yx(t.getCoordinates());return this._ocaMap.get(e)},Hx.prototype.add=function(t){this._edges.add(t);var e=new Yx(t.getCoordinates());this._ocaMap.put(e,t)},Hx.prototype.interfaces_=function(){return[]},Hx.prototype.getClass=function(){return Hx};var Xx=function(){};Xx.prototype.processIntersections=function(t,e,r,n){},Xx.prototype.isDone=function(){},Xx.prototype.interfaces_=function(){return[]},Xx.prototype.getClass=function(){return Xx};var Jx=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var t=arguments[0];this._li=t};Jx.prototype.isTrivialIntersection=function(t,e,r,n){if(t===r&&1===this._li.getIntersectionNum()){if(Jx.isAdjacentSegments(e,n))return!0;if(t.isClosed()){var i=t.size()-1;if(0===e&&n===i||0===n&&e===i)return!0}}return!1},Jx.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Jx.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Jx.prototype.getLineIntersector=function(){return this._li},Jx.prototype.hasProperIntersection=function(){return this._hasProper},Jx.prototype.processIntersections=function(t,e,r,n){if(t===r&&e===n)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,e,r,n)||(this._hasIntersection=!0,t.addIntersections(this._li,e,0),r.addIntersections(this._li,n,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},Jx.prototype.hasIntersection=function(){return this._hasIntersection},Jx.prototype.isDone=function(){return!1},Jx.prototype.hasInteriorIntersection=function(){return this._hasInterior},Jx.prototype.interfaces_=function(){return[Xx]},Jx.prototype.getClass=function(){return Jx},Jx.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var Wx=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],e=arguments[1],r=arguments[2];this.coord=new s_(t),this.segmentIndex=e,this.dist=r};Wx.prototype.getSegmentIndex=function(){return this.segmentIndex},Wx.prototype.getCoordinate=function(){return this.coord},Wx.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)},Wx.prototype.compareTo=function(t){var e=t;return this.compare(e.segmentIndex,e.dist)},Wx.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&0===this.dist||this.segmentIndex===t},Wx.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},Wx.prototype.getDistance=function(){return this.dist},Wx.prototype.compare=function(t,e){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<e?-1:this.dist>e?1:0},Wx.prototype.interfaces_=function(){return[r_]},Wx.prototype.getClass=function(){return Wx};var Kx=function(){this._nodeMap=new wI,this.edge=null;var t=arguments[0];this.edge=t};Kx.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){e.next().print(t)}},Kx.prototype.iterator=function(){return this._nodeMap.values().iterator()},Kx.prototype.addSplitEdges=function(t){this.addEndpoints();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next(),i=this.createSplitEdge(r,n);t.add(i),r=n}},Kx.prototype.addEndpoints=function(){var t=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[t],t,0)},Kx.prototype.createSplitEdge=function(t,e){var r=e.segmentIndex-t.segmentIndex+2,n=this.edge.pts[e.segmentIndex],i=e.dist>0||!e.coord.equals2D(n);i||r--;var o=new Array(r).fill(null),s=0;o[s++]=new s_(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this.edge.pts[a];return i&&(o[s]=e.coord),new rC(o,new RE(this.edge._label))},Kx.prototype.add=function(t,e,r){var n=new Wx(t,e,r),i=this._nodeMap.get(n);return null!==i?i:(this._nodeMap.put(n,n),n)},Kx.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){if(e.next().coord.equals(t))return!0}return!1},Kx.prototype.interfaces_=function(){return[]},Kx.prototype.getClass=function(){return Kx};var Zx=function(){};Zx.prototype.getChainStartIndices=function(t){var e=0,r=new aI;r.add(new d_(e));do{var n=this.findChainEnd(t,e);r.add(new d_(n)),e=n}while(e<t.length-1);return Zx.toIntArray(r)},Zx.prototype.findChainEnd=function(t,e){for(var r=GE.quadrant(t[e],t[e+1]),n=e+1;n<t.length;){if(GE.quadrant(t[n-1],t[n])!==r)break;n++}return n-1},Zx.prototype.interfaces_=function(){return[]},Zx.prototype.getClass=function(){return Zx},Zx.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),r=0;r<e.length;r++)e[r]=t.get(r).intValue();return e};var $x=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new S_,this.env2=new S_;var t=arguments[0];this.e=t,this.pts=t.getCoordinates();var e=new Zx;this.startIndex=e.getChainStartIndices(this.pts)};$x.prototype.getCoordinates=function(){return this.pts},$x.prototype.getMaxX=function(t){var e=this.pts[this.startIndex[t]].x,r=this.pts[this.startIndex[t+1]].x;return e>r?e:r},$x.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,r=this.pts[this.startIndex[t+1]].x;return e<r?e:r},$x.prototype.computeIntersectsForChain=function(){if(4===arguments.length){var t=arguments[0],e=arguments[1],r=arguments[2],n=arguments[3];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],e,e.startIndex[r],e.startIndex[r+1],n)}else if(6===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3],u=arguments[4],l=arguments[5],c=this.pts[i],h=this.pts[o],f=s.pts[a],p=s.pts[u];if(o-i==1&&u-a==1)return l.addIntersections(this.e,i,s.e,a),null;if(this.env1.init(c,h),this.env2.init(f,p),!this.env1.intersects(this.env2))return null;var g=Math.trunc((i+o)/2),A=Math.trunc((a+u)/2);i<g&&(a<A&&this.computeIntersectsForChain(i,g,s,a,A,l),A<u&&this.computeIntersectsForChain(i,g,s,A,u,l)),g<o&&(a<A&&this.computeIntersectsForChain(g,o,s,a,A,l),A<u&&this.computeIntersectsForChain(g,o,s,A,u,l))}},$x.prototype.getStartIndexes=function(){return this.startIndex},$x.prototype.computeIntersects=function(t,e){for(var r=0;r<this.startIndex.length-1;r++)for(var n=0;n<t.startIndex.length-1;n++)this.computeIntersectsForChain(r,t,n,e)},$x.prototype.interfaces_=function(){return[]},$x.prototype.getClass=function(){return $x};var tC=function t(){this._depth=Array(2).fill().map((function(){return Array(3)}));for(var e=0;e<2;e++)for(var r=0;r<3;r++)this._depth[e][r]=t.NULL_VALUE},eC={NULL_VALUE:{configurable:!0}};tC.prototype.getDepth=function(t,e){return this._depth[t][e]},tC.prototype.setDepth=function(t,e,r){this._depth[t][e]=r},tC.prototype.isNull=function(){if(0===arguments.length){for(var t=0;t<2;t++)for(var e=0;e<3;e++)if(this._depth[t][e]!==tC.NULL_VALUE)return!1;return!0}if(1===arguments.length){var r=arguments[0];return this._depth[r][1]===tC.NULL_VALUE}if(2===arguments.length){var n=arguments[0],i=arguments[1];return this._depth[n][i]===tC.NULL_VALUE}},tC.prototype.normalize=function(){for(var t=this,e=0;e<2;e++)if(!t.isNull(e)){var r=t._depth[e][1];t._depth[e][2]<r&&(r=t._depth[e][2]),r<0&&(r=0);for(var n=1;n<3;n++){var i=0;t._depth[e][n]>r&&(i=1),t._depth[e][n]=i}}},tC.prototype.getDelta=function(t){return this._depth[t][CE.RIGHT]-this._depth[t][CE.LEFT]},tC.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?c_.EXTERIOR:c_.INTERIOR},tC.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},tC.prototype.add=function(){var t=this;if(1===arguments.length)for(var e=arguments[0],r=0;r<2;r++)for(var n=1;n<3;n++){var i=e.getLocation(r,n);i!==c_.EXTERIOR&&i!==c_.INTERIOR||(t.isNull(r,n)?t._depth[r][n]=tC.depthAtLocation(i):t._depth[r][n]+=tC.depthAtLocation(i))}else if(3===arguments.length){var o=arguments[0],s=arguments[1];arguments[2]===c_.INTERIOR&&this._depth[o][s]++}},tC.prototype.interfaces_=function(){return[]},tC.prototype.getClass=function(){return tC},tC.depthAtLocation=function(t){return t===c_.EXTERIOR?0:t===c_.INTERIOR?1:tC.NULL_VALUE},eC.NULL_VALUE.get=function(){return-1},Object.defineProperties(tC,eC);var rC=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new Kx(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new tC,this._depthDelta=0,1===arguments.length){var r=arguments[0];e.call(this,r,null)}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.pts=n,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[0]=this.pts[0],t[1]=this.pts[1],new e(t,RE.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 r=t;if(this.pts.length!==r.pts.length)return!1;for(var n=!0,i=!0,o=this.pts.length,s=0;s<this.pts.length;s++)if(this.pts[s].equals2D(r.pts[s])||(n=!1),this.pts[s].equals2D(r.pts[--o])||(i=!1),!n&&!i)return!1;return!0},e.prototype.getCoordinate=function(){if(0===arguments.length)return this.pts.length>0?this.pts[0]:null;if(1===arguments.length){var t=arguments[0];return this.pts[t]}},e.prototype.print=function(t){t.print("edge "+this._name+": "),t.print("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.print(","),t.print(this.pts[e].x+" "+this.pts[e].y);t.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(t){e.updateIM(this._label,t)},e.prototype.isCollapsed=function(){return!!this._label.isArea()&&(3===this.pts.length&&!!this.pts[0].equals(this.pts[2]))},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(t){t.print("edge "+this._name+": ");for(var e=this.pts.length-1;e>=0;e--)t.print(this.pts[e]+" ");t.println("")},e.prototype.getMonotoneChainEdge=function(){return null===this._mce&&(this._mce=new $x(this)),this._mce},e.prototype.getEnvelope=function(){if(null===this._env){this._env=new S_;for(var t=0;t<this.pts.length;t++)this._env.expandToInclude(this.pts[t])}return this._env},e.prototype.addIntersection=function(t,e,r,n){var i=new s_(t.getIntersection(n)),o=e,s=t.getEdgeDistance(r,n),a=o+1;if(a<this.pts.length){var u=this.pts[a];i.equals2D(u)&&(o=a,s=0)}this.eiList.add(i,o,s)},e.prototype.toString=function(){var t=new A_;t.append("edge "+this._name+": "),t.append("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.append(","),t.append(this.pts[e].x+" "+this.pts[e].y);return t.append(") "+this._label+" "+this._depthDelta),t.toString()},e.prototype.isPointwiseEqual=function(t){if(this.pts.length!==t.pts.length)return!1;for(var e=0;e<this.pts.length;e++)if(!this.pts[e].equals2D(t.pts[e]))return!1;return!0},e.prototype.setDepthDelta=function(t){this._depthDelta=t},e.prototype.getEdgeIntersectionList=function(){return this.eiList},e.prototype.addIntersections=function(t,e,r){for(var n=0;n<t.getIntersectionNum();n++)this.addIntersection(t,e,r,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.updateIM=function(){if(2!==arguments.length)return t.prototype.updateIM.apply(this,arguments);var e=arguments[0],r=arguments[1];r.setAtLeastIfValid(e.getLocation(0,CE.ON),e.getLocation(1,CE.ON),1),e.isArea()&&(r.setAtLeastIfValid(e.getLocation(0,CE.LEFT),e.getLocation(1,CE.LEFT),2),r.setAtLeastIfValid(e.getLocation(0,CE.RIGHT),e.getLocation(1,CE.RIGHT),2))},e}(kE),nC=function(t){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new Hx,this._bufParams=t||null};nC.prototype.setWorkingPrecisionModel=function(t){this._workingPrecisionModel=t},nC.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var r=e.getLabel(),n=t.getLabel();e.isPointwiseEqual(t)||(n=new RE(t.getLabel())).flip(),r.merge(n);var i=nC.depthDelta(n),o=e.getDepthDelta()+i;e.setDepthDelta(o)}else this._edgeList.add(t),t.setDepthDelta(nC.depthDelta(t.getLabel()))},nC.prototype.buildSubgraphs=function(t,e){for(var r=new aI,n=t.iterator();n.hasNext();){var i=n.next(),o=i.getRightmostCoordinate(),s=new Px(r).getDepth(o);i.computeDepth(s),i.findResultEdges(),r.add(i),e.add(i.getDirectedEdges(),i.getNodes())}},nC.prototype.createSubgraphs=function(t){for(var e=new aI,r=t.getNodes().iterator();r.hasNext();){var n=r.next();if(!n.isVisited()){var i=new NE;i.create(n),e.add(i)}}return tx.sort(e,tx.reverseOrder()),e},nC.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},nC.prototype.getNoder=function(t){if(null!==this._workingNoder)return this._workingNoder;var e=new Ex,r=new G_;return r.setPrecisionModel(t),e.setSegmentIntersector(new Jx(r)),e},nC.prototype.buffer=function(t,e){var r=this._workingPrecisionModel;null===r&&(r=t.getPrecisionModel()),this._geomFact=t.getFactory();var n=new Dx(r,this._bufParams),i=new Fx(t,e,n).getCurves();if(i.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(i,r),this._graph=new zE(new zx),this._graph.addEdges(this._edgeList.getEdges());var o=this.createSubgraphs(this._graph),s=new YE(this._geomFact);this.buildSubgraphs(o,s);var a=s.getPolygons();return a.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(a)},nC.prototype.computeNodedEdges=function(t,e){var r=this.getNoder(e);r.computeNodes(t);for(var n=r.getNodedSubstrings().iterator();n.hasNext();){var i=n.next(),o=i.getCoordinates();if(2!==o.length||!o[0].equals2D(o[1])){var s=i.getData(),a=new rC(i.getCoordinates(),new RE(s));this.insertUniqueEdge(a)}}},nC.prototype.setNoder=function(t){this._workingNoder=t},nC.prototype.interfaces_=function(){return[]},nC.prototype.getClass=function(){return nC},nC.depthDelta=function(t){var e=t.getLocation(0,CE.LEFT),r=t.getLocation(0,CE.RIGHT);return e===c_.INTERIOR&&r===c_.EXTERIOR?1:e===c_.EXTERIOR&&r===c_.INTERIOR?-1:0},nC.convertSegStrings=function(t){for(var e=new dE,r=new aI;t.hasNext();){var n=t.next(),i=e.createLineString(n.getCoordinates());r.add(i)}return e.buildGeometry(r)};var iC=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,2===arguments.length){var t=arguments[0],e=arguments[1];this._noder=t,this._scaleFactor=e,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(4===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2],o=arguments[3];this._noder=r,this._scaleFactor=n,this._offsetX=i,this._offsetY=o,this._isScaled=!this.isIntegerPrecision()}};iC.prototype.rescale=function(){var t=this;if(f_(arguments[0],rI))for(var e=arguments[0].iterator();e.hasNext();){var r=e.next();t.rescale(r.getCoordinates())}else if(arguments[0]instanceof Array){for(var n=arguments[0],i=0;i<n.length;i++)n[i].x=n[i].x/t._scaleFactor+t._offsetX,n[i].y=n[i].y/t._scaleFactor+t._offsetY;2===n.length&&n[0].equals2D(n[1])&&b_.out.println(n)}},iC.prototype.scale=function(){var t=this;if(f_(arguments[0],rI)){for(var e=arguments[0],r=new aI,n=e.iterator();n.hasNext();){var i=n.next();r.add(new gx(t.scale(i.getCoordinates()),i.getData()))}return r}if(arguments[0]instanceof Array){for(var o=arguments[0],s=new Array(o.length).fill(null),a=0;a<o.length;a++)s[a]=new s_(Math.round((o[a].x-t._offsetX)*t._scaleFactor),Math.round((o[a].y-t._offsetY)*t._scaleFactor),o[a].z);return cI.removeRepeatedPoints(s)}},iC.prototype.isIntegerPrecision=function(){return 1===this._scaleFactor},iC.prototype.getNodedSubstrings=function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t},iC.prototype.computeNodes=function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)},iC.prototype.interfaces_=function(){return[_x]},iC.prototype.getClass=function(){return iC};var oC=function(){this._li=new G_,this._segStrings=null;var t=arguments[0];this._segStrings=t},sC={fact:{configurable:!0}};oC.prototype.checkEndPtVertexIntersections=function(){var t=this;if(0===arguments.length)for(var e=this._segStrings.iterator();e.hasNext();){var r=e.next().getCoordinates();t.checkEndPtVertexIntersections(r[0],t._segStrings),t.checkEndPtVertexIntersections(r[r.length-1],t._segStrings)}else if(2===arguments.length)for(var n=arguments[0],i=arguments[1].iterator();i.hasNext();)for(var o=i.next().getCoordinates(),s=1;s<o.length-1;s++)if(o[s].equals(n))throw new P_("found endpt/interior pt intersection at index "+s+" :pt "+n)},oC.prototype.checkInteriorIntersections=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();)for(var e=t.next(),r=this._segStrings.iterator();r.hasNext();){var n=r.next();this.checkInteriorIntersections(e,n)}else if(2===arguments.length)for(var i=arguments[0],o=arguments[1],s=i.getCoordinates(),a=o.getCoordinates(),u=0;u<s.length-1;u++)for(var l=0;l<a.length-1;l++)this.checkInteriorIntersections(i,u,o,l);else if(4===arguments.length){var c=arguments[0],h=arguments[1],f=arguments[2],p=arguments[3];if(c===f&&h===p)return null;var g=c.getCoordinates()[h],A=c.getCoordinates()[h+1],d=f.getCoordinates()[p],y=f.getCoordinates()[p+1];if(this._li.computeIntersection(g,A,d,y),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,g,A)||this.hasInteriorIntersection(this._li,d,y)))throw new P_("found non-noded intersection at "+g+"-"+A+" and "+d+"-"+y)}},oC.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},oC.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 r=arguments[0].getCoordinates(),n=0;n<r.length-2;n++)this.checkCollapse(r[n],r[n+1],r[n+2])},oC.prototype.hasInteriorIntersection=function(t,e,r){for(var n=0;n<t.getIntersectionNum();n++){var i=t.getIntersection(n);if(!i.equals(e)&&!i.equals(r))return!0}return!1},oC.prototype.checkCollapse=function(t,e,r){if(t.equals(r))throw new P_("found non-noded collapse at "+oC.fact.createLineString([t,e,r]))},oC.prototype.interfaces_=function(){return[]},oC.prototype.getClass=function(){return oC},sC.fact.get=function(){return new dE},Object.defineProperties(oC,sC);var aC=function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var t=arguments[0],e=arguments[1],r=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=e,this._li=r,e<=0)throw new $m("Scale factor must be non-zero");1!==e&&(this._pt=new s_(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new s_,this._p1Scaled=new s_),this.initCorners(this._pt)},uC={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};aC.prototype.intersectsScaled=function(t,e){var r=Math.min(t.x,e.x),n=Math.max(t.x,e.x),i=Math.min(t.y,e.y),o=Math.max(t.y,e.y),s=this._maxx<r||this._minx>n||this._maxy<i||this._miny>o;if(s)return!1;var a=this.intersectsToleranceSquare(t,e);return k_.isTrue(!(s&&a),"Found bad envelope test"),a},aC.prototype.initCorners=function(t){var e=.5;this._minx=t.x-e,this._maxx=t.x+e,this._miny=t.y-e,this._maxy=t.y+e,this._corner[0]=new s_(this._maxx,this._maxy),this._corner[1]=new s_(this._minx,this._maxy),this._corner[2]=new s_(this._minx,this._miny),this._corner[3]=new s_(this._maxx,this._miny)},aC.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))},aC.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},aC.prototype.getCoordinate=function(){return this._originalPt},aC.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},aC.prototype.getSafeEnvelope=function(){if(null===this._safeEnv){var t=aC.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new S_(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},aC.prototype.intersectsPixelClosure=function(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))},aC.prototype.intersectsToleranceSquare=function(t,e){var r=!1,n=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),!!this._li.isProper()||(!(!r||!n)||(!!t.equals(this._pt)||!!e.equals(this._pt))))))},aC.prototype.addSnappedNode=function(t,e){var r=t.getCoordinate(e),n=t.getCoordinate(e+1);return!!this.intersects(r,n)&&(t.addIntersection(this.getCoordinate(),e),!0)},aC.prototype.interfaces_=function(){return[]},aC.prototype.getClass=function(){return aC},uC.SAFE_ENV_EXPANSION_FACTOR.get=function(){return.75},Object.defineProperties(aC,uC);var lC=function(){this.tempEnv1=new S_,this.selectedSegment=new Ax};lC.prototype.select=function(){if(1===arguments.length);else if(2===arguments.length){var t=arguments[1];arguments[0].getLineSegment(t,this.selectedSegment),this.select(this.selectedSegment)}},lC.prototype.interfaces_=function(){return[]},lC.prototype.getClass=function(){return lC};var cC=function(){this._index=null;var t=arguments[0];this._index=t},hC={HotPixelSnapAction:{configurable:!0}};cC.prototype.snap=function(){if(1===arguments.length){var t=arguments[0];return this.snap(t,null,-1)}if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2],i=e.getSafeEnvelope(),o=new fC(e,r,n);return this._index.query(i,{interfaces_:function(){return[WE]},visitItem:function(t){t.select(i,o)}}),o.isNodeAdded()}},cC.prototype.interfaces_=function(){return[]},cC.prototype.getClass=function(){return cC},hC.HotPixelSnapAction.get=function(){return fC},Object.defineProperties(cC,hC);var fC=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var e=arguments[0],r=arguments[1],n=arguments[2];this._hotPixel=e,this._parentEdge=r,this._hotPixelVertexIndex=n}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[1],r=arguments[0].getContext();if(null!==this._parentEdge&&r===this._parentEdge&&e===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(r,e)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(lC),pC=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new aI};pC.prototype.processIntersections=function(t,e,r,n){if(t===r&&e===n)return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];if(this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var u=0;u<this._li.getIntersectionNum();u++)this._interiorIntersections.add(this._li.getIntersection(u));t.addIntersections(this._li,e,0),r.addIntersections(this._li,n,1)}},pC.prototype.isDone=function(){return!1},pC.prototype.getInteriorIntersections=function(){return this._interiorIntersections},pC.prototype.interfaces_=function(){return[Xx]},pC.prototype.getClass=function(){return pC};var gC=function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var t=arguments[0];this._pm=t,this._li=new G_,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()};gC.prototype.checkCorrectness=function(t){var e=gx.getNodedSubstrings(t),r=new oC(e);try{r.checkValid()}catch(t){if(!(t instanceof C_))throw t;t.printStackTrace()}},gC.prototype.getNodedSubstrings=function(){return gx.getNodedSubstrings(this._nodedSegStrings)},gC.prototype.snapRound=function(t,e){var r=this.findInteriorIntersections(t,e);this.computeIntersectionSnaps(r),this.computeVertexSnaps(t)},gC.prototype.findInteriorIntersections=function(t,e){var r=new pC(e);return this._noder.setSegmentIntersector(r),this._noder.computeNodes(t),r.getInteriorIntersections()},gC.prototype.computeVertexSnaps=function(){var t=this;if(f_(arguments[0],rI))for(var e=arguments[0].iterator();e.hasNext();){var r=e.next();t.computeVertexSnaps(r)}else if(arguments[0]instanceof gx)for(var n=arguments[0],i=n.getCoordinates(),o=0;o<i.length;o++){var s=new aC(i[o],t._scaleFactor,t._li);t._pointSnapper.snap(s,n,o)&&n.addIntersection(i[o],o)}},gC.prototype.computeNodes=function(t){this._nodedSegStrings=t,this._noder=new Ex,this._pointSnapper=new cC(this._noder.getIndex()),this.snapRound(t,this._li)},gC.prototype.computeIntersectionSnaps=function(t){for(var e=this,r=t.iterator();r.hasNext();){var n=r.next(),i=new aC(n,e._scaleFactor,e._li);e._pointSnapper.snap(i)}},gC.prototype.interfaces_=function(){return[_x]},gC.prototype.getClass=function(){return gC};var AC=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new Cx,this._resultGeometry=null,this._saveException=null,1===arguments.length){var t=arguments[0];this._argGeom=t}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this._argGeom=e,this._bufParams=r}},dC={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};AC.prototype.bufferFixedPrecision=function(t){var e=new iC(new gC(new fE(1)),t.getScale()),r=new nC(this._bufParams);r.setWorkingPrecisionModel(t),r.setNoder(e),this._resultGeometry=r.buffer(this._argGeom,this._distance)},AC.prototype.bufferReducedPrecision=function(){var t=this;if(0===arguments.length){for(var e=AC.MAX_PRECISION_DIGITS;e>=0;e--){try{t.bufferReducedPrecision(e)}catch(e){if(!(e instanceof ME))throw e;t._saveException=e}if(null!==t._resultGeometry)return null}throw this._saveException}if(1===arguments.length){var r=arguments[0],n=AC.precisionScaleFactor(this._argGeom,this._distance,r),i=new fE(n);this.bufferFixedPrecision(i)}},AC.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===fE.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},AC.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},AC.prototype.bufferOriginalPrecision=function(){try{var t=new nC(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof P_))throw t;this._saveException=t}},AC.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},AC.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},AC.prototype.interfaces_=function(){return[]},AC.prototype.getClass=function(){return AC},AC.bufferOp=function(){if(2===arguments.length){var t=arguments[1];return new AC(arguments[0]).getResultGeometry(t)}if(3===arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Y_&&"number"==typeof arguments[1]){var e=arguments[1],r=arguments[2],n=new AC(arguments[0]);return n.setQuadrantSegments(r),n.getResultGeometry(e)}if(arguments[2]instanceof Cx&&arguments[0]instanceof Y_&&"number"==typeof arguments[1]){var i=arguments[1];return new AC(arguments[0],arguments[2]).getResultGeometry(i)}}else if(4===arguments.length){var o=arguments[1],s=arguments[2],a=arguments[3],u=new AC(arguments[0]);return u.setQuadrantSegments(s),u.setEndCapStyle(a),u.getResultGeometry(o)}},AC.precisionScaleFactor=function(t,e,r){var n=t.getEnvelopeInternal(),i=p_.max(Math.abs(n.getMaxX()),Math.abs(n.getMaxY()),Math.abs(n.getMinX()),Math.abs(n.getMinY()))+2*(e>0?e:0),o=r-Math.trunc(Math.log(i)/Math.log(10)+1);return Math.pow(10,o)},dC.CAP_ROUND.get=function(){return Cx.CAP_ROUND},dC.CAP_BUTT.get=function(){return Cx.CAP_FLAT},dC.CAP_FLAT.get=function(){return Cx.CAP_FLAT},dC.CAP_SQUARE.get=function(){return Cx.CAP_SQUARE},dC.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(AC,dC);var yC=function(){this._pt=[new s_,new s_],this._distance=t_.NaN,this._isNull=!0};yC.prototype.getCoordinates=function(){return this._pt},yC.prototype.getCoordinate=function(t){return this._pt[t]},yC.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n<this._distance&&this.initialize(e,r,n)}},yC.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this._pt[0].setCoordinate(r),this._pt[1].setCoordinate(n),this._distance=i,this._isNull=!1}},yC.prototype.getDistance=function(){return this._distance},yC.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n>this._distance&&this.initialize(e,r,n)}},yC.prototype.interfaces_=function(){return[]},yC.prototype.getClass=function(){return yC};var vC=function(){};vC.prototype.interfaces_=function(){return[]},vC.prototype.getClass=function(){return vC},vC.computeDistance=function(){if(arguments[2]instanceof yC&&arguments[0]instanceof XI&&arguments[1]instanceof s_)for(var t=arguments[1],e=arguments[2],r=arguments[0].getCoordinates(),n=new Ax,i=0;i<r.length-1;i++){n.setCoordinates(r[i],r[i+1]);var o=n.closestPoint(t);e.setMinimum(o,t)}else if(arguments[2]instanceof yC&&arguments[0]instanceof ZI&&arguments[1]instanceof s_){var s=arguments[0],a=arguments[1],u=arguments[2];vC.computeDistance(s.getExteriorRing(),a,u);for(var l=0;l<s.getNumInteriorRing();l++)vC.computeDistance(s.getInteriorRingN(l),a,u)}else if(arguments[2]instanceof yC&&arguments[0]instanceof Y_&&arguments[1]instanceof s_){var c=arguments[0],h=arguments[1],f=arguments[2];if(c instanceof XI)vC.computeDistance(c,h,f);else if(c instanceof ZI)vC.computeDistance(c,h,f);else if(c instanceof PI)for(var p=c,g=0;g<p.getNumGeometries();g++){var A=p.getGeometryN(g);vC.computeDistance(A,h,f)}else f.setMinimum(c.getCoordinate(),h)}else if(arguments[2]instanceof yC&&arguments[0]instanceof Ax&&arguments[1]instanceof s_){var d=arguments[1],y=arguments[2],v=arguments[0].closestPoint(d);y.setMinimum(v,d)}};var mC=function(t){this._maxPtDist=new yC,this._inputGeom=t||null},_C={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};mC.prototype.computeMaxMidpointDistance=function(t){var e=new EC(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},mC.prototype.computeMaxVertexDistance=function(t){var e=new IC(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},mC.prototype.findDistance=function(t){return this.computeMaxVertexDistance(t),this.computeMaxMidpointDistance(t),this._maxPtDist.getDistance()},mC.prototype.getDistancePoints=function(){return this._maxPtDist},mC.prototype.interfaces_=function(){return[]},mC.prototype.getClass=function(){return mC},_C.MaxPointDistanceFilter.get=function(){return IC},_C.MaxMidpointDistanceFilter.get=function(){return EC},Object.defineProperties(mC,_C);var IC=function(t){this._maxPtDist=new yC,this._minPtDist=new yC,this._geom=t||null};IC.prototype.filter=function(t){this._minPtDist.initialize(),vC.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},IC.prototype.getMaxPointDistance=function(){return this._maxPtDist},IC.prototype.interfaces_=function(){return[J_]},IC.prototype.getClass=function(){return IC};var EC=function(t){this._maxPtDist=new yC,this._minPtDist=new yC,this._geom=t||null};EC.prototype.filter=function(t,e){if(0===e)return null;var r=t.getCoordinate(e-1),n=t.getCoordinate(e),i=new s_((r.x+n.x)/2,(r.y+n.y)/2);this._minPtDist.initialize(),vC.computeDistance(this._geom,i,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},EC.prototype.isDone=function(){return!1},EC.prototype.isGeometryChanged=function(){return!1},EC.prototype.getMaxPointDistance=function(){return this._maxPtDist},EC.prototype.interfaces_=function(){return[DI]},EC.prototype.getClass=function(){return EC};var xC=function(t){this._comps=t||null};xC.prototype.filter=function(t){t instanceof ZI&&this._comps.add(t)},xC.prototype.interfaces_=function(){return[RI]},xC.prototype.getClass=function(){return xC},xC.getPolygons=function(){if(1===arguments.length)return xC.getPolygons(arguments[0],new aI);if(2===arguments.length){var t=arguments[0],e=arguments[1];return t instanceof ZI?e.add(t):t instanceof PI&&t.apply(new xC(e)),e}};var CC=function(){if(this._lines=null,this._isForcedToLineString=!1,1===arguments.length){var t=arguments[0];this._lines=t}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this._lines=e,this._isForcedToLineString=r}};CC.prototype.filter=function(t){if(this._isForcedToLineString&&t instanceof tE){var e=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(e),null}t instanceof XI&&this._lines.add(t)},CC.prototype.setForceToLineString=function(t){this._isForcedToLineString=t},CC.prototype.interfaces_=function(){return[z_]},CC.prototype.getClass=function(){return CC},CC.getGeometry=function(){if(1===arguments.length){var t=arguments[0];return t.getFactory().buildGeometry(CC.getLines(t))}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e.getFactory().buildGeometry(CC.getLines(e,r))}},CC.getLines=function(){if(1===arguments.length)return CC.getLines(arguments[0],!1);if(2===arguments.length){if(f_(arguments[0],rI)&&f_(arguments[1],rI)){for(var t=arguments[1],e=arguments[0].iterator();e.hasNext();){var r=e.next();CC.getLines(r,t)}return t}if(arguments[0]instanceof Y_&&"boolean"==typeof arguments[1]){var n=arguments[0],i=arguments[1],o=new aI;return n.apply(new CC(o,i)),o}if(arguments[0]instanceof Y_&&f_(arguments[1],rI)){var s=arguments[0],a=arguments[1];return s instanceof XI?a.add(s):s.apply(new CC(a)),a}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&f_(arguments[0],rI)&&f_(arguments[1],rI)){for(var u=arguments[1],l=arguments[2],c=arguments[0].iterator();c.hasNext();){var h=c.next();CC.getLines(h,u,l)}return u}if("boolean"==typeof arguments[2]&&arguments[0]instanceof Y_&&f_(arguments[1],rI)){var f=arguments[1],p=arguments[2];return arguments[0].apply(new CC(f,p)),f}}};var wC=function(){if(this._boundaryRule=W_.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];if(null===t)throw new $m("Rule must be non-null");this._boundaryRule=t}};wC.prototype.locateInternal=function(){if(arguments[0]instanceof s_&&arguments[1]instanceof ZI){var t=arguments[0],e=arguments[1];if(e.isEmpty())return c_.EXTERIOR;var r=e.getExteriorRing(),n=this.locateInPolygonRing(t,r);if(n===c_.EXTERIOR)return c_.EXTERIOR;if(n===c_.BOUNDARY)return c_.BOUNDARY;for(var i=0;i<e.getNumInteriorRing();i++){var o=e.getInteriorRingN(i),s=this.locateInPolygonRing(t,o);if(s===c_.INTERIOR)return c_.EXTERIOR;if(s===c_.BOUNDARY)return c_.BOUNDARY}return c_.INTERIOR}if(arguments[0]instanceof s_&&arguments[1]instanceof XI){var a=arguments[0],u=arguments[1];if(!u.getEnvelopeInternal().intersects(a))return c_.EXTERIOR;var l=u.getCoordinates();return u.isClosed()||!a.equals(l[0])&&!a.equals(l[l.length-1])?j_.isOnLine(a,l)?c_.INTERIOR:c_.EXTERIOR:c_.BOUNDARY}if(arguments[0]instanceof s_&&arguments[1]instanceof WI){var c=arguments[0];return arguments[1].getCoordinate().equals2D(c)?c_.INTERIOR:c_.EXTERIOR}},wC.prototype.locateInPolygonRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?j_.locatePointInRing(t,e.getCoordinates()):c_.EXTERIOR},wC.prototype.intersects=function(t,e){return this.locate(t,e)!==c_.EXTERIOR},wC.prototype.updateLocationInfo=function(t){t===c_.INTERIOR&&(this._isIn=!0),t===c_.BOUNDARY&&this._numBoundaries++},wC.prototype.computeLocation=function(t,e){var r=this;if(e instanceof WI&&this.updateLocationInfo(this.locateInternal(t,e)),e instanceof XI)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof ZI)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof QI)for(var n=e,i=0;i<n.getNumGeometries();i++){var o=n.getGeometryN(i);r.updateLocationInfo(r.locateInternal(t,o))}else if(e instanceof eE)for(var s=e,a=0;a<s.getNumGeometries();a++){var u=s.getGeometryN(a);r.updateLocationInfo(r.locateInternal(t,u))}else if(e instanceof PI)for(var l=new Ux(e);l.hasNext();){var c=l.next();c!==e&&r.computeLocation(t,c)}},wC.prototype.locate=function(t,e){return e.isEmpty()?c_.EXTERIOR:e instanceof XI||e instanceof ZI?this.locateInternal(t,e):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,e),this._boundaryRule.isInBoundary(this._numBoundaries)?c_.BOUNDARY:this._numBoundaries>0||this._isIn?c_.INTERIOR:c_.EXTERIOR)},wC.prototype.interfaces_=function(){return[]},wC.prototype.getClass=function(){return wC};var bC=function t(){if(this._component=null,this._segIndex=null,this._pt=null,2===arguments.length)t.call(this,arguments[0],t.INSIDE_AREA,arguments[1]);else if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2];this._component=e,this._segIndex=r,this._pt=n}},BC={INSIDE_AREA:{configurable:!0}};bC.prototype.isInsideArea=function(){return this._segIndex===bC.INSIDE_AREA},bC.prototype.getCoordinate=function(){return this._pt},bC.prototype.getGeometryComponent=function(){return this._component},bC.prototype.getSegmentIndex=function(){return this._segIndex},bC.prototype.interfaces_=function(){return[]},bC.prototype.getClass=function(){return bC},BC.INSIDE_AREA.get=function(){return-1},Object.defineProperties(bC,BC);var SC=function(t){this._pts=t||null};SC.prototype.filter=function(t){t instanceof WI&&this._pts.add(t)},SC.prototype.interfaces_=function(){return[RI]},SC.prototype.getClass=function(){return SC},SC.getPoints=function(){if(1===arguments.length){var t=arguments[0];return t instanceof WI?tx.singletonList(t):SC.getPoints(t,new aI)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e instanceof WI?r.add(e):e instanceof PI&&e.apply(new SC(r)),r}};var MC=function(){this._locations=null;var t=arguments[0];this._locations=t};MC.prototype.filter=function(t){(t instanceof WI||t instanceof XI||t instanceof ZI)&&this._locations.add(new bC(t,0,t.getCoordinate()))},MC.prototype.interfaces_=function(){return[RI]},MC.prototype.getClass=function(){return MC},MC.getLocations=function(t){var e=new aI;return t.apply(new MC(e)),e};var LC=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new wC,this._minDistanceLocation=null,this._minDistance=t_.MAX_VALUE,2===arguments.length){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=r,this._geom[1]=n,this._terminateDistance=i}};LC.prototype.computeContainmentDistance=function(){var t=this;if(0===arguments.length){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(2===arguments.length){var r=arguments[0],n=arguments[1],i=1-r,o=xC.getPolygons(this._geom[r]);if(o.size()>0){var s=MC.getLocations(this._geom[i]);if(this.computeContainmentDistance(s,o,n),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[i]=n[0],this._minDistanceLocation[r]=n[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&f_(arguments[0],oI)&&f_(arguments[1],oI)){for(var a=arguments[0],u=arguments[1],l=arguments[2],c=0;c<a.size();c++)for(var h=a.get(c),f=0;f<u.size();f++)if(t.computeContainmentDistance(h,u.get(f),l),t._minDistance<=t._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof bC&&arguments[1]instanceof ZI){var p=arguments[0],g=arguments[1],A=arguments[2],d=p.getCoordinate();if(c_.EXTERIOR!==this._ptLocator.locate(d,g))return this._minDistance=0,A[0]=p,A[1]=new bC(g,d),null}},LC.prototype.computeMinDistanceLinesPoints=function(t,e,r){for(var n=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s);if(n.computeMinDistance(o,a,r),n._minDistance<=n._terminateDistance)return null}},LC.prototype.computeFacetDistance=function(){var t=new Array(2).fill(null),e=CC.getLines(this._geom[0]),r=CC.getLines(this._geom[1]),n=SC.getPoints(this._geom[0]),i=SC.getPoints(this._geom[1]);return this.computeMinDistanceLines(e,r,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(e,i,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(r,n,t),this.updateMinDistance(t,!0),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistancePoints(n,i,t),void this.updateMinDistance(t,!1))))},LC.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},LC.prototype.updateMinDistance=function(t,e){if(null===t[0])return null;e?(this._minDistanceLocation[0]=t[1],this._minDistanceLocation[1]=t[0]):(this._minDistanceLocation[0]=t[0],this._minDistanceLocation[1]=t[1])},LC.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},LC.prototype.computeMinDistance=function(){var t=this;if(0===arguments.length){if(null!==this._minDistanceLocation)return null;if(this._minDistanceLocation=new Array(2).fill(null),this.computeContainmentDistance(),this._minDistance<=this._terminateDistance)return null;this.computeFacetDistance()}else if(3===arguments.length)if(arguments[2]instanceof Array&&arguments[0]instanceof XI&&arguments[1]instanceof WI){var e=arguments[0],r=arguments[1],n=arguments[2];if(e.getEnvelopeInternal().distance(r.getEnvelopeInternal())>this._minDistance)return null;for(var i=e.getCoordinates(),o=r.getCoordinate(),s=0;s<i.length-1;s++){var a=j_.distancePointLine(o,i[s],i[s+1]);if(a<t._minDistance){t._minDistance=a;var u=new Ax(i[s],i[s+1]).closestPoint(o);n[0]=new bC(e,s,u),n[1]=new bC(r,0,o)}if(t._minDistance<=t._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof XI&&arguments[1]instanceof XI){var l=arguments[0],c=arguments[1],h=arguments[2];if(l.getEnvelopeInternal().distance(c.getEnvelopeInternal())>this._minDistance)return null;for(var f=l.getCoordinates(),p=c.getCoordinates(),g=0;g<f.length-1;g++)for(var A=0;A<p.length-1;A++){var d=j_.distanceLineLine(f[g],f[g+1],p[A],p[A+1]);if(d<t._minDistance){t._minDistance=d;var y=new Ax(f[g],f[g+1]),v=new Ax(p[A],p[A+1]),m=y.closestPoints(v);h[0]=new bC(l,g,m[0]),h[1]=new bC(c,A,m[1])}if(t._minDistance<=t._terminateDistance)return null}}},LC.prototype.computeMinDistancePoints=function(t,e,r){for(var n=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s),u=o.getCoordinate().distance(a.getCoordinate());if(u<n._minDistance&&(n._minDistance=u,r[0]=new bC(o,0,o.getCoordinate()),r[1]=new bC(a,0,a.getCoordinate())),n._minDistance<=n._terminateDistance)return null}},LC.prototype.distance=function(){if(null===this._geom[0]||null===this._geom[1])throw new $m("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},LC.prototype.computeMinDistanceLines=function(t,e,r){for(var n=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s);if(n.computeMinDistance(o,a,r),n._minDistance<=n._terminateDistance)return null}},LC.prototype.interfaces_=function(){return[]},LC.prototype.getClass=function(){return LC},LC.distance=function(t,e){return new LC(t,e).distance()},LC.isWithinDistance=function(t,e,r){return new LC(t,e,r).distance()<=r},LC.nearestPoints=function(t,e){return new LC(t,e).nearestPoints()};var NC=function(){this._pt=[new s_,new s_],this._distance=t_.NaN,this._isNull=!0};NC.prototype.getCoordinates=function(){return this._pt},NC.prototype.getCoordinate=function(t){return this._pt[t]},NC.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n<this._distance&&this.initialize(e,r,n)}},NC.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this._pt[0].setCoordinate(r),this._pt[1].setCoordinate(n),this._distance=i,this._isNull=!1}},NC.prototype.toString=function(){return D_.toLineString(this._pt[0],this._pt[1])},NC.prototype.getDistance=function(){return this._distance},NC.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n>this._distance&&this.initialize(e,r,n)}},NC.prototype.interfaces_=function(){return[]},NC.prototype.getClass=function(){return NC};var TC=function(){};TC.prototype.interfaces_=function(){return[]},TC.prototype.getClass=function(){return TC},TC.computeDistance=function(){if(arguments[2]instanceof NC&&arguments[0]instanceof XI&&arguments[1]instanceof s_)for(var t=arguments[0],e=arguments[1],r=arguments[2],n=new Ax,i=t.getCoordinates(),o=0;o<i.length-1;o++){n.setCoordinates(i[o],i[o+1]);var s=n.closestPoint(e);r.setMinimum(s,e)}else if(arguments[2]instanceof NC&&arguments[0]instanceof ZI&&arguments[1]instanceof s_){var a=arguments[0],u=arguments[1],l=arguments[2];TC.computeDistance(a.getExteriorRing(),u,l);for(var c=0;c<a.getNumInteriorRing();c++)TC.computeDistance(a.getInteriorRingN(c),u,l)}else if(arguments[2]instanceof NC&&arguments[0]instanceof Y_&&arguments[1]instanceof s_){var h=arguments[0],f=arguments[1],p=arguments[2];if(h instanceof XI)TC.computeDistance(h,f,p);else if(h instanceof ZI)TC.computeDistance(h,f,p);else if(h instanceof PI)for(var g=h,A=0;A<g.getNumGeometries();A++){var d=g.getGeometryN(A);TC.computeDistance(d,f,p)}else p.setMinimum(h.getCoordinate(),f)}else if(arguments[2]instanceof NC&&arguments[0]instanceof Ax&&arguments[1]instanceof s_){var y=arguments[1],v=arguments[2],m=arguments[0].closestPoint(y);v.setMinimum(m,y)}};var RC=function(){this._g0=null,this._g1=null,this._ptDist=new NC,this._densifyFrac=0;var t=arguments[0],e=arguments[1];this._g0=t,this._g1=e},DC={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};RC.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},RC.prototype.setDensifyFraction=function(t){if(t>1||t<=0)throw new $m("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},RC.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},RC.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},RC.prototype.computeOrientedDistance=function(t,e,r){var n=new PC(e);if(t.apply(n),r.setMaximum(n.getMaxPointDistance()),this._densifyFrac>0){var i=new QC(e,this._densifyFrac);t.apply(i),r.setMaximum(i.getMaxPointDistance())}},RC.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},RC.prototype.interfaces_=function(){return[]},RC.prototype.getClass=function(){return RC},RC.distance=function(){if(2===arguments.length)return new RC(arguments[0],arguments[1]).distance();if(3===arguments.length){var t=arguments[2],e=new RC(arguments[0],arguments[1]);return e.setDensifyFraction(t),e.distance()}},DC.MaxPointDistanceFilter.get=function(){return PC},DC.MaxDensifiedByFractionDistanceFilter.get=function(){return QC},Object.defineProperties(RC,DC);var PC=function(){this._maxPtDist=new NC,this._minPtDist=new NC,this._euclideanDist=new TC,this._geom=null;var t=arguments[0];this._geom=t};PC.prototype.filter=function(t){this._minPtDist.initialize(),TC.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},PC.prototype.getMaxPointDistance=function(){return this._maxPtDist},PC.prototype.interfaces_=function(){return[J_]},PC.prototype.getClass=function(){return PC};var QC=function(){this._maxPtDist=new NC,this._minPtDist=new NC,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};QC.prototype.filter=function(t,e){var r=this;if(0===e)return null;for(var n=t.getCoordinate(e-1),i=t.getCoordinate(e),o=(i.x-n.x)/this._numSubSegs,s=(i.y-n.y)/this._numSubSegs,a=0;a<this._numSubSegs;a++){var u=n.x+a*o,l=n.y+a*s,c=new s_(u,l);r._minPtDist.initialize(),TC.computeDistance(r._geom,c,r._minPtDist),r._maxPtDist.setMaximum(r._minPtDist)}},QC.prototype.isDone=function(){return!1},QC.prototype.isGeometryChanged=function(){return!1},QC.prototype.getMaxPointDistance=function(){return this._maxPtDist},QC.prototype.interfaces_=function(){return[DI]},QC.prototype.getClass=function(){return QC};var kC=function(t,e,r){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=r||null},OC={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};kC.prototype.checkMaximumDistance=function(t,e,r){var n=new RC(e,t);if(n.setDensifyFraction(.25),this._maxDistanceFound=n.orientedDistance(),this._maxDistanceFound>r){this._isValid=!1;var i=n.getCoordinates();this._errorLocation=i[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+D_.toLineString(i[0],i[1])+")"}},kC.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=kC.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(),kC.VERBOSE&&b_.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},kC.prototype.checkNegativeValid=function(){if(!(this._input instanceof ZI||this._input instanceof eE||this._input instanceof PI))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)},kC.prototype.getErrorIndicator=function(){return this._errorIndicator},kC.prototype.checkMinimumDistance=function(t,e,r){var n=new LC(t,e,r);if(this._minDistanceFound=n.distance(),this._minDistanceFound<r){this._isValid=!1;var i=n.nearestPoints();this._errorLocation=n.nearestPoints()[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+D_.toLineString(i[0],i[1])+" )"}},kC.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)},kC.prototype.getErrorLocation=function(){return this._errorLocation},kC.prototype.getPolygonLines=function(t){for(var e=new aI,r=new CC(e),n=xC.getPolygons(t).iterator();n.hasNext();){n.next().apply(r)}return t.getFactory().buildGeometry(e)},kC.prototype.getErrorMessage=function(){return this._errMsg},kC.prototype.interfaces_=function(){return[]},kC.prototype.getClass=function(){return kC},OC.VERBOSE.get=function(){return!1},OC.MAX_DISTANCE_DIFF_FRAC.get=function(){return.012},Object.defineProperties(kC,OC);var FC=function(t,e,r){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._distance=e||null,this._result=r||null},GC={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};FC.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},FC.prototype.checkEnvelope=function(){if(this._distance<0)return null;var t=this._distance*FC.MAX_ENV_DIFF_FRAC;0===t&&(t=.001);var e=new S_(this._input.getEnvelopeInternal());e.expandBy(this._distance);var r=new S_(this._result.getEnvelopeInternal());r.expandBy(t),r.contains(e)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(r)),this.report("Envelope")},FC.prototype.checkDistance=function(){var t=new kC(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")},FC.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")},FC.prototype.checkPolygonal=function(){this._result instanceof ZI||this._result instanceof eE||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},FC.prototype.getErrorIndicator=function(){return this._errorIndicator},FC.prototype.getErrorLocation=function(){return this._errorLocation},FC.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"))},FC.prototype.report=function(t){if(!FC.VERBOSE)return null;b_.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},FC.prototype.getErrorMessage=function(){return this._errorMsg},FC.prototype.interfaces_=function(){return[]},FC.prototype.getClass=function(){return FC},FC.isValidMsg=function(t,e,r){var n=new FC(t,e,r);return n.isValid()?null:n.getErrorMessage()},FC.isValid=function(t,e,r){return!!new FC(t,e,r).isValid()},GC.VERBOSE.get=function(){return!1},GC.MAX_ENV_DIFF_FRAC.get=function(){return.012},Object.defineProperties(FC,GC);var UC=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};UC.prototype.getCoordinates=function(){return this._pts},UC.prototype.size=function(){return this._pts.length},UC.prototype.getCoordinate=function(t){return this._pts[t]},UC.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},UC.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:hx.octant(this.getCoordinate(t),this.getCoordinate(t+1))},UC.prototype.setData=function(t){this._data=t},UC.prototype.getData=function(){return this._data},UC.prototype.toString=function(){return D_.toLineString(new aE(this._pts))},UC.prototype.interfaces_=function(){return[fx]},UC.prototype.getClass=function(){return UC};var qC=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new aI,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};qC.prototype.getInteriorIntersection=function(){return this._interiorIntersection},qC.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},qC.prototype.getIntersectionSegments=function(){return this._intSegments},qC.prototype.count=function(){return this._intersectionCount},qC.prototype.getIntersections=function(){return this._intersections},qC.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},qC.prototype.setKeepIntersections=function(t){this._keepIntersections=t},qC.prototype.processIntersections=function(t,e,r,n){if(!this._findAllIntersections&&this.hasIntersection())return null;if(t===r&&e===n)return null;if(this._isCheckEndSegmentsOnly&&!(this.isEndSegment(t,e)||this.isEndSegment(r,n)))return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=i,this._intSegments[1]=o,this._intSegments[2]=s,this._intSegments[3]=a,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},qC.prototype.isEndSegment=function(t,e){return 0===e||e>=t.size()-2},qC.prototype.hasIntersection=function(){return null!==this._interiorIntersection},qC.prototype.isDone=function(){return!this._findAllIntersections&&null!==this._interiorIntersection},qC.prototype.interfaces_=function(){return[Xx]},qC.prototype.getClass=function(){return qC},qC.createAllIntersectionsFinder=function(t){var e=new qC(t);return e.setFindAllIntersections(!0),e},qC.createAnyIntersectionFinder=function(t){return new qC(t)},qC.createIntersectionCounter=function(t){var e=new qC(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var jC=function(){this._li=new G_,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};jC.prototype.execute=function(){if(null!==this._segInt)return null;this.checkInteriorIntersections()},jC.prototype.getIntersections=function(){return this._segInt.getIntersections()},jC.prototype.isValid=function(){return this.execute(),this._isValid},jC.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},jC.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new qC(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new Ex;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},jC.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new ME(this.getErrorMessage(),this._segInt.getInteriorIntersection())},jC.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+D_.toLineString(t[0],t[1])+" and "+D_.toLineString(t[2],t[3])},jC.prototype.interfaces_=function(){return[]},jC.prototype.getClass=function(){return jC},jC.computeIntersections=function(t){var e=new jC(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var VC=function t(){this._nv=null;var e=arguments[0];this._nv=new jC(t.toSegmentStrings(e))};VC.prototype.checkValid=function(){this._nv.checkValid()},VC.prototype.interfaces_=function(){return[]},VC.prototype.getClass=function(){return VC},VC.toSegmentStrings=function(t){for(var e=new aI,r=t.iterator();r.hasNext();){var n=r.next();e.add(new UC(n.getCoordinates(),n))}return e},VC.checkValid=function(t){new VC(t).checkValid()};var zC=function(t){this._mapOp=t};zC.prototype.map=function(t){for(var e=new aI,r=0;r<t.getNumGeometries();r++){var n=this._mapOp.map(t.getGeometryN(r));n.isEmpty()||e.add(n)}return t.getFactory().createGeometryCollection(dE.toGeometryArray(e))},zC.prototype.interfaces_=function(){return[]},zC.prototype.getClass=function(){return zC},zC.map=function(t,e){return new zC(e).map(t)};var YC=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new aI,this._resultLineList=new aI;var t=arguments[0],e=arguments[1],r=arguments[2];this._op=t,this._geometryFactory=e,this._ptLocator=r};YC.prototype.collectLines=function(t){for(var e=this,r=this._op.getGraph().getEdgeEnds().iterator();r.hasNext();){var n=r.next();e.collectLineEdge(n,t,e._lineEdgesList),e.collectBoundaryTouchEdge(n,t,e._lineEdgesList)}},YC.prototype.labelIsolatedLine=function(t,e){var r=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(e));t.getLabel().setLocation(e,r)},YC.prototype.build=function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList},YC.prototype.collectLineEdge=function(t,e,r){var n=t.getLabel(),i=t.getEdge();t.isLineEdge()&&(t.isVisited()||!bw.isResultOfOp(n,e)||i.isCovered()||(r.add(i),t.setVisitedEdge(!0)))},YC.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 r=e.next(),n=r.getEdge();if(r.isLineEdge()&&!n.isCoveredSet()){var i=this._op.isCoveredByA(r.getCoordinate());n.setCovered(i)}}},YC.prototype.labelIsolatedLines=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next(),n=r.getLabel();r.isIsolated()&&(n.isNull(0)?this.labelIsolatedLine(r,0):this.labelIsolatedLine(r,1))}},YC.prototype.buildLines=function(t){for(var e=this._lineEdgesList.iterator();e.hasNext();){var r=e.next(),n=this._geometryFactory.createLineString(r.getCoordinates());this._resultLineList.add(n),r.setInResult(!0)}},YC.prototype.collectBoundaryTouchEdge=function(t,e,r){var n=t.getLabel();return t.isLineEdge()||t.isVisited()||t.isInteriorAreaEdge()||t.getEdge().isInResult()?null:(k_.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void(bw.isResultOfOp(n,e)&&e===bw.INTERSECTION&&(r.add(t.getEdge()),t.setVisitedEdge(!0))))},YC.prototype.interfaces_=function(){return[]},YC.prototype.getClass=function(){return YC};var HC=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new aI;var t=arguments[0],e=arguments[1];this._op=t,this._geometryFactory=e};HC.prototype.filterCoveredNodeToPoint=function(t){var e=t.getCoordinate();if(!this._op.isCoveredByLA(e)){var r=this._geometryFactory.createPoint(e);this._resultPointList.add(r)}},HC.prototype.extractNonCoveredResultNodes=function(t){for(var e=this._op.getGraph().getNodes().iterator();e.hasNext();){var r=e.next();if(!r.isInResult()&&(!r.isIncidentEdgeInResult()&&(0===r.getEdges().getDegree()||t===bw.INTERSECTION))){var n=r.getLabel();bw.isResultOfOp(n,t)&&this.filterCoveredNodeToPoint(r)}}},HC.prototype.build=function(t){return this.extractNonCoveredResultNodes(t),this._resultPointList},HC.prototype.interfaces_=function(){return[]},HC.prototype.getClass=function(){return HC};var XC=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};XC.prototype.transformPoint=function(t,e){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},XC.prototype.transformPolygon=function(t,e){var r=!0,n=this.transformLinearRing(t.getExteriorRing(),t);null!==n&&n instanceof tE&&!n.isEmpty()||(r=!1);for(var i=new aI,o=0;o<t.getNumInteriorRing();o++){var s=this.transformLinearRing(t.getInteriorRingN(o),t);null===s||s.isEmpty()||(s instanceof tE||(r=!1),i.add(s))}if(r)return this._factory.createPolygon(n,i.toArray([]));var a=new aI;return null!==n&&a.add(n),a.addAll(i),this._factory.buildGeometry(a)},XC.prototype.createCoordinateSequence=function(t){return this._factory.getCoordinateSequenceFactory().create(t)},XC.prototype.getInputGeometry=function(){return this._inputGeom},XC.prototype.transformMultiLineString=function(t,e){for(var r=new aI,n=0;n<t.getNumGeometries();n++){var i=this.transformLineString(t.getGeometryN(n),t);null!==i&&(i.isEmpty()||r.add(i))}return this._factory.buildGeometry(r)},XC.prototype.transformCoordinates=function(t,e){return this.copy(t)},XC.prototype.transformLineString=function(t,e){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},XC.prototype.transformMultiPoint=function(t,e){for(var r=new aI,n=0;n<t.getNumGeometries();n++){var i=this.transformPoint(t.getGeometryN(n),t);null!==i&&(i.isEmpty()||r.add(i))}return this._factory.buildGeometry(r)},XC.prototype.transformMultiPolygon=function(t,e){for(var r=new aI,n=0;n<t.getNumGeometries();n++){var i=this.transformPolygon(t.getGeometryN(n),t);null!==i&&(i.isEmpty()||r.add(i))}return this._factory.buildGeometry(r)},XC.prototype.copy=function(t){return t.copy()},XC.prototype.transformGeometryCollection=function(t,e){for(var r=new aI,n=0;n<t.getNumGeometries();n++){var i=this.transform(t.getGeometryN(n));null!==i&&(this._pruneEmptyGeometry&&i.isEmpty()||r.add(i))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(dE.toGeometryArray(r)):this._factory.buildGeometry(r)},XC.prototype.transform=function(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof WI)return this.transformPoint(t,null);if(t instanceof $I)return this.transformMultiPoint(t,null);if(t instanceof tE)return this.transformLinearRing(t,null);if(t instanceof XI)return this.transformLineString(t,null);if(t instanceof QI)return this.transformMultiLineString(t,null);if(t instanceof ZI)return this.transformPolygon(t,null);if(t instanceof eE)return this.transformMultiPolygon(t,null);if(t instanceof PI)return this.transformGeometryCollection(t,null);throw new $m("Unknown Geometry subtype: "+t.getClass().getName())},XC.prototype.transformLinearRing=function(t,e){var r=this.transformCoordinates(t.getCoordinateSequence(),t);if(null===r)return this._factory.createLinearRing(null);var n=r.size();return n>0&&n<4&&!this._preserveType?this._factory.createLineString(r):this._factory.createLinearRing(r)},XC.prototype.interfaces_=function(){return[]},XC.prototype.getClass=function(){return XC};var JC=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new Ax,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof XI&&"number"==typeof arguments[1]){var e=arguments[1];t.call(this,arguments[0].getCoordinates(),e)}else if(arguments[0]instanceof Array&&"number"==typeof arguments[1]){var r=arguments[0],n=arguments[1];this._srcPts=r,this._isClosed=t.isClosed(r),this._snapTolerance=n}};JC.prototype.snapVertices=function(t,e){for(var r=this._isClosed?t.size()-1:t.size(),n=0;n<r;n++){var i=t.get(n),o=this.findSnapForVertex(i,e);null!==o&&(t.set(n,new s_(o)),0===n&&this._isClosed&&t.set(t.size()-1,new s_(o)))}},JC.prototype.findSnapForVertex=function(t,e){for(var r=0;r<e.length;r++){if(t.equals2D(e[r]))return null;if(t.distance(e[r])<this._snapTolerance)return e[r]}return null},JC.prototype.snapTo=function(t){var e=new lI(this._srcPts);return this.snapVertices(e,t),this.snapSegments(e,t),e.toCoordinateArray()},JC.prototype.snapSegments=function(t,e){if(0===e.length)return null;var r=e.length;e[0].equals2D(e[e.length-1])&&(r=e.length-1);for(var n=0;n<r;n++){var i=e[n],o=this.findSegmentIndexToSnap(i,t);o>=0&&t.add(o+1,new s_(i),!1)}},JC.prototype.findSegmentIndexToSnap=function(t,e){for(var r=this,n=t_.MAX_VALUE,i=-1,o=0;o<e.size()-1;o++){if(r._seg.p0=e.get(o),r._seg.p1=e.get(o+1),r._seg.p0.equals2D(t)||r._seg.p1.equals2D(t)){if(r._allowSnappingToSourceVertices)continue;return-1}var s=r._seg.distance(t);s<r._snapTolerance&&s<n&&(n=s,i=o)}return i},JC.prototype.setAllowSnappingToSourceVertices=function(t){this._allowSnappingToSourceVertices=t},JC.prototype.interfaces_=function(){return[]},JC.prototype.getClass=function(){return JC},JC.isClosed=function(t){return!(t.length<=1)&&t[0].equals2D(t[t.length-1])};var WC=function(t){this._srcGeom=t||null},KC={SNAP_PRECISION_FACTOR:{configurable:!0}};WC.prototype.snapTo=function(t,e){var r=this.extractTargetCoordinates(t);return new ZC(e,r).transform(this._srcGeom)},WC.prototype.snapToSelf=function(t,e){var r=this.extractTargetCoordinates(this._srcGeom),n=new ZC(t,r,!0).transform(this._srcGeom),i=n;return e&&f_(i,KI)&&(i=n.buffer(0)),i},WC.prototype.computeSnapTolerance=function(t){return this.computeMinimumSegmentLength(t)/10},WC.prototype.extractTargetCoordinates=function(t){for(var e=new SI,r=t.getCoordinates(),n=0;n<r.length;n++)e.add(r[n]);return e.toArray(new Array(0).fill(null))},WC.prototype.computeMinimumSegmentLength=function(t){for(var e=t_.MAX_VALUE,r=0;r<t.length-1;r++){var n=t[r].distance(t[r+1]);n<e&&(e=n)}return e},WC.prototype.interfaces_=function(){return[]},WC.prototype.getClass=function(){return WC},WC.snap=function(t,e,r){var n=new Array(2).fill(null),i=new WC(t);n[0]=i.snapTo(e,r);var o=new WC(e);return n[1]=o.snapTo(n[0],r),n},WC.computeOverlaySnapTolerance=function(){if(1===arguments.length){var t=arguments[0],e=WC.computeSizeBasedSnapTolerance(t),r=t.getPrecisionModel();if(r.getType()===fE.FIXED){var n=1/r.getScale()*2/1.415;n>e&&(e=n)}return e}if(2===arguments.length){var i=arguments[0],o=arguments[1];return Math.min(WC.computeOverlaySnapTolerance(i),WC.computeOverlaySnapTolerance(o))}},WC.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*WC.SNAP_PRECISION_FACTOR},WC.snapToSelf=function(t,e,r){return new WC(t).snapToSelf(e,r)},KC.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(WC,KC);var ZC=function(t){function e(e,r,n){t.call(this),this._snapTolerance=e||null,this._snapPts=r||null,this._isSelfSnap=void 0!==n&&n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(t,e){var r=new JC(t,this._snapTolerance);return r.setAllowSnappingToSourceVertices(this._isSelfSnap),r.snapTo(e)},e.prototype.transformCoordinates=function(t,e){var r=t.toCoordinateArray(),n=this.snapLine(r,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(XC),$C=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};$C.prototype.getCommon=function(){return t_.longBitsToDouble(this._commonBits)},$C.prototype.add=function(t){var e=t_.doubleToLongBits(t);return this._isFirst?(this._commonBits=e,this._commonSignExp=$C.signExpBits(this._commonBits),this._isFirst=!1,null):$C.signExpBits(e)!==this._commonSignExp?(this._commonBits=0,null):(this._commonMantissaBitsCount=$C.numCommonMostSigMantissaBits(this._commonBits,e),void(this._commonBits=$C.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))))},$C.prototype.toString=function(){if(1===arguments.length){var t=arguments[0],e=t_.longBitsToDouble(t),r="0000000000000000000000000000000000000000000000000000000000000000"+t_.toBinaryString(t),n=r.substring(r.length-64);return n.substring(0,1)+" "+n.substring(1,12)+"(exp) "+n.substring(12)+" [ "+e+" ]"}},$C.prototype.interfaces_=function(){return[]},$C.prototype.getClass=function(){return $C},$C.getBit=function(t,e){return 0!=(t&1<<e)?1:0},$C.signExpBits=function(t){return t>>52},$C.zeroLowerBits=function(t,e){return t&~((1<<e)-1)},$C.numCommonMostSigMantissaBits=function(t,e){for(var r=0,n=52;n>=0;n--){if($C.getBit(t,n)!==$C.getBit(e,n))return r;r++}return 52};var tw=function(){this._commonCoord=null,this._ccFilter=new rw},ew={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};tw.prototype.addCommonBits=function(t){var e=new nw(this._commonCoord);t.apply(e),t.geometryChanged()},tw.prototype.removeCommonBits=function(t){if(0===this._commonCoord.x&&0===this._commonCoord.y)return t;var e=new s_(this._commonCoord);e.x=-e.x,e.y=-e.y;var r=new nw(e);return t.apply(r),t.geometryChanged(),t},tw.prototype.getCommonCoordinate=function(){return this._commonCoord},tw.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},tw.prototype.interfaces_=function(){return[]},tw.prototype.getClass=function(){return tw},ew.CommonCoordinateFilter.get=function(){return rw},ew.Translater.get=function(){return nw},Object.defineProperties(tw,ew);var rw=function(){this._commonBitsX=new $C,this._commonBitsY=new $C};rw.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},rw.prototype.getCommonCoordinate=function(){return new s_(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},rw.prototype.interfaces_=function(){return[J_]},rw.prototype.getClass=function(){return rw};var nw=function(){this.trans=null;var t=arguments[0];this.trans=t};nw.prototype.filter=function(t,e){var r=t.getOrdinate(e,0)+this.trans.x,n=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,r),t.setOrdinate(e,1,n)},nw.prototype.isDone=function(){return!1},nw.prototype.isGeometryChanged=function(){return!0},nw.prototype.interfaces_=function(){return[DI]},nw.prototype.getClass=function(){return nw};var iw=function(t,e){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()};iw.prototype.selfSnap=function(t){return new WC(t).snapTo(t,this._snapTolerance)},iw.prototype.removeCommonBits=function(t){this._cbr=new tw,this._cbr.add(t[0]),this._cbr.add(t[1]);var e=new Array(2).fill(null);return e[0]=this._cbr.removeCommonBits(t[0].copy()),e[1]=this._cbr.removeCommonBits(t[1].copy()),e},iw.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},iw.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),r=bw.overlayOp(e[0],e[1],t);return this.prepareResult(r)},iw.prototype.checkValid=function(t){t.isValid()||b_.out.println("Snapped geometry is invalid")},iw.prototype.computeSnapTolerance=function(){this._snapTolerance=WC.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},iw.prototype.snap=function(t){var e=this.removeCommonBits(t);return WC.snap(e[0],e[1],this._snapTolerance)},iw.prototype.interfaces_=function(){return[]},iw.prototype.getClass=function(){return iw},iw.overlayOp=function(t,e,r){return new iw(t,e).getResultGeometry(r)},iw.union=function(t,e){return iw.overlayOp(t,e,bw.UNION)},iw.intersection=function(t,e){return iw.overlayOp(t,e,bw.INTERSECTION)},iw.symDifference=function(t,e){return iw.overlayOp(t,e,bw.SYMDIFFERENCE)},iw.difference=function(t,e){return iw.overlayOp(t,e,bw.DIFFERENCE)};var ow=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};ow.prototype.getResultGeometry=function(t){var e=null,r=!1,n=null;try{e=bw.overlayOp(this._geom[0],this._geom[1],t);r=!0}catch(t){if(!(t instanceof P_))throw t;n=t}if(!r)try{e=iw.overlayOp(this._geom[0],this._geom[1],t)}catch(t){throw t instanceof P_?n:t}return e},ow.prototype.interfaces_=function(){return[]},ow.prototype.getClass=function(){return ow},ow.overlayOp=function(t,e,r){return new ow(t,e).getResultGeometry(r)},ow.union=function(t,e){return ow.overlayOp(t,e,bw.UNION)},ow.intersection=function(t,e){return ow.overlayOp(t,e,bw.INTERSECTION)},ow.symDifference=function(t,e){return ow.overlayOp(t,e,bw.SYMDIFFERENCE)},ow.difference=function(t,e){return ow.overlayOp(t,e,bw.DIFFERENCE)};var sw=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};sw.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},sw.prototype.interfaces_=function(){return[]},sw.prototype.getClass=function(){return sw};var aw=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,2===arguments.length){var e=arguments[0],r=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=r}else if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];this._eventType=t.INSERT,this._label=n,this._xValue=i,this._obj=o}},uw={INSERT:{configurable:!0},DELETE:{configurable:!0}};aw.prototype.isDelete=function(){return this._eventType===aw.DELETE},aw.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},aw.prototype.getObject=function(){return this._obj},aw.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},aw.prototype.getInsertEvent=function(){return this._insertEvent},aw.prototype.isInsert=function(){return this._eventType===aw.INSERT},aw.prototype.isSameLabel=function(t){return null!==this._label&&this._label===t._label},aw.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},aw.prototype.interfaces_=function(){return[r_]},aw.prototype.getClass=function(){return aw},uw.INSERT.get=function(){return 1},uw.DELETE.get=function(){return 2},Object.defineProperties(aw,uw);var lw=function(){};lw.prototype.interfaces_=function(){return[]},lw.prototype.getClass=function(){return lw};var cw=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],e=arguments[1],r=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=r};cw.prototype.isTrivialIntersection=function(t,e,r,n){if(t===r&&1===this._li.getIntersectionNum()){if(cw.isAdjacentSegments(e,n))return!0;if(t.isClosed()){var i=t.getNumPoints()-1;if(0===e&&n===i||0===n&&e===i)return!0}}return!1},cw.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},cw.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},cw.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},cw.prototype.isBoundaryPointInternal=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next().getCoordinate();if(t.isIntersection(n))return!0}return!1},cw.prototype.hasProperIntersection=function(){return this._hasProper},cw.prototype.hasIntersection=function(){return this._hasIntersection},cw.prototype.isDone=function(){return this._isDone},cw.prototype.isBoundaryPoint=function(t,e){return null!==e&&(!!this.isBoundaryPointInternal(t,e[0])||!!this.isBoundaryPointInternal(t,e[1]))},cw.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e},cw.prototype.addIntersections=function(t,e,r,n){if(t===r&&e===n)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),r.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,r,n)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(t.addIntersections(this._li,e,0),r.addIntersections(this._li,n,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))))},cw.prototype.interfaces_=function(){return[]},cw.prototype.getClass=function(){return cw},cw.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var hw=function(t){function e(){t.call(this),this.events=new aI,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){tx.sort(this.events);for(var t=0;t<this.events.size();t++){var e=this.events.get(t);e.isDelete()&&e.getInsertEvent().setDeleteEventIndex(t)}},e.prototype.computeIntersections=function(){if(1===arguments.length){var t=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var e=0;e<this.events.size();e++){var r=this.events.get(e);if(r.isInsert()&&this.processOverlaps(e,r.getDeleteEventIndex(),r,t),t.isDone())break}}else if(3===arguments.length)if(arguments[2]instanceof cw&&f_(arguments[0],oI)&&f_(arguments[1],oI)){var n=arguments[0],i=arguments[1],o=arguments[2];this.addEdges(n,n),this.addEdges(i,i),this.computeIntersections(o)}else if("boolean"==typeof arguments[2]&&f_(arguments[0],oI)&&arguments[1]instanceof cw){var s=arguments[0],a=arguments[1];arguments[2]?this.addEdges(s,null):this.addEdges(s),this.computeIntersections(a)}},e.prototype.addEdge=function(t,e){for(var r=t.getMonotoneChainEdge(),n=r.getStartIndexes(),i=0;i<n.length-1;i++){var o=new sw(r,i),s=new aw(e,r.getMinX(i),o);this.events.add(s),this.events.add(new aw(r.getMaxX(i),s))}},e.prototype.processOverlaps=function(t,e,r,n){for(var i=r.getObject(),o=t;o<e;o++){var s=this.events.get(o);if(s.isInsert()){var a=s.getObject();r.isSameLabel(s)||(i.computeIntersections(a,n),this.nOverlaps++)}}},e.prototype.addEdges=function(){if(1===arguments.length)for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.addEdge(e,e)}else if(2===arguments.length)for(var r=arguments[1],n=arguments[0].iterator();n.hasNext();){var i=n.next();this.addEdge(i,r)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(lw),fw=function(){this._min=t_.POSITIVE_INFINITY,this._max=t_.NEGATIVE_INFINITY},pw={NodeComparator:{configurable:!0}};fw.prototype.getMin=function(){return this._min},fw.prototype.intersects=function(t,e){return!(this._min>e||this._max<t)},fw.prototype.getMax=function(){return this._max},fw.prototype.toString=function(){return D_.toLineString(new s_(this._min,0),new s_(this._max,0))},fw.prototype.interfaces_=function(){return[]},fw.prototype.getClass=function(){return fw},pw.NodeComparator.get=function(){return gw},Object.defineProperties(fw,pw);var gw=function(){};gw.prototype.compare=function(t,e){var r=t,n=e,i=(r._min+r._max)/2,o=(n._min+n._max)/2;return i<o?-1:i>o?1:0},gw.prototype.interfaces_=function(){return[i_]},gw.prototype.getClass=function(){return gw};var Aw=function(t){function e(){t.call(this),this._item=null;var e=arguments[0],r=arguments[1],n=arguments[2];this._min=e,this._max=r,this._item=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(t,e,r){if(!this.intersects(t,e))return null;r.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(fw),dw=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var e=arguments[0],r=arguments[1];this._node1=e,this._node2=r,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,r){if(!this.intersects(t,e))return null;null!==this._node1&&this._node1.query(t,e,r),null!==this._node2&&this._node2.query(t,e,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(fw),yw=function(){this._leaves=new aI,this._root=null,this._level=0};yw.prototype.buildTree=function(){tx.sort(this._leaves,new fw.NodeComparator);for(var t=this._leaves,e=null,r=new aI;;){if(this.buildLevel(t,r),1===r.size())return r.get(0);e=t,t=r,r=e}},yw.prototype.insert=function(t,e,r){if(null!==this._root)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new Aw(t,e,r))},yw.prototype.query=function(t,e,r){this.init(),this._root.query(t,e,r)},yw.prototype.buildRoot=function(){if(null!==this._root)return null;this._root=this.buildTree()},yw.prototype.printNode=function(t){b_.out.println(D_.toLineString(new s_(t._min,this._level),new s_(t._max,this._level)))},yw.prototype.init=function(){if(null!==this._root)return null;this.buildRoot()},yw.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var r=0;r<t.size();r+=2){var n=t.get(r);if(null===(r+1<t.size()?t.get(r):null))e.add(n);else{var i=new dw(t.get(r),t.get(r+1));e.add(i)}}},yw.prototype.interfaces_=function(){return[]},yw.prototype.getClass=function(){return yw};var vw=function(){this._items=new aI};vw.prototype.visitItem=function(t){this._items.add(t)},vw.prototype.getItems=function(){return this._items},vw.prototype.interfaces_=function(){return[WE]},vw.prototype.getClass=function(){return vw};var mw=function(){this._index=null;var t=arguments[0];if(!f_(t,KI))throw new $m("Argument must be Polygonal");this._index=new Ew(t)},_w={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};mw.prototype.locate=function(t){var e=new q_(t),r=new Iw(e);return this._index.query(t.y,t.y,r),e.getLocation()},mw.prototype.interfaces_=function(){return[Gx]},mw.prototype.getClass=function(){return mw},_w.SegmentVisitor.get=function(){return Iw},_w.IntervalIndexedGeometry.get=function(){return Ew},Object.defineProperties(mw,_w);var Iw=function(){this._counter=null;var t=arguments[0];this._counter=t};Iw.prototype.visitItem=function(t){var e=t;this._counter.countSegment(e.getCoordinate(0),e.getCoordinate(1))},Iw.prototype.interfaces_=function(){return[WE]},Iw.prototype.getClass=function(){return Iw};var Ew=function(){this._index=new yw;var t=arguments[0];this.init(t)};Ew.prototype.init=function(t){for(var e=CC.getLines(t).iterator();e.hasNext();){var r=e.next().getCoordinates();this.addLine(r)}},Ew.prototype.addLine=function(t){for(var e=1;e<t.length;e++){var r=new Ax(t[e-1],t[e]),n=Math.min(r.p0.y,r.p1.y),i=Math.max(r.p0.y,r.p1.y);this._index.insert(n,i,r)}},Ew.prototype.query=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],r=new vw;return this._index.query(t,e,r),r.getItems()}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];this._index.query(n,i,o)}},Ew.prototype.interfaces_=function(){return[]},Ew.prototype.getClass=function(){return Ew};var xw=function(t){function e(){if(t.call(this),this._parentGeom=null,this._lineEdgeMap=new hE,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new wC,2===arguments.length){var e=arguments[0],r=arguments[1],n=W_.OGC_SFS_BOUNDARY_RULE;this._argIndex=e,this._parentGeom=r,this._boundaryNodeRule=n,null!==r&&this.add(r)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];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,r){var n=this._nodes.addNode(r).getLabel(),i=1;n.getLocation(t,CE.ON)===c_.BOUNDARY&&i++;var o=e.determineBoundary(this._boundaryNodeRule,i);n.setLocation(t,o)},e.prototype.computeSelfNodes=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.computeSelfNodes(t,e,!1)}if(3===arguments.length){var r=arguments[1],n=arguments[2],i=new cw(arguments[0],!0,!1);i.setIsDoneIfProperInt(n);var o=this.createEdgeSetIntersector(),s=this._parentGeom instanceof tE||this._parentGeom instanceof ZI||this._parentGeom instanceof eE,a=r||!s;return o.computeIntersections(this._edges,i,a),this.addSelfIntersectionNodes(this._argIndex),i}},e.prototype.computeSplitEdges=function(t){for(var e=this._edges.iterator();e.hasNext();){e.next().eiList.addSplitEdges(t)}},e.prototype.computeEdgeIntersections=function(t,e,r){var n=new cw(e,r,!0);return n.setBoundaryNodes(this.getBoundaryNodes(),t.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,t._edges,n),n},e.prototype.getGeometry=function(){return this._parentGeom},e.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},e.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},e.prototype.addPoint=function(){if(arguments[0]instanceof WI){var t=arguments[0].getCoordinate();this.insertPoint(this._argIndex,t,c_.INTERIOR)}else if(arguments[0]instanceof s_){var e=arguments[0];this.insertPoint(this._argIndex,e,c_.INTERIOR)}},e.prototype.addPolygon=function(t){this.addPolygonRing(t.getExteriorRing(),c_.EXTERIOR,c_.INTERIOR);for(var e=0;e<t.getNumInteriorRing();e++){var r=t.getInteriorRingN(e);this.addPolygonRing(r,c_.INTERIOR,c_.EXTERIOR)}},e.prototype.addEdge=function(t){this.insertEdge(t);var e=t.getCoordinates();this.insertPoint(this._argIndex,e[0],c_.BOUNDARY),this.insertPoint(this._argIndex,e[e.length-1],c_.BOUNDARY)},e.prototype.addLineString=function(t){var e=cI.removeRepeatedPoints(t.getCoordinates());if(e.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=e[0],null;var r=new rC(e,new RE(this._argIndex,c_.INTERIOR));this._lineEdgeMap.put(t,r),this.insertEdge(r),k_.isTrue(e.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,e[0]),this.insertBoundaryPoint(this._argIndex,e[e.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var t=this.getBoundaryNodes(),e=new Array(t.size()).fill(null),r=0,n=t.iterator();n.hasNext();){var i=n.next();e[r++]=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,r){if(this.isBoundaryNode(t,e))return null;r===c_.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(t,e):this.insertPoint(t,e,r)},e.prototype.addPolygonRing=function(t,e,r){if(t.isEmpty())return null;var n=cI.removeRepeatedPoints(t.getCoordinates());if(n.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=n[0],null;var i=e,o=r;j_.isCCW(n)&&(i=r,o=e);var s=new rC(n,new RE(this._argIndex,c_.BOUNDARY,i,o));this._lineEdgeMap.put(t,s),this.insertEdge(s),this.insertPoint(this._argIndex,n[0],c_.BOUNDARY)},e.prototype.insertPoint=function(t,e,r){var n=this._nodes.addNode(e),i=n.getLabel();null===i?n._label=new RE(t,r):i.setLocation(t,r)},e.prototype.createEdgeSetIntersector=function(){return new hw},e.prototype.addSelfIntersectionNodes=function(t){for(var e=this._edges.iterator();e.hasNext();)for(var r=e.next(),n=r.getLabel().getLocation(t),i=r.eiList.iterator();i.hasNext();){var o=i.next();this.addSelfIntersectionNode(t,o.coord,n)}},e.prototype.add=function(){if(1!==arguments.length)return t.prototype.add.apply(this,arguments);var e=arguments[0];if(e.isEmpty())return null;if(e instanceof eE&&(this._useBoundaryDeterminationRule=!1),e instanceof ZI)this.addPolygon(e);else if(e instanceof XI)this.addLineString(e);else if(e instanceof WI)this.addPoint(e);else if(e instanceof $I)this.addCollection(e);else if(e instanceof QI)this.addCollection(e);else if(e instanceof eE)this.addCollection(e);else{if(!(e instanceof PI))throw new Error(e.getClass().getName());this.addCollection(e)}},e.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var r=t.getGeometryN(e);this.add(r)}},e.prototype.locate=function(t){return f_(this._parentGeom,KI)&&this._parentGeom.getNumGeometries()>50?(null===this._areaPtLocator&&(this._areaPtLocator=new mw(this._parentGeom)),this._areaPtLocator.locate(t)):this._ptLocator.locate(t,this._parentGeom)},e.prototype.findEdge=function(){if(1===arguments.length){var e=arguments[0];return this._lineEdgeMap.get(e)}return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(t,e){return t.isInBoundary(e)?c_.BOUNDARY:c_.INTERIOR},e}(zE),Cw=function(){if(this._li=new G_,this._resultPrecisionModel=null,this._arg=null,1===arguments.length){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new xw(0,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1],n=W_.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(r.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(r.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new xw(0,e,n),this._arg[1]=new xw(1,r,n)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];i.getPrecisionModel().compareTo(o.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(o.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new xw(0,i,s),this._arg[1]=new xw(1,o,s)}};Cw.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},Cw.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},Cw.prototype.interfaces_=function(){return[]},Cw.prototype.getClass=function(){return Cw};var ww=function(){};ww.prototype.interfaces_=function(){return[]},ww.prototype.getClass=function(){return ww},ww.map=function(){if(arguments[0]instanceof Y_&&f_(arguments[1],ww.MapOp)){for(var t=arguments[0],e=arguments[1],r=new aI,n=0;n<t.getNumGeometries();n++){var i=e.map(t.getGeometryN(n));null!==i&&r.add(i)}return t.getFactory().buildGeometry(r)}if(f_(arguments[0],rI)&&f_(arguments[1],ww.MapOp)){for(var o=arguments[0],s=arguments[1],a=new aI,u=o.iterator();u.hasNext();){var l=u.next(),c=s.map(l);null!==c&&a.add(c)}return a}},ww.MapOp=function(){};var bw=function(t){function e(){var e=arguments[0],r=arguments[1];t.call(this,e,r),this._ptLocator=new wC,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new Hx,this._resultPolyList=new aI,this._resultLineList=new aI,this._resultPointList=new aI,this._graph=new zE(new zx),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 r=e.getLabel(),n=t.getLabel();e.isPointwiseEqual(t)||(n=new RE(t.getLabel())).flip();var i=e.getDepth();i.isNull()&&i.add(r),i.add(n),r.merge(n)}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(),r=e.getSym();e.isInResult()&&r.isInResult()&&(e.setInResult(!1),r.setInResult(!1))}},e.prototype.isCoveredByLA=function(t){return!!this.isCovered(t,this._resultLineList)||!!this.isCovered(t,this._resultPolyList)},e.prototype.computeGeometry=function(t,r,n,i){var o=new aI;return o.addAll(t),o.addAll(r),o.addAll(n),o.isEmpty()?e.createEmptyResult(i,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(o)},e.prototype.mergeSymLabels=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){t.next().getEdges().mergeSymLabels()}},e.prototype.isCovered=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();if(this._ptLocator.locate(t,n)!==c_.EXTERIOR)return!0}return!1},e.prototype.replaceCollapsedEdges=function(){for(var t=new aI,e=this._edgeList.iterator();e.hasNext();){var r=e.next();r.isCollapsed()&&(e.remove(),t.add(r.getCollapsedEdge()))}this._edgeList.addAll(t)},e.prototype.updateNodeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),r=e.getEdges().getLabel();e.getLabel().merge(r)}},e.prototype.getResultGeometry=function(t){return this.computeOverlay(t),this._resultGeom},e.prototype.insertUniqueEdges=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next();this.insertUniqueEdge(r)}},e.prototype.computeOverlay=function(t){this.copyPoints(0),this.copyPoints(1),this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1),this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!0);var e=new aI;this._arg[0].computeSplitEdges(e),this._arg[1].computeSplitEdges(e),this.insertUniqueEdges(e),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),VC.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(t),this.cancelDuplicateResultEdges();var r=new YE(this._geomFact);r.add(this._graph),this._resultPolyList=r.getPolygons();var n=new YC(this,this._geomFact,this._ptLocator);this._resultLineList=n.build(t);var i=new HC(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 r=this._ptLocator.locate(t.getCoordinate(),this._arg[e].getGeometry());t.getLabel().setLocation(e,r)},e.prototype.copyPoints=function(t){for(var e=this._arg[t].getNodeIterator();e.hasNext();){var r=e.next();this._graph.addNode(r.getCoordinate()).setLabel(t,r.getLabel().getLocation(t))}},e.prototype.findResultAreaEdges=function(t){for(var r=this._graph.getEdgeEnds().iterator();r.hasNext();){var n=r.next(),i=n.getLabel();i.isArea()&&!n.isInteriorAreaEdge()&&e.isResultOfOp(i.getLocation(0,CE.RIGHT),i.getLocation(1,CE.RIGHT),t)&&n.setInResult(!0)}},e.prototype.computeLabelsFromDepths=function(){for(var t=this._edgeList.iterator();t.hasNext();){var e=t.next(),r=e.getLabel(),n=e.getDepth();if(!n.isNull()){n.normalize();for(var i=0;i<2;i++)r.isNull(i)||!r.isArea()||n.isNull(i)||(0===n.getDelta(i)?r.toLine(i):(k_.isTrue(!n.isNull(i,CE.LEFT),"depth of LEFT side has not been initialized"),r.setLocation(i,CE.LEFT,n.getLocation(i,CE.LEFT)),k_.isTrue(!n.isNull(i,CE.RIGHT),"depth of RIGHT side has not been initialized"),r.setLocation(i,CE.RIGHT,n.getLocation(i,CE.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(),r=e.getLabel();e.isIsolated()&&(r.isNull(0)?this.labelIncompleteNode(e,0):this.labelIncompleteNode(e,1)),e.getEdges().updateLabelling(r)}},e.prototype.isCoveredByA=function(t){return!!this.isCovered(t,this._resultPolyList)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Cw);bw.overlayOp=function(t,e,r){return new bw(t,e).getResultGeometry(r)},bw.intersection=function(t,e){if(t.isEmpty()||e.isEmpty())return bw.createEmptyResult(bw.INTERSECTION,t,e,t.getFactory());if(t.isGeometryCollection()){var r=e;return zC.map(t,{interfaces_:function(){return[ww.MapOp]},map:function(t){return t.intersection(r)}})}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),ow.overlayOp(t,e,bw.INTERSECTION)},bw.symDifference=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return bw.createEmptyResult(bw.SYMDIFFERENCE,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),ow.overlayOp(t,e,bw.SYMDIFFERENCE)},bw.resultDimension=function(t,e,r){var n=e.getDimension(),i=r.getDimension(),o=-1;switch(t){case bw.INTERSECTION:o=Math.min(n,i);break;case bw.UNION:o=Math.max(n,i);break;case bw.DIFFERENCE:o=n;break;case bw.SYMDIFFERENCE:o=Math.max(n,i)}return o},bw.createEmptyResult=function(t,e,r,n){var i=null;switch(bw.resultDimension(t,e,r)){case-1:i=n.createGeometryCollection(new Array(0).fill(null));break;case 0:i=n.createPoint();break;case 1:i=n.createLineString();break;case 2:i=n.createPolygon()}return i},bw.difference=function(t,e){return t.isEmpty()?bw.createEmptyResult(bw.DIFFERENCE,t,e,t.getFactory()):e.isEmpty()?t.copy():(t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),ow.overlayOp(t,e,bw.DIFFERENCE))},bw.isResultOfOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],r=t.getLocation(0),n=t.getLocation(1);return bw.isResultOfOp(r,n,e)}if(3===arguments.length){var i=arguments[0],o=arguments[1];switch(i===c_.BOUNDARY&&(i=c_.INTERIOR),o===c_.BOUNDARY&&(o=c_.INTERIOR),arguments[2]){case bw.INTERSECTION:return i===c_.INTERIOR&&o===c_.INTERIOR;case bw.UNION:return i===c_.INTERIOR||o===c_.INTERIOR;case bw.DIFFERENCE:return i===c_.INTERIOR&&o!==c_.INTERIOR;case bw.SYMDIFFERENCE:return i===c_.INTERIOR&&o!==c_.INTERIOR||i!==c_.INTERIOR&&o===c_.INTERIOR}return!1}},bw.INTERSECTION=1,bw.UNION=2,bw.DIFFERENCE=3,bw.SYMDIFFERENCE=4;var Bw=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new wC,this._seg=new Ax;var t=arguments[0],e=arguments[1];this._g=t,this._boundaryDistanceTolerance=e,this._linework=this.extractLinework(t)};Bw.prototype.isWithinToleranceOfBoundary=function(t){for(var e=this,r=0;r<this._linework.getNumGeometries();r++)for(var n=e._linework.getGeometryN(r).getCoordinateSequence(),i=0;i<n.size()-1;i++){if(n.getCoordinate(i,e._seg.p0),n.getCoordinate(i+1,e._seg.p1),e._seg.distance(t)<=e._boundaryDistanceTolerance)return!0}return!1},Bw.prototype.getLocation=function(t){return this.isWithinToleranceOfBoundary(t)?c_.BOUNDARY:this._ptLocator.locate(t,this._g)},Bw.prototype.extractLinework=function(t){var e=new Sw;t.apply(e);var r=e.getLinework(),n=dE.toLineStringArray(r);return t.getFactory().createMultiLineString(n)},Bw.prototype.interfaces_=function(){return[]},Bw.prototype.getClass=function(){return Bw};var Sw=function(){this._linework=null,this._linework=new aI};Sw.prototype.getLinework=function(){return this._linework},Sw.prototype.filter=function(t){if(t instanceof ZI){var e=t;this._linework.add(e.getExteriorRing());for(var r=0;r<e.getNumInteriorRing();r++)this._linework.add(e.getInteriorRingN(r))}},Sw.prototype.interfaces_=function(){return[RI]},Sw.prototype.getClass=function(){return Sw};var Mw=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var t=arguments[0];this._g=t};Mw.prototype.extractPoints=function(t,e,r){for(var n=t.getCoordinates(),i=0;i<n.length-1;i++)this.computeOffsetPoints(n[i],n[i+1],e,r)},Mw.prototype.setSidesToGenerate=function(t,e){this._doLeft=t,this._doRight=e},Mw.prototype.getPoints=function(t){for(var e=new aI,r=CC.getLines(this._g).iterator();r.hasNext();){var n=r.next();this.extractPoints(n,t,e)}return e},Mw.prototype.computeOffsetPoints=function(t,e,r,n){var i=e.x-t.x,o=e.y-t.y,s=Math.sqrt(i*i+o*o),a=r*i/s,u=r*o/s,l=(e.x+t.x)/2,c=(e.y+t.y)/2;if(this._doLeft){var h=new s_(l-u,c+a);n.add(h)}if(this._doRight){var f=new s_(l+u,c-a);n.add(f)}},Mw.prototype.interfaces_=function(){return[]},Mw.prototype.getClass=function(){return Mw};var Lw=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 aI;var e=arguments[0],r=arguments[1],n=arguments[2];this._boundaryDistanceTolerance=t.computeBoundaryDistanceTolerance(e,r),this._geom=[e,r,n],this._locFinder=[new Bw(this._geom[0],this._boundaryDistanceTolerance),new Bw(this._geom[1],this._boundaryDistanceTolerance),new Bw(this._geom[2],this._boundaryDistanceTolerance)]},Nw={TOLERANCE:{configurable:!0}};Lw.prototype.reportResult=function(t,e,r){b_.out.println("Overlay result invalid - A:"+c_.toLocationSymbol(e[0])+" B:"+c_.toLocationSymbol(e[1])+" expected:"+(r?"i":"e")+" actual:"+c_.toLocationSymbol(e[2]))},Lw.prototype.isValid=function(t){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var e=this.checkValid(t);return e},Lw.prototype.checkValid=function(){var t=this;if(1===arguments.length){for(var e=arguments[0],r=0;r<this._testCoords.size();r++){var n=t._testCoords.get(r);if(!t.checkValid(e,n))return t._invalidLocation=n,!1}return!0}if(2===arguments.length){var i=arguments[0],o=arguments[1];return this._location[0]=this._locFinder[0].getLocation(o),this._location[1]=this._locFinder[1].getLocation(o),this._location[2]=this._locFinder[2].getLocation(o),!!Lw.hasLocation(this._location,c_.BOUNDARY)||this.isValidResult(i,this._location)}},Lw.prototype.addTestPts=function(t){var e=new Mw(t);this._testCoords.addAll(e.getPoints(5*this._boundaryDistanceTolerance))},Lw.prototype.isValidResult=function(t,e){var r=bw.isResultOfOp(e[0],e[1],t),n=!(r^e[2]===c_.INTERIOR);return n||this.reportResult(t,e,r),n},Lw.prototype.getInvalidLocation=function(){return this._invalidLocation},Lw.prototype.interfaces_=function(){return[]},Lw.prototype.getClass=function(){return Lw},Lw.hasLocation=function(t,e){for(var r=0;r<3;r++)if(t[r]===e)return!0;return!1},Lw.computeBoundaryDistanceTolerance=function(t,e){return Math.min(WC.computeSizeBasedSnapTolerance(t),WC.computeSizeBasedSnapTolerance(e))},Lw.isValid=function(t,e,r,n){return new Lw(t,e,n).isValid(r)},Nw.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(Lw,Nw);var Tw=function t(e){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=t.extractFactory(e),this._inputGeoms=e};Tw.prototype.extractElements=function(t,e){if(null===t)return null;for(var r=0;r<t.getNumGeometries();r++){var n=t.getGeometryN(r);this._skipEmpty&&n.isEmpty()||e.add(n)}},Tw.prototype.combine=function(){for(var t=new aI,e=this._inputGeoms.iterator();e.hasNext();){var r=e.next();this.extractElements(r,t)}return 0===t.size()?null!==this._geomFactory?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(t)},Tw.prototype.interfaces_=function(){return[]},Tw.prototype.getClass=function(){return Tw},Tw.combine=function(){return 1===arguments.length?new Tw(arguments[0]).combine():2===arguments.length?new Tw(Tw.createList(arguments[0],arguments[1])).combine():3===arguments.length?new Tw(Tw.createList(arguments[0],arguments[1],arguments[2])).combine():void 0},Tw.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},Tw.createList=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],r=new aI;return r.add(t),r.add(e),r}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2],s=new aI;return s.add(n),s.add(i),s.add(o),s}};var Rw=function(){this._inputPolys=null,this._geomFactory=null;var t=arguments[0];this._inputPolys=t,null===this._inputPolys&&(this._inputPolys=new aI)},Dw={STRTREE_NODE_CAPACITY:{configurable:!0}};Rw.prototype.reduceToGeometries=function(t){for(var e=new aI,r=t.iterator();r.hasNext();){var n=r.next(),i=null;f_(n,oI)?i=this.unionTree(n):n instanceof Y_&&(i=n),e.add(i)}return e},Rw.prototype.extractByEnvelope=function(t,e,r){for(var n=new aI,i=0;i<e.getNumGeometries();i++){var o=e.getGeometryN(i);o.getEnvelopeInternal().intersects(t)?n.add(o):r.add(o)}return this._geomFactory.buildGeometry(n)},Rw.prototype.unionOptimized=function(t,e){var r=t.getEnvelopeInternal(),n=e.getEnvelopeInternal();if(!r.intersects(n))return Tw.combine(t,e);if(t.getNumGeometries()<=1&&e.getNumGeometries()<=1)return this.unionActual(t,e);var i=r.intersection(n);return this.unionUsingEnvelopeIntersection(t,e,i)},Rw.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 sx(Rw.STRTREE_NODE_CAPACITY),e=this._inputPolys.iterator();e.hasNext();){var r=e.next();t.insert(r.getEnvelopeInternal(),r)}this._inputPolys=null;var n=t.itemsTree();return this.unionTree(n)},Rw.prototype.binaryUnion=function(){if(1===arguments.length){var t=arguments[0];return this.binaryUnion(t,0,t.size())}if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2];if(n-r<=1){var i=Rw.getGeometry(e,r);return this.unionSafe(i,null)}if(n-r==2)return this.unionSafe(Rw.getGeometry(e,r),Rw.getGeometry(e,r+1));var o=Math.trunc((n+r)/2),s=this.binaryUnion(e,r,o),a=this.binaryUnion(e,o,n);return this.unionSafe(s,a)}},Rw.prototype.repeatedUnion=function(t){for(var e=null,r=t.iterator();r.hasNext();){var n=r.next();e=null===e?n.copy():e.union(n)}return e},Rw.prototype.unionSafe=function(t,e){return null===t&&null===e?null:null===t?e.copy():null===e?t.copy():this.unionOptimized(t,e)},Rw.prototype.unionActual=function(t,e){return Rw.restrictToPolygons(t.union(e))},Rw.prototype.unionTree=function(t){var e=this.reduceToGeometries(t);return this.binaryUnion(e)},Rw.prototype.unionUsingEnvelopeIntersection=function(t,e,r){var n=new aI,i=this.extractByEnvelope(r,t,n),o=this.extractByEnvelope(r,e,n),s=this.unionActual(i,o);return n.add(s),Tw.combine(n)},Rw.prototype.bufferUnion=function(){if(1===arguments.length){var t=arguments[0];return t.get(0).getFactory().buildGeometry(t).buffer(0)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e.getFactory().createGeometryCollection([e,r]).buffer(0)}},Rw.prototype.interfaces_=function(){return[]},Rw.prototype.getClass=function(){return Rw},Rw.restrictToPolygons=function(t){if(f_(t,KI))return t;var e=xC.getPolygons(t);return 1===e.size()?e.get(0):t.getFactory().createMultiPolygon(dE.toPolygonArray(e))},Rw.getGeometry=function(t,e){return e>=t.size()?null:t.get(e)},Rw.union=function(t){return new Rw(t).union()},Dw.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(Rw,Dw);var Pw=function(){};function Qw(){return new kw}function kw(){this.reset()}Pw.prototype.interfaces_=function(){return[]},Pw.prototype.getClass=function(){return Pw},Pw.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return bw.createEmptyResult(bw.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),ow.overlayOp(t,e,bw.UNION)},kw.prototype={constructor:kw,reset:function(){this.s=this.t=0},add:function(t){Fw(Ow,t,this.t),Fw(this,Ow.s,this.s),this.s?this.t+=Ow.t:this.s=Ow.t},valueOf:function(){return this.s}};var Ow=new kw;function Fw(t,e,r){var n=t.s=e+r,i=n-e,o=n-i;t.t=e-o+(r-i)}var Gw=1e-6,Uw=Math.PI,qw=Uw/2,jw=Uw/4,Vw=2*Uw,zw=180/Uw,Yw=Uw/180,Hw=Math.abs,Xw=Math.atan,Jw=Math.atan2,Ww=Math.cos,Kw=Math.sin,Zw=Math.sqrt;function $w(t){return t>1?0:t<-1?Uw:Math.acos(t)}function tb(t){return t>1?qw:t<-1?-qw:Math.asin(t)}function eb(){}function rb(t,e){t&&sb.hasOwnProperty(t.type)&&sb[t.type](t,e)}var nb,ib,ob={Feature:function(t,e){rb(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n<i;)rb(r[n].geometry,e)}},sb={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)t=r[n],e.point(t[0],t[1],t[2])},LineString:function(t,e){ab(t.coordinates,e,0)},MultiLineString:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)ab(r[n],e,0)},Polygon:function(t,e){ub(t.coordinates,e)},MultiPolygon:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)ub(r[n],e)},GeometryCollection:function(t,e){for(var r=t.geometries,n=-1,i=r.length;++n<i;)rb(r[n],e)}};function ab(t,e,r){var n,i=-1,o=t.length-r;for(e.lineStart();++i<o;)n=t[i],e.point(n[0],n[1],n[2]);e.lineEnd()}function ub(t,e){var r=-1,n=t.length;for(e.polygonStart();++r<n;)ab(t[r],e,1);e.polygonEnd()}function lb(t){return[Jw(t[1],t[0]),tb(t[2])]}function cb(t){var e=t[0],r=t[1],n=Ww(r);return[n*Ww(e),n*Kw(e),Kw(r)]}function hb(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function fb(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function pb(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function gb(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Ab(t){var e=Zw(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function db(t,e){function r(r,n){return r=t(r,n),e(r[0],r[1])}return t.invert&&e.invert&&(r.invert=function(r,n){return(r=e.invert(r,n))&&t.invert(r[0],r[1])}),r}function yb(t,e){return[t>Uw?t-Vw:t<-Uw?t+Vw:t,e]}function vb(t){return function(e,r){return[(e+=t)>Uw?e-Vw:e<-Uw?e+Vw:e,r]}}function mb(t){var e=vb(t);return e.invert=vb(-t),e}function _b(t,e){var r=Ww(t),n=Kw(t),i=Ww(e),o=Kw(e);function s(t,e){var s=Ww(e),a=Ww(t)*s,u=Kw(t)*s,l=Kw(e),c=l*r+a*n;return[Jw(u*i-c*o,a*r-l*n),tb(c*i+u*o)]}return s.invert=function(t,e){var s=Ww(e),a=Ww(t)*s,u=Kw(t)*s,l=Kw(e),c=l*i-u*o;return[Jw(u*i+l*o,a*r+c*n),tb(c*r-a*n)]},s}function Ib(t,e){(e=cb(e))[0]-=t,Ab(e);var r=$w(-e[1]);return((-e[2]<0?-r:r)+Vw-Gw)%Vw}function Eb(){var t,e=[];return{point:function(e,r){t.push([e,r])},lineStart:function(){e.push(t=[])},lineEnd:eb,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var r=e;return e=[],t=null,r}}}function xb(t,e){return Hw(t[0]-e[0])<Gw&&Hw(t[1]-e[1])<Gw}function Cb(t,e,r,n){this.x=t,this.z=e,this.o=r,this.e=n,this.v=!1,this.n=this.p=null}function wb(t,e,r,n,i){var o,s,a=[],u=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,r,n=t[0],s=t[e];if(xb(n,s)){for(i.lineStart(),o=0;o<e;++o)i.point((n=t[o])[0],n[1]);i.lineEnd()}else a.push(r=new Cb(n,t,null,!0)),u.push(r.o=new Cb(n,null,r,!1)),a.push(r=new Cb(s,t,null,!1)),u.push(r.o=new Cb(s,null,r,!0))}})),a.length){for(u.sort(e),bb(a),bb(u),o=0,s=u.length;o<s;++o)u[o].e=r=!r;for(var l,c,h=a[0];;){for(var f=h,p=!0;f.v;)if((f=f.n)===h)return;l=f.z,i.lineStart();do{if(f.v=f.o.v=!0,f.e){if(p)for(o=0,s=l.length;o<s;++o)i.point((c=l[o])[0],c[1]);else n(f.x,f.n.x,1,i);f=f.n}else{if(p)for(l=f.p.z,o=l.length-1;o>=0;--o)i.point((c=l[o])[0],c[1]);else n(f.x,f.p.x,-1,i);f=f.p}l=(f=f.o).z,p=!p}while(!f.v);i.lineEnd()}}}function bb(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n<e;)i.n=r=t[n],r.p=i,i=r;i.n=r=t[0],r.p=i}}function Bb(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function Sb(t){for(var e,r,n,i=t.length,o=-1,s=0;++o<i;)s+=t[o].length;for(r=new Array(s);--i>=0;)for(e=(n=t[i]).length;--e>=0;)r[--s]=n[e];return r}Qw(),Qw(),Qw(),yb.invert=yb,1===(nb=Bb).length&&(ib=nb,nb=function(t,e){return Bb(ib(t),e)});var Mb=1e9,Lb=-Mb;function Nb(t,e,r,n){function i(i,o){return t<=i&&i<=r&&e<=o&&o<=n}function o(i,o,a,l){var c=0,h=0;if(null==i||(c=s(i,a))!==(h=s(o,a))||u(i,o)<0^a>0)do{l.point(0===c||3===c?t:r,c>1?n:e)}while((c=(c+a+4)%4)!==h);else l.point(o[0],o[1])}function s(n,i){return Hw(n[0]-t)<Gw?i>0?0:3:Hw(n[0]-r)<Gw?i>0?2:1:Hw(n[1]-e)<Gw?i>0?1:0:i>0?3:2}function a(t,e){return u(t.x,e.x)}function u(t,e){var r=s(t,1),n=s(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(s){var u,l,c,h,f,p,g,A,d,y,v,m=s,_=Eb(),I={point:E,lineStart:function(){I.point=x,l&&l.push(c=[]);y=!0,d=!1,g=A=NaN},lineEnd:function(){u&&(x(h,f),p&&d&&_.rejoin(),u.push(_.result()));I.point=E,d&&m.lineEnd()},polygonStart:function(){m=_,u=[],l=[],v=!0},polygonEnd:function(){var e=function(){for(var e=0,r=0,i=l.length;r<i;++r)for(var o,s,a=l[r],u=1,c=a.length,h=a[0],f=h[0],p=h[1];u<c;++u)o=f,s=p,f=(h=a[u])[0],p=h[1],s<=n?p>n&&(f-o)*(n-s)>(p-s)*(t-o)&&++e:p<=n&&(f-o)*(n-s)<(p-s)*(t-o)&&--e;return e}(),r=v&&e,i=(u=Sb(u)).length;(r||i)&&(s.polygonStart(),r&&(s.lineStart(),o(null,null,1,s),s.lineEnd()),i&&wb(u,a,e,o,s),s.polygonEnd());m=s,u=l=c=null}};function E(t,e){i(t,e)&&m.point(t,e)}function x(o,s){var a=i(o,s);if(l&&c.push([o,s]),y)h=o,f=s,p=a,y=!1,a&&(m.lineStart(),m.point(o,s));else if(a&&d)m.point(o,s);else{var u=[g=Math.max(Lb,Math.min(Mb,g)),A=Math.max(Lb,Math.min(Mb,A))],_=[o=Math.max(Lb,Math.min(Mb,o)),s=Math.max(Lb,Math.min(Mb,s))];!function(t,e,r,n,i,o){var s,a=t[0],u=t[1],l=0,c=1,h=e[0]-a,f=e[1]-u;if(s=r-a,h||!(s>0)){if(s/=h,h<0){if(s<l)return;s<c&&(c=s)}else if(h>0){if(s>c)return;s>l&&(l=s)}if(s=i-a,h||!(s<0)){if(s/=h,h<0){if(s>c)return;s>l&&(l=s)}else if(h>0){if(s<l)return;s<c&&(c=s)}if(s=n-u,f||!(s>0)){if(s/=f,f<0){if(s<l)return;s<c&&(c=s)}else if(f>0){if(s>c)return;s>l&&(l=s)}if(s=o-u,f||!(s<0)){if(s/=f,f<0){if(s>c)return;s>l&&(l=s)}else if(f>0){if(s<l)return;s<c&&(c=s)}return l>0&&(t[0]=a+l*h,t[1]=u+l*f),c<1&&(e[0]=a+c*h,e[1]=u+c*f),!0}}}}}(u,_,t,e,r,n)?a&&(m.lineStart(),m.point(o,s),v=!1):(d||(m.lineStart(),m.point(u[0],u[1])),m.point(_[0],_[1]),a||m.lineEnd(),v=!1)}g=o,A=s,d=a}return I}}var Tb=Qw();function Rb(t){return t}Qw(),Qw(),Qw();var Db=1/0,Pb=Db,Qb=-Db,kb=Qb,Ob={point:function(t,e){t<Db&&(Db=t);t>Qb&&(Qb=t);e<Pb&&(Pb=e);e>kb&&(kb=e)},lineStart:eb,lineEnd:eb,polygonStart:eb,polygonEnd:eb,result:function(){var t=[[Db,Pb],[Qb,kb]];return Qb=kb=-(Pb=Db=1/0),t}};function Fb(t,e,r,n){return function(i,o){var s,a,u,l=e(o),c=i.invert(n[0],n[1]),h=Eb(),f=e(h),p=!1,g={point:A,lineStart:y,lineEnd:v,polygonStart:function(){g.point=m,g.lineStart=_,g.lineEnd=I,a=[],s=[]},polygonEnd:function(){g.point=A,g.lineStart=y,g.lineEnd=v,a=Sb(a);var t=function(t,e){var r=e[0],n=e[1],i=[Kw(r),-Ww(r),0],o=0,s=0;Tb.reset();for(var a=0,u=t.length;a<u;++a)if(c=(l=t[a]).length)for(var l,c,h=l[c-1],f=h[0],p=h[1]/2+jw,g=Kw(p),A=Ww(p),d=0;d<c;++d,f=v,g=_,A=I,h=y){var y=l[d],v=y[0],m=y[1]/2+jw,_=Kw(m),I=Ww(m),E=v-f,x=E>=0?1:-1,C=x*E,w=C>Uw,b=g*_;if(Tb.add(Jw(b*x*Kw(C),A*I+b*Ww(C))),o+=w?E+x*Vw:E,w^f>=r^v>=r){var B=fb(cb(h),cb(y));Ab(B);var S=fb(i,B);Ab(S);var M=(w^E>=0?-1:1)*tb(S[2]);(n>M||n===M&&(B[0]||B[1]))&&(s+=w^E>=0?1:-1)}}return(o<-Gw||o<Gw&&Tb<-Gw)^1&s}(s,c);a.length?(p||(o.polygonStart(),p=!0),wb(a,Ub,t,r,o)):t&&(p||(o.polygonStart(),p=!0),o.lineStart(),r(null,null,1,o),o.lineEnd()),p&&(o.polygonEnd(),p=!1),a=s=null},sphere:function(){o.polygonStart(),o.lineStart(),r(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function A(e,r){var n=i(e,r);t(e=n[0],r=n[1])&&o.point(e,r)}function d(t,e){var r=i(t,e);l.point(r[0],r[1])}function y(){g.point=d,l.lineStart()}function v(){g.point=A,l.lineEnd()}function m(t,e){u.push([t,e]);var r=i(t,e);f.point(r[0],r[1])}function _(){f.lineStart(),u=[]}function I(){m(u[0][0],u[0][1]),f.lineEnd();var t,e,r,n,i=f.clean(),l=h.result(),c=l.length;if(u.pop(),s.push(u),u=null,c)if(1&i){if((e=(r=l[0]).length-1)>0){for(p||(o.polygonStart(),p=!0),o.lineStart(),t=0;t<e;++t)o.point((n=r[t])[0],n[1]);o.lineEnd()}}else c>1&&2&i&&l.push(l.pop().concat(l.shift())),a.push(l.filter(Gb))}return g}}function Gb(t){return t.length>1}function Ub(t,e){return((t=t.x)[0]<0?t[1]-qw-Gw:qw-t[1])-((e=e.x)[0]<0?e[1]-qw-Gw:qw-e[1])}Qw();var qb=Fb((function(){return!0}),(function(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,s){var a=o>0?Uw:-Uw,u=Hw(o-r);Hw(u-Uw)<Gw?(t.point(r,n=(n+s)/2>0?qw:-qw),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(a,n),t.point(o,n),e=0):i!==a&&u>=Uw&&(Hw(r-i)<Gw&&(r-=i*Gw),Hw(o-a)<Gw&&(o-=a*Gw),n=function(t,e,r,n){var i,o,s=Kw(t-r);return Hw(s)>Gw?Xw((Kw(e)*(o=Ww(n))*Kw(r)-Kw(n)*(i=Ww(e))*Kw(t))/(i*o*s)):(e+n)/2}(r,n,o,s),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(a,n),e=0),t.point(r=o,n=s),i=a},lineEnd:function(){t.lineEnd(),r=n=NaN},clean:function(){return 2-e}}}),(function(t,e,r,n){var i;if(null==t)i=r*qw,n.point(-Uw,i),n.point(0,i),n.point(Uw,i),n.point(Uw,0),n.point(Uw,-i),n.point(0,-i),n.point(-Uw,-i),n.point(-Uw,0),n.point(-Uw,i);else if(Hw(t[0]-e[0])>Gw){var o=t[0]<e[0]?Uw:-Uw;i=r*o/2,n.point(-o,i),n.point(0,i),n.point(o,i)}else n.point(e[0],e[1])}),[-Uw,-qw]);function jb(t,e){var r=Ww(t),n=r>0,i=Hw(r)>Gw;function o(t,e){return Ww(t)*Ww(e)>r}function s(t,e,n){var i=[1,0,0],o=fb(cb(t),cb(e)),s=hb(o,o),a=o[0],u=s-a*a;if(!u)return!n&&t;var l=r*s/u,c=-r*a/u,h=fb(i,o),f=gb(i,l);pb(f,gb(o,c));var p=h,g=hb(f,p),A=hb(p,p),d=g*g-A*(hb(f,f)-1);if(!(d<0)){var y=Zw(d),v=gb(p,(-g-y)/A);if(pb(v,f),v=lb(v),!n)return v;var m,_=t[0],I=e[0],E=t[1],x=e[1];I<_&&(m=_,_=I,I=m);var C=I-_,w=Hw(C-Uw)<Gw;if(!w&&x<E&&(m=E,E=x,x=m),w||C<Gw?w?E+x>0^v[1]<(Hw(v[0]-_)<Gw?E:x):E<=v[1]&&v[1]<=x:C>Uw^(_<=v[0]&&v[0]<=I)){var b=gb(p,(-g+y)/A);return pb(b,f),[v,lb(b)]}}}function a(e,r){var i=n?t:Uw-t,o=0;return e<-i?o|=1:e>i&&(o|=2),r<-i?o|=4:r>i&&(o|=8),o}return Fb(o,(function(t){var e,r,u,l,c;return{lineStart:function(){l=u=!1,c=1},point:function(h,f){var p,g=[h,f],A=o(h,f),d=n?A?0:a(h,f):A?a(h+(h<0?Uw:-Uw),f):0;if(!e&&(l=u=A)&&t.lineStart(),A!==u&&(!(p=s(e,g))||xb(e,p)||xb(g,p))&&(g[0]+=Gw,g[1]+=Gw,A=o(g[0],g[1])),A!==u)c=0,A?(t.lineStart(),p=s(g,e),t.point(p[0],p[1])):(p=s(e,g),t.point(p[0],p[1]),t.lineEnd()),e=p;else if(i&&e&&n^A){var y;d&r||!(y=s(g,e,!0))||(c=0,n?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1])))}!A||e&&xb(e,g)||t.point(g[0],g[1]),e=g,u=A,r=d},lineEnd:function(){u&&t.lineEnd(),e=null},clean:function(){return c|(l&&u)<<1}}}),(function(r,n,i,o){!function(t,e,r,n,i,o){if(r){var s=Ww(e),a=Kw(e),u=n*r;null==i?(i=e+n*Vw,o=e-u/2):(i=Ib(s,i),o=Ib(s,o),(n>0?i<o:i>o)&&(i+=n*Vw));for(var l,c=i;n>0?c>o:c<o;c-=u)l=lb([s,-a*Ww(c),-a*Kw(c)]),t.point(l[0],l[1])}}(o,t,e,i,r,n)}),n?[0,-t]:[-Uw,t-Uw])}function Vb(t){return function(e){var r=new zb;for(var n in t)r[n]=t[n];return r.stream=e,r}}function zb(){}function Yb(t,e,r){var n=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),function(t,e){t&&ob.hasOwnProperty(t.type)?ob[t.type](t,e):rb(t,e)}(r,t.stream(Ob));var s=Ob.result(),a=Math.min(n/(s[1][0]-s[0][0]),i/(s[1][1]-s[0][1])),u=+e[0][0]+(n-a*(s[1][0]+s[0][0]))/2,l=+e[0][1]+(i-a*(s[1][1]+s[0][1]))/2;return null!=o&&t.clipExtent(o),t.scale(150*a).translate([u,l])}zb.prototype={constructor:zb,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 Hb=16,Xb=Ww(30*Yw);function Jb(t,e){return+e?function(t,e){function r(n,i,o,s,a,u,l,c,h,f,p,g,A,d){var y=l-n,v=c-i,m=y*y+v*v;if(m>4*e&&A--){var _=s+f,I=a+p,E=u+g,x=Zw(_*_+I*I+E*E),C=tb(E/=x),w=Hw(Hw(E)-1)<Gw||Hw(o-h)<Gw?(o+h)/2:Jw(I,_),b=t(w,C),B=b[0],S=b[1],M=B-n,L=S-i,N=v*M-y*L;(N*N/m>e||Hw((y*M+v*L)/m-.5)>.3||s*f+a*p+u*g<Xb)&&(r(n,i,o,s,a,u,B,S,w,_/=x,I/=x,E,A,d),d.point(B,S),r(B,S,w,_,I,E,l,c,h,f,p,g,A,d))}}return function(e){var n,i,o,s,a,u,l,c,h,f,p,g,A={point:d,lineStart:y,lineEnd:m,polygonStart:function(){e.polygonStart(),A.lineStart=_},polygonEnd:function(){e.polygonEnd(),A.lineStart=y}};function d(r,n){r=t(r,n),e.point(r[0],r[1])}function y(){c=NaN,A.point=v,e.lineStart()}function v(n,i){var o=cb([n,i]),s=t(n,i);r(c,h,l,f,p,g,c=s[0],h=s[1],l=n,f=o[0],p=o[1],g=o[2],Hb,e),e.point(c,h)}function m(){A.point=d,e.lineEnd()}function _(){y(),A.point=I,A.lineEnd=E}function I(t,e){v(n=t,e),i=c,o=h,s=f,a=p,u=g,A.point=v}function E(){r(c,h,l,f,p,g,i,o,n,s,a,u,Hb,e),A.lineEnd=m,m()}return A}}(t,e):function(t){return Vb({point:function(e,r){e=t(e,r),this.stream.point(e[0],e[1])}})}(t)}var Wb=Vb({point:function(t,e){this.stream.point(t*Yw,e*Yw)}});function Kb(t){return function(t){var e,r,n,i,o,s,a,u,l,c,h=150,f=480,p=250,g=0,A=0,d=0,y=0,v=0,m=null,_=qb,I=null,E=Rb,x=.5,C=Jb(B,x);function w(t){return[(t=o(t[0]*Yw,t[1]*Yw))[0]*h+r,n-t[1]*h]}function b(t){return(t=o.invert((t[0]-r)/h,(n-t[1])/h))&&[t[0]*zw,t[1]*zw]}function B(t,i){return[(t=e(t,i))[0]*h+r,n-t[1]*h]}function S(){o=db(i=function(t,e,r){return(t%=Vw)?e||r?db(mb(t),_b(e,r)):mb(t):e||r?_b(e,r):yb}(d,y,v),e);var t=e(g,A);return r=f-t[0]*h,n=p+t[1]*h,M()}function M(){return l=c=null,w}return w.stream=function(t){return l&&c===t?l:l=Wb(_(i,C(E(c=t))))},w.clipAngle=function(t){return arguments.length?(_=+t?jb(m=t*Yw,6*Yw):(m=null,qb),M()):m*zw},w.clipExtent=function(t){return arguments.length?(E=null==t?(I=s=a=u=null,Rb):Nb(I=+t[0][0],s=+t[0][1],a=+t[1][0],u=+t[1][1]),M()):null==I?null:[[I,s],[a,u]]},w.scale=function(t){return arguments.length?(h=+t,S()):h},w.translate=function(t){return arguments.length?(f=+t[0],p=+t[1],S()):[f,p]},w.center=function(t){return arguments.length?(g=t[0]%360*Yw,A=t[1]%360*Yw,S()):[g*zw,A*zw]},w.rotate=function(t){return arguments.length?(d=t[0]%360*Yw,y=t[1]%360*Yw,v=t.length>2?t[2]%360*Yw:0,S()):[d*zw,y*zw,v*zw]},w.precision=function(t){return arguments.length?(C=Jb(B,x=t*t),M()):Zw(x)},w.fitExtent=function(t,e){return Yb(w,t,e)},w.fitSize=function(t,e){return function(t,e,r){return Yb(t,[[0,0],e],r)}(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&b,S()}}((function(){return t}))()}function Zb(t){return function(e,r){var n=Ww(e),i=Ww(r),o=t(n*i);return[o*i*Kw(e),o*Kw(r)]}}function $b(t){return function(e,r){var n=Zw(e*e+r*r),i=t(n),o=Kw(i),s=Ww(i);return[Jw(e*o,n*s),tb(n&&r*o/n)]}}Zb((function(t){return Zw(2/(1+t))})).invert=$b((function(t){return 2*tb(t/2)}));var tB=Zb((function(t){return(t=$w(t))&&t/Kw(t)}));function eB(){return Kb(tB).scale(79.4188).clipAngle(179.999)}function rB(t,e){return[t,e]}function nB(t,e,r,n){var i=t.properties||{},o="Feature"===t.type?t.geometry:t;if("GeometryCollection"===o.type){var s=[];return Va(t,(function(t){var i=nB(t,e,r,n);i&&s.push(i)})),At(s)}var a=function(t){var e=Jc(t).geometry.coordinates,r=[-e[0],-e[1]];return eB().rotate(r).scale(nt)}(o),u={type:o.type,coordinates:oB(o.coordinates,a)},l=(new EE).read(u),c=It(Et(e,r),"meters"),h=AC.bufferOp(l,c,n);if(!iB((h=(new xE).write(h)).coordinates))return at({type:h.type,coordinates:sB(h.coordinates,a)},i)}function iB(t){return Array.isArray(t[0])?iB(t[0]):isNaN(t[0])}function oB(t,e){return"object"!=typeof t[0]?e(t):t.map((function(t){return oB(t,e)}))}function sB(t,e){return"object"!=typeof t[0]?e.invert(t):t.map((function(t){return sB(t,e)}))}function aB(t,e,r){void 0===r&&(r={});var n=Gt(t),i=Gt(e),o=Km.intersection(n.coordinates,i.coordinates);return 0===o.length?null:1===o.length?ht(o[0],r.properties):vt(o,r.properties)}function uB(t,e,r){void 0===r&&(r={});var n=JSON.stringify(r.properties||{}),i=t[0],o=t[1],s=t[2],a=t[3],u=(o+a)/2,l=(i+s)/2,c=2*e/jt([i,u],[s,u],r)*(s-i),h=2*e/jt([l,o],[l,a],r)*(a-o),f=c/2,p=2*f,g=Math.sqrt(3)/2*h,A=s-i,d=a-o,y=3/4*p,v=g,m=(A-p)/(p-f/2),_=Math.floor(m),I=(_*y-f/2-A)/2-f/2+y/2,E=Math.floor((d-g)/g),x=(d-E*g)/2,C=E*g-d>g/2;C&&(x-=g/4);for(var w=[],b=[],B=0;B<6;B++){var S=2*Math.PI/6*B;w.push(Math.cos(S)),b.push(Math.sin(S))}for(var M=[],L=0;L<=_;L++)for(var N=0;N<=E;N++){var T=L%2==1;if((0!==N||!T)&&(0!==N||!C)){var R=L*y+i-I,D=N*v+o+x;if(T&&(D-=g/2),!0===r.triangles)cB([R,D],c/2,h/2,JSON.parse(n),w,b).forEach((function(t){r.mask?aB(r.mask,t)&&M.push(t):M.push(t)}));else{var P=lB([R,D],c/2,h/2,JSON.parse(n),w,b);r.mask?aB(r.mask,P)&&M.push(P):M.push(P)}}}return At(M)}function lB(t,e,r,n,i,o){for(var s=[],a=0;a<6;a++){var u=t[0]+e*i[a],l=t[1]+r*o[a];s.push([u,l])}return s.push(s[0].slice()),ht([s],n)}function cB(t,e,r,n,i,o){for(var s=[],a=0;a<6;a++){var u=[];u.push(t),u.push([t[0]+e*i[a],t[1]+r*o[a]]),u.push([t[0]+e*i[(a+1)%6],t[1]+r*o[(a+1)%6]]),u.push(t),s.push(ht([u],n))}return s}function hB(t){return vt(t)}function fB(t){return ht(t&&t.geometry.coordinates||[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]])}function pB(t,e,r){return void 0===r&&(r={}),function(t,e,r,n){void 0===n&&(n={});for(var i=[],o=t[0],s=t[1],a=t[2],u=t[3],l=e/jt([o,s],[a,s],n)*(a-o),c=r/jt([o,s],[o,u],n)*(u-s),h=a-o,f=u-s,p=Math.floor(h/l),g=Math.floor(f/c),A=(f-g*c)/2,d=o+(h-p*l)/2,y=0;y<p;y++){for(var v=s+A,m=0;m<g;m++){var _=ht([[[d,v],[d,v+c],[d+l,v+c],[d+l,v],[d,v]]],n.properties);n.mask?Iy(n.mask,_)&&i.push(_):i.push(_),v+=c}d+=l}return At(i)}(t,e,e,r)}function gB(t,e,r){void 0===r&&(r={});for(var n=[],i=e/jt([t[0],t[1]],[t[2],t[1]],r)*(t[2]-t[0]),o=e/jt([t[0],t[1]],[t[0],t[3]],r)*(t[3]-t[1]),s=0,a=t[0];a<=t[2];){for(var u=0,l=t[1];l<=t[3];){var c=null,h=null;s%2==0&&u%2==0?(c=ht([[[a,l],[a,l+o],[a+i,l],[a,l]]],r.properties),h=ht([[[a,l+o],[a+i,l+o],[a+i,l],[a,l+o]]],r.properties)):s%2==0&&u%2==1?(c=ht([[[a,l],[a+i,l+o],[a+i,l],[a,l]]],r.properties),h=ht([[[a,l],[a,l+o],[a+i,l+o],[a,l]]],r.properties)):u%2==0&&s%2==1?(c=ht([[[a,l],[a,l+o],[a+i,l+o],[a,l]]],r.properties),h=ht([[[a,l],[a+i,l+o],[a+i,l],[a,l]]],r.properties)):u%2==1&&s%2==1&&(c=ht([[[a,l],[a,l+o],[a+i,l],[a,l]]],r.properties),h=ht([[[a,l+o],[a+i,l+o],[a+i,l],[a,l+o]]],r.properties)),r.mask?(aB(r.mask,c)&&n.push(c),aB(r.mask,h)&&n.push(h)):(n.push(c),n.push(h)),l+=o,u++}s++,a+=i}return At(n)}tB.invert=$b((function(t){return t})),rB.invert=rB;var AB=Object.freeze({__proto__:null,projection:zv,random:$v,clusters:am,helpers:Rt,invariant:qt,meta:tu,isolines:function(t,e,r){if(!Lt(r=r||{}))throw new Error("options is invalid");var n=r.zProperty||"elevation",i=r.commonProperties||{},o=r.breaksProperties||[];if(Ft(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(!Lt(i))throw new Error("commonProperties must be an Object");if(!Array.isArray(o))throw new Error("breaksProperties must be an Array");var s=el(t,{zProperty:n,flip:!0}),a=function(t,e,r,n,i){for(var o=[],s=1;s<e.length;s++){var a=+e[s],u=Hu({},n,i[s]);u[r]=a;var l=dt(Wu(t,a),u);o.push(l)}return o}(s,e,n,i,o),u=function(t,e,r){var n=ju(r),i=n[2]-n[0],o=n[3]-n[1],s=n[0],a=n[1],u=e[0].length-1,l=e.length-1,c=i/u,h=o/l,f=function(t){t[0]=t[0]*c+s,t[1]=t[1]*h+a};return t.forEach((function(t){ka(t,f)})),t}(a,s,t);return At(u)},convex:Hl,pointsWithinPolygon:Xl,within:Xl,concave:function(t,e){void 0===e&&(e={});var r=e.maxEdge||1/0,n=function(t){var e=[],r={};return Ua(t,(function(t){if(t.geometry){var n=t.geometry.coordinates.join("-");Object.prototype.hasOwnProperty.call(r,n)||(e.push(t),r[n]=!0)}})),At(e)}(t),i=Jl(n);if(i.features=i.features.filter((function(t){var n=t.geometry.coordinates[0][0],i=t.geometry.coordinates[0][1],o=t.geometry.coordinates[0][2],s=jt(n,i,e),a=jt(i,o,e),u=jt(n,o,e);return s<=r&&a<=r&&u<=r})),i.features.length<1)return null;var o=xc(i);return 1===o.coordinates.length&&(o.coordinates=o.coordinates[0],o.type="Polygon"),at(o)},collect:function(t,e,r,n){var i=Gc(6),o=e.features.map((function(t){var e;return{minX:t.geometry.coordinates[0],minY:t.geometry.coordinates[1],maxX:t.geometry.coordinates[0],maxY:t.geometry.coordinates[1],property:null===(e=t.properties)||void 0===e?void 0:e[r]}}));return i.load(o),t.features.forEach((function(t){t.properties||(t.properties={});var e=ju(t),r=i.search({minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]}),o=[];r.forEach((function(e){Vt([e.minX,e.minY],t)&&o.push(e.property)})),t.properties[n]=o})),t},flip:function(t,e){if(!Lt(e=e||{}))throw new Error("options is invalid");var r=e.mutate;if(!t)throw new Error("geojson is required");return!1!==r&&void 0!==r||(t=Ta(t)),ka(t,(function(t){var e=t[0],r=t[1];t[0]=r,t[1]=e})),t},simplify:ou,bezier:qc,bezierSpline:qc,tag:function(t,e,r,n){return t=Ta(t),e=Ta(e),Ua(t,(function(t){t.properties||(t.properties={}),Ua(e,(function(e){void 0===t.properties[n]&&Vt(t,e)&&(t.properties[n]=e.properties[r])}))})),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");var r=At(function(t,e){var r,n,i=t.slice(0),o=t.length,s=o-e;for(;o-- >s;)r=i[n=Math.floor((o+1)*Math.random())],i[n]=i[o],i[o]=r;return i.slice(s)}(t.features,e));return r},envelope:Vc,square:zc,circle:Hc,midpoint:function(t,e){return Yc(t,jt(t,e)/2,Xc(t,e))},center:Jc,centerOfMass:function t(e,r){switch(void 0===r&&(r={}),Ut(e)){case"Point":return lt(Dt(e),r.properties);case"Polygon":var n=[];ka(e,(function(t){n.push(t)}));var i,o,s,a,u,l,c,h,f=Wc(e,{properties:r.properties}),p=f.geometry.coordinates,g=0,A=0,d=0,y=n.map((function(t){return[t[0]-p[0],t[1]-p[1]]}));for(i=0;i<n.length-1;i++)a=(o=y[i])[0],l=o[1],u=(s=y[i+1])[0],d+=h=a*(c=s[1])-u*l,g+=(a+u)*h,A+=(l+c)*h;if(0===d)return f;var v=1/(6*(.5*d));return lt([p[0]+v*g,p[1]+v*A],r.properties);default:var m=Hl(e);return m?t(m,{properties:r.properties}):Wc(e,{properties:r.properties})}},centroid:Wc,combine:function(t){var e={MultiPoint:{coordinates:[],properties:[]},MultiLineString:{coordinates:[],properties:[]},MultiPolygon:{coordinates:[],properties:[]}};return Ua(t,(function(t){var r,n,i,o;switch(null===(o=t.geometry)||void 0===o?void 0:o.type){case"Point":e.MultiPoint.coordinates.push(t.geometry.coordinates),e.MultiPoint.properties.push(t.properties);break;case"MultiPoint":(r=e.MultiPoint.coordinates).push.apply(r,t.geometry.coordinates),e.MultiPoint.properties.push(t.properties);break;case"LineString":e.MultiLineString.coordinates.push(t.geometry.coordinates),e.MultiLineString.properties.push(t.properties);break;case"MultiLineString":(n=e.MultiLineString.coordinates).push.apply(n,t.geometry.coordinates),e.MultiLineString.properties.push(t.properties);break;case"Polygon":e.MultiPolygon.coordinates.push(t.geometry.coordinates),e.MultiPolygon.properties.push(t.properties);break;case"MultiPolygon":(i=e.MultiPolygon.coordinates).push.apply(i,t.geometry.coordinates),e.MultiPolygon.properties.push(t.properties)}})),At(Object.keys(e).filter((function(t){return e[t].coordinates.length})).sort().map((function(t){return at({type:t,coordinates:e[t].coordinates},{collectedProperties:e[t].properties})})))},distance:jt,explode:Kc,bbox:ju,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=Zc(t.geometry.coordinates):t.geometry.coordinates.forEach((function(t){e.features=e.features.concat(Zc(t))})),e},bboxPolygon:jc,booleanPointInPolygon:Vt,inside:Vt,nearest:$c,nearestPoint:$c,nearestPointOnLine:Vh,pointOnLine:Vh,nearestPointToLine:function(t,e,r){void 0===r&&(r={});var n=r.units,i=r.properties||{},o=function(t){var e=[];switch(t.geometry?t.geometry.type:t.type){case"GeometryCollection":return Va(t,(function(t){"Point"===t.type&&e.push({type:"Feature",properties:{},geometry:t})})),{type:"FeatureCollection",features:e};case"FeatureCollection":return t.features=t.features.filter((function(t){return"Point"===t.geometry.type})),t;default:throw new Error("points must be a Point Collection")}}(t);if(!o.features.length)throw new Error("points must contain features");if(!e)throw new Error("line is required");if("LineString"!==Ut(e))throw new Error("line must be a LineString");var s=1/0,a=null;return Ua(o,(function(t){var r=Yh(t,e,{units:n});r<s&&(s=r,a=t)})),a&&(a.properties=Hu({dist:s},a.properties,i)),a},planepoint:function(t,e){var r=Dt(t),n=Gt(e).coordinates[0];if(n.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=r[0],l=r[1],c=n[0][0],h=n[0][1],f=void 0!==o?o:n[0][2],p=n[1][0],g=n[1][1],A=void 0!==s?s:n[1][2],d=n[2][0],y=n[2][1],v=void 0!==a?a:n[2][2];return(v*(u-c)*(l-g)+f*(u-p)*(l-y)+A*(u-d)*(l-h)-A*(u-c)*(l-y)-v*(u-p)*(l-h)-f*(u-d)*(l-g))/((u-c)*(l-g)+(u-p)*(l-y)+(u-d)*(l-h)-(u-c)*(l-y)-(u-p)*(l-h)-(u-d)*(l-g))},tin:Jl,bearing:Xc,destination:Yc,kinks:function(t){var e,r,n={type:"FeatureCollection",features:[]};if("LineString"===(r="Feature"===t.type?t.geometry:t).type)e=[r.coordinates];else if("MultiLineString"===r.type)e=r.coordinates;else if("MultiPolygon"===r.type)e=[].concat.apply([],r.coordinates);else{if("Polygon"!==r.type)throw new Error("Input must be a LineString, MultiLineString, Polygon, or MultiPolygon Feature or Geometry");e=r.coordinates}return e.forEach((function(t){e.forEach((function(e){for(var r=0;r<t.length-1;r++)for(var i=r;i<e.length-1;i++){if(t===e){if(1===Math.abs(r-i))continue;if(0===r&&i===t.length-2&&t[r][0]===t[t.length-1][0]&&t[r][1]===t[t.length-1][1])continue}var o=Jh(t[r][0],t[r][1],t[r+1][0],t[r+1][1],e[i][0],e[i][1],e[i+1][0],e[i+1][1]);o&&n.features.push(lt([o[0],o[1]]))}}))})),n},pointOnFeature:Wh,pointOnSurface:Wh,area:$h,along:function(t,e,r){void 0===r&&(r={});for(var n=Gt(t).coordinates,i=0,o=0;o<n.length&&!(e>=i&&o===n.length-1);o++){if(i>=e){var s=e-i;if(s){var a=Xc(n[o],n[o-1])-180;return Yc(n[o],s,a,r)}return lt(n[o])}i+=jt(n[o],n[o+1],r)}return lt(n[n.length-1])},length:nf,lineDistance:nf,lineSlice:function(t,e,r){var n=Pt(r);if("LineString"!==Ut(r))throw new Error("line must be a LineString");for(var i,o=Vh(r,t),s=Vh(r,e),a=[(i=o.properties.index<=s.properties.index?[o,s]:[s,o])[0].geometry.coordinates],u=i[0].properties.index+1;u<i[1].properties.index+1;u++)a.push(n[u]);return a.push(i[1].geometry.coordinates),pt(a,r.properties)},lineSliceAlong:of,pointGrid:ff,truncate:pf,flatten:gf,lineIntersect:qh,lineChunk:function(t,e,r){if(!Lt(r=r||{}))throw new Error("options is invalid");var n=r.units,i=r.reverse;if(!t)throw new Error("geojson is required");if(e<=0)throw new Error("segmentLength must be greater than 0");var o=[];return Ya(t,(function(t){i&&(t.geometry.coordinates=t.geometry.coordinates.reverse()),function(t,e,r,n){var i=nf(t,{units:r});if(i<=e)return n(t);var o=i/e;Number.isInteger(o)||(o=Math.floor(o)+1);for(var s=0;s<o;s++){n(of(t,e*s,e*(s+1),{units:r}),s)}}(t,e,n,(function(t){o.push(t)}))})),At(o)},unkinkPolygon:function(t){var e=[];return Ya(t,(function(t){"Polygon"===t.geometry.type&&Ua(yf(t),(function(r){e.push(ht(r.geometry.coordinates,t.properties))}))})),At(e)},greatCircle:function(t,e,r){if("object"!=typeof(r=r||{}))throw new Error("options is invalid");var n=r.properties,i=r.npoints,o=r.offset;return t=Dt(t),e=Dt(e),n=n||{},i=i||100,o=o||10,new Mf({x:t[0],y:t[1]},{x:e[0],y:e[1]},n).Arc(i,{offset:o}).json()},lineSegment:th,lineSplit:function(t,e){if(!t)throw new Error("line is required");if(!e)throw new Error("splitter is required");var r=Ut(t),n=Ut(e);if("LineString"!==r)throw new Error("line must be LineString");if("FeatureCollection"===n)throw new Error("splitter cannot be a FeatureCollection");if("GeometryCollection"===n)throw new Error("splitter cannot be a GeometryCollection");var i=pf(e,{precision:7});switch(n){case"Point":return Nf(t,i);case"MultiPoint":return Lf(t,i);case"LineString":case"MultiLineString":case"Polygon":case"MultiPolygon":return Lf(t,qh(t,i))}},lineArc:Df,polygonToLine:Qf,polygonToLineString:Qf,lineStringToPolygon:Ff,lineToPolygon:Ff,bboxClip:function(t,e){var r=Gt(t),n=r.type,i="Feature"===t.type?t.properties:{},o=r.coordinates;switch(n){case"LineString":case"MultiLineString":var s=[];return"LineString"===n&&(o=[o]),o.forEach((function(t){!function(t,e,r){var n,i,o,s,a,u=t.length,l=Vf(t[0],e),c=[];for(r||(r=[]),n=1;n<u;n++){for(s=t[n-1],i=o=Vf(a=t[n],e);;){if(!(l|i)){c.push(s),i!==o?(c.push(a),n<u-1&&(r.push(c),c=[])):n===u-1&&c.push(a);break}if(l&i)break;l?l=Vf(s=jf(s,a,l,e),e):i=Vf(a=jf(s,a,i,e),e)}l=o}c.length&&r.push(c)}(t,e,s)})),1===s.length?pt(s[0],i):dt(s,i);case"Polygon":return ht(zf(o,e),i);case"MultiPolygon":return vt(o.map((function(t){return zf(t,e)})),i);default:throw new Error("geometry "+n+" not supported")}},lineOverlap:bA,sector:function(t,e,r,n,i){if(!Lt(i=i||{}))throw new Error("options is invalid");var o=i.properties;if(!t)throw new Error("center is required");if(null==r)throw new Error("bearing1 is required");if(null==n)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(SA(r)===SA(n))return Hc(t,e,i);var s=Pt(t),a=Df(t,e,r,n,i),u=[[s]];return ka(a,(function(t){u[0].push(t)})),u[0].push(s),ht(u,o)},rhumbBearing:MA,rhumbDistance:zh,rhumbDestination:NA,polygonTangents:function(t,e){var r,n,i,o,s=Pt(t),a=Pt(e),u=ju(e),l=0,c=null;switch(s[0]>u[0]&&s[0]<u[2]&&s[1]>u[1]&&s[1]<u[3]&&(l=(c=$c(t,Kc(e))).properties.featureIndex),Ut(e)){case"Polygon":r=a[0][l],n=a[0][0],null!==c&&c.geometry.coordinates[1]<s[1]&&(n=a[0][l]),o=DA(a[0][0],a[0][a[0].length-1],s);var h=TA(a[0],s,o,i,r,n);r=h[0],n=h[1];break;case"MultiPolygon":for(var f=0,p=0,g=0,A=0;A<a[0].length;A++){f=A;for(var d=!1,y=0;y<a[0][A].length;y++){if(p=y,g===l){d=!0;break}g++}if(d)break}r=a[0][f][p],n=a[0][f][p],o=DA(a[0][0][0],a[0][0][a[0][0].length-1],s),a.forEach((function(t){var e=TA(t[0],s,o,i,r,n);r=e[0],n=e[1]}))}return At([lt(r),lt(n)])},rewind:function(t,e){if(!Lt(e=e||{}))throw new Error("options is invalid");var r=e.reverse||!1,n=e.mutate||!1;if(!t)throw new Error("<geojson> is required");if("boolean"!=typeof r)throw new Error("<reverse> must be a boolean");if("boolean"!=typeof n)throw new Error("<mutate> must be a boolean");!1===n&&(t=Ta(t));var i=[];switch(t.type){case"GeometryCollection":return Va(t,(function(t){QA(t,r)})),t;case"FeatureCollection":return Ua(t,(function(t){Ua(QA(t,r),(function(t){i.push(t)}))})),At(i)}return QA(t,r)},isobands:function(t,e,r){if(!Lt(r=r||{}))throw new Error("options is invalid");var n=r.zProperty||"elevation",i=r.commonProperties||{},o=r.breaksProperties||[];if(Ft(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(!Lt(i))throw new Error("commonProperties is not an Object");if(!Array.isArray(o))throw new Error("breaksProperties is not an Array");var s=FA(t,{zProperty:n,flip:!0}),a=function(t,e,r){for(var n=[],i=1;i<e.length;i++){var o=+e[i-1],s=+e[i],a=Gd(Fd(qA(t,o,s-o))),u={};u.groupedRings=a,u[r]=o+"-"+s,n.push(u)}return n}(s,e,n);a=function(t,e,r){var n=ju(r),i=n[2]-n[0],o=n[3]-n[1],s=n[0],a=n[1],u=e[0].length-1,l=e.length-1,c=i/u,h=o/l,f=function(t){t[0]=t[0]*c+s,t[1]=t[1]*h+a};return t.forEach((function(t){t.groupedRings.forEach((function(t){t.forEach((function(t){t.forEach(f)}))}))})),t}(a,s,t);var u=a.map((function(t,e){if(o[e]&&!Lt(o[e]))throw new Error("Each mappedProperty is required to be an Object");var r=Hu({},i,o[e]);return r[n]=t[n],vt(t.groupedRings,r)}));return At(u)},transformRotate:jd,transformScale:Vd,transformTranslate:function(t,e,r,n){if(!Lt(n=n||{}))throw new Error("options is invalid");var i=n.units,o=n.zTranslation,s=n.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==r||isNaN(r))throw new Error("direction is required");return e<0&&(e=-e,r+=180),!1!==s&&void 0!==s||(t=Ta(t)),ka(t,(function(t){var n=Pt(NA(t,e,r,{units:i}));t[0]=n[0],t[1]=n[1],o&&3===t.length&&(t[2]+=o)})),t},lineOffset:function(t,e,r){if(!Lt(r=r||{}))throw new Error("options is invalid");var n=r.units;if(!t)throw new Error("geojson is required");if(null==e||isNaN(e))throw new Error("distance is required");var i=Ut(t),o=t.properties;switch(i){case"LineString":return Jd(t,e,n);case"MultiLineString":var s=[];return Ya(t,(function(t){s.push(Jd(t,e,n).geometry.coordinates)})),dt(s,o);default:throw new Error("geometry "+i+" is not supported")}},polygonize:function(t){var e=ny.fromGeoJson(t);e.deleteDangles(),e.deleteCutEdges();var r=[],n=[];return e.getEdgeRings().filter((function(t){return t.isValid()})).forEach((function(t){t.isHole()?r.push(t):n.push(t)})),r.forEach((function(t){ey.findEdgeRingContaining(t,n)&&n.push(t)})),At(n.map((function(t){return t.toPolygon()})))},booleanDisjoint:iy,booleanContains:function(t,e){var r=Gt(t),n=Gt(e),i=r.type,o=n.type,s=r.coordinates,a=n.coordinates;switch(i){case"Point":if("Point"===o)return ly(s,a);throw new Error("feature2 "+o+" geometry not supported");case"MultiPoint":switch(o){case"Point":return function(t,e){var r,n=!1;for(r=0;r<t.coordinates.length;r++)if(ly(t.coordinates[r],e.coordinates)){n=!0;break}return n}(r,n);case"MultiPoint":return function(t,e){for(var r=0,n=e.coordinates;r<n.length;r++){for(var i=n[r],o=!1,s=0,a=t.coordinates;s<a.length;s++){if(ly(i,a[s])){o=!0;break}}if(!o)return!1}return!0}(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"Point":return sf(n,r,{ignoreEndVertices:!0});case"LineString":return function(t,e){for(var r=!1,n=0,i=e.coordinates;n<i.length;n++){var o=i[n];if(sf({type:"Point",coordinates:o},t,{ignoreEndVertices:!0})&&(r=!0),!sf({type:"Point",coordinates:o},t,{ignoreEndVertices:!1}))return!1}return r}(r,n);case"MultiPoint":return function(t,e){for(var r=!1,n=0,i=e.coordinates;n<i.length;n++){var o=i[n];if(sf(o,t,{ignoreEndVertices:!0})&&(r=!0),!sf(o,t))return!1}if(r)return!0;return!1}(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"Point":return Vt(n,r,{ignoreBoundary:!0});case"LineString":return function(t,e){var r=!1,n=0,i=ju(t),o=ju(e);if(!uy(i,o))return!1;for(;n<e.coordinates.length-1;n++){if(Vt({type:"Point",coordinates:cy(e.coordinates[n],e.coordinates[n+1])},t,{ignoreBoundary:!0})){r=!0;break}}return r}(r,n);case"Polygon":return function(t,e){if("Feature"===t.type&&null===t.geometry)return!1;if("Feature"===e.type&&null===e.geometry)return!1;var r=ju(t),n=ju(e);if(!uy(r,n))return!1;for(var i=Gt(e).coordinates,o=0,s=i;o<s.length;o++)for(var a=0,u=s[o];a<u.length;a++){if(!Vt(u[a],t))return!1}return!0}(r,n);case"MultiPoint":return function(t,e){for(var r=0,n=e.coordinates;r<n.length;r++){if(!Vt(n[r],t,{ignoreBoundary:!0}))return!1}return!0}(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}},booleanCrosses:function(t,e){var r=Gt(t),n=Gt(e),i=r.type,o=n.type;switch(i){case"MultiPoint":switch(o){case"LineString":return hy(r,n);case"Polygon":return py(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"MultiPoint":return hy(n,r);case"LineString":return function(t,e){if(qh(t,e).features.length>0)for(var r=0;r<t.coordinates.length-1;r++)for(var n=0;n<e.coordinates.length-1;n++){var i=!0;if(0!==n&&n!==e.coordinates.length-2||(i=!1),gy(t.coordinates[r],t.coordinates[r+1],e.coordinates[n],i))return!0}return!1}(r,n);case"Polygon":return fy(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"MultiPoint":return py(n,r);case"LineString":return fy(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}},booleanClockwise:PA,booleanOverlap:function(t,e){var r=Gt(t),n=Gt(e),i=r.type,o=n.type;if("MultiPoint"===i&&"MultiPoint"!==o||("LineString"===i||"MultiLineString"===i)&&"LineString"!==o&&"MultiLineString"!==o||("Polygon"===i||"MultiPolygon"===i)&&"Polygon"!==o&&"MultiPolygon"!==o)throw new Error("features must be of the same type");if("Point"===i)throw new Error("Point geometry not supported");if(new _y({precision:6}).compare(t,e))return!1;var s=0;switch(i){case"MultiPoint":for(var a=0;a<r.coordinates.length;a++)for(var u=0;u<n.coordinates.length;u++){var l=r.coordinates[a],c=n.coordinates[u];if(l[0]===c[0]&&l[1]===c[1])return!0}return!1;case"LineString":case"MultiLineString":Xa(t,(function(t){Xa(e,(function(e){bA(t,e).features.length&&s++}))}));break;case"Polygon":case"MultiPolygon":Xa(t,(function(t){Xa(e,(function(e){qh(t,e).features.length&&s++}))}))}return s>0},booleanPointOnLine:sf,booleanEqual:function(t,e){return Gt(t).type===Gt(e).type&&new _y({precision:6}).compare(Sa(t),Sa(e))},booleanWithin:uf,booleanIntersects:Iy,clone:Ta,cleanCoords:Sa,clustersDbscan:function(t,e,r){void 0===r&&(r={}),!0!==r.mutate&&(t=Ta(t)),r.minPoints=r.minPoints||3;var n=new Sy.DBSCAN,i=n.run(ja(t),Bt(e,r.units),r.minPoints,jt),o=-1;return i.forEach((function(e){o++,e.forEach((function(e){var r=t.features[e];r.properties||(r.properties={}),r.properties.cluster=o,r.properties.dbscan="core"}))})),n.noise.forEach((function(e){var r=t.features[e];r.properties||(r.properties={}),r.properties.cluster?r.properties.dbscan="edge":r.properties.dbscan="noise"})),t},clustersKmeans:function(t,e){void 0===e&&(e={});var r=t.features.length;e.numberOfClusters=e.numberOfClusters||Math.round(Math.sqrt(r/2)),e.numberOfClusters>r&&(e.numberOfClusters=r),!0!==e.mutate&&(t=Ta(t));var n=ja(t),i=n.slice(0,e.numberOfClusters),o=ky(n,e.numberOfClusters,i),s={};return o.centroids.forEach((function(t,e){s[e]=t})),Ua(t,(function(t,e){var r=o.idxs[e];t.properties.cluster=r,t.properties.centroid=s[r]})),t},pointToLineDistance:Yh,booleanParallel:function(t,e){if(!t)throw new Error("line1 is required");if(!e)throw new Error("line2 is required");if("LineString"!==Fy(t,"line1"))throw new Error("line1 must be a LineString");if("LineString"!==Fy(e,"line2"))throw new Error("line2 must be a LineString");for(var r=th(Sa(t)).features,n=th(Sa(e)).features,i=0;i<r.length;i++){var o=r[i].geometry.coordinates;if(!n[i])break;if(!Oy(o,n[i].geometry.coordinates))return!1}return!0},shortestPath:function(t,e,r){if(!Lt(r=r||{}))throw new Error("options is invalid");var n=r.resolution,i=r.minDistance,o=r.obstacles||At([]);if(!t)throw new Error("start is required");if(!e)throw new Error("end is required");if(n&&!Mt(n)||n<=0)throw new Error("options.resolution must be a number, greater than 0");if(i)throw new Error("options.minDistance is not yet implemented");var s=Dt(t),a=Dt(e);switch(t=lt(s),e=lt(a),Ut(o)){case"FeatureCollection":if(0===o.features.length)return pt([s,a]);break;case"Polygon":o=At([at(Gt(o))]);break;default:throw new Error("invalid obstacles")}var u=o;u.features.push(t),u.features.push(e);var l=ju(Vd(jc(ju(u)),1.15));n||(n=jt([l[0],l[1]],[l[2],l[1]],r)/100),u.features.pop(),u.features.pop();for(var c=l[0],h=l[1],f=l[2],p=l[3],g=n/jt([c,h],[f,h],r)*(f-c),A=n/jt([c,h],[c,p],r)*(p-h),d=f-c,y=p-h,v=Math.floor(d/g),m=Math.floor(y/A),_=(d-v*g)/2,I=[],E=[],x=[],C=[],w=1/0,b=1/0,B=p-(y-m*A)/2,S=0;B>=h;){for(var M=[],L=[],N=c+_,T=0;N<=f;){var R=lt([N,B]),D=zy(R,o);M.push(D?0:1),L.push(N+"|"+B);var P=jt(R,t);!D&&P<w&&(w=P,x={x:T,y:S});var Q=jt(R,e);!D&&Q<b&&(b=Q,C={x:T,y:S}),N+=g,T++}E.push(M),I.push(L),B-=A,S++}var k=new qy(E,{diagonal:!0}),O=k.grid[x.y][x.x],F=k.grid[C.y][C.x],G=Uy.search(k,O,F),U=[s];return G.forEach((function(t){var e=I[t.x][t.y].split("|");U.push([+e[0],+e[1]])})),U.push(a),Sa(pt(U))},voronoi:function(t,e){if(!Lt(e=e||{}))throw new Error("options is invalid");var r=e.bbox||[-180,-85,180,85];if(!t)throw new Error("points is required");if(!Array.isArray(r))throw new Error("bbox is invalid");return Ft(t,"Point","points"),At(function(){var t=Hy,e=Xy,r=null;function n(n){return new Sv(n.map((function(r,i){var o=[Math.round(t(r,i,n)/wv)*wv,Math.round(e(r,i,n)/wv)*wv];return o.index=i,o.data=r,o})),r)}return n.polygons=function(t){return n(t).polygons()},n.links=function(t){return n(t).links()},n.triangles=function(t){return n(t).triangles()},n.x=function(e){return arguments.length?(t="function"==typeof e?e:Yy(+e),n):t},n.y=function(t){return arguments.length?(e="function"==typeof t?t:Yy(+t),n):e},n.extent=function(t){return arguments.length?(r=null==t?null:[[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]],n):r&&[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},n.size=function(t){return arguments.length?(r=null==t?null:[[0,0],[+t[0],+t[1]]],n):r&&[r[1][0]-r[0][0],r[1][1]-r[0][1]]},n}().x((function(t){return t.geometry.coordinates[0]})).y((function(t){return t.geometry.coordinates[1]})).extent([[r[0],r[1]],[r[2],r[3]]]).polygons(t.features).map(Mv))},ellipse:Lv,centerMean:Tv,centerMedian:function(t,e){if(void 0===e&&(e={}),!Lt(e=e||{}))throw new Error("options is invalid");var r=e.counter||10;if(!Mt(r))throw new Error("counter must be a number");var n=e.weight,i=Tv(t,{weight:e.weight}),o=At([]);Ua(t,(function(t){var e;o.features.push(Wc(t,{properties:{weight:null===(e=t.properties)||void 0===e?void 0:e[n]}}))}));var s={tolerance:e.tolerance,medianCandidates:[]};return Rv(i.geometry.coordinates,[0,0],o,s,r)},standardDeviationalEllipse:function(t,e){if(!Lt(e=e||{}))throw new Error("options is invalid");var r=e.steps||64,n=e.weight,i=e.properties||{};if(!Mt(r))throw new Error("steps must be a number");if(!Lt(i))throw new Error("properties must be a number");var o=ja(t).length,s=Tv(t,{weight:n}),a=0,u=0,l=0;Ua(t,(function(t){var e=t.properties[n]||1,r=Dv(Pt(t),Pt(s));a+=Math.pow(r.x,2)*e,u+=Math.pow(r.y,2)*e,l+=r.x*r.y*e}));var c=a-u,h=Math.sqrt(Math.pow(c,2)+4*Math.pow(l,2)),f=2*l,p=Math.atan((c+h)/f),g=180*p/Math.PI,A=0,d=0,y=0;Ua(t,(function(t){var e=t.properties[n]||1,r=Dv(Pt(t),Pt(s));A+=Math.pow(r.x*Math.cos(p)-r.y*Math.sin(p),2)*e,d+=Math.pow(r.x*Math.sin(p)+r.y*Math.cos(p),2)*e,y+=e}));var v=Math.sqrt(2*A/y),m=Math.sqrt(2*d/y),_=Lv(s,v,m,{units:"degrees",angle:g,steps:r,properties:i}),I=Xl(t,At([_])),E={meanCenterCoordinates:Pt(s),semiMajorAxis:v,semiMinorAxis:m,numberOfFeatures:o,angle:g,percentageWithinEllipse:100*ja(I).length/o};return _.properties.standardDeviationalEllipse=E,_},angle:function(t,e,r,n){if(void 0===n&&(n={}),!Lt(n))throw new Error("options is invalid");if(!t)throw new Error("startPoint is required");if(!e)throw new Error("midPoint is required");if(!r)throw new Error("endPoint is required");var i=t,o=e,s=r,a=Ct(!0!==n.mercator?Xc(i,o):MA(i,o)),u=Ct(!0!==n.mercator?Xc(s,o):MA(s,o)),l=Math.abs(a-u);return!0===n.explementary?360-l:l},polygonSmooth:function(t,e){var r=[],n=e.iterations||1;if(!t)throw new Error("inputPolys is required");return Va(t,(function(t,e,i){var o,s,a;switch(t.type){case"Polygon":o=[[]];for(var u=0;u<n;u++)a=[[]],s=t,u>0&&(s=ht(o).geometry),Pv(s,a),o=a.slice(0);r.push(ht(o,i));break;case"MultiPolygon":o=[[[]]];for(var l=0;l<n;l++)a=[[[]]],s=t,l>0&&(s=vt(o).geometry),Qv(s,a),o=a.slice(0);r.push(vt(o,i));break;default:throw new Error("geometry is invalid, must be Polygon or MultiPolygon")}})),At(r)},moranIndex:function(t,e){var r=e.inputField,n=e.threshold||1e5,i=e.p||2,o=e.binary||!1,s=Ov(t,{alpha:e.alpha||-1,binary:o,p:i,standardization:e.standardization||!0,threshold:n}),a=[];Ua(t,(function(t){var e=t.properties||{};a.push(e[r])}));for(var u=Fv(a),l=function(t){for(var e=Fv(t),r=0,n=0,i=t;n<i.length;n++){var o=i[n];r+=Math.pow(o-e,2)}return r/t.length}(a),c=0,h=0,f=0,p=0,g=s.length,A=0;A<g;A++){for(var d=0,y=0;y<g;y++)c+=s[A][y]*(a[A]-u)*(a[y]-u),h+=s[A][y],f+=Math.pow(s[A][y]+s[y][A],2),d+=s[A][y]+s[y][A];p+=Math.pow(d,2)}var v=c/h/l,m=-1/(g-1),_=(g*g*(f*=.5)-g*p+h*h*3)/((g-1)*(g+1)*(h*h))-m*m,I=Math.sqrt(_);return{expectedMoranIndex:m,moranIndex:v,stdNorm:I,zNorm:(v-m)/I}},distanceWeight:Ov,bearingToAngle:Ct,convertDistance:Bt,degrees2radians:bt,distanceToDegrees:xt,distanceToRadians:Et,radians2degrees:wt,radiansToDistance:It,difference:function(t,e){var r=Gt(t),n=Gt(e),i=t.properties||{},o=Km.difference(r.coordinates,n.coordinates);return 0===o.length?null:1===o.length?ht(o[0],i):vt(o,i)},buffer:function(t,e,r){var n=(r=r||{}).units||"kilometers",i=r.steps||8;if(!t)throw new Error("geojson is required");if("object"!=typeof r)throw new Error("options must be an object");if("number"!=typeof i)throw new Error("steps must be an number");if(void 0===e)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");var o=[];switch(t.type){case"GeometryCollection":return Va(t,(function(t){var r=nB(t,e,n,i);r&&o.push(r)})),At(o);case"FeatureCollection":return Ua(t,(function(t){var r=nB(t,e,n,i);r&&Ua(r,(function(t){t&&o.push(t)}))})),At(o)}return nB(t,e,n,i)},union:function(t,e,r){void 0===r&&(r={});var n=Gt(t),i=Gt(e),o=Km.union(n.coordinates,i.coordinates);return 0===o.length?null:1===o.length?ht(o[0],r.properties):vt(o,r.properties)},intersect:aB,dissolve:function(t,e){if(!Lt(e=e||{}))throw new Error("options is invalid");var r=e.propertyName;Ft(t,"Polygon","dissolve");var n=[];if(!e.propertyName)return gf(vt(Km.union.apply(null,t.features.map((function(t){return t.geometry.coordinates})))));var i={};Ua(t,(function(t){Object.prototype.hasOwnProperty.call(i,t.properties[r])||(i[t.properties[r]]=[]),i[t.properties[r]].push(t)}));for(var o=Object.keys(i),s=0;s<o.length;s++){var a=vt(Km.union.apply(null,i[o[s]].map((function(t){return t.geometry.coordinates}))));a.properties[r]=o[s],n.push(a)}return gf(At(n))},hexGrid:uB,mask:function(t,e){var r,n,i=fB(e),o=null;return"FeatureCollection"===t.type?(n=2===(r=t).features.length?Km.union(r.features[0].geometry.coordinates,r.features[1].geometry.coordinates):Km.union.apply(Km,r.features.map((function(t){return t.geometry.coordinates}))),o=hB(n)):o=hB(Km.union(t.geometry.coordinates)),o.geometry.coordinates.forEach((function(t){i.geometry.coordinates.push(t[0])})),i},squareGrid:pB,triangleGrid:gB,interpolate:function(t,e,r){if("object"!=typeof(r=r||{}))throw new Error("options is invalid");var n=r.gridType,i=r.property,o=r.weight;if(!t)throw new Error("points is required");if(Ft(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",n=n||"square",o=o||1;var s,a=ju(t);switch(n){case"point":case"points":s=ff(a,e,r);break;case"square":case"squares":s=pB(a,e,r);break;case"hex":case"hexes":s=uB(a,e,r);break;case"triangle":case"triangles":s=gB(a,e,r);break;default:throw new Error("invalid gridType")}var u=[];return Ua(s,(function(e){var s=0,a=0;Ua(t,(function(t){var u,l=jt("point"===n?e:Wc(e),t,r);if(void 0!==i&&(u=t.properties[i]),void 0===u&&(u=t.geometry.coordinates[2]),void 0===u)throw new Error("zValue is missing");0===l&&(s=u);var c=1/Math.pow(l,o);a+=c,s+=c*u}));var l=Ta(e);l.properties[i]=s/a,u.push(l)})),At(u)},toMercator:Gv,toWgs84:Uv,randomPosition:Hv,randomPoint:Xv,randomPolygon:Jv,randomLineString:Wv,getCluster:tm,clusterEach:em,clusterReduce:rm,createBins:nm,applyFilter:im,propertiesContainsFilter:om,filterProperties:sm,earthRadius:nt,factors:it,unitsFactors:ot,areaFactors:st,feature:at,geometry:ut,point:lt,points:ct,polygon:ht,polygons:ft,lineString:pt,lineStrings:gt,featureCollection:At,multiLineString:dt,multiPoint:yt,multiPolygon:vt,geometryCollection:mt,round:_t,radiansToLength:It,lengthToRadians:Et,lengthToDegrees:xt,bearingToAzimuth:Ct,radiansToDegrees:wt,degreesToRadians:bt,convertLength:Bt,convertArea:St,isNumber:Mt,isObject:Lt,validateBBox:Nt,validateId:Tt,getCoord:Dt,getCoords:Pt,containsNumber:Qt,geojsonType:kt,featureOf:Ot,collectionOf:Ft,getGeom:Gt,getType:Ut,coordAll:ja,coordEach:ka,coordReduce:Oa,featureEach:Ua,featureReduce:qa,findPoint:$a,findSegment:Za,flattenEach:Ya,flattenReduce:Ha,geomEach:Va,geomReduce:za,lineEach:Wa,lineReduce:Ka,propEach:Fa,propReduce:Ga,segmentEach:Xa,segmentReduce:Ja});exports.Arrow3D=wa,exports.CoordinateTransform=qu,exports.LineGeometry=ha,exports.LineMaterial=js,exports.TextureAnimator=Z,exports.drawTool=Uu,exports.gisCommon=Ht,exports.gltfLoadClass=Po,exports.imgClass=j,exports.layerClass=Gu,exports.line2Object=xa,exports.lineLength=G,exports.planeGifClass=va,exports.planeMark=ce,exports.planeSectorClass=$,exports.polygonClass=Fu,exports.radarClass=Y,exports.rippleWallClass=Fs,exports.sectorClass=J,exports.shockClass=rt,exports.sleep=R,exports.tileClass=To,exports.tripHeight=ba,exports.tripLineClass=Ba,exports.tubeClass=Ia,exports.turf=AB,exports.verticalFatLineClass=Aa;
158
+ ***************************************************************************** */function um(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}var lm=function(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null};function cm(t,e){return t>e?1:t<e?-1:0}function hm(t,e,r){for(var n=new lm(null,null),i=n,o=n;;){var s=r(t,e.key);if(s<0){if(null===e.left)break;if(r(t,e.left.key)<0){var a=e.left;if(e.left=a.right,a.right=e,null===(e=a).left)break}o.left=e,o=e,e=e.left}else{if(!(s>0))break;if(null===e.right)break;if(r(t,e.right.key)>0){a=e.right;if(e.right=a.left,a.left=e,null===(e=a).right)break}i.right=e,i=e,e=e.right}}return i.right=e.left,o.left=e.right,e.left=n.right,e.right=n.left,e}function fm(t,e,r,n){var i=new lm(t,e);if(null===r)return i.left=i.right=null,i;var o=n(t,(r=hm(t,r,n)).key);return o<0?(i.left=r.left,i.right=r,r.left=null):o>=0&&(i.right=r.right,i.left=r,r.right=null),i}function pm(t,e,r){var n=null,i=null;if(e){var o=r((e=hm(t,e,r)).key,t);0===o?(n=e.left,i=e.right):o<0?(i=e.right,e.right=null,n=e):(n=e.left,e.left=null,i=e)}return{left:n,right:i}}function gm(t,e,r,n,i){if(t){n(e+(r?"└── ":"├── ")+i(t)+"\n");var o=e+(r?" ":"│ ");t.left&&gm(t.left,o,!1,n,i),t.right&&gm(t.right,o,!0,n,i)}}var Am=function(){function t(t){void 0===t&&(t=cm),this._root=null,this._size=0,this._comparator=t}return t.prototype.insert=function(t,e){return this._size++,this._root=fm(t,e,this._root,this._comparator)},t.prototype.add=function(t,e){var r=new lm(t,e);null===this._root&&(r.left=r.right=null,this._size++,this._root=r);var n=this._comparator,i=hm(t,this._root,n),o=n(t,i.key);return 0===o?this._root=i:(o<0?(r.left=i.left,r.right=i,i.left=null):o>0&&(r.right=i.right,r.left=i,i.right=null),this._size++,this._root=r),this._root},t.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},t.prototype._remove=function(t,e,r){var n;return null===e?null:0===r(t,(e=hm(t,e,r)).key)?(null===e.left?n=e.right:(n=hm(t,e.left,r)).right=e.right,this._size--,n):e},t.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=hm(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},t.prototype.findStatic=function(t){for(var e=this._root,r=this._comparator;e;){var n=r(t,e.key);if(0===n)return e;e=n<0?e.left:e.right}return null},t.prototype.find=function(t){return this._root&&(this._root=hm(t,this._root,this._comparator),0!==this._comparator(t,this._root.key))?null:this._root},t.prototype.contains=function(t){for(var e=this._root,r=this._comparator;e;){var n=r(t,e.key);if(0===n)return!0;e=n<0?e.left:e.right}return!1},t.prototype.forEach=function(t,e){for(var r=this._root,n=[],i=!1;!i;)null!==r?(n.push(r),r=r.left):0!==n.length?(r=n.pop(),t.call(e,r),r=r.right):i=!0;return this},t.prototype.range=function(t,e,r,n){for(var i=[],o=this._comparator,s=this._root;0!==i.length||s;)if(s)i.push(s),s=s.left;else{if(o((s=i.pop()).key,e)>0)break;if(o(s.key,t)>=0&&r.call(n,s))return this;s=s.right}return this},t.prototype.keys=function(){var t=[];return this.forEach((function(e){var r=e.key;return t.push(r)})),t},t.prototype.values=function(){var t=[];return this.forEach((function(e){var r=e.data;return t.push(r)})),t},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.left;)t=t.left;return t},t.prototype.maxNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.right;)t=t.right;return t},t.prototype.at=function(t){for(var e=this._root,r=!1,n=0,i=[];!r;)if(e)i.push(e),e=e.left;else if(i.length>0){if(e=i.pop(),n===t)return e;n++,e=e.right}else r=!0;return null},t.prototype.next=function(t){var e=this._root,r=null;if(t.right){for(r=t.right;r.left;)r=r.left;return r}for(var n=this._comparator;e;){var i=n(t.key,e.key);if(0===i)break;i<0?(r=e,e=e.left):e=e.right}return r},t.prototype.prev=function(t){var e=this._root,r=null;if(null!==t.left){for(r=t.left;r.right;)r=r.right;return r}for(var n=this._comparator;e;){var i=n(t.key,e.key);if(0===i)break;i<0?e=e.left:(r=e,e=e.right)}return r},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return function(t){var e=t,r=[],n=!1,i=new lm(null,null),o=i;for(;!n;)e?(r.push(e),e=e.left):r.length>0?e=(e=o=o.next=r.pop()).right:n=!0;return o.next=null,i.next}(this._root)},t.prototype.load=function(t,e,r){void 0===e&&(e=[]),void 0===r&&(r=!1);var n=t.length,i=this._comparator;if(r&&vm(t,e,0,n-1,i),null===this._root)this._root=dm(t,e,0,n),this._size=n;else{var o=function(t,e,r){var n=new lm(null,null),i=n,o=t,s=e;for(;null!==o&&null!==s;)r(o.key,s.key)<0?(i.next=o,o=o.next):(i.next=s,s=s.next),i=i.next;null!==o?i.next=o:null!==s&&(i.next=s);return n.next}(this.toList(),function(t,e){for(var r=new lm(null,null),n=r,i=0;i<t.length;i++)n=n.next=new lm(t[i],e[i]);return n.next=null,r.next}(t,e),i);n=this._size+n,this._root=ym({head:o},0,n)}return this},t.prototype.isEmpty=function(){return null===this._root},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),t.prototype.toString=function(t){void 0===t&&(t=function(t){return String(t.key)});var e=[];return gm(this._root,"",!0,(function(t){return e.push(t)}),t),e.join("")},t.prototype.update=function(t,e,r){var n=this._comparator,i=pm(t,this._root,n),o=i.left,s=i.right;n(t,e)<0?s=fm(e,r,s,n):o=fm(e,r,o,n),this._root=function(t,e,r){return null===e?t:(null===t||((e=hm(t.key,e,r)).left=t),e)}(o,s,n)},t.prototype.split=function(t){return pm(t,this._root,this._comparator)},t.prototype[Symbol.iterator]=function(){var t,e,r;return um(this,(function(n){switch(n.label){case 0:t=this._root,e=[],r=!1,n.label=1;case 1:return r?[3,6]:null===t?[3,2]:(e.push(t),t=t.left,[3,5]);case 2:return 0===e.length?[3,4]:[4,t=e.pop()];case 3:return n.sent(),t=t.right,[3,5];case 4:r=!0,n.label=5;case 5:return[3,1];case 6:return[2]}}))},t}();function dm(t,e,r,n){var i=n-r;if(i>0){var o=r+Math.floor(i/2),s=t[o],a=e[o],u=new lm(s,a);return u.left=dm(t,e,r,o),u.right=dm(t,e,o+1,n),u}return null}function ym(t,e,r){var n=r-e;if(n>0){var i=e+Math.floor(n/2),o=ym(t,e,i),s=t.head;return s.left=o,t.head=t.head.next,s.right=ym(t,i+1,r),s}return null}function vm(t,e,r,n,i){if(!(r>=n)){for(var o=t[r+n>>1],s=r-1,a=n+1;;){do{s++}while(i(t[s],o)<0);do{a--}while(i(t[a],o)>0);if(s>=a)break;var u=t[s];t[s]=t[a],t[a]=u,u=e[s],e[s]=e[a],e[a]=u}vm(t,e,r,a,i),vm(t,e,a+1,n,i)}}function mm(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _m(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Im(t,e,r){return e&&_m(t.prototype,e),r&&_m(t,r),t}var Em=function(t,e){return t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y},xm=function(t,e){if(e.ur.x<t.ll.x||t.ur.x<e.ll.x||e.ur.y<t.ll.y||t.ur.y<e.ll.y)return null;var r=t.ll.x<e.ll.x?e.ll.x:t.ll.x,n=t.ur.x<e.ur.x?t.ur.x:e.ur.x;return{ll:{x:r,y:t.ll.y<e.ll.y?e.ll.y:t.ll.y},ur:{x:n,y:t.ur.y<e.ur.y?t.ur.y:e.ur.y}}},Cm=Number.EPSILON;void 0===Cm&&(Cm=Math.pow(2,-52));var wm=Cm*Cm,bm=function(t,e){if(-Cm<t&&t<Cm&&-Cm<e&&e<Cm)return 0;var r=t-e;return r*r<wm*t*e?0:t<e?-1:1},Bm=function(){function t(){mm(this,t),this.reset()}return Im(t,[{key:"reset",value:function(){this.xRounder=new Sm,this.yRounder=new Sm}},{key:"round",value:function(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}]),t}(),Sm=function(){function t(){mm(this,t),this.tree=new Am,this.round(0)}return Im(t,[{key:"round",value:function(t){var e=this.tree.add(t),r=this.tree.prev(e);if(null!==r&&0===bm(e.key,r.key))return this.tree.remove(t),r.key;var n=this.tree.next(e);return null!==n&&0===bm(e.key,n.key)?(this.tree.remove(t),n.key):t}}]),t}(),Mm=new Bm,Lm=function(t,e){return t.x*e.y-t.y*e.x},Nm=function(t,e){return t.x*e.x+t.y*e.y},Tm=function(t,e,r){var n={x:e.x-t.x,y:e.y-t.y},i={x:r.x-t.x,y:r.y-t.y},o=Lm(n,i);return bm(o,0)},Rm=function(t){return Math.sqrt(Nm(t,t))},Dm=function(t,e,r){var n={x:e.x-t.x,y:e.y-t.y},i={x:r.x-t.x,y:r.y-t.y};return Nm(i,n)/Rm(i)/Rm(n)},Pm=function(t,e,r){return 0===e.y?null:{x:t.x+e.x/e.y*(r-t.y),y:r}},Qm=function(t,e,r){return 0===e.x?null:{x:r,y:t.y+e.y/e.x*(r-t.x)}},km=function(){function t(e,r){mm(this,t),void 0===e.events?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=r}return Im(t,null,[{key:"compare",value:function(e,r){var n=t.comparePoints(e.point,r.point);return 0!==n?n:(e.point!==r.point&&e.link(r),e.isLeft!==r.isLeft?e.isLeft?1:-1:Fm.compare(e.segment,r.segment))}},{key:"comparePoints",value:function(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}}]),Im(t,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var e=t.point.events,r=0,n=e.length;r<n;r++){var i=e[r];this.point.events.push(i),i.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var t=this.point.events.length,e=0;e<t;e++){var r=this.point.events[e];if(void 0===r.segment.consumedBy)for(var n=e+1;n<t;n++){var i=this.point.events[n];void 0===i.consumedBy&&(r.otherSE.point.events===i.otherSE.point.events&&r.segment.consume(i.segment))}}}},{key:"getAvailableLinkedEvents",value:function(){for(var t=[],e=0,r=this.point.events.length;e<r;e++){var n=this.point.events[e];n!==this&&!n.segment.ringOut&&n.segment.isInResult()&&t.push(n)}return t}},{key:"getLeftmostComparator",value:function(t){var e=this,r=new Map,n=function(n){var i,o,s,a,u,l=n.otherSE;r.set(n,{sine:(i=e.point,o=t.point,s=l.point,a={x:o.x-i.x,y:o.y-i.y},u={x:s.x-i.x,y:s.y-i.y},Lm(u,a)/Rm(u)/Rm(a)),cosine:Dm(e.point,t.point,l.point)})};return function(t,e){r.has(t)||n(t),r.has(e)||n(e);var i=r.get(t),o=i.sine,s=i.cosine,a=r.get(e),u=a.sine,l=a.cosine;return o>=0&&u>=0?s<l?1:s>l?-1:0:o<0&&u<0?s<l?-1:s>l?1:0:u<o?-1:u>o?1:0}}}]),t}(),Om=0,Fm=function(){function t(e,r,n,i){mm(this,t),this.id=++Om,this.leftSE=e,e.segment=this,e.otherSE=r,this.rightSE=r,r.segment=this,r.otherSE=e,this.rings=n,this.windings=i}return Im(t,null,[{key:"compare",value:function(t,e){var r=t.leftSE.point.x,n=e.leftSE.point.x,i=t.rightSE.point.x,o=e.rightSE.point.x;if(o<r)return 1;if(i<n)return-1;var s=t.leftSE.point.y,a=e.leftSE.point.y,u=t.rightSE.point.y,l=e.rightSE.point.y;if(r<n){if(a<s&&a<u)return 1;if(a>s&&a>u)return-1;var c=t.comparePoint(e.leftSE.point);if(c<0)return 1;if(c>0)return-1;var h=e.comparePoint(t.rightSE.point);return 0!==h?h:-1}if(r>n){if(s<a&&s<l)return-1;if(s>a&&s>l)return 1;var f=e.comparePoint(t.leftSE.point);if(0!==f)return f;var p=t.comparePoint(e.rightSE.point);return p<0?1:p>0?-1:1}if(s<a)return-1;if(s>a)return 1;if(i<o){var g=e.comparePoint(t.rightSE.point);if(0!==g)return g}if(i>o){var A=t.comparePoint(e.rightSE.point);if(A<0)return 1;if(A>0)return-1}if(i!==o){var d=u-s,y=i-r,v=l-a,m=o-n;if(d>y&&v<m)return 1;if(d<y&&v>m)return-1}return i>o?1:i<o||u<l?-1:u>l?1:t.id<e.id?-1:t.id>e.id?1:0}}]),Im(t,[{key:"replaceRightSE",value:function(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var t=this.leftSE.point.y,e=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t<e?t:e},ur:{x:this.rightSE.point.x,y:t>e?t:e}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}},{key:"comparePoint",value:function(t){if(this.isAnEndpoint(t))return 0;var e=this.leftSE.point,r=this.rightSE.point,n=this.vector();if(e.x===r.x)return t.x===e.x?0:t.x<e.x?1:-1;var i=(t.y-e.y)/n.y,o=e.x+i*n.x;if(t.x===o)return 0;var s=(t.x-e.x)/n.x,a=e.y+s*n.y;return t.y===a?0:t.y<a?-1:1}},{key:"getIntersection",value:function(t){var e=this.bbox(),r=t.bbox(),n=xm(e,r);if(null===n)return null;var i=this.leftSE.point,o=this.rightSE.point,s=t.leftSE.point,a=t.rightSE.point,u=Em(e,s)&&0===this.comparePoint(s),l=Em(r,i)&&0===t.comparePoint(i),c=Em(e,a)&&0===this.comparePoint(a),h=Em(r,o)&&0===t.comparePoint(o);if(l&&u)return h&&!c?o:!h&&c?a:null;if(l)return c&&i.x===a.x&&i.y===a.y?null:i;if(u)return h&&o.x===s.x&&o.y===s.y?null:s;if(h&&c)return null;if(h)return o;if(c)return a;var f=function(t,e,r,n){if(0===e.x)return Qm(r,n,t.x);if(0===n.x)return Qm(t,e,r.x);if(0===e.y)return Pm(r,n,t.y);if(0===n.y)return Pm(t,e,r.y);var i=Lm(e,n);if(0==i)return null;var o={x:r.x-t.x,y:r.y-t.y},s=Lm(o,e)/i,a=Lm(o,n)/i;return{x:(t.x+a*e.x+(r.x+s*n.x))/2,y:(t.y+a*e.y+(r.y+s*n.y))/2}}(i,this.vector(),s,t.vector());return null===f?null:Em(n,f)?Mm.round(f.x,f.y):null}},{key:"split",value:function(e){var r=[],n=void 0!==e.events,i=new km(e,!0),o=new km(e,!1),s=this.rightSE;this.replaceRightSE(o),r.push(o),r.push(i);var a=new t(i,s,this.rings.slice(),this.windings.slice());return km.comparePoints(a.leftSE.point,a.rightSE.point)>0&&a.swapEvents(),km.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(i.checkForConsuming(),o.checkForConsuming()),r}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var e=0,r=this.windings.length;e<r;e++)this.windings[e]*=-1}},{key:"consume",value:function(e){for(var r=this,n=e;r.consumedBy;)r=r.consumedBy;for(;n.consumedBy;)n=n.consumedBy;var i=t.compare(r,n);if(0!==i){if(i>0){var o=r;r=n,n=o}if(r.prev===n){var s=r;r=n,n=s}for(var a=0,u=n.rings.length;a<u;a++){var l=n.rings[a],c=n.windings[a],h=r.rings.indexOf(l);-1===h?(r.rings.push(l),r.windings.push(c)):r.windings[h]+=c}n.rings=null,n.windings=null,n.consumedBy=r,n.leftSE.consumedBy=r.leftSE,n.rightSE.consumedBy=r.rightSE}}},{key:"prevInResult",value:function(){return void 0!==this._prevInResult||(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null),this._prevInResult}},{key:"beforeState",value:function(){if(void 0!==this._beforeState)return this._beforeState;if(this.prev){var t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}else this._beforeState={rings:[],windings:[],multiPolys:[]};return this._beforeState}},{key:"afterState",value:function(){if(void 0!==this._afterState)return this._afterState;var t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};for(var e=this._afterState.rings,r=this._afterState.windings,n=this._afterState.multiPolys,i=0,o=this.rings.length;i<o;i++){var s=this.rings[i],a=this.windings[i],u=e.indexOf(s);-1===u?(e.push(s),r.push(a)):r[u]+=a}for(var l=[],c=[],h=0,f=e.length;h<f;h++)if(0!==r[h]){var p=e[h],g=p.poly;if(-1===c.indexOf(g))if(p.isExterior)l.push(g);else{-1===c.indexOf(g)&&c.push(g);var A=l.indexOf(p.poly);-1!==A&&l.splice(A,1)}}for(var d=0,y=l.length;d<y;d++){var v=l[d].multiPoly;-1===n.indexOf(v)&&n.push(v)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(void 0!==this._isInResult)return this._isInResult;var t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch(Wm.type){case"union":var r=0===t.length,n=0===e.length;this._isInResult=r!==n;break;case"intersection":var i,o;t.length<e.length?(i=t.length,o=e.length):(i=e.length,o=t.length),this._isInResult=o===Wm.numMultiPolys&&i<o;break;case"xor":var s=Math.abs(t.length-e.length);this._isInResult=s%2==1;break;case"difference":var a=function(t){return 1===t.length&&t[0].isSubject};this._isInResult=a(t)!==a(e);break;default:throw new Error("Unrecognized operation type found ".concat(Wm.type))}return this._isInResult}}],[{key:"fromRing",value:function(e,r,n){var i,o,s,a=km.comparePoints(e,r);if(a<0)i=e,o=r,s=1;else{if(!(a>0))throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));i=r,o=e,s=-1}return new t(new km(i,!0),new km(o,!1),[n],[s])}}]),t}(),Gm=function(){function t(e,r,n){if(mm(this,t),!Array.isArray(e)||0===e.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=r,this.isExterior=n,this.segments=[],"number"!=typeof e[0][0]||"number"!=typeof e[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var i=Mm.round(e[0][0],e[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};for(var o=i,s=1,a=e.length;s<a;s++){if("number"!=typeof e[s][0]||"number"!=typeof e[s][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var u=Mm.round(e[s][0],e[s][1]);u.x===o.x&&u.y===o.y||(this.segments.push(Fm.fromRing(o,u,this)),u.x<this.bbox.ll.x&&(this.bbox.ll.x=u.x),u.y<this.bbox.ll.y&&(this.bbox.ll.y=u.y),u.x>this.bbox.ur.x&&(this.bbox.ur.x=u.x),u.y>this.bbox.ur.y&&(this.bbox.ur.y=u.y),o=u)}i.x===o.x&&i.y===o.y||this.segments.push(Fm.fromRing(o,i,this))}return Im(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,r=this.segments.length;e<r;e++){var n=this.segments[e];t.push(n.leftSE),t.push(n.rightSE)}return t}}]),t}(),Um=function(){function t(e,r){if(mm(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Gm(e[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(var n=1,i=e.length;n<i;n++){var o=new Gm(e[n],this,!1);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=r}return Im(t,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),e=0,r=this.interiorRings.length;e<r;e++)for(var n=this.interiorRings[e].getSweepEvents(),i=0,o=n.length;i<o;i++)t.push(n[i]);return t}}]),t}(),qm=function(){function t(e,r){if(mm(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{"number"==typeof e[0][0][0]&&(e=[e])}catch(t){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var n=0,i=e.length;n<i;n++){var o=new Um(e[n],this);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=r}return Im(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,r=this.polys.length;e<r;e++)for(var n=this.polys[e].getSweepEvents(),i=0,o=n.length;i<o;i++)t.push(n[i]);return t}}]),t}(),jm=function(){function t(e){mm(this,t),this.events=e;for(var r=0,n=e.length;r<n;r++)e[r].segment.ringOut=this;this.poly=null}return Im(t,null,[{key:"factory",value:function(e){for(var r=[],n=0,i=e.length;n<i;n++){var o=e[n];if(o.isInResult()&&!o.ringOut){for(var s=null,a=o.leftSE,u=o.rightSE,l=[a],c=a.point,h=[];s=a,a=u,l.push(a),a.point!==c;)for(;;){var f=a.getAvailableLinkedEvents();if(0===f.length){var p=l[0].point,g=l[l.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(p.x,",")+" ".concat(p.y,"]. Last matching segment found ends at")+" [".concat(g.x,", ").concat(g.y,"]."))}if(1===f.length){u=f[0].otherSE;break}for(var A=null,d=0,y=h.length;d<y;d++)if(h[d].point===a.point){A=d;break}if(null===A){h.push({index:l.length,point:a.point});var v=a.getLeftmostComparator(s);u=f.sort(v)[0].otherSE;break}var m=h.splice(A)[0],_=l.splice(m.index);_.unshift(_[0].otherSE),r.push(new t(_.reverse()))}r.push(new t(l))}}return r}}]),Im(t,[{key:"getGeom",value:function(){for(var t=this.events[0].point,e=[t],r=1,n=this.events.length-1;r<n;r++){var i=this.events[r].point,o=this.events[r+1].point;0!==Tm(i,t,o)&&(e.push(i),t=i)}if(1===e.length)return null;var s=e[0],a=e[1];0===Tm(s,t,a)&&e.shift(),e.push(e[0]);for(var u=this.isExteriorRing()?1:-1,l=this.isExteriorRing()?0:e.length-1,c=this.isExteriorRing()?e.length:-1,h=[],f=l;f!=c;f+=u)h.push([e[f].x,e[f].y]);return h}},{key:"isExteriorRing",value:function(){if(void 0===this._isExteriorRing){var t=this.enclosingRing();this._isExteriorRing=!t||!t.isExteriorRing()}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return void 0===this._enclosingRing&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var t=this.events[0],e=1,r=this.events.length;e<r;e++){var n=this.events[e];km.compare(t,n)>0&&(t=n)}for(var i=t.segment.prevInResult(),o=i?i.prevInResult():null;;){if(!i)return null;if(!o)return i.ringOut;if(o.ringOut!==i.ringOut)return o.ringOut.enclosingRing()!==i.ringOut?i.ringOut:i.ringOut.enclosingRing();i=o.prevInResult(),o=i?i.prevInResult():null}}}]),t}(),Vm=function(){function t(e){mm(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return Im(t,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(null===t[0])return null;for(var e=0,r=this.interiorRings.length;e<r;e++){var n=this.interiorRings[e].getGeom();null!==n&&t.push(n)}return t}}]),t}(),zm=function(){function t(e){mm(this,t),this.rings=e,this.polys=this._composePolys(e)}return Im(t,[{key:"getGeom",value:function(){for(var t=[],e=0,r=this.polys.length;e<r;e++){var n=this.polys[e].getGeom();null!==n&&t.push(n)}return t}},{key:"_composePolys",value:function(t){for(var e=[],r=0,n=t.length;r<n;r++){var i=t[r];if(!i.poly)if(i.isExteriorRing())e.push(new Vm(i));else{var o=i.enclosingRing();o.poly||e.push(new Vm(o)),o.poly.addInterior(i)}}return e}}]),t}(),Ym=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Fm.compare;mm(this,t),this.queue=e,this.tree=new Am(r),this.segments=[]}return Im(t,[{key:"process",value:function(t){var e=t.segment,r=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),r;var n=t.isLeft?this.tree.insert(e):this.tree.find(e);if(!n)throw new Error("Unable to find segment #".concat(e.id," ")+"[".concat(e.leftSE.point.x,", ").concat(e.leftSE.point.y,"] -> ")+"[".concat(e.rightSE.point.x,", ").concat(e.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var i=n,o=n,s=void 0,a=void 0;void 0===s;)null===(i=this.tree.prev(i))?s=null:void 0===i.key.consumedBy&&(s=i.key);for(;void 0===a;)null===(o=this.tree.next(o))?a=null:void 0===o.key.consumedBy&&(a=o.key);if(t.isLeft){var u=null;if(s){var l=s.getIntersection(e);if(null!==l&&(e.isAnEndpoint(l)||(u=l),!s.isAnEndpoint(l)))for(var c=this._splitSafely(s,l),h=0,f=c.length;h<f;h++)r.push(c[h])}var p=null;if(a){var g=a.getIntersection(e);if(null!==g&&(e.isAnEndpoint(g)||(p=g),!a.isAnEndpoint(g)))for(var A=this._splitSafely(a,g),d=0,y=A.length;d<y;d++)r.push(A[d])}if(null!==u||null!==p){var v=null;if(null===u)v=p;else if(null===p)v=u;else{v=km.comparePoints(u,p)<=0?u:p}this.queue.remove(e.rightSE),r.push(e.rightSE);for(var m=e.split(v),_=0,I=m.length;_<I;_++)r.push(m[_])}r.length>0?(this.tree.remove(e),r.push(t)):(this.segments.push(e),e.prev=s)}else{if(s&&a){var E=s.getIntersection(a);if(null!==E){if(!s.isAnEndpoint(E))for(var x=this._splitSafely(s,E),C=0,w=x.length;C<w;C++)r.push(x[C]);if(!a.isAnEndpoint(E))for(var b=this._splitSafely(a,E),B=0,S=b.length;B<S;B++)r.push(b[B])}}this.tree.remove(e)}return r}},{key:"_splitSafely",value:function(t,e){this.tree.remove(t);var r=t.rightSE;this.queue.remove(r);var n=t.split(e);return n.push(r),void 0===t.consumedBy&&this.tree.insert(t),n}}]),t}(),Hm="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,Xm="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,Jm=function(){function t(){mm(this,t)}return Im(t,[{key:"run",value:function(t,e,r){Wm.type=t,Mm.reset();for(var n=[new qm(e,!0)],i=0,o=r.length;i<o;i++)n.push(new qm(r[i],!1));if(Wm.numMultiPolys=n.length,"difference"===Wm.type)for(var s=n[0],a=1;a<n.length;)null!==xm(n[a].bbox,s.bbox)?a++:n.splice(a,1);if("intersection"===Wm.type)for(var u=0,l=n.length;u<l;u++)for(var c=n[u],h=u+1,f=n.length;h<f;h++)if(null===xm(c.bbox,n[h].bbox))return[];for(var p=new Am(km.compare),g=0,A=n.length;g<A;g++)for(var d=n[g].getSweepEvents(),y=0,v=d.length;y<v;y++)if(p.insert(d[y]),p.size>Hm)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var m=new Ym(p),_=p.size,I=p.pop();I;){var E=I.key;if(p.size===_){var x=E.segment;throw new Error("Unable to pop() ".concat(E.isLeft?"left":"right"," SweepEvent ")+"[".concat(E.point.x,", ").concat(E.point.y,"] from segment #").concat(x.id," ")+"[".concat(x.leftSE.point.x,", ").concat(x.leftSE.point.y,"] -> ")+"[".concat(x.rightSE.point.x,", ").concat(x.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(p.size>Hm)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(m.segments.length>Xm)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var C=m.process(E),w=0,b=C.length;w<b;w++){var B=C[w];void 0===B.consumedBy&&p.insert(B)}_=p.size,I=p.pop()}Mm.reset();var S=jm.factory(m.segments);return new zm(S).getGeom()}}]),t}(),Wm=new Jm,Km={union:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return Wm.run("union",t,r)},intersection:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return Wm.run("intersection",t,r)},xor:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return Wm.run("xor",t,r)},difference:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return Wm.run("difference",t,r)}};"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(t){if(null==this)throw new TypeError(this+" is not an object");var e=Object(this),r=Math.max(Math.min(e.length,9007199254740991),0)||0,n=1 in arguments&&parseInt(Number(arguments[1]),10)||0;n=n<0?Math.max(r+n,0):Math.min(n,r);var i=2 in arguments&&void 0!==arguments[2]?parseInt(Number(arguments[2]),10)||0:r;for(i=i<0?Math.max(r+arguments[2],0):Math.min(i,r);n<i;)e[n]=t,++n;return e},writable:!0}),Number.isFinite=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},Number.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(t){return t!=t},Math.trunc=Math.trunc||function(t){return t<0?Math.ceil(t):Math.floor(t)};var Zm=function(){};Zm.prototype.interfaces_=function(){return[]},Zm.prototype.getClass=function(){return Zm},Zm.prototype.equalsWithTolerance=function(t,e,r){return Math.abs(t-e)<=r};var $m=function(t){function e(e){t.call(this,e),this.name="IllegalArgumentException",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),t_=function(){},e_={MAX_VALUE:{configurable:!0}};t_.isNaN=function(t){return Number.isNaN(t)},t_.doubleToLongBits=function(t){return t},t_.longBitsToDouble=function(t){return t},t_.isInfinite=function(t){return!Number.isFinite(t)},e_.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(t_,e_);var r_=function(){},n_=function(){},i_=function(){};function o_(){}var s_=function t(){if(this.x=null,this.y=null,this.z=null,0===arguments.length)this.x=0,this.y=0,this.z=t.NULL_ORDINATE;else if(1===arguments.length){var e=arguments[0];this.x=e.x,this.y=e.y,this.z=e.z}else 2===arguments.length?(this.x=arguments[0],this.y=arguments[1],this.z=t.NULL_ORDINATE):3===arguments.length&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},a_={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};s_.prototype.setOrdinate=function(t,e){switch(t){case s_.X:this.x=e;break;case s_.Y:this.y=e;break;case s_.Z:this.z=e;break;default:throw new $m("Invalid ordinate index: "+t)}},s_.prototype.equals2D=function(){if(1===arguments.length){var t=arguments[0];return this.x===t.x&&this.y===t.y}if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!Zm.equalsWithTolerance(this.x,e.x,r)&&!!Zm.equalsWithTolerance(this.y,e.y,r)}},s_.prototype.getOrdinate=function(t){switch(t){case s_.X:return this.x;case s_.Y:return this.y;case s_.Z:return this.z}throw new $m("Invalid ordinate index: "+t)},s_.prototype.equals3D=function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||t_.isNaN(this.z))&&t_.isNaN(t.z)},s_.prototype.equals=function(t){return t instanceof s_&&this.equals2D(t)},s_.prototype.equalInZ=function(t,e){return Zm.equalsWithTolerance(this.z,t.z,e)},s_.prototype.compareTo=function(t){var e=t;return this.x<e.x?-1:this.x>e.x?1:this.y<e.y?-1:this.y>e.y?1:0},s_.prototype.clone=function(){},s_.prototype.copy=function(){return new s_(this)},s_.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},s_.prototype.distance3D=function(t){var e=this.x-t.x,r=this.y-t.y,n=this.z-t.z;return Math.sqrt(e*e+r*r+n*n)},s_.prototype.distance=function(t){var e=this.x-t.x,r=this.y-t.y;return Math.sqrt(e*e+r*r)},s_.prototype.hashCode=function(){var t=17;return t=37*(t=37*t+s_.hashCode(this.x))+s_.hashCode(this.y)},s_.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},s_.prototype.interfaces_=function(){return[r_,n_,o_]},s_.prototype.getClass=function(){return s_},s_.hashCode=function(){if(1===arguments.length){var t=t_.doubleToLongBits(arguments[0]);return Math.trunc((t^t)>>>32)}},a_.DimensionalComparator.get=function(){return u_},a_.serialVersionUID.get=function(){return 0x5cbf2c235c7e5800},a_.NULL_ORDINATE.get=function(){return t_.NaN},a_.X.get=function(){return 0},a_.Y.get=function(){return 1},a_.Z.get=function(){return 2},Object.defineProperties(s_,a_);var u_=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 $m("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};u_.prototype.compare=function(t,e){var r=t,n=e,i=u_.compare(r.x,n.x);if(0!==i)return i;var o=u_.compare(r.y,n.y);return 0!==o?o:this._dimensionsToTest<=2?0:u_.compare(r.z,n.z)},u_.prototype.interfaces_=function(){return[i_]},u_.prototype.getClass=function(){return u_},u_.compare=function(t,e){return t<e?-1:t>e?1:t_.isNaN(t)?t_.isNaN(e)?0:-1:t_.isNaN(e)?1:0};var l_=function(){};l_.prototype.create=function(){},l_.prototype.interfaces_=function(){return[]},l_.prototype.getClass=function(){return l_};var c_=function(){},h_={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};c_.prototype.interfaces_=function(){return[]},c_.prototype.getClass=function(){return c_},c_.toLocationSymbol=function(t){switch(t){case c_.EXTERIOR:return"e";case c_.BOUNDARY:return"b";case c_.INTERIOR:return"i";case c_.NONE:return"-"}throw new $m("Unknown location value: "+t)},h_.INTERIOR.get=function(){return 0},h_.BOUNDARY.get=function(){return 1},h_.EXTERIOR.get=function(){return 2},h_.NONE.get=function(){return-1},Object.defineProperties(c_,h_);var f_=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},p_=function(){},g_={LOG_10:{configurable:!0}};p_.prototype.interfaces_=function(){return[]},p_.prototype.getClass=function(){return p_},p_.log10=function(t){var e=Math.log(t);return t_.isInfinite(e)||t_.isNaN(e)?e:e/p_.LOG_10},p_.min=function(t,e,r,n){var i=t;return e<i&&(i=e),r<i&&(i=r),n<i&&(i=n),i},p_.clamp=function(){if("number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1],r=arguments[2];return t<e?e:t>r?r:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var n=arguments[0],i=arguments[1],o=arguments[2];return n<i?i:n>o?o:n}},p_.wrap=function(t,e){return t<0?e- -t%e:t%e},p_.max=function(){if(3===arguments.length){var t=arguments[1],e=arguments[2],r=arguments[0];return t>r&&(r=t),e>r&&(r=e),r}if(4===arguments.length){var n=arguments[1],i=arguments[2],o=arguments[3],s=arguments[0];return n>s&&(s=n),i>s&&(s=i),o>s&&(s=o),s}},p_.average=function(t,e){return(t+e)/2},g_.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(p_,g_);var A_=function(t){this.str=t};A_.prototype.append=function(t){this.str+=t},A_.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},A_.prototype.toString=function(t){return this.str};var d_=function(t){this.value=t};d_.prototype.intValue=function(){return this.value},d_.prototype.compareTo=function(t){return this.value<t?-1:this.value>t?1:0},d_.isNaN=function(t){return Number.isNaN(t)};var y_=function(){};y_.isWhitespace=function(t){return t<=32&&t>=0||127===t},y_.toUpperCase=function(t){return t.toUpperCase()};var v_=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 r=arguments[0];this.init(r)}else if("string"==typeof arguments[0]){t.call(this,t.parse(arguments[0]))}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.init(n,i)}},m_={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}};v_.prototype.le=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<=t._lo},v_.prototype.extractSignificantDigits=function(t,e){var r=this.abs(),n=v_.magnitude(r._hi),i=v_.TEN.pow(n);(r=r.divide(i)).gt(v_.TEN)?(r=r.divide(v_.TEN),n+=1):r.lt(v_.ONE)&&(r=r.multiply(v_.TEN),n-=1);for(var o=n+1,s=new A_,a=v_.MAX_PRINT_DIGITS-1,u=0;u<=a;u++){t&&u===o&&s.append(".");var l=Math.trunc(r._hi);if(l<0)break;var c=!1,h=0;l>9?(c=!0,h="9"):h="0"+l,s.append(h),r=r.subtract(v_.valueOf(l)).multiply(v_.TEN),c&&r.selfAdd(v_.TEN);var f=!0,p=v_.magnitude(r._hi);if(p<0&&Math.abs(p)>=a-u&&(f=!1),!f)break}return e[0]=n,s.toString()},v_.prototype.sqr=function(){return this.multiply(this)},v_.prototype.doubleValue=function(){return this._hi+this._lo},v_.prototype.subtract=function(){if(arguments[0]instanceof v_){var t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){var e=arguments[0];return this.add(-e)}},v_.prototype.equals=function(){if(1===arguments.length){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},v_.prototype.isZero=function(){return 0===this._hi&&0===this._lo},v_.prototype.selfSubtract=function(){if(arguments[0]instanceof v_){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)}},v_.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},v_.prototype.min=function(t){return this.le(t)?this:t},v_.prototype.selfDivide=function(){if(1===arguments.length){if(arguments[0]instanceof v_){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 r,n,i,o,s=arguments[0],a=arguments[1],u=null,l=null,c=null,h=null;return i=this._hi/s,h=(u=(c=v_.SPLIT*i)-(u=c-i))*(l=(h=v_.SPLIT*s)-(l=h-s))-(o=i*s)+u*(n=s-l)+(r=i-u)*l+r*n,h=i+(c=(this._hi-o-h+this._lo-i*a)/s),this._hi=h,this._lo=i-h+c,this}},v_.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},v_.prototype.divide=function(){if(arguments[0]instanceof v_){var t,e,r,n,i=arguments[0],o=null,s=null,a=null,u=null;return t=(r=this._hi/i._hi)-(o=(a=v_.SPLIT*r)-(o=a-r)),u=o*(s=(u=v_.SPLIT*i._hi)-(s=u-i._hi))-(n=r*i._hi)+o*(e=i._hi-s)+t*s+t*e,a=(this._hi-n-u+this._lo-r*i._lo)/i._hi,new v_(u=r+a,r-u+a)}if("number"==typeof arguments[0]){var l=arguments[0];return t_.isNaN(l)?v_.createNaN():v_.copy(this).selfDivide(l,0)}},v_.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},v_.prototype.pow=function(t){if(0===t)return v_.valueOf(1);var e=new v_(this),r=v_.valueOf(1),n=Math.abs(t);if(n>1)for(;n>0;)n%2==1&&r.selfMultiply(e),(n/=2)>0&&(e=e.sqr());else r=e;return t<0?r.reciprocal():r},v_.prototype.ceil=function(){if(this.isNaN())return v_.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new v_(t,e)},v_.prototype.compareTo=function(t){var e=t;return this._hi<e._hi?-1:this._hi>e._hi?1:this._lo<e._lo?-1:this._lo>e._lo?1:0},v_.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},v_.prototype.setValue=function(){if(arguments[0]instanceof v_){var t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){var e=arguments[0];return this.init(e),this}},v_.prototype.max=function(t){return this.ge(t)?this:t},v_.prototype.sqrt=function(){if(this.isZero())return v_.valueOf(0);if(this.isNegative())return v_.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,r=v_.valueOf(e),n=this.subtract(r.sqr())._hi*(.5*t);return r.add(n)},v_.prototype.selfAdd=function(){if(1===arguments.length){if(arguments[0]instanceof v_){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if("number"==typeof arguments[0]){var e,r,n,i,o,s=arguments[0],a=null;return a=(n=this._hi+s)-(i=n-this._hi),r=(o=(a=s-i+(this._hi-a))+this._lo)+(n-(e=n+o)),this._hi=e+r,this._lo=r+(e-this._hi),this}}else if(2===arguments.length){var u,l,c,h,f=arguments[0],p=arguments[1],g=null,A=null,d=null;c=this._hi+f,l=this._lo+p,A=c-(d=c-this._hi),g=l-(h=l-this._lo);var y=(u=c+(d=(A=f-d+(this._hi-A))+l))+(d=(g=p-h+(this._lo-g))+(d+(c-u))),v=d+(u-y);return this._hi=y,this._lo=v,this}},v_.prototype.selfMultiply=function(){if(1===arguments.length){if(arguments[0]instanceof v_){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 r,n,i=arguments[0],o=arguments[1],s=null,a=null,u=null,l=null;s=(u=v_.SPLIT*this._hi)-this._hi,l=v_.SPLIT*i,s=u-s,r=this._hi-s,a=l-i;var c=(u=this._hi*i)+(l=s*(a=l-a)-u+s*(n=i-a)+r*a+r*n+(this._hi*o+this._lo*i)),h=l+(s=u-c);return this._hi=c,this._lo=h,this}},v_.prototype.selfSqr=function(){return this.selfMultiply(this)},v_.prototype.floor=function(){if(this.isNaN())return v_.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new v_(t,e)},v_.prototype.negate=function(){return this.isNaN()?this:new v_(-this._hi,-this._lo)},v_.prototype.clone=function(){},v_.prototype.multiply=function(){if(arguments[0]instanceof v_){var t=arguments[0];return t.isNaN()?v_.createNaN():v_.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){var e=arguments[0];return t_.isNaN(e)?v_.createNaN():v_.copy(this).selfMultiply(e,0)}},v_.prototype.isNaN=function(){return t_.isNaN(this._hi)},v_.prototype.intValue=function(){return Math.trunc(this._hi)},v_.prototype.toString=function(){var t=v_.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()},v_.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),r=this.extractSignificantDigits(!0,e),n=e[0]+1,i=r;if("."===r.charAt(0))i="0"+r;else if(n<0)i="0."+v_.stringOfChar("0",-n)+r;else if(-1===r.indexOf(".")){var o=n-r.length;i=r+v_.stringOfChar("0",o)+".0"}return this.isNegative()?"-"+i:i},v_.prototype.reciprocal=function(){var t,e,r,n,i=null,o=null,s=null,a=null;t=(r=1/this._hi)-(i=(s=v_.SPLIT*r)-(i=s-r)),o=(a=v_.SPLIT*this._hi)-this._hi;var u=r+(s=(1-(n=r*this._hi)-(a=i*(o=a-o)-n+i*(e=this._hi-o)+t*o+t*e)-r*this._lo)/this._hi);return new v_(u,r-u+s)},v_.prototype.toSciNotation=function(){if(this.isZero())return v_.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),r=this.extractSignificantDigits(!1,e),n=v_.SCI_NOT_EXPONENT_CHAR+e[0];if("0"===r.charAt(0))throw new Error("Found leading zero: "+r);var i="";r.length>1&&(i=r.substring(1));var o=r.charAt(0)+"."+i;return this.isNegative()?"-"+o+n:o+n},v_.prototype.abs=function(){return this.isNaN()?v_.NaN:this.isNegative()?this.negate():new v_(this)},v_.prototype.isPositive=function(){return(this._hi>0||0===this._hi)&&this._lo>0},v_.prototype.lt=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<t._lo},v_.prototype.add=function(){if(arguments[0]instanceof v_){var t=arguments[0];return v_.copy(this).selfAdd(t)}if("number"==typeof arguments[0]){var e=arguments[0];return v_.copy(this).selfAdd(e)}},v_.prototype.init=function(){if(1===arguments.length){if("number"==typeof arguments[0]){var t=arguments[0];this._hi=t,this._lo=0}else if(arguments[0]instanceof v_){var e=arguments[0];this._hi=e._hi,this._lo=e._lo}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this._hi=r,this._lo=n}},v_.prototype.gt=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>t._lo},v_.prototype.isNegative=function(){return(this._hi<0||0===this._hi)&&this._lo<0},v_.prototype.trunc=function(){return this.isNaN()?v_.NaN:this.isPositive()?this.floor():this.ceil()},v_.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},v_.prototype.interfaces_=function(){return[o_,r_,n_]},v_.prototype.getClass=function(){return v_},v_.sqr=function(t){return v_.valueOf(t).selfMultiply(t)},v_.valueOf=function(){return"string"==typeof arguments[0]?v_.parse(arguments[0]):"number"==typeof arguments[0]?new v_(arguments[0]):void 0},v_.sqrt=function(t){return v_.valueOf(t).sqrt()},v_.parse=function(t){for(var e=0,r=t.length;y_.isWhitespace(t.charAt(e));)e++;var n=!1;if(e<r){var i=t.charAt(e);"-"!==i&&"+"!==i||(e++,"-"===i&&(n=!0))}for(var o=new v_,s=0,a=0,u=0;!(e>=r);){var l=t.charAt(e);if(e++,y_.isDigit(l)){var c=l-"0";o.selfMultiply(v_.TEN),o.selfAdd(c),s++}else{if("."!==l){if("e"===l||"E"===l){var h=t.substring(e);try{u=d_.parseInt(h)}catch(e){throw e instanceof Error?new Error("Invalid exponent "+h+" in string "+t):e}break}throw new Error("Unexpected character '"+l+"' at position "+e+" in string "+t)}a=s}}var f=o,p=s-a-u;if(0===p)f=o;else if(p>0){var g=v_.TEN.pow(p);f=o.divide(g)}else if(p<0){var A=v_.TEN.pow(-p);f=o.multiply(A)}return n?f.negate():f},v_.createNaN=function(){return new v_(t_.NaN,t_.NaN)},v_.copy=function(t){return new v_(t)},v_.magnitude=function(t){var e=Math.abs(t),r=Math.log(e)/Math.log(10),n=Math.trunc(Math.floor(r));return 10*Math.pow(10,n)<=e&&(n+=1),n},v_.stringOfChar=function(t,e){for(var r=new A_,n=0;n<e;n++)r.append(t);return r.toString()},m_.PI.get=function(){return new v_(3.141592653589793,12246467991473532e-32)},m_.TWO_PI.get=function(){return new v_(6.283185307179586,24492935982947064e-32)},m_.PI_2.get=function(){return new v_(1.5707963267948966,6123233995736766e-32)},m_.E.get=function(){return new v_(2.718281828459045,14456468917292502e-32)},m_.NaN.get=function(){return new v_(t_.NaN,t_.NaN)},m_.EPS.get=function(){return 123259516440783e-46},m_.SPLIT.get=function(){return 134217729},m_.MAX_PRINT_DIGITS.get=function(){return 32},m_.TEN.get=function(){return v_.valueOf(10)},m_.ONE.get=function(){return v_.valueOf(1)},m_.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},m_.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(v_,m_);var __=function(){},I_={DP_SAFE_EPSILON:{configurable:!0}};__.prototype.interfaces_=function(){return[]},__.prototype.getClass=function(){return __},__.orientationIndex=function(t,e,r){var n=__.orientationIndexFilter(t,e,r);if(n<=1)return n;var i=v_.valueOf(e.x).selfAdd(-t.x),o=v_.valueOf(e.y).selfAdd(-t.y),s=v_.valueOf(r.x).selfAdd(-e.x),a=v_.valueOf(r.y).selfAdd(-e.y);return i.selfMultiply(a).selfSubtract(o.selfMultiply(s)).signum()},__.signOfDet2x2=function(t,e,r,n){return t.multiply(n).selfSubtract(e.multiply(r)).signum()},__.intersection=function(t,e,r,n){var i=v_.valueOf(n.y).selfSubtract(r.y).selfMultiply(v_.valueOf(e.x).selfSubtract(t.x)),o=v_.valueOf(n.x).selfSubtract(r.x).selfMultiply(v_.valueOf(e.y).selfSubtract(t.y)),s=i.subtract(o),a=v_.valueOf(n.x).selfSubtract(r.x).selfMultiply(v_.valueOf(t.y).selfSubtract(r.y)),u=v_.valueOf(n.y).selfSubtract(r.y).selfMultiply(v_.valueOf(t.x).selfSubtract(r.x)),l=a.subtract(u).selfDivide(s).doubleValue(),c=v_.valueOf(t.x).selfAdd(v_.valueOf(e.x).selfSubtract(t.x).selfMultiply(l)).doubleValue(),h=v_.valueOf(e.x).selfSubtract(t.x).selfMultiply(v_.valueOf(t.y).selfSubtract(r.y)),f=v_.valueOf(e.y).selfSubtract(t.y).selfMultiply(v_.valueOf(t.x).selfSubtract(r.x)),p=h.subtract(f).selfDivide(s).doubleValue(),g=v_.valueOf(r.y).selfAdd(v_.valueOf(n.y).selfSubtract(r.y).selfMultiply(p)).doubleValue();return new s_(c,g)},__.orientationIndexFilter=function(t,e,r){var n=null,i=(t.x-r.x)*(e.y-r.y),o=(t.y-r.y)*(e.x-r.x),s=i-o;if(i>0){if(o<=0)return __.signum(s);n=i+o}else{if(!(i<0))return __.signum(s);if(o>=0)return __.signum(s);n=-i-o}var a=__.DP_SAFE_EPSILON*n;return s>=a||-s>=a?__.signum(s):2},__.signum=function(t){return t>0?1:t<0?-1:0},I_.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(__,I_);var E_=function(){},x_={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};x_.X.get=function(){return 0},x_.Y.get=function(){return 1},x_.Z.get=function(){return 2},x_.M.get=function(){return 3},E_.prototype.setOrdinate=function(t,e,r){},E_.prototype.size=function(){},E_.prototype.getOrdinate=function(t,e){},E_.prototype.getCoordinate=function(){},E_.prototype.getCoordinateCopy=function(t){},E_.prototype.getDimension=function(){},E_.prototype.getX=function(t){},E_.prototype.clone=function(){},E_.prototype.expandEnvelope=function(t){},E_.prototype.copy=function(){},E_.prototype.getY=function(t){},E_.prototype.toCoordinateArray=function(){},E_.prototype.interfaces_=function(){return[n_]},E_.prototype.getClass=function(){return E_},Object.defineProperties(E_,x_);var C_=function(){},w_=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}(C_),b_=function(){};b_.arraycopy=function(t,e,r,n,i){for(var o=0,s=e;s<e+i;s++)r[n+o]=t[s],o++},b_.getProperty=function(t){return{"line.separator":"\n"}[t]};var B_=function t(){if(this.x=null,this.y=null,this.w=null,0===arguments.length)this.x=0,this.y=0,this.w=1;else if(1===arguments.length){var e=arguments[0];this.x=e.x,this.y=e.y,this.w=1}else if(2===arguments.length){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var r=arguments[0],n=arguments[1];this.x=r,this.y=n,this.w=1}else if(arguments[0]instanceof t&&arguments[1]instanceof t){var i=arguments[0],o=arguments[1];this.x=i.y*o.w-o.y*i.w,this.y=o.x*i.w-i.x*o.w,this.w=i.x*o.y-o.x*i.y}else if(arguments[0]instanceof s_&&arguments[1]instanceof s_){var s=arguments[0],a=arguments[1];this.x=s.y-a.y,this.y=a.x-s.x,this.w=s.x*a.y-a.x*s.y}}else if(3===arguments.length){var u=arguments[0],l=arguments[1],c=arguments[2];this.x=u,this.y=l,this.w=c}else if(4===arguments.length){var h=arguments[0],f=arguments[1],p=arguments[2],g=arguments[3],A=h.y-f.y,d=f.x-h.x,y=h.x*f.y-f.x*h.y,v=p.y-g.y,m=g.x-p.x,_=p.x*g.y-g.x*p.y;this.x=d*_-m*y,this.y=v*y-A*_,this.w=A*m-v*d}};B_.prototype.getY=function(){var t=this.y/this.w;if(t_.isNaN(t)||t_.isInfinite(t))throw new w_;return t},B_.prototype.getX=function(){var t=this.x/this.w;if(t_.isNaN(t)||t_.isInfinite(t))throw new w_;return t},B_.prototype.getCoordinate=function(){var t=new s_;return t.x=this.getX(),t.y=this.getY(),t},B_.prototype.interfaces_=function(){return[]},B_.prototype.getClass=function(){return B_},B_.intersection=function(t,e,r,n){var i=t.y-e.y,o=e.x-t.x,s=t.x*e.y-e.x*t.y,a=r.y-n.y,u=n.x-r.x,l=r.x*n.y-n.x*r.y,c=i*u-a*o,h=(o*l-u*s)/c,f=(a*s-i*l)/c;if(t_.isNaN(h)||t_.isInfinite(h)||t_.isNaN(f)||t_.isInfinite(f))throw new w_;return new s_(h,f)};var S_=function t(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,0===arguments.length)this.init();else if(1===arguments.length){if(arguments[0]instanceof s_){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof t){var r=arguments[0];this.init(r)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(4===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2],u=arguments[3];this.init(o,s,a,u)}},M_={serialVersionUID:{configurable:!0}};S_.prototype.getArea=function(){return this.getWidth()*this.getHeight()},S_.prototype.equals=function(t){if(!(t instanceof S_))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()},S_.prototype.intersection=function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new S_;var e=this._minx>t._minx?this._minx:t._minx,r=this._miny>t._miny?this._miny:t._miny,n=this._maxx<t._maxx?this._maxx:t._maxx,i=this._maxy<t._maxy?this._maxy:t._maxy;return new S_(e,n,r,i)},S_.prototype.isNull=function(){return this._maxx<this._minx},S_.prototype.getMaxX=function(){return this._maxx},S_.prototype.covers=function(){if(1===arguments.length){if(arguments[0]instanceof s_){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof S_){var e=arguments[0];return!this.isNull()&&!e.isNull()&&(e.getMinX()>=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy)}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return!this.isNull()&&(r>=this._minx&&r<=this._maxx&&n>=this._miny&&n<=this._maxy)}},S_.prototype.intersects=function(){if(1===arguments.length){if(arguments[0]instanceof S_){var t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)}if(arguments[0]instanceof s_){var e=arguments[0];return this.intersects(e.x,e.y)}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return!this.isNull()&&!(r>this._maxx||r<this._minx||n>this._maxy||n<this._miny)}},S_.prototype.getMinY=function(){return this._miny},S_.prototype.getMinX=function(){return this._minx},S_.prototype.expandToInclude=function(){if(1===arguments.length){if(arguments[0]instanceof s_){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof S_){var e=arguments[0];if(e.isNull())return null;this.isNull()?(this._minx=e.getMinX(),this._maxx=e.getMaxX(),this._miny=e.getMinY(),this._maxy=e.getMaxY()):(e._minx<this._minx&&(this._minx=e._minx),e._maxx>this._maxx&&(this._maxx=e._maxx),e._miny<this._miny&&(this._miny=e._miny),e._maxy>this._maxy&&(this._maxy=e._maxy))}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.isNull()?(this._minx=r,this._maxx=r,this._miny=n,this._maxy=n):(r<this._minx&&(this._minx=r),r>this._maxx&&(this._maxx=r),n<this._miny&&(this._miny=n),n>this._maxy&&(this._maxy=n))}},S_.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t<e?t:e},S_.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},S_.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},S_.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},S_.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},S_.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},S_.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},S_.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e},S_.prototype.expandBy=function(){if(1===arguments.length){var t=arguments[0];this.expandBy(t,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=r,this._maxy+=r,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},S_.prototype.contains=function(){if(1===arguments.length){if(arguments[0]instanceof S_){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof s_){var e=arguments[0];return this.covers(e)}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return this.covers(r,n)}},S_.prototype.centre=function(){return this.isNull()?null:new s_((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},S_.prototype.init=function(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(arguments[0]instanceof s_){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof S_){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.init(r.x,n.x,r.y,n.y)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];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)}},S_.prototype.getMaxY=function(){return this._maxy},S_.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 r=0;return this._maxy<t._miny?r=t._miny-this._maxy:this._miny>t._maxy&&(r=this._miny-t._maxy),0===e?r:0===r?e:Math.sqrt(e*e+r*r)},S_.prototype.hashCode=function(){var t=17;return t=37*(t=37*(t=37*(t=37*t+s_.hashCode(this._minx))+s_.hashCode(this._maxx))+s_.hashCode(this._miny))+s_.hashCode(this._maxy)},S_.prototype.interfaces_=function(){return[r_,o_]},S_.prototype.getClass=function(){return S_},S_.intersects=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],r=arguments[2];return r.x>=(t.x<e.x?t.x:e.x)&&r.x<=(t.x>e.x?t.x:e.x)&&r.y>=(t.y<e.y?t.y:e.y)&&r.y<=(t.y>e.y?t.y:e.y)}if(4===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=Math.min(o.x,s.x),u=Math.max(o.x,s.x),l=Math.min(n.x,i.x),c=Math.max(n.x,i.x);return!(l>u)&&(!(c<a)&&(a=Math.min(o.y,s.y),u=Math.max(o.y,s.y),l=Math.min(n.y,i.y),c=Math.max(n.y,i.y),!(l>u)&&!(c<a)))}},M_.serialVersionUID.get=function(){return 0x51845cd552189800},Object.defineProperties(S_,M_);var L_={typeStr:/^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,emptyTypeStr:/^\s*(\w+)\s*EMPTY\s*$/,spaces:/\s+/,parenComma:/\)\s*,\s*\(/,doubleParenComma:/\)\s*\)\s*,\s*\(\s*\(/,trimParens:/^\s*\(?(.*?)\)?\s*$/},N_=function(t){this.geometryFactory=t||new dE};N_.prototype.read=function(t){var e,r,n;t=t.replace(/[\n\r]/g," ");var i=L_.typeStr.exec(t);if(-1!==t.search("EMPTY")&&((i=L_.emptyTypeStr.exec(t))[2]=void 0),i&&(r=i[1].toLowerCase(),n=i[2],R_[r]&&(e=R_[r].apply(this,[n]))),void 0===e)throw new Error("Could not parse WKT "+t);return e},N_.prototype.write=function(t){return this.extractGeometry(t)},N_.prototype.extractGeometry=function(t){var e=t.getGeometryType().toLowerCase();if(!T_[e])return null;var r=e.toUpperCase();return t.isEmpty()?r+" EMPTY":r+"("+T_[e].apply(this,[t])+")"};var T_={coordinate:function(t){return t.x+" "+t.y},point:function(t){return T_.coordinate.call(this,t._coordinates._coordinates[0])},multipoint:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push("("+T_.point.apply(this,[t._geometries[r]])+")");return e.join(",")},linestring:function(t){for(var e=[],r=0,n=t._points._coordinates.length;r<n;++r)e.push(T_.coordinate.apply(this,[t._points._coordinates[r]]));return e.join(",")},linearring:function(t){for(var e=[],r=0,n=t._points._coordinates.length;r<n;++r)e.push(T_.coordinate.apply(this,[t._points._coordinates[r]]));return e.join(",")},multilinestring:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push("("+T_.linestring.apply(this,[t._geometries[r]])+")");return e.join(",")},polygon:function(t){var e=[];e.push("("+T_.linestring.apply(this,[t._shell])+")");for(var r=0,n=t._holes.length;r<n;++r)e.push("("+T_.linestring.apply(this,[t._holes[r]])+")");return e.join(",")},multipolygon:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push("("+T_.polygon.apply(this,[t._geometries[r]])+")");return e.join(",")},geometrycollection:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push(this.extractGeometry(t._geometries[r]));return e.join(",")}},R_={point:function(t){if(void 0===t)return this.geometryFactory.createPoint();var e=t.trim().split(L_.spaces);return this.geometryFactory.createPoint(new s_(Number.parseFloat(e[0]),Number.parseFloat(e[1])))},multipoint:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiPoint();for(var r=t.trim().split(","),n=[],i=0,o=r.length;i<o;++i)e=r[i].replace(L_.trimParens,"$1"),n.push(R_.point.apply(this,[e]));return this.geometryFactory.createMultiPoint(n)},linestring:function(t){if(void 0===t)return this.geometryFactory.createLineString();for(var e,r=t.trim().split(","),n=[],i=0,o=r.length;i<o;++i)e=r[i].trim().split(L_.spaces),n.push(new s_(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLineString(n)},linearring:function(t){if(void 0===t)return this.geometryFactory.createLinearRing();for(var e,r=t.trim().split(","),n=[],i=0,o=r.length;i<o;++i)e=r[i].trim().split(L_.spaces),n.push(new s_(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLinearRing(n)},multilinestring:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiLineString();for(var r=t.trim().split(L_.parenComma),n=[],i=0,o=r.length;i<o;++i)e=r[i].replace(L_.trimParens,"$1"),n.push(R_.linestring.apply(this,[e]));return this.geometryFactory.createMultiLineString(n)},polygon:function(t){var e,r,n;if(void 0===t)return this.geometryFactory.createPolygon();for(var i,o=t.trim().split(L_.parenComma),s=[],a=0,u=o.length;a<u;++a)e=o[a].replace(L_.trimParens,"$1"),r=R_.linestring.apply(this,[e]),n=this.geometryFactory.createLinearRing(r._points),0===a?i=n:s.push(n);return this.geometryFactory.createPolygon(i,s)},multipolygon:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiPolygon();for(var r=t.trim().split(L_.doubleParenComma),n=[],i=0,o=r.length;i<o;++i)e=r[i].replace(L_.trimParens,"$1"),n.push(R_.polygon.apply(this,[e]));return this.geometryFactory.createMultiPolygon(n)},geometrycollection:function(t){if(void 0===t)return this.geometryFactory.createGeometryCollection();for(var e=(t=t.replace(/,\s*([A-Za-z])/g,"|$1")).trim().split("|"),r=[],n=0,i=e.length;n<i;++n)r.push(this.read(e[n]));return this.geometryFactory.createGeometryCollection(r)}},D_=function(t){this.parser=new N_(t)};D_.prototype.write=function(t){return this.parser.write(t)},D_.toLineString=function(t,e){if(2!==arguments.length)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"};var P_=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),Q_=function(t){function e(){if(t.call(this),0===arguments.length)t.call(this);else if(1===arguments.length){var e=arguments[0];t.call(this,e)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(P_),k_=function(){};k_.prototype.interfaces_=function(){return[]},k_.prototype.getClass=function(){return k_},k_.shouldNeverReachHere=function(){if(0===arguments.length)k_.shouldNeverReachHere(null);else if(1===arguments.length){var t=arguments[0];throw new Q_("Should never reach here"+(null!==t?": "+t:""))}},k_.isTrue=function(){var t;if(1===arguments.length)k_.isTrue(arguments[0],null);else if(2===arguments.length&&(t=arguments[1],!arguments[0]))throw null===t?new Q_:new Q_(t)},k_.equals=function(){var t,e,r;if(2===arguments.length)k_.equals(t=arguments[0],e=arguments[1],null);else if(3===arguments.length&&(t=arguments[0],r=arguments[2],!(e=arguments[1]).equals(t)))throw new Q_("Expected "+t+" but encountered "+e+(null!==r?": "+r:""))};var O_=function(){this._result=null,this._inputLines=Array(2).fill().map((function(){return Array(2)})),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new s_,this._intPt[1]=new s_,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},F_={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};O_.prototype.getIndexAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]},O_.prototype.getTopologySummary=function(){var t=new A_;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()},O_.prototype.computeIntersection=function(t,e,r,n){this._inputLines[0][0]=t,this._inputLines[0][1]=e,this._inputLines[1][0]=r,this._inputLines[1][1]=n,this._result=this.computeIntersect(t,e,r,n)},O_.prototype.getIntersectionNum=function(){return this._result},O_.prototype.computeIntLineIndex=function(){if(0===arguments.length)null===this._intLineIndex&&(this._intLineIndex=Array(2).fill().map((function(){return Array(2)})),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(1===arguments.length){var t=arguments[0];this.getEdgeDistance(t,0)>this.getEdgeDistance(t,1)?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}},O_.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},O_.prototype.setPrecisionModel=function(t){this._precisionModel=t},O_.prototype.isInteriorIntersection=function(){var t=this;if(0===arguments.length)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(1===arguments.length){for(var e=arguments[0],r=0;r<this._result;r++)if(!t._intPt[r].equals2D(t._inputLines[e][0])&&!t._intPt[r].equals2D(t._inputLines[e][1]))return!0;return!1}},O_.prototype.getIntersection=function(t){return this._intPt[t]},O_.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},O_.prototype.hasIntersection=function(){return this._result!==O_.NO_INTERSECTION},O_.prototype.getEdgeDistance=function(t,e){return O_.computeEdgeDistance(this._intPt[e],this._inputLines[t][0],this._inputLines[t][1])},O_.prototype.isCollinear=function(){return this._result===O_.COLLINEAR_INTERSECTION},O_.prototype.toString=function(){return D_.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+D_.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},O_.prototype.getEndpoint=function(t,e){return this._inputLines[t][e]},O_.prototype.isIntersection=function(t){for(var e=0;e<this._result;e++)if(this._intPt[e].equals2D(t))return!0;return!1},O_.prototype.getIntersectionAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][e]]},O_.prototype.interfaces_=function(){return[]},O_.prototype.getClass=function(){return O_},O_.computeEdgeDistance=function(t,e,r){var n=Math.abs(r.x-e.x),i=Math.abs(r.y-e.y),o=-1;if(t.equals(e))o=0;else if(t.equals(r))o=n>i?n:i;else{var s=Math.abs(t.x-e.x),a=Math.abs(t.y-e.y);0!==(o=n>i?s:a)||t.equals(e)||(o=Math.max(s,a))}return k_.isTrue(!(0===o&&!t.equals(e)),"Bad distance calculation"),o},O_.nonRobustComputeEdgeDistance=function(t,e,r){var n=t.x-e.x,i=t.y-e.y,o=Math.sqrt(n*n+i*i);return k_.isTrue(!(0===o&&!t.equals(e)),"Invalid distance calculation"),o},F_.DONT_INTERSECT.get=function(){return 0},F_.DO_INTERSECT.get=function(){return 1},F_.COLLINEAR.get=function(){return 2},F_.NO_INTERSECTION.get=function(){return 0},F_.POINT_INTERSECTION.get=function(){return 1},F_.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(O_,F_);var G_=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 S_(this._inputLines[0][0],this._inputLines[0][1]),r=new S_(this._inputLines[1][0],this._inputLines[1][1]);return e.contains(t)&&r.contains(t)},e.prototype.computeIntersection=function(){if(3!==arguments.length)return t.prototype.computeIntersection.apply(this,arguments);var e=arguments[0],r=arguments[1],n=arguments[2];if(this._isProper=!1,S_.intersects(r,n,e)&&0===j_.orientationIndex(r,n,e)&&0===j_.orientationIndex(n,r,e))return this._isProper=!0,(e.equals(r)||e.equals(n))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION},e.prototype.normalizeToMinimum=function(t,e,r,n,i){i.x=this.smallestInAbsValue(t.x,e.x,r.x,n.x),i.y=this.smallestInAbsValue(t.y,e.y,r.y,n.y),t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,r.x-=i.x,r.y-=i.y,n.x-=i.x,n.y-=i.y},e.prototype.safeHCoordinateIntersection=function(t,r,n,i){var o=null;try{o=B_.intersection(t,r,n,i)}catch(s){if(!(s instanceof w_))throw s;o=e.nearestEndpoint(t,r,n,i)}return o},e.prototype.intersection=function(t,r,n,i){var o=this.intersectionWithNormalization(t,r,n,i);return this.isInSegmentEnvelopes(o)||(o=new s_(e.nearestEndpoint(t,r,n,i))),null!==this._precisionModel&&this._precisionModel.makePrecise(o),o},e.prototype.smallestInAbsValue=function(t,e,r,n){var i=t,o=Math.abs(i);return Math.abs(e)<o&&(i=e,o=Math.abs(e)),Math.abs(r)<o&&(i=r,o=Math.abs(r)),Math.abs(n)<o&&(i=n),i},e.prototype.checkDD=function(t,e,r,n,i){var o=__.intersection(t,e,r,n),s=this.isInSegmentEnvelopes(o);b_.out.println("DD in env = "+s+" --------------------- "+o),i.distance(o)>1e-4&&b_.out.println("Distance = "+i.distance(o))},e.prototype.intersectionWithNormalization=function(t,e,r,n){var i=new s_(t),o=new s_(e),s=new s_(r),a=new s_(n),u=new s_;this.normalizeToEnvCentre(i,o,s,a,u);var l=this.safeHCoordinateIntersection(i,o,s,a);return l.x+=u.x,l.y+=u.y,l},e.prototype.computeCollinearIntersection=function(e,r,n,i){var o=S_.intersects(e,r,n),s=S_.intersects(e,r,i),a=S_.intersects(n,i,e),u=S_.intersects(n,i,r);return o&&s?(this._intPt[0]=n,this._intPt[1]=i,t.COLLINEAR_INTERSECTION):a&&u?(this._intPt[0]=e,this._intPt[1]=r,t.COLLINEAR_INTERSECTION):o&&a?(this._intPt[0]=n,this._intPt[1]=e,!n.equals(e)||s||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):o&&u?(this._intPt[0]=n,this._intPt[1]=r,!n.equals(r)||s||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&a?(this._intPt[0]=i,this._intPt[1]=e,!i.equals(e)||o||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&u?(this._intPt[0]=i,this._intPt[1]=r,!i.equals(r)||o||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(t,e,r,n,i){var o=t.x<e.x?t.x:e.x,s=t.y<e.y?t.y:e.y,a=t.x>e.x?t.x:e.x,u=t.y>e.y?t.y:e.y,l=r.x<n.x?r.x:n.x,c=r.y<n.y?r.y:n.y,h=r.x>n.x?r.x:n.x,f=r.y>n.y?r.y:n.y,p=((o>l?o:l)+(a<h?a:h))/2,g=((s>c?s:c)+(u<f?u:f))/2;i.x=p,i.y=g,t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,r.x-=i.x,r.y-=i.y,n.x-=i.x,n.y-=i.y},e.prototype.computeIntersect=function(e,r,n,i){if(this._isProper=!1,!S_.intersects(e,r,n,i))return t.NO_INTERSECTION;var o=j_.orientationIndex(e,r,n),s=j_.orientationIndex(e,r,i);if(o>0&&s>0||o<0&&s<0)return t.NO_INTERSECTION;var a=j_.orientationIndex(n,i,e),u=j_.orientationIndex(n,i,r);return a>0&&u>0||a<0&&u<0?t.NO_INTERSECTION:0===o&&0===s&&0===a&&0===u?this.computeCollinearIntersection(e,r,n,i):(0===o||0===s||0===a||0===u?(this._isProper=!1,e.equals2D(n)||e.equals2D(i)?this._intPt[0]=e:r.equals2D(n)||r.equals2D(i)?this._intPt[0]=r:0===o?this._intPt[0]=new s_(n):0===s?this._intPt[0]=new s_(i):0===a?this._intPt[0]=new s_(e):0===u&&(this._intPt[0]=new s_(r))):(this._isProper=!0,this._intPt[0]=this.intersection(e,r,n,i)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(t,e,r,n){var i=t,o=j_.distancePointLine(t,r,n),s=j_.distancePointLine(e,r,n);return s<o&&(o=s,i=e),(s=j_.distancePointLine(r,t,e))<o&&(o=s,i=r),(s=j_.distancePointLine(n,t,e))<o&&(o=s,i=n),i},e}(O_),U_=function(){};U_.prototype.interfaces_=function(){return[]},U_.prototype.getClass=function(){return U_},U_.orientationIndex=function(t,e,r){var n=e.x-t.x,i=e.y-t.y,o=r.x-e.x,s=r.y-e.y;return U_.signOfDet2x2(n,i,o,s)},U_.signOfDet2x2=function(t,e,r,n){var i=null,o=null,s=null;if(i=1,0===t||0===n)return 0===e||0===r?0:e>0?r>0?-i:i:r>0?i:-i;if(0===e||0===r)return n>0?t>0?i:-i:t>0?-i:i;if(e>0?n>0?e<=n||(i=-i,o=t,t=r,r=o,o=e,e=n,n=o):e<=-n?(i=-i,r=-r,n=-n):(o=t,t=-r,r=o,o=e,e=-n,n=o):n>0?-e<=n?(i=-i,t=-t,e=-e):(o=-t,t=r,r=o,o=-e,e=n,n=o):e>=n?(t=-t,e=-e,r=-r,n=-n):(i=-i,o=-t,t=-r,r=o,o=-e,e=-n,n=o),t>0){if(!(r>0))return i;if(!(t<=r))return i}else{if(r>0)return-i;if(!(t>=r))return-i;i=-i,t=-t,r=-r}for(;;){if((n-=(s=Math.floor(r/t))*e)<0)return-i;if(n>e)return i;if(t>(r-=s*t)+r){if(e<n+n)return i}else{if(e>n+n)return-i;r=t-r,n=e-n,i=-i}if(0===n)return 0===r?0:-i;if(0===r)return i;if((e-=(s=Math.floor(t/r))*n)<0)return i;if(e>n)return-i;if(r>(t-=s*r)+t){if(n<e+e)return-i}else{if(n>e+e)return i;t=r-t,e=n-e,i=-i}if(0===e)return 0===t?0:i;if(0===t)return-i}};var q_=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};q_.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 r=t.x,n=e.x;return r>n&&(r=e.x,n=t.x),this._p.x>=r&&this._p.x<=n&&(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=U_.signOfDet2x2(i,o,s,a);if(0===u)return this._isPointOnSegment=!0,null;a<o&&(u=-u),u>0&&this._crossingCount++}},q_.prototype.isPointInPolygon=function(){return this.getLocation()!==c_.EXTERIOR},q_.prototype.getLocation=function(){return this._isPointOnSegment?c_.BOUNDARY:this._crossingCount%2==1?c_.INTERIOR:c_.EXTERIOR},q_.prototype.isOnSegment=function(){return this._isPointOnSegment},q_.prototype.interfaces_=function(){return[]},q_.prototype.getClass=function(){return q_},q_.locatePointInRing=function(){if(arguments[0]instanceof s_&&f_(arguments[1],E_)){for(var t=arguments[1],e=new q_(arguments[0]),r=new s_,n=new s_,i=1;i<t.size();i++)if(t.getCoordinate(i,r),t.getCoordinate(i-1,n),e.countSegment(r,n),e.isOnSegment())return e.getLocation();return e.getLocation()}if(arguments[0]instanceof s_&&arguments[1]instanceof Array){for(var o=arguments[1],s=new q_(arguments[0]),a=1;a<o.length;a++){var u=o[a],l=o[a-1];if(s.countSegment(u,l),s.isOnSegment())return s.getLocation()}return s.getLocation()}};var j_=function(){},V_={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};j_.prototype.interfaces_=function(){return[]},j_.prototype.getClass=function(){return j_},j_.orientationIndex=function(t,e,r){return __.orientationIndex(t,e,r)},j_.signedArea=function(){if(arguments[0]instanceof Array){var t=arguments[0];if(t.length<3)return 0;for(var e=0,r=t[0].x,n=1;n<t.length-1;n++){var i=t[n].x-r,o=t[n+1].y;e+=i*(t[n-1].y-o)}return e/2}if(f_(arguments[0],E_)){var s=arguments[0],a=s.size();if(a<3)return 0;var u=new s_,l=new s_,c=new s_;s.getCoordinate(0,l),s.getCoordinate(1,c);var h=l.x;c.x-=h;for(var f=0,p=1;p<a-1;p++)u.y=l.y,l.x=c.x,l.y=c.y,s.getCoordinate(p+1,c),c.x-=h,f+=l.x*(u.y-c.y);return f/2}},j_.distanceLineLine=function(t,e,r,n){if(t.equals(e))return j_.distancePointLine(t,r,n);if(r.equals(n))return j_.distancePointLine(n,t,e);var i=!1;if(S_.intersects(t,e,r,n)){var o=(e.x-t.x)*(n.y-r.y)-(e.y-t.y)*(n.x-r.x);if(0===o)i=!0;else{var s=(t.y-r.y)*(n.x-r.x)-(t.x-r.x)*(n.y-r.y),a=((t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y))/o,u=s/o;(u<0||u>1||a<0||a>1)&&(i=!0)}}else i=!0;return i?p_.min(j_.distancePointLine(t,r,n),j_.distancePointLine(e,r,n),j_.distancePointLine(r,t,e),j_.distancePointLine(n,t,e)):0},j_.isPointInRing=function(t,e){return j_.locatePointInRing(t,e)!==c_.EXTERIOR},j_.computeLength=function(t){var e=t.size();if(e<=1)return 0;var r=0,n=new s_;t.getCoordinate(0,n);for(var i=n.x,o=n.y,s=1;s<e;s++){t.getCoordinate(s,n);var a=n.x,u=n.y,l=a-i,c=u-o;r+=Math.sqrt(l*l+c*c),i=a,o=u}return r},j_.isCCW=function(t){var e=t.length-1;if(e<3)throw new $m("Ring has fewer than 4 points, so orientation cannot be determined");for(var r=t[0],n=0,i=1;i<=e;i++){var o=t[i];o.y>r.y&&(r=o,n=i)}var s=n;do{(s-=1)<0&&(s=e)}while(t[s].equals2D(r)&&s!==n);var a=n;do{a=(a+1)%e}while(t[a].equals2D(r)&&a!==n);var u=t[s],l=t[a];if(u.equals2D(r)||l.equals2D(r)||u.equals2D(l))return!1;var c=j_.computeOrientation(u,r,l),h=!1;return h=0===c?u.x>l.x:c>0,h},j_.locatePointInRing=function(t,e){return q_.locatePointInRing(t,e)},j_.distancePointLinePerpendicular=function(t,e,r){var n=(r.x-e.x)*(r.x-e.x)+(r.y-e.y)*(r.y-e.y),i=((e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y))/n;return Math.abs(i)*Math.sqrt(n)},j_.computeOrientation=function(t,e,r){return j_.orientationIndex(t,e,r)},j_.distancePointLine=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(0===e.length)throw new $m("Line array must contain at least one vertex");for(var r=t.distance(e[0]),n=0;n<e.length-1;n++){var i=j_.distancePointLine(t,e[n],e[n+1]);i<r&&(r=i)}return r}if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];if(s.x===a.x&&s.y===a.y)return o.distance(s);var u=(a.x-s.x)*(a.x-s.x)+(a.y-s.y)*(a.y-s.y),l=((o.x-s.x)*(a.x-s.x)+(o.y-s.y)*(a.y-s.y))/u;if(l<=0)return o.distance(s);if(l>=1)return o.distance(a);var c=((s.y-o.y)*(a.x-s.x)-(s.x-o.x)*(a.y-s.y))/u;return Math.abs(c)*Math.sqrt(u)}},j_.isOnLine=function(t,e){for(var r=new G_,n=1;n<e.length;n++){var i=e[n-1],o=e[n];if(r.computeIntersection(t,i,o),r.hasIntersection())return!0}return!1},V_.CLOCKWISE.get=function(){return-1},V_.RIGHT.get=function(){return j_.CLOCKWISE},V_.COUNTERCLOCKWISE.get=function(){return 1},V_.LEFT.get=function(){return j_.COUNTERCLOCKWISE},V_.COLLINEAR.get=function(){return 0},V_.STRAIGHT.get=function(){return j_.COLLINEAR},Object.defineProperties(j_,V_);var z_=function(){};z_.prototype.filter=function(t){},z_.prototype.interfaces_=function(){return[]},z_.prototype.getClass=function(){return z_};var Y_=function(){var t=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=t,this._SRID=t.getSRID()},H_={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}};Y_.prototype.isGeometryCollection=function(){return this.getSortIndex()===Y_.SORTINDEX_GEOMETRYCOLLECTION},Y_.prototype.getFactory=function(){return this._factory},Y_.prototype.getGeometryN=function(t){return this},Y_.prototype.getArea=function(){return 0},Y_.prototype.isRectangle=function(){return!1},Y_.prototype.equals=function(){if(arguments[0]instanceof Y_){var t=arguments[0];return null!==t&&this.equalsTopo(t)}if(arguments[0]instanceof Object){var e=arguments[0];if(!(e instanceof Y_))return!1;var r=e;return this.equalsExact(r)}},Y_.prototype.equalsExact=function(t){return this===t||this.equalsExact(t,0)},Y_.prototype.geometryChanged=function(){this.apply(Y_.geometryChangedFilter)},Y_.prototype.geometryChangedAction=function(){this._envelope=null},Y_.prototype.equalsNorm=function(t){return null!==t&&this.norm().equalsExact(t.norm())},Y_.prototype.getLength=function(){return 0},Y_.prototype.getNumGeometries=function(){return 1},Y_.prototype.compareTo=function(){if(1===arguments.length){var t=arguments[0],e=t;return this.getSortIndex()!==e.getSortIndex()?this.getSortIndex()-e.getSortIndex():this.isEmpty()&&e.isEmpty()?0:this.isEmpty()?-1:e.isEmpty()?1:this.compareToSameClass(t)}if(2===arguments.length){var r=arguments[0],n=arguments[1];return this.getSortIndex()!==r.getSortIndex()?this.getSortIndex()-r.getSortIndex():this.isEmpty()&&r.isEmpty()?0:this.isEmpty()?-1:r.isEmpty()?1:this.compareToSameClass(r,n)}},Y_.prototype.getUserData=function(){return this._userData},Y_.prototype.getSRID=function(){return this._SRID},Y_.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},Y_.prototype.checkNotGeometryCollection=function(t){if(t.getSortIndex()===Y_.SORTINDEX_GEOMETRYCOLLECTION)throw new $m("This method does not support GeometryCollection arguments")},Y_.prototype.equal=function(t,e,r){return 0===r?t.equals(e):t.distance(e)<=r},Y_.prototype.norm=function(){var t=this.copy();return t.normalize(),t},Y_.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},Y_.prototype.getEnvelopeInternal=function(){return null===this._envelope&&(this._envelope=this.computeEnvelopeInternal()),new S_(this._envelope)},Y_.prototype.setSRID=function(t){this._SRID=t},Y_.prototype.setUserData=function(t){this._userData=t},Y_.prototype.compare=function(t,e){for(var r=t.iterator(),n=e.iterator();r.hasNext()&&n.hasNext();){var i=r.next(),o=n.next(),s=i.compareTo(o);if(0!==s)return s}return r.hasNext()?1:n.hasNext()?-1:0},Y_.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},Y_.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===Y_.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===Y_.SORTINDEX_MULTIPOINT||this.getSortIndex()===Y_.SORTINDEX_MULTILINESTRING||this.getSortIndex()===Y_.SORTINDEX_MULTIPOLYGON},Y_.prototype.interfaces_=function(){return[n_,r_,o_]},Y_.prototype.getClass=function(){return Y_},Y_.hasNonEmptyElements=function(t){for(var e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1},Y_.hasNullElements=function(t){for(var e=0;e<t.length;e++)if(null===t[e])return!0;return!1},H_.serialVersionUID.get=function(){return 0x799ea46522854c00},H_.SORTINDEX_POINT.get=function(){return 0},H_.SORTINDEX_MULTIPOINT.get=function(){return 1},H_.SORTINDEX_LINESTRING.get=function(){return 2},H_.SORTINDEX_LINEARRING.get=function(){return 3},H_.SORTINDEX_MULTILINESTRING.get=function(){return 4},H_.SORTINDEX_POLYGON.get=function(){return 5},H_.SORTINDEX_MULTIPOLYGON.get=function(){return 6},H_.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},H_.geometryChangedFilter.get=function(){return X_},Object.defineProperties(Y_,H_);var X_=function(){};X_.interfaces_=function(){return[z_]},X_.filter=function(t){t.geometryChangedAction()};var J_=function(){};J_.prototype.filter=function(t){},J_.prototype.interfaces_=function(){return[]},J_.prototype.getClass=function(){return J_};var W_=function(){},K_={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}};W_.prototype.isInBoundary=function(t){},W_.prototype.interfaces_=function(){return[]},W_.prototype.getClass=function(){return W_},K_.Mod2BoundaryNodeRule.get=function(){return Z_},K_.EndPointBoundaryNodeRule.get=function(){return $_},K_.MultiValentEndPointBoundaryNodeRule.get=function(){return tI},K_.MonoValentEndPointBoundaryNodeRule.get=function(){return eI},K_.MOD2_BOUNDARY_RULE.get=function(){return new Z_},K_.ENDPOINT_BOUNDARY_RULE.get=function(){return new $_},K_.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new tI},K_.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new eI},K_.OGC_SFS_BOUNDARY_RULE.get=function(){return W_.MOD2_BOUNDARY_RULE},Object.defineProperties(W_,K_);var Z_=function(){};Z_.prototype.isInBoundary=function(t){return t%2==1},Z_.prototype.interfaces_=function(){return[W_]},Z_.prototype.getClass=function(){return Z_};var $_=function(){};$_.prototype.isInBoundary=function(t){return t>0},$_.prototype.interfaces_=function(){return[W_]},$_.prototype.getClass=function(){return $_};var tI=function(){};tI.prototype.isInBoundary=function(t){return t>1},tI.prototype.interfaces_=function(){return[W_]},tI.prototype.getClass=function(){return tI};var eI=function(){};eI.prototype.isInBoundary=function(t){return 1===t},eI.prototype.interfaces_=function(){return[W_]},eI.prototype.getClass=function(){return eI};var rI=function(){};function nI(t){this.message=t||""}rI.prototype.add=function(){},rI.prototype.addAll=function(){},rI.prototype.isEmpty=function(){},rI.prototype.iterator=function(){},rI.prototype.size=function(){},rI.prototype.toArray=function(){},rI.prototype.remove=function(){},nI.prototype=new Error,nI.prototype.name="IndexOutOfBoundsException";var iI=function(){};iI.prototype.hasNext=function(){},iI.prototype.next=function(){},iI.prototype.remove=function(){};var oI=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}(rI);function sI(t){this.message=t||""}sI.prototype=new Error,sI.prototype.name="NoSuchElementException";var aI=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof rI&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.ensureCapacity=function(){},e.prototype.interfaces_=function(){return[t,rI]},e.prototype.add=function(t){return 1===arguments.length?this.array_.push(t):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.set=function(t,e){var r=this.array_[t];return this.array_[t]=e,r},e.prototype.iterator=function(){return new uI(this)},e.prototype.get=function(t){if(t<0||t>=this.size())throw new nI;return this.array_[t]},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t},e.prototype.remove=function(t){for(var e=!1,r=0,n=this.array_.length;r<n;r++)if(this.array_[r]===t){this.array_.splice(r,1),e=!0;break}return e},e}(oI),uI=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 sI;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}(iI),lI=function(t){function e(){if(t.call(this),0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.ensureCapacity(e.length),this.add(e,!0)}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.ensureCapacity(r.length),this.add(r,n)}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={coordArrayType:{configurable:!0}};return r.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[1],r=!1,n=arguments[0].iterator();n.hasNext();)this.add(n.next(),e),r=!0;return r}return t.prototype.addAll.apply(this,arguments)},e.prototype.clone=function(){for(var e=t.prototype.clone.call(this),r=0;r<this.size();r++)e.add(r,this.get(r).copy());return e},e.prototype.toCoordinateArray=function(){return this.toArray(e.coordArrayType)},e.prototype.add=function(){var e=this;if(1===arguments.length){var r=arguments[0];t.prototype.add.call(this,r)}else if(2===arguments.length){if(arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var n=arguments[0],i=arguments[1];return this.add(n,i,!0),!0}if(arguments[0]instanceof s_&&"boolean"==typeof arguments[1]){var o=arguments[0];if(!arguments[1])if(this.size()>=1)if(this.get(this.size()-1).equals2D(o))return null;t.prototype.add.call(this,o)}else if(arguments[0]instanceof Object&&"boolean"==typeof arguments[1]){var s=arguments[0],a=arguments[1];return this.add(s,a),!0}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var u=arguments[0],l=arguments[1];if(arguments[2])for(var c=0;c<u.length;c++)e.add(u[c],l);else for(var h=u.length-1;h>=0;h--)e.add(u[h],l);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof s_){var f=arguments[0],p=arguments[1];if(!arguments[2]){var g=this.size();if(g>0){if(f>0)if(this.get(f-1).equals2D(p))return null;if(f<g)if(this.get(f).equals2D(p))return null}}t.prototype.add.call(this,f,p)}}else if(4===arguments.length){var A=arguments[0],d=arguments[1],y=arguments[2],v=arguments[3],m=1;y>v&&(m=-1);for(var _=y;_!==v;_+=m)e.add(A[_],d);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new s_(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,r),e}(aI),cI=function(){},hI={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};hI.ForwardComparator.get=function(){return fI},hI.BidirectionalComparator.get=function(){return pI},hI.coordArrayType.get=function(){return new Array(0).fill(null)},cI.prototype.interfaces_=function(){return[]},cI.prototype.getClass=function(){return cI},cI.isRing=function(t){return!(t.length<4)&&!!t[0].equals2D(t[t.length-1])},cI.ptNotInList=function(t,e){for(var r=0;r<t.length;r++){var n=t[r];if(cI.indexOf(n,e)<0)return n}return null},cI.scroll=function(t,e){var r=cI.indexOf(e,t);if(r<0)return null;var n=new Array(t.length).fill(null);b_.arraycopy(t,r,n,0,t.length-r),b_.arraycopy(t,0,n,t.length-r,r),b_.arraycopy(n,0,t,0,t.length)},cI.equals=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(t===e)return!0;if(null===t||null===e)return!1;if(t.length!==e.length)return!1;for(var r=0;r<t.length;r++)if(!t[r].equals(e[r]))return!1;return!0}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];if(n===i)return!0;if(null===n||null===i)return!1;if(n.length!==i.length)return!1;for(var s=0;s<n.length;s++)if(0!==o.compare(n[s],i[s]))return!1;return!0}},cI.intersection=function(t,e){for(var r=new lI,n=0;n<t.length;n++)e.intersects(t[n])&&r.add(t[n],!0);return r.toCoordinateArray()},cI.hasRepeatedPoints=function(t){for(var e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1},cI.removeRepeatedPoints=function(t){return cI.hasRepeatedPoints(t)?new lI(t,!1).toCoordinateArray():t},cI.reverse=function(t){for(var e=t.length-1,r=Math.trunc(e/2),n=0;n<=r;n++){var i=t[n];t[n]=t[e-n],t[e-n]=i}},cI.removeNull=function(t){for(var e=0,r=0;r<t.length;r++)null!==t[r]&&e++;var n=new Array(e).fill(null);if(0===e)return n;for(var i=0,o=0;o<t.length;o++)null!==t[o]&&(n[i++]=t[o]);return n},cI.copyDeep=function(){if(1===arguments.length){for(var t=arguments[0],e=new Array(t.length).fill(null),r=0;r<t.length;r++)e[r]=new s_(t[r]);return e}if(5===arguments.length)for(var n=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=arguments[4],u=0;u<a;u++)o[s+u]=new s_(n[i+u])},cI.isEqualReversed=function(t,e){for(var r=0;r<t.length;r++){var n=t[r],i=e[t.length-r-1];if(0!==n.compareTo(i))return!1}return!0},cI.envelope=function(t){for(var e=new S_,r=0;r<t.length;r++)e.expandToInclude(t[r]);return e},cI.toCoordinateArray=function(t){return t.toArray(cI.coordArrayType)},cI.atLeastNCoordinatesOrNothing=function(t,e){return e.length>=t?e:[]},cI.indexOf=function(t,e){for(var r=0;r<e.length;r++)if(t.equals(e[r]))return r;return-1},cI.increasingDirection=function(t){for(var e=0;e<Math.trunc(t.length/2);e++){var r=t.length-1-e,n=t[e].compareTo(t[r]);if(0!==n)return n}return 1},cI.compare=function(t,e){for(var r=0;r<t.length&&r<e.length;){var n=t[r].compareTo(e[r]);if(0!==n)return n;r++}return r<e.length?-1:r<t.length?1:0},cI.minCoordinate=function(t){for(var e=null,r=0;r<t.length;r++)(null===e||e.compareTo(t[r])>0)&&(e=t[r]);return e},cI.extract=function(t,e,r){e=p_.clamp(e,0,t.length);var n=(r=p_.clamp(r,-1,t.length))-e+1;r<0&&(n=0),e>=t.length&&(n=0),r<e&&(n=0);var i=new Array(n).fill(null);if(0===n)return i;for(var o=0,s=e;s<=r;s++)i[o++]=t[s];return i},Object.defineProperties(cI,hI);var fI=function(){};fI.prototype.compare=function(t,e){return cI.compare(t,e)},fI.prototype.interfaces_=function(){return[i_]},fI.prototype.getClass=function(){return fI};var pI=function(){};pI.prototype.compare=function(t,e){var r=t,n=e;if(r.length<n.length)return-1;if(r.length>n.length)return 1;if(0===r.length)return 0;var i=cI.compare(r,n);return cI.isEqualReversed(r,n)?0:i},pI.prototype.OLDcompare=function(t,e){var r=t,n=e;if(r.length<n.length)return-1;if(r.length>n.length)return 1;if(0===r.length)return 0;for(var i=cI.increasingDirection(r),o=cI.increasingDirection(n),s=i>0?0:r.length-1,a=o>0?0:r.length-1,u=0;u<r.length;u++){var l=r[s].compareTo(n[a]);if(0!==l)return l;s+=i,a+=o}return 0},pI.prototype.interfaces_=function(){return[i_]},pI.prototype.getClass=function(){return pI};var gI=function(){};gI.prototype.get=function(){},gI.prototype.put=function(){},gI.prototype.size=function(){},gI.prototype.values=function(){},gI.prototype.entrySet=function(){};var AI=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}(gI);function dI(t){this.message=t||""}function yI(){}dI.prototype=new Error,dI.prototype.name="OperationNotSupported",yI.prototype=new rI,yI.prototype.contains=function(){};var vI=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof rI&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.contains=function(t){for(var e=0,r=this.array_.length;e<r;e++){if(this.array_[e]===t)return!0}return!1},e.prototype.add=function(t){return!this.contains(t)&&(this.array_.push(t),!0)},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.remove=function(t){throw new Error},e.prototype.size=function(){return this.array_.length},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t},e.prototype.iterator=function(){return new mI(this)},e}(yI),mI=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 sI;return this.hashSet_.array_[this.position_++]},e.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},e.prototype.remove=function(){throw new dI},e}(iI);function _I(t){return null===t?0:t.color}function II(t){return null===t?null:t.parent}function EI(t,e){null!==t&&(t.color=e)}function xI(t){return null===t?null:t.left}function CI(t){return null===t?null:t.right}function wI(){this.root_=null,this.size_=0}wI.prototype=new AI,wI.prototype.get=function(t){for(var e=this.root_;null!==e;){var r=t.compareTo(e.key);if(r<0)e=e.left;else{if(!(r>0))return e.value;e=e.right}}return null},wI.prototype.put=function(t,e){if(null===this.root_)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:0,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var r,n,i=this.root_;do{if(r=i,(n=t.compareTo(i.key))<0)i=i.left;else{if(!(n>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:r,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return n<0?r.left=s:r.right=s,this.fixAfterInsertion(s),this.size_++,null},wI.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=1;null!=t&&t!==this.root_&&1===t.parent.color;)if(II(t)===xI(II(II(t)))){var r=CI(II(II(t)));1===_I(r)?(EI(II(t),0),EI(r,0),EI(II(II(t)),1),t=II(II(t))):(t===CI(II(t))&&(t=II(t),e.rotateLeft(t)),EI(II(t),0),EI(II(II(t)),1),e.rotateRight(II(II(t))))}else{var n=xI(II(II(t)));1===_I(n)?(EI(II(t),0),EI(n,0),EI(II(II(t)),1),t=II(II(t))):(t===xI(II(t))&&(t=II(t),e.rotateRight(t)),EI(II(t),0),EI(II(II(t)),1),e.rotateLeft(II(II(t))))}this.root_.color=0},wI.prototype.values=function(){var t=new aI,e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=wI.successor(e));)t.add(e.value);return t},wI.prototype.entrySet=function(){var t=new vI,e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=wI.successor(e));)t.add(e);return t},wI.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}},wI.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}},wI.prototype.getFirstEntry=function(){var t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t},wI.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 r=t.parent,n=t;null!==r&&n===r.right;)n=r,r=r.parent;return r},wI.prototype.size=function(){return this.size_};var bI=function(){};function BI(){}function SI(){this.array_=[],arguments[0]instanceof rI&&this.addAll(arguments[0])}bI.prototype.interfaces_=function(){return[]},bI.prototype.getClass=function(){return bI},BI.prototype=new yI,SI.prototype=new BI,SI.prototype.contains=function(t){for(var e=0,r=this.array_.length;e<r;e++){if(0===this.array_[e].compareTo(t))return!0}return!1},SI.prototype.add=function(t){if(this.contains(t))return!1;for(var e=0,r=this.array_.length;e<r;e++){if(1===this.array_[e].compareTo(t))return this.array_.splice(e,0,t),!0}return this.array_.push(t),!0},SI.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},SI.prototype.remove=function(t){throw new dI},SI.prototype.size=function(){return this.array_.length},SI.prototype.isEmpty=function(){return 0===this.array_.length},SI.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t},SI.prototype.iterator=function(){return new MI(this)};var MI=function(t){this.treeSet_=t,this.position_=0};MI.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new sI;return this.treeSet_.array_[this.position_++]},MI.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},MI.prototype.remove=function(){throw new dI};var LI=function(){};LI.sort=function(){var t,e,r,n,i=arguments[0];if(1===arguments.length)n=function(t,e){return t.compareTo(e)},i.sort(n);else if(2===arguments.length)r=arguments[1],n=function(t,e){return r.compare(t,e)},i.sort(n);else if(3===arguments.length){(e=i.slice(arguments[1],arguments[2])).sort();var o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length));for(i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])}else if(4===arguments.length)for(e=i.slice(arguments[1],arguments[2]),r=arguments[3],n=function(t,e){return r.compare(t,e)},e.sort(n),o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length)),i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])},LI.asList=function(t){for(var e=new aI,r=0,n=t.length;r<n;r++)e.add(t[r]);return e};var NI=function(){},TI={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}};TI.P.get=function(){return 0},TI.L.get=function(){return 1},TI.A.get=function(){return 2},TI.FALSE.get=function(){return-1},TI.TRUE.get=function(){return-2},TI.DONTCARE.get=function(){return-3},TI.SYM_FALSE.get=function(){return"F"},TI.SYM_TRUE.get=function(){return"T"},TI.SYM_DONTCARE.get=function(){return"*"},TI.SYM_P.get=function(){return"0"},TI.SYM_L.get=function(){return"1"},TI.SYM_A.get=function(){return"2"},NI.prototype.interfaces_=function(){return[]},NI.prototype.getClass=function(){return NI},NI.toDimensionSymbol=function(t){switch(t){case NI.FALSE:return NI.SYM_FALSE;case NI.TRUE:return NI.SYM_TRUE;case NI.DONTCARE:return NI.SYM_DONTCARE;case NI.P:return NI.SYM_P;case NI.L:return NI.SYM_L;case NI.A:return NI.SYM_A}throw new $m("Unknown dimension value: "+t)},NI.toDimensionValue=function(t){switch(y_.toUpperCase(t)){case NI.SYM_FALSE:return NI.FALSE;case NI.SYM_TRUE:return NI.TRUE;case NI.SYM_DONTCARE:return NI.DONTCARE;case NI.SYM_P:return NI.P;case NI.SYM_L:return NI.L;case NI.SYM_A:return NI.A}throw new $m("Unknown dimension symbol: "+t)},Object.defineProperties(NI,TI);var RI=function(){};RI.prototype.filter=function(t){},RI.prototype.interfaces_=function(){return[]},RI.prototype.getClass=function(){return RI};var DI=function(){};DI.prototype.filter=function(t,e){},DI.prototype.isDone=function(){},DI.prototype.isGeometryChanged=function(){},DI.prototype.interfaces_=function(){return[]},DI.prototype.getClass=function(){return DI};var PI=function(t){function e(e,r){if(t.call(this,r),this._geometries=e||[],t.hasNullElements(this._geometries))throw new $m("geometries must not contain null elements")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){for(var t=new S_,e=0;e<this._geometries.length;e++)t.expandToInclude(this._geometries[e].getEnvelopeInternal());return t},e.prototype.getGeometryN=function(t){return this._geometries[t]},e.prototype.getSortIndex=function(){return t.SORTINDEX_GEOMETRYCOLLECTION},e.prototype.getCoordinates=function(){for(var t=new Array(this.getNumPoints()).fill(null),e=-1,r=0;r<this._geometries.length;r++)for(var n=this._geometries[r].getCoordinates(),i=0;i<n.length;i++)t[++e]=n[i];return t},e.prototype.getArea=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getArea();return t},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];if(!this.isEquivalentClass(e))return!1;var n=e;if(this._geometries.length!==n._geometries.length)return!1;for(var i=0;i<this._geometries.length;i++)if(!this._geometries[i].equalsExact(n._geometries[i],r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=0;t<this._geometries.length;t++)this._geometries[t].normalize();LI.sort(this._geometries)},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},e.prototype.getBoundaryDimension=function(){for(var t=NI.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getBoundaryDimension());return t},e.prototype.getDimension=function(){for(var t=NI.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getDimension());return t},e.prototype.getLength=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getLength();return t},e.prototype.getNumPoints=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getNumPoints();return t},e.prototype.getNumGeometries=function(){return this._geometries.length},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),r=0;r<this._geometries.length;r++)e[r]=this._geometries[r].reverse();return this.getFactory().createGeometryCollection(e)},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=new SI(LI.asList(this._geometries)),r=new SI(LI.asList(t._geometries));return this.compare(e,r)}if(2===arguments.length){for(var n=arguments[1],i=arguments[0],o=this.getNumGeometries(),s=i.getNumGeometries(),a=0;a<o&&a<s;){var u=this.getGeometryN(a),l=i.getGeometryN(a),c=u.compareToSameClass(l,n);if(0!==c)return c;a++}return a<o?1:a<s?-1:0}},e.prototype.apply=function(){var t=this;if(f_(arguments[0],J_))for(var e=arguments[0],r=0;r<this._geometries.length;r++)t._geometries[r].apply(e);else if(f_(arguments[0],DI)){var n=arguments[0];if(0===this._geometries.length)return null;for(var i=0;i<this._geometries.length&&(t._geometries[i].apply(n),!n.isDone());i++);n.isGeometryChanged()&&this.geometryChanged()}else if(f_(arguments[0],RI)){var o=arguments[0];o.filter(this);for(var s=0;s<this._geometries.length;s++)t._geometries[s].apply(o)}else if(f_(arguments[0],z_)){var a=arguments[0];a.filter(this);for(var u=0;u<this._geometries.length;u++)t._geometries[u].apply(a)}},e.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),k_.shouldNeverReachHere(),null},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._geometries=new Array(this._geometries.length).fill(null);for(var r=0;r<this._geometries.length;r++)e._geometries[r]=this._geometries[r].clone();return e},e.prototype.getGeometryType=function(){return"GeometryCollection"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.isEmpty=function(){for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isEmpty())return!1;return!0},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x4f07bcb1f857d800},Object.defineProperties(e,r),e}(Y_),QI=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return Y_.SORTINDEX_MULTILINESTRING},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?NI.FALSE:0},e.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isClosed())return!1;return!0},e.prototype.getDimension=function(){return 1},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),r=0;r<this._geometries.length;r++)e[t-1-r]=this._geometries[r].reverse();return this.getFactory().createMultiLineString(e)},e.prototype.getBoundary=function(){return new kI(this).getBoundary()},e.prototype.getGeometryType=function(){return"MultiLineString"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[bI]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return 0x7155d2ab4afa8000},Object.defineProperties(e,r),e}(PI),kI=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,1===arguments.length){var t=arguments[0],e=W_.MOD2_BOUNDARY_RULE;this._geom=t,this._geomFact=t.getFactory(),this._bnRule=e}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this._geom=r,this._geomFact=r.getFactory(),this._bnRule=n}};kI.prototype.boundaryMultiLineString=function(t){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var e=this.computeBoundaryCoordinates(t);return 1===e.length?this._geomFact.createPoint(e[0]):this._geomFact.createMultiPointFromCoords(e)},kI.prototype.getBoundary=function(){return this._geom instanceof XI?this.boundaryLineString(this._geom):this._geom instanceof QI?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},kI.prototype.boundaryLineString=function(t){return this._geom.isEmpty()?this.getEmptyMultiPoint():t.isClosed()?this._bnRule.isInBoundary(2)?t.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([t.getStartPoint(),t.getEndPoint()])},kI.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},kI.prototype.computeBoundaryCoordinates=function(t){var e=this,r=new aI;this._endpointMap=new wI;for(var n=0;n<t.getNumGeometries();n++){var i=t.getGeometryN(n);0!==i.getNumPoints()&&(e.addEndpoint(i.getCoordinateN(0)),e.addEndpoint(i.getCoordinateN(i.getNumPoints()-1)))}for(var o=this._endpointMap.entrySet().iterator();o.hasNext();){var s=o.next(),a=s.getValue().count;e._bnRule.isInBoundary(a)&&r.add(s.getKey())}return cI.toCoordinateArray(r)},kI.prototype.addEndpoint=function(t){var e=this._endpointMap.get(t);null===e&&(e=new OI,this._endpointMap.put(t,e)),e.count++},kI.prototype.interfaces_=function(){return[]},kI.prototype.getClass=function(){return kI},kI.getBoundary=function(){return 1===arguments.length?new kI(arguments[0]).getBoundary():2===arguments.length?new kI(arguments[0],arguments[1]).getBoundary():void 0};var OI=function(){this.count=null};function FI(){}function GI(){}OI.prototype.interfaces_=function(){return[]},OI.prototype.getClass=function(){return OI};var UI=function(){};function qI(){}function jI(){}function VI(){}var zI=function(){},YI={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};zI.prototype.interfaces_=function(){return[]},zI.prototype.getClass=function(){return zI},zI.chars=function(t,e){for(var r=new Array(e).fill(null),n=0;n<e;n++)r[n]=t;return String(r)},zI.getStackTrace=function(){if(1===arguments.length){var t=arguments[0],e=new qI,r=new FI;return t.printStackTrace(r),e.toString()}if(2===arguments.length){var n=arguments[1],i="";new GI(zI.getStackTrace(arguments[0]));for(var o=new VI,s=0;s<n;s++)try{i+=o.readLine()+zI.NEWLINE}catch(t){if(!(t instanceof jI))throw t;k_.shouldNeverReachHere()}return i}},zI.split=function(t,e){for(var r=e.length,n=new aI,i=""+t,o=i.indexOf(e);o>=0;){var s=i.substring(0,o);n.add(s),o=(i=i.substring(o+r)).indexOf(e)}i.length>0&&n.add(i);for(var a=new Array(n.size()).fill(null),u=0;u<a.length;u++)a[u]=n.get(u);return a},zI.toString=function(){if(1===arguments.length){var t=arguments[0];return zI.SIMPLE_ORDINATE_FORMAT.format(t)}},zI.spaces=function(t){return zI.chars(" ",t)},YI.NEWLINE.get=function(){return b_.getProperty("line.separator")},YI.SIMPLE_ORDINATE_FORMAT.get=function(){return new UI},Object.defineProperties(zI,YI);var HI=function(){};HI.prototype.interfaces_=function(){return[]},HI.prototype.getClass=function(){return HI},HI.copyCoord=function(t,e,r,n){for(var i=Math.min(t.getDimension(),r.getDimension()),o=0;o<i;o++)r.setOrdinate(n,o,t.getOrdinate(e,o))},HI.isRing=function(t){var e=t.size();return 0===e||!(e<=3)&&(t.getOrdinate(0,E_.X)===t.getOrdinate(e-1,E_.X)&&t.getOrdinate(0,E_.Y)===t.getOrdinate(e-1,E_.Y))},HI.isEqual=function(t,e){var r=t.size();if(r!==e.size())return!1;for(var n=Math.min(t.getDimension(),e.getDimension()),i=0;i<r;i++)for(var o=0;o<n;o++){var s=t.getOrdinate(i,o),a=e.getOrdinate(i,o);if(t.getOrdinate(i,o)!==e.getOrdinate(i,o)&&(!t_.isNaN(s)||!t_.isNaN(a)))return!1}return!0},HI.extend=function(t,e,r){var n=t.create(r,e.getDimension()),i=e.size();if(HI.copy(e,0,n,0,i),i>0)for(var o=i;o<r;o++)HI.copy(e,i-1,n,o,1);return n},HI.reverse=function(t){for(var e=t.size()-1,r=Math.trunc(e/2),n=0;n<=r;n++)HI.swap(t,n,e-n)},HI.swap=function(t,e,r){if(e===r)return null;for(var n=0;n<t.getDimension();n++){var i=t.getOrdinate(e,n);t.setOrdinate(e,n,t.getOrdinate(r,n)),t.setOrdinate(r,n,i)}},HI.copy=function(t,e,r,n,i){for(var o=0;o<i;o++)HI.copyCoord(t,e+o,r,n+o)},HI.toString=function(){if(1===arguments.length){var t=arguments[0],e=t.size();if(0===e)return"()";var r=t.getDimension(),n=new A_;n.append("(");for(var i=0;i<e;i++){i>0&&n.append(" ");for(var o=0;o<r;o++)o>0&&n.append(","),n.append(zI.toString(t.getOrdinate(i,o)))}return n.append(")"),n.toString()}},HI.ensureValidRing=function(t,e){var r=e.size();return 0===r?e:r<=3?HI.createClosedRing(t,e,4):e.getOrdinate(0,E_.X)===e.getOrdinate(r-1,E_.X)&&e.getOrdinate(0,E_.Y)===e.getOrdinate(r-1,E_.Y)?e:HI.createClosedRing(t,e,r+1)},HI.createClosedRing=function(t,e,r){var n=t.create(r,e.getDimension()),i=e.size();HI.copy(e,0,n,0,i);for(var o=i;o<r;o++)HI.copy(e,0,n,o,1);return n};var XI=function(t){function e(e,r){t.call(this,r),this._points=null,this.init(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new S_:this._points.expandEnvelope(new S_)},e.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},e.prototype.getSortIndex=function(){return t.SORTINDEX_LINESTRING},e.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];if(!this.isEquivalentClass(e))return!1;var n=e;if(this._points.size()!==n._points.size())return!1;for(var i=0;i<this._points.size();i++)if(!this.equal(this._points.getCoordinate(i),n._points.getCoordinate(i),r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=this,e=0;e<Math.trunc(this._points.size()/2);e++){var r=t._points.size()-1-e;if(!t._points.getCoordinate(e).equals(t._points.getCoordinate(r)))return t._points.getCoordinate(e).compareTo(t._points.getCoordinate(r))>0&&HI.reverse(t._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?NI.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 j_.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var t=this._points.copy();return HI.reverse(t),this.getFactory().createLineString(t)},e.prototype.compareToSameClass=function(){if(1===arguments.length){for(var t=arguments[0],e=0,r=0;e<this._points.size()&&r<t._points.size();){var n=this._points.getCoordinate(e).compareTo(t._points.getCoordinate(r));if(0!==n)return n;e++,r++}return e<this._points.size()?1:r<t._points.size()?-1:0}if(2===arguments.length){var i=arguments[0];return arguments[1].compare(this._points,i._points)}},e.prototype.apply=function(){if(f_(arguments[0],J_))for(var t=arguments[0],e=0;e<this._points.size();e++)t.filter(this._points.getCoordinate(e));else if(f_(arguments[0],DI)){var r=arguments[0];if(0===this._points.size())return null;for(var n=0;n<this._points.size()&&(r.filter(this._points,n),!r.isDone());n++);r.isGeometryChanged()&&this.geometryChanged()}else if(f_(arguments[0],RI)){arguments[0].filter(this)}else if(f_(arguments[0],z_)){arguments[0].filter(this)}},e.prototype.getBoundary=function(){return new kI(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 $m("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[bI]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(e,r),e}(Y_),JI=function(){};JI.prototype.interfaces_=function(){return[]},JI.prototype.getClass=function(){return JI};var WI=function(t){function e(e,r){t.call(this,r),this._coordinates=e||null,this.init(this._coordinates)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new S_;var t=new S_;return t.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),t},e.prototype.getSortIndex=function(){return t.SORTINDEX_POINT},e.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&(!(!this.isEmpty()||!e.isEmpty())||this.isEmpty()===e.isEmpty()&&this.equal(e.getCoordinate(),this.getCoordinate(),r))}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 NI.FALSE},e.prototype.getDimension=function(){return 0},e.prototype.getNumPoints=function(){return this.isEmpty()?0:1},e.prototype.reverse=function(){return this.copy()},e.prototype.getX=function(){if(null===this.getCoordinate())throw new Error("getX called on empty Point");return this.getCoordinate().x},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0];return this.getCoordinate().compareTo(t.getCoordinate())}if(2===arguments.length){var e=arguments[0];return arguments[1].compare(this._coordinates,e._coordinates)}},e.prototype.apply=function(){if(f_(arguments[0],J_)){var t=arguments[0];if(this.isEmpty())return null;t.filter(this.getCoordinate())}else if(f_(arguments[0],DI)){var e=arguments[0];if(this.isEmpty())return null;e.filter(this._coordinates,0),e.isGeometryChanged()&&this.geometryChanged()}else if(f_(arguments[0],RI)){arguments[0].filter(this)}else if(f_(arguments[0],z_)){arguments[0].filter(this)}},e.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},e.prototype.clone=function(){var e=t.prototype.clone.call(this);return e._coordinates=this._coordinates.clone(),e},e.prototype.getGeometryType=function(){return"Point"},e.prototype.copy=function(){return new e(this._coordinates.copy(),this._factory)},e.prototype.getCoordinateSequence=function(){return this._coordinates},e.prototype.getY=function(){if(null===this.getCoordinate())throw new Error("getY called on empty Point");return this.getCoordinate().y},e.prototype.isEmpty=function(){return 0===this._coordinates.size()},e.prototype.init=function(t){null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),k_.isTrue(t.size()<=1),this._coordinates=t},e.prototype.isSimple=function(){return!0},e.prototype.interfaces_=function(){return[JI]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return 0x44077bad161cbc00},Object.defineProperties(e,r),e}(Y_),KI=function(){};KI.prototype.interfaces_=function(){return[]},KI.prototype.getClass=function(){return KI};var ZI=function(t){function e(e,r,n){if(t.call(this,n),this._shell=null,this._holes=null,null===e&&(e=this.getFactory().createLinearRing()),null===r&&(r=[]),t.hasNullElements(r))throw new $m("holes must not contain null elements");if(e.isEmpty()&&t.hasNonEmptyElements(r))throw new $m("shell is empty but holes are not");this._shell=e,this._holes=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={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,r=this._shell.getCoordinates(),n=0;n<r.length;n++)t[++e]=r[n];for(var i=0;i<this._holes.length;i++)for(var o=this._holes[i].getCoordinates(),s=0;s<o.length;s++)t[++e]=o[s];return t},e.prototype.getArea=function(){var t=0;t+=Math.abs(j_.signedArea(this._shell.getCoordinateSequence()));for(var e=0;e<this._holes.length;e++)t-=Math.abs(j_.signedArea(this._holes[e].getCoordinateSequence()));return t},e.prototype.isRectangle=function(){if(0!==this.getNumInteriorRing())return!1;if(null===this._shell)return!1;if(5!==this._shell.getNumPoints())return!1;for(var t=this._shell.getCoordinateSequence(),e=this.getEnvelopeInternal(),r=0;r<5;r++){var n=t.getX(r);if(n!==e.getMinX()&&n!==e.getMaxX())return!1;var i=t.getY(r);if(i!==e.getMinY()&&i!==e.getMaxY())return!1}for(var o=t.getX(0),s=t.getY(0),a=1;a<=4;a++){var u=t.getX(a),l=t.getY(a);if(u!==o===(l!==s))return!1;o=u,s=l}return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];if(!this.isEquivalentClass(e))return!1;var n=e,i=this._shell,o=n._shell;if(!i.equalsExact(o,r))return!1;if(this._holes.length!==n._holes.length)return!1;for(var s=0;s<this._holes.length;s++)if(!this._holes[s].equalsExact(n._holes[s],r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){if(0===arguments.length){this.normalize(this._shell,!0);for(var t=0;t<this._holes.length;t++)this.normalize(this._holes[t],!1);LI.sort(this._holes)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(e.isEmpty())return null;var n=new Array(e.getCoordinates().length-1).fill(null);b_.arraycopy(e.getCoordinates(),0,n,0,n.length);var i=cI.minCoordinate(e.getCoordinates());cI.scroll(n,i),b_.arraycopy(n,0,e.getCoordinates(),0,n.length),e.getCoordinates()[n.length]=n[0],j_.isCCW(e.getCoordinates())===r&&cI.reverse(e.getCoordinates())}},e.prototype.getCoordinate=function(){return this._shell.getCoordinate()},e.prototype.getNumInteriorRing=function(){return this._holes.length},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.getLength=function(){var t=0;t+=this._shell.getLength();for(var e=0;e<this._holes.length;e++)t+=this._holes[e].getLength();return t},e.prototype.getNumPoints=function(){for(var t=this._shell.getNumPoints(),e=0;e<this._holes.length;e++)t+=this._holes[e].getNumPoints();return t},e.prototype.reverse=function(){var t=this.copy();t._shell=this._shell.copy().reverse(),t._holes=new Array(this._holes.length).fill(null);for(var e=0;e<this._holes.length;e++)t._holes[e]=this._holes[e].copy().reverse();return t},e.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=this._shell,r=t._shell;return e.compareToSameClass(r)}if(2===arguments.length){var n=arguments[1],i=arguments[0],o=this._shell,s=i._shell,a=o.compareToSameClass(s,n);if(0!==a)return a;for(var u=this.getNumInteriorRing(),l=i.getNumInteriorRing(),c=0;c<u&&c<l;){var h=this.getInteriorRingN(c),f=i.getInteriorRingN(c),p=h.compareToSameClass(f,n);if(0!==p)return p;c++}return c<u?1:c<l?-1:0}},e.prototype.apply=function(t){var e=this;if(f_(t,J_)){this._shell.apply(t);for(var r=0;r<this._holes.length;r++)e._holes[r].apply(t)}else if(f_(t,DI)){if(this._shell.apply(t),!t.isDone())for(var n=0;n<this._holes.length&&(e._holes[n].apply(t),!t.isDone());n++);t.isGeometryChanged()&&this.geometryChanged()}else if(f_(t,RI))t.filter(this);else if(f_(t,z_)){t.filter(this),this._shell.apply(t);for(var i=0;i<this._holes.length;i++)e._holes[i].apply(t)}},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var t=new Array(this._holes.length+1).fill(null);t[0]=this._shell;for(var e=0;e<this._holes.length;e++)t[e+1]=this._holes[e];return t.length<=1?this.getFactory().createLinearRing(t[0].getCoordinateSequence()):this.getFactory().createMultiLineString(t)},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._shell=this._shell.clone(),e._holes=new Array(this._holes.length).fill(null);for(var r=0;r<this._holes.length;r++)e._holes[r]=this._holes[r].clone();return e},e.prototype.getGeometryType=function(){return"Polygon"},e.prototype.copy=function(){for(var t=this._shell.copy(),r=new Array(this._holes.length).fill(null),n=0;n<r.length;n++)r[n]=this._holes[n].copy();return new e(t,r,this._factory)},e.prototype.getExteriorRing=function(){return this._shell},e.prototype.isEmpty=function(){return this._shell.isEmpty()},e.prototype.getInteriorRingN=function(t){return this._holes[t]},e.prototype.interfaces_=function(){return[KI]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(e,r),e}(Y_),$I=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return Y_.SORTINDEX_MULTIPOINT},e.prototype.isValid=function(){return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getCoordinate=function(){if(1===arguments.length){var e=arguments[0];return this._geometries[e].getCoordinate()}return t.prototype.getCoordinate.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return NI.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),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[JI]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x6fb1ed4162e0fc00},Object.defineProperties(e,r),e}(PI),tE=function(t){function e(e,r){e instanceof s_&&r instanceof dE&&(e=r.getCoordinateSequenceFactory().create(e)),t.call(this,e,r),this.validateConstruction()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return Y_.SORTINDEX_LINEARRING},e.prototype.getBoundaryDimension=function(){return NI.FALSE},e.prototype.isClosed=function(){return!!this.isEmpty()||t.prototype.isClosed.call(this)},e.prototype.reverse=function(){var t=this._points.copy();return HI.reverse(t),this.getFactory().createLinearRing(t)},e.prototype.validateConstruction=function(){if(!this.isEmpty()&&!t.prototype.isClosed.call(this))throw new $m("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<e.MINIMUM_VALID_SIZE)throw new $m("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},r.MINIMUM_VALID_SIZE.get=function(){return 4},r.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,r),e}(XI),eE=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return Y_.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}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),r=0;r<this._geometries.length;r++)e[r]=this._geometries[r].reverse();return this.getFactory().createMultiPolygon(e)},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var t=new aI,e=0;e<this._geometries.length;e++)for(var r=this._geometries[e].getBoundary(),n=0;n<r.getNumGeometries();n++)t.add(r.getGeometryN(n));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),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[KI]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(e,r),e}(PI),rE=function(t){this._factory=t||null,this._isUserDataCopied=!1},nE={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};rE.prototype.setCopyUserData=function(t){this._isUserDataCopied=t},rE.prototype.edit=function(t,e){if(null===t)return null;var r=this.editInternal(t,e);return this._isUserDataCopied&&r.setUserData(t.getUserData()),r},rE.prototype.editInternal=function(t,e){return null===this._factory&&(this._factory=t.getFactory()),t instanceof PI?this.editGeometryCollection(t,e):t instanceof ZI?this.editPolygon(t,e):t instanceof WI||t instanceof XI?e.edit(t,this._factory):(k_.shouldNeverReachHere("Unsupported Geometry class: "+t.getClass().getName()),null)},rE.prototype.editGeometryCollection=function(t,e){for(var r=e.edit(t,this._factory),n=new aI,i=0;i<r.getNumGeometries();i++){var o=this.edit(r.getGeometryN(i),e);null===o||o.isEmpty()||n.add(o)}return r.getClass()===$I?this._factory.createMultiPoint(n.toArray([])):r.getClass()===QI?this._factory.createMultiLineString(n.toArray([])):r.getClass()===eE?this._factory.createMultiPolygon(n.toArray([])):this._factory.createGeometryCollection(n.toArray([]))},rE.prototype.editPolygon=function(t,e){var r=e.edit(t,this._factory);if(null===r&&(r=this._factory.createPolygon(null)),r.isEmpty())return r;var n=this.edit(r.getExteriorRing(),e);if(null===n||n.isEmpty())return this._factory.createPolygon();for(var i=new aI,o=0;o<r.getNumInteriorRing();o++){var s=this.edit(r.getInteriorRingN(o),e);null===s||s.isEmpty()||i.add(s)}return this._factory.createPolygon(n,i.toArray([]))},rE.prototype.interfaces_=function(){return[]},rE.prototype.getClass=function(){return rE},rE.GeometryEditorOperation=function(){},nE.NoOpGeometryOperation.get=function(){return iE},nE.CoordinateOperation.get=function(){return oE},nE.CoordinateSequenceOperation.get=function(){return sE},Object.defineProperties(rE,nE);var iE=function(){};iE.prototype.edit=function(t,e){return t},iE.prototype.interfaces_=function(){return[rE.GeometryEditorOperation]},iE.prototype.getClass=function(){return iE};var oE=function(){};oE.prototype.edit=function(t,e){var r=this.editCoordinates(t.getCoordinates(),t);return null===r?t:t instanceof tE?e.createLinearRing(r):t instanceof XI?e.createLineString(r):t instanceof WI?r.length>0?e.createPoint(r[0]):e.createPoint():t},oE.prototype.interfaces_=function(){return[rE.GeometryEditorOperation]},oE.prototype.getClass=function(){return oE};var sE=function(){};sE.prototype.edit=function(t,e){return t instanceof tE?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof XI?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof WI?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t},sE.prototype.interfaces_=function(){return[rE.GeometryEditorOperation]},sE.prototype.getClass=function(){return sE};var aE=function(){var t=this;if(this._dimension=3,this._coordinates=null,1===arguments.length){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var e=arguments[0];this._coordinates=new Array(e).fill(null);for(var r=0;r<e;r++)t._coordinates[r]=new s_}else if(f_(arguments[0],E_)){var n=arguments[0];if(null===n)return this._coordinates=new Array(0).fill(null),null;this._dimension=n.getDimension(),this._coordinates=new Array(n.size()).fill(null);for(var i=0;i<this._coordinates.length;i++)t._coordinates[i]=n.getCoordinateCopy(i)}}else if(2===arguments.length)if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var o=arguments[0],s=arguments[1];this._coordinates=o,this._dimension=s,null===o&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var a=arguments[0],u=arguments[1];this._coordinates=new Array(a).fill(null),this._dimension=u;for(var l=0;l<a;l++)t._coordinates[l]=new s_}},uE={serialVersionUID:{configurable:!0}};aE.prototype.setOrdinate=function(t,e,r){switch(e){case E_.X:this._coordinates[t].x=r;break;case E_.Y:this._coordinates[t].y=r;break;case E_.Z:this._coordinates[t].z=r;break;default:throw new $m("invalid ordinateIndex")}},aE.prototype.size=function(){return this._coordinates.length},aE.prototype.getOrdinate=function(t,e){switch(e){case E_.X:return this._coordinates[t].x;case E_.Y:return this._coordinates[t].y;case E_.Z:return this._coordinates[t].z}return t_.NaN},aE.prototype.getCoordinate=function(){if(1===arguments.length){var t=arguments[0];return this._coordinates[t]}if(2===arguments.length){var e=arguments[0],r=arguments[1];r.x=this._coordinates[e].x,r.y=this._coordinates[e].y,r.z=this._coordinates[e].z}},aE.prototype.getCoordinateCopy=function(t){return new s_(this._coordinates[t])},aE.prototype.getDimension=function(){return this._dimension},aE.prototype.getX=function(t){return this._coordinates[t].x},aE.prototype.clone=function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].clone();return new aE(t,this._dimension)},aE.prototype.expandEnvelope=function(t){for(var e=0;e<this._coordinates.length;e++)t.expandToInclude(this._coordinates[e]);return t},aE.prototype.copy=function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].copy();return new aE(t,this._dimension)},aE.prototype.toString=function(){if(this._coordinates.length>0){var t=new A_(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var e=1;e<this._coordinates.length;e++)t.append(", "),t.append(this._coordinates[e]);return t.append(")"),t.toString()}return"()"},aE.prototype.getY=function(t){return this._coordinates[t].y},aE.prototype.toCoordinateArray=function(){return this._coordinates},aE.prototype.interfaces_=function(){return[E_,o_]},aE.prototype.getClass=function(){return aE},uE.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(aE,uE);var lE=function(){},cE={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};lE.prototype.readResolve=function(){return lE.instance()},lE.prototype.create=function(){if(1===arguments.length){if(arguments[0]instanceof Array)return new aE(arguments[0]);if(f_(arguments[0],E_))return new aE(arguments[0])}else if(2===arguments.length){var t=arguments[0],e=arguments[1];return e>3&&(e=3),e<2?new aE(t):new aE(t,e)}},lE.prototype.interfaces_=function(){return[l_,o_]},lE.prototype.getClass=function(){return lE},lE.instance=function(){return lE.instanceObject},cE.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},cE.instanceObject.get=function(){return new lE},Object.defineProperties(lE,cE);var hE=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 aI,e=this.map_.values(),r=e.next();!r.done;)t.add(r.value),r=e.next();return t},e.prototype.entrySet=function(){var t=new vI;return this.map_.entries().forEach((function(e){return t.add(e)})),t},e.prototype.size=function(){return this.map_.size()},e}(gI),fE=function t(){if(this._modelType=null,this._scale=null,0===arguments.length)this._modelType=t.FLOATING;else if(1===arguments.length)if(arguments[0]instanceof gE){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if("number"==typeof arguments[0]){var r=arguments[0];this._modelType=t.FIXED,this.setScale(r)}else if(arguments[0]instanceof t){var n=arguments[0];this._modelType=n._modelType,this._scale=n._scale}},pE={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};fE.prototype.equals=function(t){if(!(t instanceof fE))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale},fE.prototype.compareTo=function(t){var e=t,r=this.getMaximumSignificantDigits(),n=e.getMaximumSignificantDigits();return new d_(r).compareTo(new d_(n))},fE.prototype.getScale=function(){return this._scale},fE.prototype.isFloating=function(){return this._modelType===fE.FLOATING||this._modelType===fE.FLOATING_SINGLE},fE.prototype.getType=function(){return this._modelType},fE.prototype.toString=function(){var t="UNKNOWN";return this._modelType===fE.FLOATING?t="Floating":this._modelType===fE.FLOATING_SINGLE?t="Floating-Single":this._modelType===fE.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},fE.prototype.makePrecise=function(){if("number"==typeof arguments[0]){var t=arguments[0];return t_.isNaN(t)||this._modelType===fE.FLOATING_SINGLE?t:this._modelType===fE.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof s_){var e=arguments[0];if(this._modelType===fE.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}},fE.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===fE.FLOATING?t=16:this._modelType===fE.FLOATING_SINGLE?t=6:this._modelType===fE.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},fE.prototype.setScale=function(t){this._scale=Math.abs(t)},fE.prototype.interfaces_=function(){return[o_,r_]},fE.prototype.getClass=function(){return fE},fE.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e},pE.serialVersionUID.get=function(){return 0x6bee6404e9a25c00},pE.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(fE,pE);var gE=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},AE={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};gE.prototype.readResolve=function(){return gE.nameToTypeMap.get(this._name)},gE.prototype.toString=function(){return this._name},gE.prototype.interfaces_=function(){return[o_]},gE.prototype.getClass=function(){return gE},AE.serialVersionUID.get=function(){return-552860263173159e4},AE.nameToTypeMap.get=function(){return new hE},Object.defineProperties(gE,AE),fE.Type=gE,fE.FIXED=new gE("FIXED"),fE.FLOATING=new gE("FLOATING"),fE.FLOATING_SINGLE=new gE("FLOATING SINGLE");var dE=function t(){this._precisionModel=new fE,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),0===arguments.length||(1===arguments.length?f_(arguments[0],l_)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof fE&&(this._precisionModel=arguments[0]):2===arguments.length?(this._precisionModel=arguments[0],this._SRID=arguments[1]):3===arguments.length&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},yE={serialVersionUID:{configurable:!0}};dE.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new s_(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new s_(t.getMinX(),t.getMinY()),new s_(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new s_(t.getMinX(),t.getMinY()),new s_(t.getMinX(),t.getMaxY()),new s_(t.getMaxX(),t.getMaxY()),new s_(t.getMaxX(),t.getMinY()),new s_(t.getMinX(),t.getMinY())]),null)},dE.prototype.createLineString=function(t){return t?t instanceof Array?new XI(this.getCoordinateSequenceFactory().create(t),this):f_(t,E_)?new XI(t,this):void 0:new XI(this.getCoordinateSequenceFactory().create([]),this)},dE.prototype.createMultiLineString=function(){return 0===arguments.length?new QI(null,this):1===arguments.length?new QI(arguments[0],this):void 0},dE.prototype.buildGeometry=function(t){for(var e=null,r=!1,n=!1,i=t.iterator();i.hasNext();){var o=i.next(),s=o.getClass();null===e&&(e=s),s!==e&&(r=!0),o.isGeometryCollectionOrDerived()&&(n=!0)}if(null===e)return this.createGeometryCollection();if(r||n)return this.createGeometryCollection(dE.toGeometryArray(t));var a=t.iterator().next();if(t.size()>1){if(a instanceof ZI)return this.createMultiPolygon(dE.toPolygonArray(t));if(a instanceof XI)return this.createMultiLineString(dE.toLineStringArray(t));if(a instanceof WI)return this.createMultiPoint(dE.toPointArray(t));k_.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a},dE.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)},dE.prototype.createPoint=function(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof s_){var t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(f_(arguments[0],E_))return new WI(arguments[0],this)}},dE.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},dE.prototype.createPolygon=function(){if(0===arguments.length)return new ZI(null,null,this);if(1===arguments.length){if(f_(arguments[0],E_)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}if(arguments[0]instanceof tE){var r=arguments[0];return this.createPolygon(r,null)}}else if(2===arguments.length){return new ZI(arguments[0],arguments[1],this)}},dE.prototype.getSRID=function(){return this._SRID},dE.prototype.createGeometryCollection=function(){return 0===arguments.length?new PI(null,this):1===arguments.length?new PI(arguments[0],this):void 0},dE.prototype.createGeometry=function(t){return new rE(this).edit(t,{edit:function(){if(2===arguments.length){var t=arguments[0];return this._coordinateSequenceFactory.create(t)}}})},dE.prototype.getPrecisionModel=function(){return this._precisionModel},dE.prototype.createLinearRing=function(){if(0===arguments.length)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(f_(arguments[0],E_))return new tE(arguments[0],this)}},dE.prototype.createMultiPolygon=function(){return 0===arguments.length?new eE(null,this):1===arguments.length?new eE(arguments[0],this):void 0},dE.prototype.createMultiPoint=function(){if(0===arguments.length)return new $I(null,this);if(1===arguments.length){if(arguments[0]instanceof Array)return new $I(arguments[0],this);if(arguments[0]instanceof Array){var t=arguments[0];return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(f_(arguments[0],E_)){var e=arguments[0];if(null===e)return this.createMultiPoint(new Array(0).fill(null));for(var r=new Array(e.size()).fill(null),n=0;n<e.size();n++){var i=this.getCoordinateSequenceFactory().create(1,e.getDimension());HI.copy(e,n,i,0,1),r[n]=this.createPoint(i)}return this.createMultiPoint(r)}}},dE.prototype.interfaces_=function(){return[o_]},dE.prototype.getClass=function(){return dE},dE.toMultiPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},dE.toGeometryArray=function(t){if(null===t)return null;var e=new Array(t.size()).fill(null);return t.toArray(e)},dE.getDefaultCoordinateSequenceFactory=function(){return lE.instance()},dE.toMultiLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},dE.toLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},dE.toMultiPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},dE.toLinearRingArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},dE.toPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},dE.toPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},dE.createPointFromInternalCoord=function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)},yE.serialVersionUID.get=function(){return-0x5ea75f2051eeb400},Object.defineProperties(dE,yE);var vE=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],mE=function(t){this.geometryFactory=t||new dE};mE.prototype.read=function(t){var e,r=(e="string"==typeof t?JSON.parse(t):t).type;if(!_E[r])throw new Error("Unknown GeoJSON type: "+e.type);return-1!==vE.indexOf(r)?_E[r].apply(this,[e.coordinates]):"GeometryCollection"===r?_E[r].apply(this,[e.geometries]):_E[r].apply(this,[e])},mE.prototype.write=function(t){var e=t.getGeometryType();if(!IE[e])throw new Error("Geometry is not supported");return IE[e].apply(this,[t])};var _E={Feature:function(t){var e={};for(var r in t)e[r]=t[r];if(t.geometry){var n=t.geometry.type;if(!_E[n])throw new Error("Unknown GeoJSON type: "+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=_E.bbox.apply(this,[t.bbox])),e},FeatureCollection:function(t){var e={};if(t.features){e.features=[];for(var r=0;r<t.features.length;++r)e.features.push(this.read(t.features[r]))}return t.bbox&&(e.bbox=this.parse.bbox.apply(this,[t.bbox])),e},coordinates:function(t){for(var e=[],r=0;r<t.length;++r){var n=t[r];e.push(new s_(n[0],n[1]))}return e},bbox:function(t){return this.geometryFactory.createLinearRing([new s_(t[0],t[1]),new s_(t[2],t[1]),new s_(t[2],t[3]),new s_(t[0],t[3]),new s_(t[0],t[1])])},Point:function(t){var e=new s_(t[0],t[1]);return this.geometryFactory.createPoint(e)},MultiPoint:function(t){for(var e=[],r=0;r<t.length;++r)e.push(_E.Point.apply(this,[t[r]]));return this.geometryFactory.createMultiPoint(e)},LineString:function(t){var e=_E.coordinates.apply(this,[t]);return this.geometryFactory.createLineString(e)},MultiLineString:function(t){for(var e=[],r=0;r<t.length;++r)e.push(_E.LineString.apply(this,[t[r]]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(t){for(var e=_E.coordinates.apply(this,[t[0]]),r=this.geometryFactory.createLinearRing(e),n=[],i=1;i<t.length;++i){var o=t[i],s=_E.coordinates.apply(this,[o]),a=this.geometryFactory.createLinearRing(s);n.push(a)}return this.geometryFactory.createPolygon(r,n)},MultiPolygon:function(t){for(var e=[],r=0;r<t.length;++r){var n=t[r];e.push(_E.Polygon.apply(this,[n]))}return this.geometryFactory.createMultiPolygon(e)},GeometryCollection:function(t){for(var e=[],r=0;r<t.length;++r){var n=t[r];e.push(this.read(n))}return this.geometryFactory.createGeometryCollection(e)}},IE={coordinate:function(t){return[t.x,t.y]},Point:function(t){return{type:"Point",coordinates:IE.coordinate.apply(this,[t.getCoordinate()])}},MultiPoint:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=IE.Point.apply(this,[n]);e.push(i.coordinates)}return{type:"MultiPoint",coordinates:e}},LineString:function(t){for(var e=[],r=t.getCoordinates(),n=0;n<r.length;++n){var i=r[n];e.push(IE.coordinate.apply(this,[i]))}return{type:"LineString",coordinates:e}},MultiLineString:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=IE.LineString.apply(this,[n]);e.push(i.coordinates)}return{type:"MultiLineString",coordinates:e}},Polygon:function(t){var e=[],r=IE.LineString.apply(this,[t._shell]);e.push(r.coordinates);for(var n=0;n<t._holes.length;++n){var i=t._holes[n],o=IE.LineString.apply(this,[i]);e.push(o.coordinates)}return{type:"Polygon",coordinates:e}},MultiPolygon:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=IE.Polygon.apply(this,[n]);e.push(i.coordinates)}return{type:"MultiPolygon",coordinates:e}},GeometryCollection:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=n.getGeometryType();e.push(IE[i].apply(this,[n]))}return{type:"GeometryCollection",geometries:e}}},EE=function(t){this.geometryFactory=t||new dE,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new mE(this.geometryFactory)};EE.prototype.read=function(t){var e=this.parser.read(t);return this.precisionModel.getType()===fE.FIXED&&this.reducePrecision(e),e},EE.prototype.reducePrecision=function(t){var e,r;if(t.coordinate)this.precisionModel.makePrecise(t.coordinate);else if(t.points)for(e=0,r=t.points.length;e<r;e++)this.precisionModel.makePrecise(t.points[e]);else if(t.geometries)for(e=0,r=t.geometries.length;e<r;e++)this.reducePrecision(t.geometries[e])};var xE=function(){this.parser=new mE(this.geometryFactory)};xE.prototype.write=function(t){return this.parser.write(t)};var CE=function(){},wE={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};function bE(t){this.message=t||""}function BE(){this.array_=[]}CE.prototype.interfaces_=function(){return[]},CE.prototype.getClass=function(){return CE},CE.opposite=function(t){return t===CE.LEFT?CE.RIGHT:t===CE.RIGHT?CE.LEFT:t},wE.ON.get=function(){return 0},wE.LEFT.get=function(){return 1},wE.RIGHT.get=function(){return 2},Object.defineProperties(CE,wE),bE.prototype=new Error,bE.prototype.name="EmptyStackException",BE.prototype=new oI,BE.prototype.add=function(t){return this.array_.push(t),!0},BE.prototype.get=function(t){if(t<0||t>=this.size())throw new Error;return this.array_[t]},BE.prototype.push=function(t){return this.array_.push(t),t},BE.prototype.pop=function(t){if(0===this.array_.length)throw new bE;return this.array_.pop()},BE.prototype.peek=function(){if(0===this.array_.length)throw new bE;return this.array_[this.array_.length-1]},BE.prototype.empty=function(){return 0===this.array_.length},BE.prototype.isEmpty=function(){return this.empty()},BE.prototype.search=function(t){return this.array_.indexOf(t)},BE.prototype.size=function(){return this.array_.length},BE.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t};var SE=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};SE.prototype.getCoordinate=function(){return this._minCoord},SE.prototype.getRightmostSide=function(t,e){var r=this.getRightmostSideOfSegment(t,e);return r<0&&(r=this.getRightmostSideOfSegment(t,e-1)),r<0&&(this._minCoord=null,this.checkForRightmostCoordinate(t)),r},SE.prototype.findRightmostEdgeAtVertex=function(){var t=this._minDe.getEdge().getCoordinates();k_.isTrue(this._minIndex>0&&this._minIndex<t.length,"rightmost point expected to be interior vertex of edge");var e=t[this._minIndex-1],r=t[this._minIndex+1],n=j_.computeOrientation(this._minCoord,r,e),i=!1;(e.y<this._minCoord.y&&r.y<this._minCoord.y&&n===j_.COUNTERCLOCKWISE||e.y>this._minCoord.y&&r.y>this._minCoord.y&&n===j_.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)},SE.prototype.getRightmostSideOfSegment=function(t,e){var r=t.getEdge().getCoordinates();if(e<0||e+1>=r.length)return-1;if(r[e].y===r[e+1].y)return-1;var n=CE.LEFT;return r[e].y<r[e+1].y&&(n=CE.RIGHT),n},SE.prototype.getEdge=function(){return this._orientedDe},SE.prototype.checkForRightmostCoordinate=function(t){for(var e=this,r=t.getEdge().getCoordinates(),n=0;n<r.length-1;n++)(null===e._minCoord||r[n].x>e._minCoord.x)&&(e._minDe=t,e._minIndex=n,e._minCoord=r[n])},SE.prototype.findRightmostEdgeAtNode=function(){var t=this._minDe.getNode().getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},SE.prototype.findEdge=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next();r.isForward()&&this.checkForRightmostCoordinate(r)}k_.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)===CE.LEFT&&(this._orientedDe=this._minDe.getSym())},SE.prototype.interfaces_=function(){return[]},SE.prototype.getClass=function(){return SE};var ME=function(t){function e(r,n){t.call(this,e.msgWithCoord(r,n)),this.pt=n?new s_(n):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}(P_),LE=function(){this.array_=[]};LE.prototype.addLast=function(t){this.array_.push(t)},LE.prototype.removeFirst=function(){return this.array_.shift()},LE.prototype.isEmpty=function(){return 0===this.array_.length};var NE=function(){this._finder=null,this._dirEdgeList=new aI,this._nodes=new aI,this._rightMostCoord=null,this._env=null,this._finder=new SE};NE.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){t.next().setVisited(!1)}},NE.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},NE.prototype.computeNodeDepth=function(t){for(var e=null,r=t.getEdges().iterator();r.hasNext();){var n=r.next();if(n.isVisited()||n.getSym().isVisited()){e=n;break}}if(null===e)throw new ME("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)}},NE.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(CE.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)},NE.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},NE.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(CE.RIGHT)>=1&&e.getDepth(CE.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},NE.prototype.computeDepths=function(t){var e=new vI,r=new LE,n=t.getNode();for(r.addLast(n),e.add(n),t.setVisited(!0);!r.isEmpty();){var i=r.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)||(r.addLast(a),e.add(a))}}}},NE.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.x<e._rightMostCoord.x?-1:this._rightMostCoord.x>e._rightMostCoord.x?1:0},NE.prototype.getEnvelope=function(){if(null===this._env){for(var t=new S_,e=this._dirEdgeList.iterator();e.hasNext();)for(var r=e.next().getEdge().getCoordinates(),n=0;n<r.length-1;n++)t.expandToInclude(r[n]);this._env=t}return this._env},NE.prototype.addReachable=function(t){var e=new BE;for(e.add(t);!e.empty();){var r=e.pop();this.add(r,e)}},NE.prototype.copySymDepths=function(t){var e=t.getSym();e.setDepth(CE.LEFT,t.getDepth(CE.RIGHT)),e.setDepth(CE.RIGHT,t.getDepth(CE.LEFT))},NE.prototype.add=function(t,e){t.setVisited(!0),this._nodes.add(t);for(var r=t.getEdges().iterator();r.hasNext();){var n=r.next();this._dirEdgeList.add(n);var i=n.getSym().getNode();i.isVisited()||e.push(i)}},NE.prototype.getNodes=function(){return this._nodes},NE.prototype.getDirectedEdges=function(){return this._dirEdgeList},NE.prototype.interfaces_=function(){return[r_]},NE.prototype.getClass=function(){return NE};var TE=function t(){if(this.location=null,1===arguments.length){if(arguments[0]instanceof Array){var e=arguments[0];this.init(e.length)}else if(Number.isInteger(arguments[0])){var r=arguments[0];this.init(1),this.location[CE.ON]=r}else if(arguments[0]instanceof t){var n=arguments[0];if(this.init(n.location.length),null!==n)for(var i=0;i<this.location.length;i++)this.location[i]=n.location[i]}}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];this.init(3),this.location[CE.ON]=o,this.location[CE.LEFT]=s,this.location[CE.RIGHT]=a}};TE.prototype.setAllLocations=function(t){for(var e=0;e<this.location.length;e++)this.location[e]=t},TE.prototype.isNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==c_.NONE)return!1;return!0},TE.prototype.setAllLocationsIfNull=function(t){for(var e=0;e<this.location.length;e++)this.location[e]===c_.NONE&&(this.location[e]=t)},TE.prototype.isLine=function(){return 1===this.location.length},TE.prototype.merge=function(t){if(t.location.length>this.location.length){var e=new Array(3).fill(null);e[CE.ON]=this.location[CE.ON],e[CE.LEFT]=c_.NONE,e[CE.RIGHT]=c_.NONE,this.location=e}for(var r=0;r<this.location.length;r++)this.location[r]===c_.NONE&&r<t.location.length&&(this.location[r]=t.location[r])},TE.prototype.getLocations=function(){return this.location},TE.prototype.flip=function(){if(this.location.length<=1)return null;var t=this.location[CE.LEFT];this.location[CE.LEFT]=this.location[CE.RIGHT],this.location[CE.RIGHT]=t},TE.prototype.toString=function(){var t=new A_;return this.location.length>1&&t.append(c_.toLocationSymbol(this.location[CE.LEFT])),t.append(c_.toLocationSymbol(this.location[CE.ON])),this.location.length>1&&t.append(c_.toLocationSymbol(this.location[CE.RIGHT])),t.toString()},TE.prototype.setLocations=function(t,e,r){this.location[CE.ON]=t,this.location[CE.LEFT]=e,this.location[CE.RIGHT]=r},TE.prototype.get=function(t){return t<this.location.length?this.location[t]:c_.NONE},TE.prototype.isArea=function(){return this.location.length>1},TE.prototype.isAnyNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===c_.NONE)return!0;return!1},TE.prototype.setLocation=function(){if(1===arguments.length){var t=arguments[0];this.setLocation(CE.ON,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this.location[e]=r}},TE.prototype.init=function(t){this.location=new Array(t).fill(null),this.setAllLocations(c_.NONE)},TE.prototype.isEqualOnSide=function(t,e){return this.location[e]===t.location[e]},TE.prototype.allPositionsEqual=function(t){for(var e=0;e<this.location.length;e++)if(this.location[e]!==t)return!1;return!0},TE.prototype.interfaces_=function(){return[]},TE.prototype.getClass=function(){return TE};var RE=function t(){if(this.elt=new Array(2).fill(null),1===arguments.length){if(Number.isInteger(arguments[0])){var e=arguments[0];this.elt[0]=new TE(e),this.elt[1]=new TE(e)}else if(arguments[0]instanceof t){var r=arguments[0];this.elt[0]=new TE(r.elt[0]),this.elt[1]=new TE(r.elt[1])}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.elt[0]=new TE(c_.NONE),this.elt[1]=new TE(c_.NONE),this.elt[n].setLocation(i)}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];this.elt[0]=new TE(o,s,a),this.elt[1]=new TE(o,s,a)}else if(4===arguments.length){var u=arguments[0],l=arguments[1],c=arguments[2],h=arguments[3];this.elt[0]=new TE(c_.NONE,c_.NONE,c_.NONE),this.elt[1]=new TE(c_.NONE,c_.NONE,c_.NONE),this.elt[u].setLocations(l,c,h)}};RE.prototype.getGeometryCount=function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t},RE.prototype.setAllLocations=function(t,e){this.elt[t].setAllLocations(e)},RE.prototype.isNull=function(t){return this.elt[t].isNull()},RE.prototype.setAllLocationsIfNull=function(){if(1===arguments.length){var t=arguments[0];this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this.elt[e].setAllLocationsIfNull(r)}},RE.prototype.isLine=function(t){return this.elt[t].isLine()},RE.prototype.merge=function(t){for(var e=this,r=0;r<2;r++)null===e.elt[r]&&null!==t.elt[r]?e.elt[r]=new TE(t.elt[r]):e.elt[r].merge(t.elt[r])},RE.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},RE.prototype.getLocation=function(){if(1===arguments.length){var t=arguments[0];return this.elt[t].get(CE.ON)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return this.elt[e].get(r)}},RE.prototype.toString=function(){var t=new A_;return null!==this.elt[0]&&(t.append("A:"),t.append(this.elt[0].toString())),null!==this.elt[1]&&(t.append(" B:"),t.append(this.elt[1].toString())),t.toString()},RE.prototype.isArea=function(){if(0===arguments.length)return this.elt[0].isArea()||this.elt[1].isArea();if(1===arguments.length){var t=arguments[0];return this.elt[t].isArea()}},RE.prototype.isAnyNull=function(t){return this.elt[t].isAnyNull()},RE.prototype.setLocation=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.elt[t].setLocation(CE.ON,e)}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this.elt[r].setLocation(n,i)}},RE.prototype.isEqualOnSide=function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)},RE.prototype.allPositionsEqual=function(t,e){return this.elt[t].allPositionsEqual(e)},RE.prototype.toLine=function(t){this.elt[t].isArea()&&(this.elt[t]=new TE(this.elt[t].location[0]))},RE.prototype.interfaces_=function(){return[]},RE.prototype.getClass=function(){return RE},RE.toLineLabel=function(t){for(var e=new RE(c_.NONE),r=0;r<2;r++)e.setLocation(r,t.getLocation(r));return e};var DE=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new aI,this._pts=new aI,this._label=new RE(c_.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new aI,this._geometryFactory=null;var t=arguments[0],e=arguments[1];this._geometryFactory=e,this.computePoints(t),this.computeRing()};DE.prototype.computeRing=function(){if(null!==this._ring)return null;for(var t=new Array(this._pts.size()).fill(null),e=0;e<this._pts.size();e++)t[e]=this._pts.get(e);this._ring=this._geometryFactory.createLinearRing(t),this._isHole=j_.isCCW(this._ring.getCoordinates())},DE.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},DE.prototype.computePoints=function(t){var e=this;this._startDe=t;var r=t,n=!0;do{if(null===r)throw new ME("Found null DirectedEdge");if(r.getEdgeRing()===e)throw new ME("Directed Edge visited twice during ring-building at "+r.getCoordinate());e._edges.add(r);var i=r.getLabel();k_.isTrue(i.isArea()),e.mergeLabel(i),e.addPoints(r.getEdge(),r.isForward(),n),n=!1,e.setEdgeRing(r,e),r=e.getNext(r)}while(r!==this._startDe)},DE.prototype.getLinearRing=function(){return this._ring},DE.prototype.getCoordinate=function(t){return this._pts.get(t)},DE.prototype.computeMaxNodeDegree=function(){var t=this;this._maxNodeDegree=0;var e=this._startDe;do{var r=e.getNode().getEdges().getOutgoingDegree(t);r>t._maxNodeDegree&&(t._maxNodeDegree=r),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2},DE.prototype.addPoints=function(t,e,r){var n=t.getCoordinates();if(e){var i=1;r&&(i=0);for(var o=i;o<n.length;o++)this._pts.add(n[o])}else{var s=n.length-2;r&&(s=n.length-1);for(var a=s;a>=0;a--)this._pts.add(n[a])}},DE.prototype.isHole=function(){return this._isHole},DE.prototype.setInResult=function(){var t=this._startDe;do{t.getEdge().setInResult(!0),t=t.getNext()}while(t!==this._startDe)},DE.prototype.containsPoint=function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!j_.isPointInRing(t,e.getCoordinates()))return!1;for(var r=this._holes.iterator();r.hasNext();){if(r.next().containsPoint(t))return!1}return!0},DE.prototype.addHole=function(t){this._holes.add(t)},DE.prototype.isShell=function(){return null===this._shell},DE.prototype.getLabel=function(){return this._label},DE.prototype.getEdges=function(){return this._edges},DE.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},DE.prototype.getShell=function(){return this._shell},DE.prototype.mergeLabel=function(){if(1===arguments.length){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(2===arguments.length){var e=arguments[1],r=arguments[0].getLocation(e,CE.RIGHT);if(r===c_.NONE)return null;if(this._label.getLocation(e)===c_.NONE)return this._label.setLocation(e,r),null}},DE.prototype.setShell=function(t){this._shell=t,null!==t&&t.addHole(this)},DE.prototype.toPolygon=function(t){for(var e=new Array(this._holes.size()).fill(null),r=0;r<this._holes.size();r++)e[r]=this._holes.get(r).getLinearRing();return t.createPolygon(this.getLinearRing(),e)},DE.prototype.interfaces_=function(){return[]},DE.prototype.getClass=function(){return DE};var PE=function(t){function e(){var e=arguments[0],r=arguments[1];t.call(this,e,r)}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}(DE),QE=function(t){function e(){var e=arguments[0],r=arguments[1];t.call(this,e,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildMinimalRings=function(){var t=new aI,e=this._startDe;do{if(null===e.getMinEdgeRing()){var r=new PE(e,this._geometryFactory);t.add(r)}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}(DE),kE=function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._label=t}};kE.prototype.setVisited=function(t){this._isVisited=t},kE.prototype.setInResult=function(t){this._isInResult=t},kE.prototype.isCovered=function(){return this._isCovered},kE.prototype.isCoveredSet=function(){return this._isCoveredSet},kE.prototype.setLabel=function(t){this._label=t},kE.prototype.getLabel=function(){return this._label},kE.prototype.setCovered=function(t){this._isCovered=t,this._isCoveredSet=!0},kE.prototype.updateIM=function(t){k_.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(t)},kE.prototype.isInResult=function(){return this._isInResult},kE.prototype.isVisited=function(){return this._isVisited},kE.prototype.interfaces_=function(){return[]},kE.prototype.getClass=function(){return kE};var OE=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var e=arguments[0],r=arguments[1];this._coord=e,this._edges=r,this._label=new RE(0,c_.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 r=c_.NONE;if(r=this._label.getLocation(e),!t.isNull(e)){var n=t.getLocation(e);r!==c_.BOUNDARY&&(r=n)}return r},e.prototype.setLabel=function(){if(2!==arguments.length)return t.prototype.setLabel.apply(this,arguments);var e=arguments[0],r=arguments[1];null===this._label?this._label=new RE(e,r):this._label.setLocation(e,r)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var t=this;if(arguments[0]instanceof e){var r=arguments[0];this.mergeLabel(r._label)}else if(arguments[0]instanceof RE)for(var n=arguments[0],i=0;i<2;i++){var o=t.computeMergedLocation(n,i);t._label.getLocation(i)===c_.NONE&&t._label.setLocation(i,o)}},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=c_.NONE;null!==this._label&&(e=this._label.getLocation(t));var r=null;if(e===c_.BOUNDARY)r=c_.INTERIOR;else r=c_.BOUNDARY;this._label.setLocation(t,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(kE),FE=function(){this.nodeMap=new wI,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};FE.prototype.find=function(t){return this.nodeMap.get(t)},FE.prototype.addNode=function(){if(arguments[0]instanceof s_){var t=arguments[0],e=this.nodeMap.get(t);return null===e&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}if(arguments[0]instanceof OE){var r=arguments[0],n=this.nodeMap.get(r.getCoordinate());return null===n?(this.nodeMap.put(r.getCoordinate(),r),r):(n.mergeLabel(r),n)}},FE.prototype.print=function(t){for(var e=this.iterator();e.hasNext();){e.next().print(t)}},FE.prototype.iterator=function(){return this.nodeMap.values().iterator()},FE.prototype.values=function(){return this.nodeMap.values()},FE.prototype.getBoundaryNodes=function(t){for(var e=new aI,r=this.iterator();r.hasNext();){var n=r.next();n.getLabel().getLocation(t)===c_.BOUNDARY&&e.add(n)}return e},FE.prototype.add=function(t){var e=t.getCoordinate();this.addNode(e).add(t)},FE.prototype.interfaces_=function(){return[]},FE.prototype.getClass=function(){return FE};var GE=function(){},UE={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};GE.prototype.interfaces_=function(){return[]},GE.prototype.getClass=function(){return GE},GE.isNorthern=function(t){return t===GE.NE||t===GE.NW},GE.isOpposite=function(t,e){return t!==e&&2===(t-e+4)%4},GE.commonHalfPlane=function(t,e){if(t===e)return t;if(2===(t-e+4)%4)return-1;var r=t<e?t:e;return 0===r&&3===(t>e?t:e)?3:r},GE.isInHalfPlane=function(t,e){return e===GE.SE?t===GE.SE||t===GE.SW:t===e||t===e+1},GE.quadrant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new $m("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?GE.NE:GE.SE:e>=0?GE.NW:GE.SW}if(arguments[0]instanceof s_&&arguments[1]instanceof s_){var r=arguments[0],n=arguments[1];if(n.x===r.x&&n.y===r.y)throw new $m("Cannot compute the quadrant for two identical points "+r);return n.x>=r.x?n.y>=r.y?GE.NE:GE.SE:n.y>=r.y?GE.NW:GE.SW}},UE.NE.get=function(){return 0},UE.NW.get=function(){return 1},UE.SW.get=function(){return 2},UE.SE.get=function(){return 3},Object.defineProperties(GE,UE);var qE=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,1===arguments.length){var t=arguments[0];this._edge=t}else if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2];this._edge=e,this.init(r,n),this._label=null}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this._edge=i,this.init(o,s),this._label=a}};qE.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:j_.computeOrientation(t._p0,t._p1,this._p1)},qE.prototype.getDy=function(){return this._dy},qE.prototype.getCoordinate=function(){return this._p0},qE.prototype.setNode=function(t){this._node=t},qE.prototype.print=function(t){var e=Math.atan2(this._dy,this._dx),r=this.getClass().getName(),n=r.lastIndexOf("."),i=r.substring(n+1);t.print(" "+i+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+" "+this._label)},qE.prototype.compareTo=function(t){var e=t;return this.compareDirection(e)},qE.prototype.getDirectedCoordinate=function(){return this._p1},qE.prototype.getDx=function(){return this._dx},qE.prototype.getLabel=function(){return this._label},qE.prototype.getEdge=function(){return this._edge},qE.prototype.getQuadrant=function(){return this._quadrant},qE.prototype.getNode=function(){return this._node},qE.prototype.toString=function(){var t=Math.atan2(this._dy,this._dx),e=this.getClass().getName(),r=e.lastIndexOf(".");return" "+e.substring(r+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+" "+this._label},qE.prototype.computeLabel=function(t){},qE.prototype.init=function(t,e){this._p0=t,this._p1=e,this._dx=e.x-t.x,this._dy=e.y-t.y,this._quadrant=GE.quadrant(this._dx,this._dy),k_.isTrue(!(0===this._dx&&0===this._dy),"EdgeEnd with identical endpoints found")},qE.prototype.interfaces_=function(){return[r_]},qE.prototype.getClass=function(){return qE};var jE=function(t){function e(){var e=arguments[0],r=arguments[1];if(t.call(this,e),this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999],this._isForward=r,r)this.init(e.getCoordinate(0),e.getCoordinate(1));else{var n=e.getNumPoints()-1;this.init(e.getCoordinate(n),e.getCoordinate(n-1))}this.computeDirectedLabel()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getNextMin=function(){return this._nextMin},e.prototype.getDepth=function(t){return this._depth[t]},e.prototype.setVisited=function(t){this._isVisited=t},e.prototype.computeDirectedLabel=function(){this._label=new RE(this._edge.getLabel()),this._isForward||this._label.flip()},e.prototype.getNext=function(){return this._next},e.prototype.setDepth=function(t,e){if(-999!==this._depth[t]&&this._depth[t]!==e)throw new ME("assigned depths do not match",this.getCoordinate());this._depth[t]=e},e.prototype.isInteriorAreaEdge=function(){for(var t=this,e=!0,r=0;r<2;r++)t._label.isArea(r)&&t._label.getLocation(r,CE.LEFT)===c_.INTERIOR&&t._label.getLocation(r,CE.RIGHT)===c_.INTERIOR||(e=!1);return e},e.prototype.setNextMin=function(t){this._nextMin=t},e.prototype.print=function(e){t.prototype.print.call(this,e),e.print(" "+this._depth[CE.LEFT]+"/"+this._depth[CE.RIGHT]),e.print(" ("+this.getDepthDelta()+")"),this._isInResult&&e.print(" inResult")},e.prototype.setMinEdgeRing=function(t){this._minEdgeRing=t},e.prototype.isLineEdge=function(){var t=this._label.isLine(0)||this._label.isLine(1),e=!this._label.isArea(0)||this._label.allPositionsEqual(0,c_.EXTERIOR),r=!this._label.isArea(1)||this._label.allPositionsEqual(1,c_.EXTERIOR);return t&&e&&r},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 r=this.getEdge().getDepthDelta();this._isForward||(r=-r);var n=1;t===CE.LEFT&&(n=-1);var i=CE.opposite(t),o=e+r*n;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===c_.EXTERIOR&&e===c_.INTERIOR?1:t===c_.INTERIOR&&e===c_.EXTERIOR?-1:0},e}(qE),VE=function(){};VE.prototype.createNode=function(t){return new OE(t,null)},VE.prototype.interfaces_=function(){return[]},VE.prototype.getClass=function(){return VE};var zE=function(){if(this._edges=new aI,this._nodes=null,this._edgeEndList=new aI,0===arguments.length)this._nodes=new FE(new VE);else if(1===arguments.length){var t=arguments[0];this._nodes=new FE(t)}};zE.prototype.printEdges=function(t){t.println("Edges:");for(var e=0;e<this._edges.size();e++){t.println("edge "+e+":");var r=this._edges.get(e);r.print(t),r.eiList.print(t)}},zE.prototype.find=function(t){return this._nodes.find(t)},zE.prototype.addNode=function(){if(arguments[0]instanceof OE){var t=arguments[0];return this._nodes.addNode(t)}if(arguments[0]instanceof s_){var e=arguments[0];return this._nodes.addNode(e)}},zE.prototype.getNodeIterator=function(){return this._nodes.iterator()},zE.prototype.linkResultDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();){t.next().getEdges().linkResultDirectedEdges()}},zE.prototype.debugPrintln=function(t){b_.out.println(t)},zE.prototype.isBoundaryNode=function(t,e){var r=this._nodes.find(e);if(null===r)return!1;var n=r.getLabel();return null!==n&&n.getLocation(t)===c_.BOUNDARY},zE.prototype.linkAllDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();){t.next().getEdges().linkAllDirectedEdges()}},zE.prototype.matchInSameDirection=function(t,e,r,n){return!!t.equals(r)&&(j_.computeOrientation(t,e,n)===j_.COLLINEAR&&GE.quadrant(t,e)===GE.quadrant(r,n))},zE.prototype.getEdgeEnds=function(){return this._edgeEndList},zE.prototype.debugPrint=function(t){b_.out.print(t)},zE.prototype.getEdgeIterator=function(){return this._edges.iterator()},zE.prototype.findEdgeInSameDirection=function(t,e){for(var r=this,n=0;n<this._edges.size();n++){var i=r._edges.get(n),o=i.getCoordinates();if(r.matchInSameDirection(t,e,o[0],o[1]))return i;if(r.matchInSameDirection(t,e,o[o.length-1],o[o.length-2]))return i}return null},zE.prototype.insertEdge=function(t){this._edges.add(t)},zE.prototype.findEdgeEnd=function(t){for(var e=this.getEdgeEnds().iterator();e.hasNext();){var r=e.next();if(r.getEdge()===t)return r}return null},zE.prototype.addEdges=function(t){for(var e=this,r=t.iterator();r.hasNext();){var n=r.next();e._edges.add(n);var i=new jE(n,!0),o=new jE(n,!1);i.setSym(o),o.setSym(i),e.add(i),e.add(o)}},zE.prototype.add=function(t){this._nodes.add(t),this._edgeEndList.add(t)},zE.prototype.getNodes=function(){return this._nodes.values()},zE.prototype.findEdge=function(t,e){for(var r=0;r<this._edges.size();r++){var n=this._edges.get(r),i=n.getCoordinates();if(t.equals(i[0])&&e.equals(i[1]))return n}return null},zE.prototype.interfaces_=function(){return[]},zE.prototype.getClass=function(){return zE},zE.linkResultDirectedEdges=function(t){for(var e=t.iterator();e.hasNext();){e.next().getEdges().linkResultDirectedEdges()}};var YE=function(){this._geometryFactory=null,this._shellList=new aI;var t=arguments[0];this._geometryFactory=t};YE.prototype.sortShellsAndHoles=function(t,e,r){for(var n=t.iterator();n.hasNext();){var i=n.next();i.isHole()?r.add(i):e.add(i)}},YE.prototype.computePolygons=function(t){for(var e=new aI,r=t.iterator();r.hasNext();){var n=r.next().toPolygon(this._geometryFactory);e.add(n)}return e},YE.prototype.placeFreeHoles=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();if(null===n.getShell()){var i=this.findEdgeRingContaining(n,t);if(null===i)throw new ME("unable to assign hole to a shell",n.getCoordinate(0));n.setShell(i)}}},YE.prototype.buildMinimalEdgeRings=function(t,e,r){for(var n=new aI,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)):r.addAll(s)}else n.add(o)}return n},YE.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();){if(e.next().containsPoint(t))return!0}return!1},YE.prototype.buildMaximalEdgeRings=function(t){for(var e=new aI,r=t.iterator();r.hasNext();){var n=r.next();if(n.isInResult()&&n.getLabel().isArea()&&null===n.getEdgeRing()){var i=new QE(n,this._geometryFactory);e.add(i),i.setInResult()}}return e},YE.prototype.placePolygonHoles=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();n.isHole()&&n.setShell(t)}},YE.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},YE.prototype.findEdgeRingContaining=function(t,e){for(var r=t.getLinearRing(),n=r.getEnvelopeInternal(),i=r.getCoordinateN(0),o=null,s=null,a=e.iterator();a.hasNext();){var u=a.next(),l=u.getLinearRing(),c=l.getEnvelopeInternal();null!==o&&(s=o.getLinearRing().getEnvelopeInternal());var h=!1;c.contains(n)&&j_.isPointInRing(i,l.getCoordinates())&&(h=!0),h&&(null===o||s.contains(c))&&(o=u)}return o},YE.prototype.findShell=function(t){for(var e=0,r=null,n=t.iterator();n.hasNext();){var i=n.next();i.isHole()||(r=i,e++)}return k_.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),r},YE.prototype.add=function(){if(1===arguments.length){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(2===arguments.length){var e=arguments[0];zE.linkResultDirectedEdges(arguments[1]);var r=this.buildMaximalEdgeRings(e),n=new aI,i=this.buildMinimalEdgeRings(r,this._shellList,n);this.sortShellsAndHoles(i,this._shellList,n),this.placeFreeHoles(this._shellList,n)}},YE.prototype.interfaces_=function(){return[]},YE.prototype.getClass=function(){return YE};var HE=function(){};HE.prototype.getBounds=function(){},HE.prototype.interfaces_=function(){return[]},HE.prototype.getClass=function(){return HE};var XE=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};XE.prototype.getItem=function(){return this._item},XE.prototype.getBounds=function(){return this._bounds},XE.prototype.interfaces_=function(){return[HE,o_]},XE.prototype.getClass=function(){return XE};var JE=function(){this._size=null,this._items=null,this._size=0,this._items=new aI,this._items.add(null)};JE.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},JE.prototype.size=function(){return this._size},JE.prototype.reorder=function(t){for(var e=this,r=null,n=this._items.get(t);2*t<=this._size&&((r=2*t)!==e._size&&e._items.get(r+1).compareTo(e._items.get(r))<0&&r++,e._items.get(r).compareTo(n)<0);t=r)e._items.set(t,e._items.get(r));this._items.set(t,n)},JE.prototype.clear=function(){this._size=0,this._items.clear()},JE.prototype.isEmpty=function(){return 0===this._size},JE.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)},JE.prototype.interfaces_=function(){return[]},JE.prototype.getClass=function(){return JE};var WE=function(){};WE.prototype.visitItem=function(t){},WE.prototype.interfaces_=function(){return[]},WE.prototype.getClass=function(){return WE};var KE=function(){};KE.prototype.insert=function(t,e){},KE.prototype.remove=function(t,e){},KE.prototype.query=function(){},KE.prototype.interfaces_=function(){return[]},KE.prototype.getClass=function(){return KE};var ZE=function(){if(this._childBoundables=new aI,this._bounds=null,this._level=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._level=t}},$E={serialVersionUID:{configurable:!0}};ZE.prototype.getLevel=function(){return this._level},ZE.prototype.size=function(){return this._childBoundables.size()},ZE.prototype.getChildBoundables=function(){return this._childBoundables},ZE.prototype.addChildBoundable=function(t){k_.isTrue(null===this._bounds),this._childBoundables.add(t)},ZE.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},ZE.prototype.getBounds=function(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds},ZE.prototype.interfaces_=function(){return[HE,o_]},ZE.prototype.getClass=function(){return ZE},$E.serialVersionUID.get=function(){return 0x5a1e55ec41369800},Object.defineProperties(ZE,$E);var tx=function(){};tx.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}},tx.min=function(t){return tx.sort(t),t.get(0)},tx.sort=function(t,e){var r=t.toArray();e?LI.sort(r,e):LI.sort(r);for(var n=t.iterator(),i=0,o=r.length;i<o;i++)n.next(),n.set(r[i])},tx.singletonList=function(t){var e=new aI;return e.add(t),e};var ex=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var t=arguments[0],e=arguments[1],r=arguments[2];this._boundable1=t,this._boundable2=e,this._itemDistance=r,this._distance=this.distance()};ex.prototype.expandToQueue=function(t,e){var r=ex.isComposite(this._boundable1),n=ex.isComposite(this._boundable2);if(r&&n)return ex.area(this._boundable1)>ex.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(r)return this.expand(this._boundable1,this._boundable2,t,e),null;if(n)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new $m("neither boundable is composite")},ex.prototype.isLeaves=function(){return!(ex.isComposite(this._boundable1)||ex.isComposite(this._boundable2))},ex.prototype.compareTo=function(t){var e=t;return this._distance<e._distance?-1:this._distance>e._distance?1:0},ex.prototype.expand=function(t,e,r,n){for(var i=t.getChildBoundables().iterator();i.hasNext();){var o=i.next(),s=new ex(o,e,this._itemDistance);s.getDistance()<n&&r.add(s)}},ex.prototype.getBoundable=function(t){return 0===t?this._boundable1:this._boundable2},ex.prototype.getDistance=function(){return this._distance},ex.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},ex.prototype.interfaces_=function(){return[r_]},ex.prototype.getClass=function(){return ex},ex.area=function(t){return t.getBounds().getArea()},ex.isComposite=function(t){return t instanceof ZE};var rx=function t(){if(this._root=null,this._built=!1,this._itemBoundables=new aI,this._nodeCapacity=null,0===arguments.length){var e=t.DEFAULT_NODE_CAPACITY;this._nodeCapacity=e}else if(1===arguments.length){var r=arguments[0];k_.isTrue(r>1,"Node capacity must be greater than 1"),this._nodeCapacity=r}},nx={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};rx.prototype.getNodeCapacity=function(){return this._nodeCapacity},rx.prototype.lastNode=function(t){return t.get(t.size()-1)},rx.prototype.size=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.size(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var r=e.next();r instanceof ZE?t+=this.size(r):r instanceof XE&&(t+=1)}return t}},rx.prototype.removeItem=function(t,e){for(var r=null,n=t.getChildBoundables().iterator();n.hasNext();){var i=n.next();i instanceof XE&&i.getItem()===e&&(r=i)}return null!==r&&(t.getChildBoundables().remove(r),!0)},rx.prototype.itemsTree=function(){if(0===arguments.length){this.build();var t=this.itemsTree(this._root);return null===t?new aI:t}if(1===arguments.length){for(var e=arguments[0],r=new aI,n=e.getChildBoundables().iterator();n.hasNext();){var i=n.next();if(i instanceof ZE){var o=this.itemsTree(i);null!==o&&r.add(o)}else i instanceof XE?r.add(i.getItem()):k_.shouldNeverReachHere()}return r.size()<=0?null:r}},rx.prototype.insert=function(t,e){k_.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new XE(t,e))},rx.prototype.boundablesAtLevel=function(){if(1===arguments.length){var t=arguments[0],e=new aI;return this.boundablesAtLevel(t,this._root,e),e}if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];if(k_.isTrue(r>-2),n.getLevel()===r)return i.add(n),null;for(var o=n.getChildBoundables().iterator();o.hasNext();){var s=o.next();s instanceof ZE?this.boundablesAtLevel(r,s,i):(k_.isTrue(s instanceof XE),-1===r&&i.add(s))}return null}},rx.prototype.query=function(){var t=this;if(1===arguments.length){var e=arguments[0];this.build();var r=new aI;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,r),r}if(2===arguments.length){var n=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,i)}else if(3===arguments.length)if(f_(arguments[2],WE)&&arguments[0]instanceof Object&&arguments[1]instanceof ZE)for(var o=arguments[0],s=arguments[2],a=arguments[1].getChildBoundables(),u=0;u<a.size();u++){var l=a.get(u);t.getIntersectsOp().intersects(l.getBounds(),o)&&(l instanceof ZE?t.query(o,l,s):l instanceof XE?s.visitItem(l.getItem()):k_.shouldNeverReachHere())}else if(f_(arguments[2],oI)&&arguments[0]instanceof Object&&arguments[1]instanceof ZE)for(var c=arguments[0],h=arguments[2],f=arguments[1].getChildBoundables(),p=0;p<f.size();p++){var g=f.get(p);t.getIntersectsOp().intersects(g.getBounds(),c)&&(g instanceof ZE?t.query(c,g,h):g instanceof XE?h.add(g.getItem()):k_.shouldNeverReachHere())}},rx.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},rx.prototype.getRoot=function(){return this.build(),this._root},rx.prototype.remove=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.remove(t,this._root,e)}if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2],o=this.removeItem(n,i);if(o)return!0;for(var s=null,a=n.getChildBoundables().iterator();a.hasNext();){var u=a.next();if(this.getIntersectsOp().intersects(u.getBounds(),r)&&(u instanceof ZE&&(o=this.remove(r,u,i)))){s=u;break}}return null!==s&&s.getChildBoundables().isEmpty()&&n.getChildBoundables().remove(s),o}},rx.prototype.createHigherLevels=function(t,e){k_.isTrue(!t.isEmpty());var r=this.createParentBoundables(t,e+1);return 1===r.size()?r.get(0):this.createHigherLevels(r,e+1)},rx.prototype.depth=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var r=e.next();if(r instanceof ZE){var n=this.depth(r);n>t&&(t=n)}}return t+1}},rx.prototype.createParentBoundables=function(t,e){var r=this;k_.isTrue(!t.isEmpty());var n=new aI;n.add(this.createNode(e));var i=new aI(t);tx.sort(i,this.getComparator());for(var o=i.iterator();o.hasNext();){var s=o.next();r.lastNode(n).getChildBoundables().size()===r.getNodeCapacity()&&n.add(r.createNode(e)),r.lastNode(n).addChildBoundable(s)}return n},rx.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},rx.prototype.interfaces_=function(){return[o_]},rx.prototype.getClass=function(){return rx},rx.compareDoubles=function(t,e){return t>e?1:t<e?-1:0},nx.IntersectsOp.get=function(){return ix},nx.serialVersionUID.get=function(){return-0x35ef64c82d4c5400},nx.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(rx,nx);var ix=function(){},ox=function(){};ox.prototype.distance=function(t,e){},ox.prototype.interfaces_=function(){return[]},ox.prototype.getClass=function(){return ox};var sx=function(t){function e(r){r=r||e.DEFAULT_NODE_CAPACITY,t.call(this,r)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={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){k_.isTrue(t.length>0);for(var r=new aI,n=0;n<t.length;n++)r.addAll(this.createParentBoundablesFromVerticalSlice(t[n],e));return r},e.prototype.createNode=function(t){return new ax(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[0],r=arguments[1];if(e.isNull())return null;t.prototype.insert.call(this,e,r)},e.prototype.getIntersectsOp=function(){return e.intersectsOp},e.prototype.verticalSlices=function(t,e){for(var r=Math.trunc(Math.ceil(t.size()/e)),n=new Array(e).fill(null),i=t.iterator(),o=0;o<e;o++){n[o]=new aI;for(var s=0;i.hasNext()&&s<r;){var a=i.next();n[o].add(a),s++}}return n},e.prototype.query=function(){if(1===arguments.length){var e=arguments[0];return t.prototype.query.call(this,e)}if(2===arguments.length){var r=arguments[0],n=arguments[1];t.prototype.query.call(this,r,n)}else if(3===arguments.length)if(f_(arguments[2],WE)&&arguments[0]instanceof Object&&arguments[1]instanceof ZE){var i=arguments[0],o=arguments[1],s=arguments[2];t.prototype.query.call(this,i,o,s)}else if(f_(arguments[2],oI)&&arguments[0]instanceof Object&&arguments[1]instanceof ZE){var a=arguments[0],u=arguments[1],l=arguments[2];t.prototype.query.call(this,a,u,l)}},e.prototype.getComparator=function(){return e.yComparator},e.prototype.createParentBoundablesFromVerticalSlice=function(e,r){return t.prototype.createParentBoundables.call(this,e,r)},e.prototype.remove=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return t.prototype.remove.call(this,e,r)}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,r){k_.isTrue(!t.isEmpty());var n=Math.trunc(Math.ceil(t.size()/this.getNodeCapacity())),i=new aI(t);tx.sort(i,e.xComparator);var o=this.verticalSlices(i,Math.trunc(Math.ceil(Math.sqrt(n))));return this.createParentBoundablesFromVerticalSlices(o,r)},e.prototype.nearestNeighbour=function(){if(1===arguments.length){if(f_(arguments[0],ox)){var t=arguments[0],r=new ex(this.getRoot(),this.getRoot(),t);return this.nearestNeighbour(r)}if(arguments[0]instanceof ex){var n=arguments[0];return this.nearestNeighbour(n,t_.POSITIVE_INFINITY)}}else if(2===arguments.length){if(arguments[0]instanceof e&&f_(arguments[1],ox)){var i=arguments[0],o=arguments[1],s=new ex(this.getRoot(),i.getRoot(),o);return this.nearestNeighbour(s)}if(arguments[0]instanceof ex&&"number"==typeof arguments[1]){var a=arguments[0],u=arguments[1],l=null,c=new JE;for(c.add(a);!c.isEmpty()&&u>0;){var h=c.poll(),f=h.getDistance();if(f>=u)break;h.isLeaves()?(u=f,l=h):h.expandToQueue(c,u)}return[l.getBoundable(0).getItem(),l.getBoundable(1).getItem()]}}else if(3===arguments.length){var p=arguments[2],g=new XE(arguments[0],arguments[1]),A=new ex(this.getRoot(),g,p);return this.nearestNeighbour(A)[0]}},e.prototype.interfaces_=function(){return[KE,o_]},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())},r.STRtreeNode.get=function(){return ax},r.serialVersionUID.get=function(){return 0x39920f7d5f261e0},r.xComparator.get=function(){return{interfaces_:function(){return[i_]},compare:function(r,n){return t.compareDoubles(e.centreX(r.getBounds()),e.centreX(n.getBounds()))}}},r.yComparator.get=function(){return{interfaces_:function(){return[i_]},compare:function(r,n){return t.compareDoubles(e.centreY(r.getBounds()),e.centreY(n.getBounds()))}}},r.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(t,e){return t.intersects(e)}}},r.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,r),e}(rx),ax=function(t){function e(){var e=arguments[0];t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var t=null,e=this.getChildBoundables().iterator();e.hasNext();){var r=e.next();null===t?t=new S_(r.getBounds()):t.expandToInclude(r.getBounds())}return t},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(ZE),ux=function(){};ux.prototype.interfaces_=function(){return[]},ux.prototype.getClass=function(){return ux},ux.relativeSign=function(t,e){return t<e?-1:t>e?1:0},ux.compare=function(t,e,r){if(e.equals2D(r))return 0;var n=ux.relativeSign(e.x,r.x),i=ux.relativeSign(e.y,r.y);switch(t){case 0:return ux.compareValue(n,i);case 1:return ux.compareValue(i,n);case 2:return ux.compareValue(i,-n);case 3:return ux.compareValue(-n,i);case 4:return ux.compareValue(-n,-i);case 5:return ux.compareValue(-i,-n);case 6:return ux.compareValue(-i,n);case 7:return ux.compareValue(n,-i)}return k_.shouldNeverReachHere("invalid octant value"),0},ux.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var lx=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],r=arguments[2],n=arguments[3];this._segString=t,this.coord=new s_(e),this.segmentIndex=r,this._segmentOctant=n,this._isInterior=!e.equals2D(t.getCoordinate(r))};lx.prototype.getCoordinate=function(){return this.coord},lx.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},lx.prototype.compareTo=function(t){var e=t;return this.segmentIndex<e.segmentIndex?-1:this.segmentIndex>e.segmentIndex?1:this.coord.equals2D(e.coord)?0:ux.compare(this._segmentOctant,this.coord,e.coord)},lx.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t},lx.prototype.isInterior=function(){return this._isInterior},lx.prototype.interfaces_=function(){return[r_]},lx.prototype.getClass=function(){return lx};var cx=function(){this._nodeMap=new wI,this._edge=null;var t=arguments[0];this._edge=t};cx.prototype.getSplitCoordinates=function(){var t=new lI;this.addEndpoints();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next();this.addEdgeCoordinates(r,n,t),r=n}return t.toCoordinateArray()},cx.prototype.addCollapsedNodes=function(){var t=new aI;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var e=t.iterator();e.hasNext();){var r=e.next().intValue();this.add(this._edge.getCoordinate(r),r)}},cx.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){e.next().print(t)}},cx.prototype.findCollapsesFromExistingVertices=function(t){for(var e=0;e<this._edge.size()-2;e++){var r=this._edge.getCoordinate(e),n=this._edge.getCoordinate(e+2);r.equals2D(n)&&t.add(new d_(e+1))}},cx.prototype.addEdgeCoordinates=function(t,e,r){var n=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(n);r.add(new s_(t.coord),!1);for(var o=t.segmentIndex+1;o<=e.segmentIndex;o++)r.add(this._edge.getCoordinate(o));i&&r.add(new s_(e.coord))},cx.prototype.iterator=function(){return this._nodeMap.values().iterator()},cx.prototype.addSplitEdges=function(t){this.addEndpoints(),this.addCollapsedNodes();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next(),i=this.createSplitEdge(r,n);t.add(i),r=n}},cx.prototype.findCollapseIndex=function(t,e,r){if(!t.coord.equals2D(e.coord))return!1;var n=e.segmentIndex-t.segmentIndex;return e.isInterior()||n--,1===n&&(r[0]=t.segmentIndex+1,!0)},cx.prototype.findCollapsesFromInsertedNodes=function(t){for(var e=new Array(1).fill(null),r=this.iterator(),n=r.next();r.hasNext();){var i=r.next();this.findCollapseIndex(n,i,e)&&t.add(new d_(e[0])),n=i}},cx.prototype.getEdge=function(){return this._edge},cx.prototype.addEndpoints=function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)},cx.prototype.createSplitEdge=function(t,e){var r=e.segmentIndex-t.segmentIndex+2,n=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(n);i||r--;var o=new Array(r).fill(null),s=0;o[s++]=new s_(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this._edge.getCoordinate(a);return i&&(o[s]=new s_(e.coord)),new gx(o,this._edge.getData())},cx.prototype.add=function(t,e){var r=new lx(this._edge,t,e,this._edge.getSegmentOctant(e)),n=this._nodeMap.get(r);return null!==n?(k_.isTrue(n.coord.equals2D(t),"Found equal nodes with different coordinates"),n):(this._nodeMap.put(r,r),r)},cx.prototype.checkSplitEdgesCorrectness=function(t){var e=this._edge.getCoordinates(),r=t.get(0).getCoordinate(0);if(!r.equals2D(e[0]))throw new P_("bad split edge start point at "+r);var n=t.get(t.size()-1).getCoordinates(),i=n[n.length-1];if(!i.equals2D(e[e.length-1]))throw new P_("bad split edge end point at "+i)},cx.prototype.interfaces_=function(){return[]},cx.prototype.getClass=function(){return cx};var hx=function(){};hx.prototype.interfaces_=function(){return[]},hx.prototype.getClass=function(){return hx},hx.octant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new $m("Cannot compute the octant for point ( "+t+", "+e+" )");var r=Math.abs(t),n=Math.abs(e);return t>=0?e>=0?r>=n?0:1:r>=n?7:6:e>=0?r>=n?3:2:r>=n?4:5}if(arguments[0]instanceof s_&&arguments[1]instanceof s_){var i=arguments[0],o=arguments[1],s=o.x-i.x,a=o.y-i.y;if(0===s&&0===a)throw new $m("Cannot compute the octant for two identical points "+i);return hx.octant(s,a)}};var fx=function(){};fx.prototype.getCoordinates=function(){},fx.prototype.size=function(){},fx.prototype.getCoordinate=function(t){},fx.prototype.isClosed=function(){},fx.prototype.setData=function(t){},fx.prototype.getData=function(){},fx.prototype.interfaces_=function(){return[]},fx.prototype.getClass=function(){return fx};var px=function(){};px.prototype.addIntersection=function(t,e){},px.prototype.interfaces_=function(){return[fx]},px.prototype.getClass=function(){return px};var gx=function(){this._nodeList=new cx(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};gx.prototype.getCoordinates=function(){return this._pts},gx.prototype.size=function(){return this._pts.length},gx.prototype.getCoordinate=function(t){return this._pts[t]},gx.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},gx.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},gx.prototype.setData=function(t){this._data=t},gx.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:hx.octant(t,e)},gx.prototype.getData=function(){return this._data},gx.prototype.addIntersection=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(4===arguments.length){var r=arguments[1],n=arguments[3],i=new s_(arguments[0].getIntersection(n));this.addIntersection(i,r)}},gx.prototype.toString=function(){return D_.toLineString(new aE(this._pts))},gx.prototype.getNodeList=function(){return this._nodeList},gx.prototype.addIntersectionNode=function(t,e){var r=e,n=r+1;if(n<this._pts.length){var i=this._pts[n];t.equals2D(i)&&(r=n)}return this._nodeList.add(t,r)},gx.prototype.addIntersections=function(t,e,r){for(var n=0;n<t.getIntersectionNum();n++)this.addIntersection(t,e,r,n)},gx.prototype.interfaces_=function(){return[px]},gx.prototype.getClass=function(){return gx},gx.getNodedSubstrings=function(){if(1===arguments.length){var t=arguments[0],e=new aI;return gx.getNodedSubstrings(t,e),e}if(2===arguments.length)for(var r=arguments[1],n=arguments[0].iterator();n.hasNext();){n.next().getNodeList().addSplitEdges(r)}};var Ax=function(){if(this.p0=null,this.p1=null,0===arguments.length)this.p0=new s_,this.p1=new s_;else if(1===arguments.length){var t=arguments[0];this.p0=new s_(t.p0),this.p1=new s_(t.p1)}else if(2===arguments.length)this.p0=arguments[0],this.p1=arguments[1];else if(4===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2],i=arguments[3];this.p0=new s_(e,r),this.p1=new s_(n,i)}},dx={serialVersionUID:{configurable:!0}};Ax.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},Ax.prototype.orientationIndex=function(){if(arguments[0]instanceof Ax){var t=arguments[0],e=j_.orientationIndex(this.p0,this.p1,t.p0),r=j_.orientationIndex(this.p0,this.p1,t.p1);return e>=0&&r>=0||e<=0&&r<=0?Math.max(e,r):0}if(arguments[0]instanceof s_){var n=arguments[0];return j_.orientationIndex(this.p0,this.p1,n)}},Ax.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},Ax.prototype.isVertical=function(){return this.p0.x===this.p1.x},Ax.prototype.equals=function(t){if(!(t instanceof Ax))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)},Ax.prototype.intersection=function(t){var e=new G_;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},Ax.prototype.project=function(){if(arguments[0]instanceof s_){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new s_(t);var e=this.projectionFactor(t),r=new s_;return r.x=this.p0.x+e*(this.p1.x-this.p0.x),r.y=this.p0.y+e*(this.p1.y-this.p0.y),r}if(arguments[0]instanceof Ax){var n=arguments[0],i=this.projectionFactor(n.p0),o=this.projectionFactor(n.p1);if(i>=1&&o>=1)return null;if(i<=0&&o<=0)return null;var s=this.project(n.p0);i<0&&(s=this.p0),i>1&&(s=this.p1);var a=this.project(n.p1);return o<0&&(a=this.p0),o>1&&(a=this.p1),new Ax(s,a)}},Ax.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},Ax.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},Ax.prototype.getCoordinate=function(t){return 0===t?this.p0:this.p1},Ax.prototype.distancePerpendicular=function(t){return j_.distancePointLinePerpendicular(t,this.p0,this.p1)},Ax.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},Ax.prototype.midPoint=function(){return Ax.midPoint(this.p0,this.p1)},Ax.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,r=this.p1.y-this.p0.y,n=e*e+r*r;return n<=0?t_.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*r)/n},Ax.prototype.closestPoints=function(t){var e=this.intersection(t);if(null!==e)return[e,e];var r=new Array(2).fill(null),n=t_.MAX_VALUE,i=null,o=this.closestPoint(t.p0);n=o.distance(t.p0),r[0]=o,r[1]=t.p0;var s=this.closestPoint(t.p1);(i=s.distance(t.p1))<n&&(n=i,r[0]=s,r[1]=t.p1);var a=t.closestPoint(this.p0);(i=a.distance(this.p0))<n&&(n=i,r[0]=this.p0,r[1]=a);var u=t.closestPoint(this.p1);return(i=u.distance(this.p1))<n&&(n=i,r[0]=this.p1,r[1]=u),r},Ax.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},Ax.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},Ax.prototype.getLength=function(){return this.p0.distance(this.p1)},Ax.prototype.compareTo=function(t){var e=t,r=this.p0.compareTo(e.p0);return 0!==r?r:this.p1.compareTo(e.p1)},Ax.prototype.reverse=function(){var t=this.p0;this.p0=this.p1,this.p1=t},Ax.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)},Ax.prototype.lineIntersection=function(t){try{return B_.intersection(this.p0,this.p1,t.p0,t.p1)}catch(t){if(!(t instanceof w_))throw t}return null},Ax.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},Ax.prototype.pointAlongOffset=function(t,e){var r=this.p0.x+t*(this.p1.x-this.p0.x),n=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 s_(r-u,n+a)},Ax.prototype.setCoordinates=function(){if(1===arguments.length){var t=arguments[0];this.setCoordinates(t.p0,t.p1)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this.p0.x=e.x,this.p0.y=e.y,this.p1.x=r.x,this.p1.y=r.y}},Ax.prototype.segmentFraction=function(t){var e=this.projectionFactor(t);return e<0?e=0:(e>1||t_.isNaN(e))&&(e=1),e},Ax.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},Ax.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},Ax.prototype.distance=function(){if(arguments[0]instanceof Ax){var t=arguments[0];return j_.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof s_){var e=arguments[0];return j_.distancePointLine(e,this.p0,this.p1)}},Ax.prototype.pointAlong=function(t){var e=new s_;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},Ax.prototype.hashCode=function(){var t=t_.doubleToLongBits(this.p0.x);t^=31*t_.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),r=t_.doubleToLongBits(this.p1.x);return r^=31*t_.doubleToLongBits(this.p1.y),e^(Math.trunc(r)^Math.trunc(r>>32))},Ax.prototype.interfaces_=function(){return[r_,o_]},Ax.prototype.getClass=function(){return Ax},Ax.midPoint=function(t,e){return new s_((t.x+e.x)/2,(t.y+e.y)/2)},dx.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(Ax,dx);var yx=function(){this.tempEnv1=new S_,this.tempEnv2=new S_,this._overlapSeg1=new Ax,this._overlapSeg2=new Ax};yx.prototype.overlap=function(){if(2===arguments.length);else if(4===arguments.length){var t=arguments[1],e=arguments[2],r=arguments[3];arguments[0].getLineSegment(t,this._overlapSeg1),e.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}},yx.prototype.interfaces_=function(){return[]},yx.prototype.getClass=function(){return yx};var vx=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],r=arguments[2],n=arguments[3];this._pts=t,this._start=e,this._end=r,this._context=n};vx.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]},vx.prototype.computeSelect=function(t,e,r,n){var i=this._pts[e],o=this._pts[r];if(n.tempEnv1.init(i,o),r-e==1)return n.select(this,e),null;if(!t.intersects(n.tempEnv1))return null;var s=Math.trunc((e+r)/2);e<s&&this.computeSelect(t,e,s,n),s<r&&this.computeSelect(t,s,r,n)},vx.prototype.getCoordinates=function(){for(var t=new Array(this._end-this._start+1).fill(null),e=0,r=this._start;r<=this._end;r++)t[e++]=this._pts[r];return t},vx.prototype.computeOverlaps=function(t,e){this.computeOverlapsInternal(this._start,this._end,t,t._start,t._end,e)},vx.prototype.setId=function(t){this._id=t},vx.prototype.select=function(t,e){this.computeSelect(t,this._start,this._end,e)},vx.prototype.getEnvelope=function(){if(null===this._env){var t=this._pts[this._start],e=this._pts[this._end];this._env=new S_(t,e)}return this._env},vx.prototype.getEndIndex=function(){return this._end},vx.prototype.getStartIndex=function(){return this._start},vx.prototype.getContext=function(){return this._context},vx.prototype.getId=function(){return this._id},vx.prototype.computeOverlapsInternal=function(t,e,r,n,i,o){var s=this._pts[t],a=this._pts[e],u=r._pts[n],l=r._pts[i];if(e-t==1&&i-n==1)return o.overlap(this,t,r,n),null;if(o.tempEnv1.init(s,a),o.tempEnv2.init(u,l),!o.tempEnv1.intersects(o.tempEnv2))return null;var c=Math.trunc((t+e)/2),h=Math.trunc((n+i)/2);t<c&&(n<h&&this.computeOverlapsInternal(t,c,r,n,h,o),h<i&&this.computeOverlapsInternal(t,c,r,h,i,o)),c<e&&(n<h&&this.computeOverlapsInternal(c,e,r,n,h,o),h<i&&this.computeOverlapsInternal(c,e,r,h,i,o))},vx.prototype.interfaces_=function(){return[]},vx.prototype.getClass=function(){return vx};var mx=function(){};mx.prototype.interfaces_=function(){return[]},mx.prototype.getClass=function(){return mx},mx.getChainStartIndices=function(t){var e=0,r=new aI;r.add(new d_(e));do{var n=mx.findChainEnd(t,e);r.add(new d_(n)),e=n}while(e<t.length-1);return mx.toIntArray(r)},mx.findChainEnd=function(t,e){for(var r=e;r<t.length-1&&t[r].equals2D(t[r+1]);)r++;if(r>=t.length-1)return t.length-1;for(var n=GE.quadrant(t[r],t[r+1]),i=e+1;i<t.length;){if(!t[i-1].equals2D(t[i]))if(GE.quadrant(t[i-1],t[i])!==n)break;i++}return i-1},mx.getChains=function(){if(1===arguments.length)return mx.getChains(arguments[0],null);if(2===arguments.length){for(var t=arguments[0],e=arguments[1],r=new aI,n=mx.getChainStartIndices(t),i=0;i<n.length-1;i++){var o=new vx(t,n[i],n[i+1],e);r.add(o)}return r}},mx.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),r=0;r<e.length;r++)e[r]=t.get(r).intValue();return e};var _x=function(){};_x.prototype.computeNodes=function(t){},_x.prototype.getNodedSubstrings=function(){},_x.prototype.interfaces_=function(){return[]},_x.prototype.getClass=function(){return _x};var Ix=function(){if(this._segInt=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.setSegmentIntersector(t)}};Ix.prototype.setSegmentIntersector=function(t){this._segInt=t},Ix.prototype.interfaces_=function(){return[_x]},Ix.prototype.getClass=function(){return Ix};var Ex=function(t){function e(e){e?t.call(this,e):t.call(this),this._monoChains=new aI,this._index=new sx,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={SegmentOverlapAction:{configurable:!0}};return e.prototype.getMonotoneChains=function(){return this._monoChains},e.prototype.getNodedSubstrings=function(){return gx.getNodedSubstrings(this._nodedSegStrings)},e.prototype.getIndex=function(){return this._index},e.prototype.add=function(t){for(var e=this,r=mx.getChains(t.getCoordinates(),t).iterator();r.hasNext();){var n=r.next();n.setId(e._idCounter++),e._index.insert(n.getEnvelope(),n),e._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=this,e=new xx(this._segInt),r=this._monoChains.iterator();r.hasNext();)for(var n=r.next(),i=t._index.query(n.getEnvelope()).iterator();i.hasNext();){var o=i.next();if(o.getId()>n.getId()&&(n.computeOverlaps(o,e),t._nOverlaps++),t._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.SegmentOverlapAction.get=function(){return xx},Object.defineProperties(e,r),e}(Ix),xx=function(t){function e(){t.call(this),this._si=null;var e=arguments[0];this._si=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(4!==arguments.length)return t.prototype.overlap.apply(this,arguments);var e=arguments[1],r=arguments[2],n=arguments[3],i=arguments[0].getContext(),o=r.getContext();this._si.processIntersections(i,e,o,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(yx),Cx=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.setQuadrantSegments(e)}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.setQuadrantSegments(r),this.setEndCapStyle(n)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(o),this.setJoinStyle(s),this.setMitreLimit(a)}},wx={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}};Cx.prototype.getEndCapStyle=function(){return this._endCapStyle},Cx.prototype.isSingleSided=function(){return this._isSingleSided},Cx.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,0===this._quadrantSegments&&(this._joinStyle=Cx.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Cx.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==Cx.JOIN_ROUND&&(this._quadrantSegments=Cx.DEFAULT_QUADRANT_SEGMENTS)},Cx.prototype.getJoinStyle=function(){return this._joinStyle},Cx.prototype.setJoinStyle=function(t){this._joinStyle=t},Cx.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},Cx.prototype.getSimplifyFactor=function(){return this._simplifyFactor},Cx.prototype.getQuadrantSegments=function(){return this._quadrantSegments},Cx.prototype.setEndCapStyle=function(t){this._endCapStyle=t},Cx.prototype.getMitreLimit=function(){return this._mitreLimit},Cx.prototype.setMitreLimit=function(t){this._mitreLimit=t},Cx.prototype.setSingleSided=function(t){this._isSingleSided=t},Cx.prototype.interfaces_=function(){return[]},Cx.prototype.getClass=function(){return Cx},Cx.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)},wx.CAP_ROUND.get=function(){return 1},wx.CAP_FLAT.get=function(){return 2},wx.CAP_SQUARE.get=function(){return 3},wx.JOIN_ROUND.get=function(){return 1},wx.JOIN_MITRE.get=function(){return 2},wx.JOIN_BEVEL.get=function(){return 3},wx.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},wx.DEFAULT_MITRE_LIMIT.get=function(){return 5},wx.DEFAULT_SIMPLIFY_FACTOR.get=function(){return.01},Object.defineProperties(Cx,wx);var bx=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=j_.COUNTERCLOCKWISE,this._inputLine=t||null},Bx={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};bx.prototype.isDeletable=function(t,e,r,n){var i=this._inputLine[t],o=this._inputLine[e],s=this._inputLine[r];return!!this.isConcave(i,o,s)&&(!!this.isShallow(i,o,s,n)&&this.isShallowSampled(i,o,t,r,n))},bx.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,r=this.findNextNonDeletedIndex(e),n=this.findNextNonDeletedIndex(r),i=!1;n<this._inputLine.length;){var o=!1;t.isDeletable(e,r,n,t._distanceTol)&&(t._isDeleted[r]=bx.DELETE,o=!0,i=!0),e=o?n:r,r=t.findNextNonDeletedIndex(e),n=t.findNextNonDeletedIndex(r)}return i},bx.prototype.isShallowConcavity=function(t,e,r,n){return j_.computeOrientation(t,e,r)===this._angleOrientation&&j_.distancePointLine(e,t,r)<n},bx.prototype.isShallowSampled=function(t,e,r,n,i){var o=Math.trunc((n-r)/bx.NUM_PTS_TO_CHECK);o<=0&&(o=1);for(var s=r;s<n;s+=o)if(!this.isShallow(t,e,this._inputLine[s],i))return!1;return!0},bx.prototype.isConcave=function(t,e,r){var n=j_.computeOrientation(t,e,r)===this._angleOrientation;return n},bx.prototype.simplify=function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=j_.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var e=!1;do{e=this.deleteShallowConcavities()}while(e);return this.collapseLine()},bx.prototype.findNextNonDeletedIndex=function(t){for(var e=t+1;e<this._inputLine.length&&this._isDeleted[e]===bx.DELETE;)e++;return e},bx.prototype.isShallow=function(t,e,r,n){return j_.distancePointLine(e,t,r)<n},bx.prototype.collapseLine=function(){for(var t=new lI,e=0;e<this._inputLine.length;e++)this._isDeleted[e]!==bx.DELETE&&t.add(this._inputLine[e]);return t.toCoordinateArray()},bx.prototype.interfaces_=function(){return[]},bx.prototype.getClass=function(){return bx},bx.simplify=function(t,e){return new bx(t).simplify(e)},Bx.INIT.get=function(){return 0},Bx.DELETE.get=function(){return 1},Bx.KEEP.get=function(){return 1},Bx.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(bx,Bx);var Sx=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new aI},Mx={COORDINATE_ARRAY_TYPE:{configurable:!0}};Sx.prototype.getCoordinates=function(){return this._ptList.toArray(Sx.COORDINATE_ARRAY_TYPE)},Sx.prototype.setPrecisionModel=function(t){this._precisionModel=t},Sx.prototype.addPt=function(t){var e=new s_(t);if(this._precisionModel.makePrecise(e),this.isRedundant(e))return null;this._ptList.add(e)},Sx.prototype.revere=function(){},Sx.prototype.addPts=function(t,e){if(e)for(var r=0;r<t.length;r++)this.addPt(t[r]);else for(var n=t.length-1;n>=0;n--)this.addPt(t[n])},Sx.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},Sx.prototype.toString=function(){return(new dE).createLineString(this.getCoordinates()).toString()},Sx.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var t=new s_(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1);if(t.equals(e))return null;this._ptList.add(t)},Sx.prototype.setMinimumVertexDistance=function(t){this._minimimVertexDistance=t},Sx.prototype.interfaces_=function(){return[]},Sx.prototype.getClass=function(){return Sx},Mx.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(Sx,Mx);var Lx=function(){},Nx={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};Lx.prototype.interfaces_=function(){return[]},Lx.prototype.getClass=function(){return Lx},Lx.toDegrees=function(t){return 180*t/Math.PI},Lx.normalize=function(t){for(;t>Math.PI;)t-=Lx.PI_TIMES_2;for(;t<=-Math.PI;)t+=Lx.PI_TIMES_2;return t},Lx.angle=function(){if(1===arguments.length){var t=arguments[0];return Math.atan2(t.y,t.x)}if(2===arguments.length){var e=arguments[0],r=arguments[1],n=r.x-e.x,i=r.y-e.y;return Math.atan2(i,n)}},Lx.isAcute=function(t,e,r){var n=t.x-e.x,i=t.y-e.y;return n*(r.x-e.x)+i*(r.y-e.y)>0},Lx.isObtuse=function(t,e,r){var n=t.x-e.x,i=t.y-e.y;return n*(r.x-e.x)+i*(r.y-e.y)<0},Lx.interiorAngle=function(t,e,r){var n=Lx.angle(e,t),i=Lx.angle(e,r);return Math.abs(i-n)},Lx.normalizePositive=function(t){if(t<0){for(;t<0;)t+=Lx.PI_TIMES_2;t>=Lx.PI_TIMES_2&&(t=0)}else{for(;t>=Lx.PI_TIMES_2;)t-=Lx.PI_TIMES_2;t<0&&(t=0)}return t},Lx.angleBetween=function(t,e,r){var n=Lx.angle(e,t),i=Lx.angle(e,r);return Lx.diff(n,i)},Lx.diff=function(t,e){var r=null;return(r=t<e?e-t:t-e)>Math.PI&&(r=2*Math.PI-r),r},Lx.toRadians=function(t){return t*Math.PI/180},Lx.getTurn=function(t,e){var r=Math.sin(e-t);return r>0?Lx.COUNTERCLOCKWISE:r<0?Lx.CLOCKWISE:Lx.NONE},Lx.angleBetweenOriented=function(t,e,r){var n=Lx.angle(e,t),i=Lx.angle(e,r)-n;return i<=-Math.PI?i+Lx.PI_TIMES_2:i>Math.PI?i-Lx.PI_TIMES_2:i},Nx.PI_TIMES_2.get=function(){return 2*Math.PI},Nx.PI_OVER_2.get=function(){return Math.PI/2},Nx.PI_OVER_4.get=function(){return Math.PI/4},Nx.COUNTERCLOCKWISE.get=function(){return j_.COUNTERCLOCKWISE},Nx.CLOCKWISE.get=function(){return j_.CLOCKWISE},Nx.NONE.get=function(){return j_.COLLINEAR},Object.defineProperties(Lx,Nx);var Tx=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 Ax,this._seg1=new Ax,this._offset0=new Ax,this._offset1=new Ax,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],r=arguments[1],n=arguments[2];this._precisionModel=e,this._bufParams=r,this._li=new G_,this._filletAngleQuantum=Math.PI/2/r.getQuadrantSegments(),r.getQuadrantSegments()>=8&&r.getJoinStyle()===Cx.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(n)},Rx={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}};Tx.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 r=j_.computeOrientation(this._s0,this._s1,this._s2),n=r===j_.CLOCKWISE&&this._side===CE.LEFT||r===j_.COUNTERCLOCKWISE&&this._side===CE.RIGHT;0===r?this.addCollinear(e):n?this.addOutsideTurn(r,e):this.addInsideTurn(r,e)},Tx.prototype.addLineEndCap=function(t,e){var r=new Ax(t,e),n=new Ax;this.computeOffsetSegment(r,CE.LEFT,this._distance,n);var i=new Ax;this.computeOffsetSegment(r,CE.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 Cx.CAP_ROUND:this._segList.addPt(n.p1),this.addFilletArc(e,a+Math.PI/2,a-Math.PI/2,j_.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case Cx.CAP_FLAT:this._segList.addPt(n.p1),this._segList.addPt(i.p1);break;case Cx.CAP_SQUARE:var u=new s_;u.x=Math.abs(this._distance)*Math.cos(a),u.y=Math.abs(this._distance)*Math.sin(a);var l=new s_(n.p1.x+u.x,n.p1.y+u.y),c=new s_(i.p1.x+u.x,i.p1.y+u.y);this._segList.addPt(l),this._segList.addPt(c)}},Tx.prototype.getCoordinates=function(){return this._segList.getCoordinates()},Tx.prototype.addMitreJoin=function(t,e,r,n){var i=!0,o=null;try{o=B_.intersection(e.p0,e.p1,r.p0,r.p1),(n<=0?1:o.distance(t)/Math.abs(n))>this._bufParams.getMitreLimit()&&(i=!1)}catch(t){if(!(t instanceof w_))throw t;o=new s_(0,0),i=!1}i?this._segList.addPt(o):this.addLimitedMitreJoin(e,r,n,this._bufParams.getMitreLimit())},Tx.prototype.addFilletCorner=function(t,e,r,n,i){var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o),u=r.x-t.x,l=r.y-t.y,c=Math.atan2(l,u);n===j_.CLOCKWISE?a<=c&&(a+=2*Math.PI):a>=c&&(a-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,a,c,n,i),this._segList.addPt(r)},Tx.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*Tx.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===Cx.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===Cx.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))},Tx.prototype.createSquare=function(t){this._segList.addPt(new s_(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new s_(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new s_(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new s_(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()},Tx.prototype.addSegments=function(t,e){this._segList.addPts(t,e)},Tx.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},Tx.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},Tx.prototype.initSideSegments=function(t,e,r){this._s1=t,this._s2=e,this._side=r,this._seg1.setCoordinates(t,e),this.computeOffsetSegment(this._seg1,r,this._distance,this._offset1)},Tx.prototype.addLimitedMitreJoin=function(t,e,r,n){var i=this._seg0.p1,o=Lx.angle(i,this._seg0.p0),s=Lx.angleBetweenOriented(this._seg0.p0,i,this._seg1.p1)/2,a=Lx.normalize(o+s),u=Lx.normalize(a+Math.PI),l=n*r,c=r-l*Math.abs(Math.sin(s)),h=i.x+l*Math.cos(u),f=i.y+l*Math.sin(u),p=new s_(h,f),g=new Ax(i,p),A=g.pointAlongOffset(1,c),d=g.pointAlongOffset(1,-c);this._side===CE.LEFT?(this._segList.addPt(A),this._segList.addPt(d)):(this._segList.addPt(d),this._segList.addPt(A))},Tx.prototype.computeOffsetSegment=function(t,e,r,n){var i=e===CE.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*r*o/a,l=i*r*s/a;n.p0.x=t.p0.x-l,n.p0.y=t.p0.y+u,n.p1.x=t.p1.x-l,n.p1.y=t.p1.y+u},Tx.prototype.addFilletArc=function(t,e,r,n,i){var o=n===j_.CLOCKWISE?-1:1,s=Math.abs(e-r),a=Math.trunc(s/this._filletAngleQuantum+.5);if(a<1)return null;for(var u=s/a,l=0,c=new s_;l<s;){var h=e+o*l;c.x=t.x+i*Math.cos(h),c.y=t.y+i*Math.sin(h),this._segList.addPt(c),l+=u}},Tx.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*Tx.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var r=new s_((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(r);var n=new s_((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(n)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},Tx.prototype.createCircle=function(t){var e=new s_(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},Tx.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)},Tx.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Sx,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*Tx.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},Tx.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===Cx.JOIN_BEVEL||this._bufParams.getJoinStyle()===Cx.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,j_.CLOCKWISE,this._distance))},Tx.prototype.closeRing=function(){this._segList.closeRing()},Tx.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},Tx.prototype.interfaces_=function(){return[]},Tx.prototype.getClass=function(){return Tx},Rx.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return.001},Rx.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return.001},Rx.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},Rx.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(Tx,Rx);var Dx=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};Dx.prototype.getOffsetCurve=function(t,e){if(this._distance=e,0===e)return null;var r=e<0,n=Math.abs(e),i=this.getSegGen(n);t.length<=1?this.computePointCurve(t[0],i):this.computeOffsetCurve(t,r,i);var o=i.getCoordinates();return r&&cI.reverse(o),o},Dx.prototype.computeSingleSidedBufferCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);if(e){r.addSegments(t,!0);var i=bx.simplify(t,-n),o=i.length-1;r.initSideSegments(i[o],i[o-1],CE.LEFT),r.addFirstSegment();for(var s=o-2;s>=0;s--)r.addNextSegment(i[s],!0)}else{r.addSegments(t,!1);var a=bx.simplify(t,n),u=a.length-1;r.initSideSegments(a[0],a[1],CE.LEFT),r.addFirstSegment();for(var l=2;l<=u;l++)r.addNextSegment(a[l],!0)}r.addLastSegment(),r.closeRing()},Dx.prototype.computeRingBufferCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);e===CE.RIGHT&&(n=-n);var i=bx.simplify(t,n),o=i.length-1;r.initSideSegments(i[o-1],i[0],e);for(var s=1;s<=o;s++){var a=1!==s;r.addNextSegment(i[s],a)}r.closeRing()},Dx.prototype.computeLineBufferCurve=function(t,e){var r=this.simplifyTolerance(this._distance),n=bx.simplify(t,r),i=n.length-1;e.initSideSegments(n[0],n[1],CE.LEFT);for(var o=2;o<=i;o++)e.addNextSegment(n[o],!0);e.addLastSegment(),e.addLineEndCap(n[i-1],n[i]);var s=bx.simplify(t,-r),a=s.length-1;e.initSideSegments(s[a],s[a-1],CE.LEFT);for(var u=a-2;u>=0;u--)e.addNextSegment(s[u],!0);e.addLastSegment(),e.addLineEndCap(s[1],s[0]),e.closeRing()},Dx.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case Cx.CAP_ROUND:e.createCircle(t);break;case Cx.CAP_SQUARE:e.createSquare(t)}},Dx.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided())return null;if(0===e)return null;var r=Math.abs(e),n=this.getSegGen(r);if(t.length<=1)this.computePointCurve(t[0],n);else if(this._bufParams.isSingleSided()){var i=e<0;this.computeSingleSidedBufferCurve(t,i,n)}else this.computeLineBufferCurve(t,n);return n.getCoordinates()},Dx.prototype.getBufferParameters=function(){return this._bufParams},Dx.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},Dx.prototype.getRingCurve=function(t,e,r){if(this._distance=r,t.length<=2)return this.getLineCurve(t,r);if(0===r)return Dx.copyCoordinates(t);var n=this.getSegGen(r);return this.computeRingBufferCurve(t,e,n),n.getCoordinates()},Dx.prototype.computeOffsetCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);if(e){var i=bx.simplify(t,-n),o=i.length-1;r.initSideSegments(i[o],i[o-1],CE.LEFT),r.addFirstSegment();for(var s=o-2;s>=0;s--)r.addNextSegment(i[s],!0)}else{var a=bx.simplify(t,n),u=a.length-1;r.initSideSegments(a[0],a[1],CE.LEFT),r.addFirstSegment();for(var l=2;l<=u;l++)r.addNextSegment(a[l],!0)}r.addLastSegment()},Dx.prototype.getSegGen=function(t){return new Tx(this._precisionModel,this._bufParams,t)},Dx.prototype.interfaces_=function(){return[]},Dx.prototype.getClass=function(){return Dx},Dx.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),r=0;r<e.length;r++)e[r]=new s_(t[r]);return e};var Px=function(){this._subgraphs=null,this._seg=new Ax,this._cga=new j_;var t=arguments[0];this._subgraphs=t},Qx={DepthSegment:{configurable:!0}};Px.prototype.findStabbedSegments=function(){var t=this;if(1===arguments.length){for(var e=arguments[0],r=new aI,n=this._subgraphs.iterator();n.hasNext();){var i=n.next(),o=i.getEnvelope();e.y<o.getMinY()||e.y>o.getMaxY()||t.findStabbedSegments(e,i.getDirectedEdges(),r)}return r}if(3===arguments.length)if(f_(arguments[2],oI)&&arguments[0]instanceof s_&&arguments[1]instanceof jE)for(var s=arguments[0],a=arguments[1],u=arguments[2],l=a.getEdge().getCoordinates(),c=0;c<l.length-1;c++){if(t._seg.p0=l[c],t._seg.p1=l[c+1],t._seg.p0.y>t._seg.p1.y&&t._seg.reverse(),!(Math.max(t._seg.p0.x,t._seg.p1.x)<s.x||t._seg.isHorizontal()||s.y<t._seg.p0.y||s.y>t._seg.p1.y||j_.computeOrientation(t._seg.p0,t._seg.p1,s)===j_.RIGHT)){var h=a.getDepth(CE.LEFT);t._seg.p0.equals(l[c])||(h=a.getDepth(CE.RIGHT));var f=new kx(t._seg,h);u.add(f)}}else if(f_(arguments[2],oI)&&arguments[0]instanceof s_&&f_(arguments[1],oI))for(var p=arguments[0],g=arguments[2],A=arguments[1].iterator();A.hasNext();){var d=A.next();d.isForward()&&t.findStabbedSegments(p,d,g)}},Px.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);return 0===e.size()?0:tx.min(e)._leftDepth},Px.prototype.interfaces_=function(){return[]},Px.prototype.getClass=function(){return Px},Qx.DepthSegment.get=function(){return kx},Object.defineProperties(Px,Qx);var kx=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new Ax(t),this._leftDepth=e};kx.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 r=this._upwardSeg.orientationIndex(e._upwardSeg);return 0!==r||0!==(r=-1*e._upwardSeg.orientationIndex(this._upwardSeg))?r:this._upwardSeg.compareTo(e._upwardSeg)},kx.prototype.compareX=function(t,e){var r=t.p0.compareTo(e.p0);return 0!==r?r:t.p1.compareTo(e.p1)},kx.prototype.toString=function(){return this._upwardSeg.toString()},kx.prototype.interfaces_=function(){return[r_]},kx.prototype.getClass=function(){return kx};var Ox=function(t,e,r){this.p0=t||null,this.p1=e||null,this.p2=r||null};Ox.prototype.area=function(){return Ox.area(this.p0,this.p1,this.p2)},Ox.prototype.signedArea=function(){return Ox.signedArea(this.p0,this.p1,this.p2)},Ox.prototype.interpolateZ=function(t){if(null===t)throw new $m("Supplied point is null.");return Ox.interpolateZ(t,this.p0,this.p1,this.p2)},Ox.prototype.longestSideLength=function(){return Ox.longestSideLength(this.p0,this.p1,this.p2)},Ox.prototype.isAcute=function(){return Ox.isAcute(this.p0,this.p1,this.p2)},Ox.prototype.circumcentre=function(){return Ox.circumcentre(this.p0,this.p1,this.p2)},Ox.prototype.area3D=function(){return Ox.area3D(this.p0,this.p1,this.p2)},Ox.prototype.centroid=function(){return Ox.centroid(this.p0,this.p1,this.p2)},Ox.prototype.inCentre=function(){return Ox.inCentre(this.p0,this.p1,this.p2)},Ox.prototype.interfaces_=function(){return[]},Ox.prototype.getClass=function(){return Ox},Ox.area=function(t,e,r){return Math.abs(((r.x-t.x)*(e.y-t.y)-(e.x-t.x)*(r.y-t.y))/2)},Ox.signedArea=function(t,e,r){return((r.x-t.x)*(e.y-t.y)-(e.x-t.x)*(r.y-t.y))/2},Ox.det=function(t,e,r,n){return t*n-e*r},Ox.interpolateZ=function(t,e,r,n){var i=e.x,o=e.y,s=r.x-i,a=n.x-i,u=r.y-o,l=n.y-o,c=s*l-a*u,h=t.x-i,f=t.y-o,p=(l*h-a*f)/c,g=(-u*h+s*f)/c;return e.z+p*(r.z-e.z)+g*(n.z-e.z)},Ox.longestSideLength=function(t,e,r){var n=t.distance(e),i=e.distance(r),o=r.distance(t),s=n;return i>s&&(s=i),o>s&&(s=o),s},Ox.isAcute=function(t,e,r){return!!Lx.isAcute(t,e,r)&&(!!Lx.isAcute(e,r,t)&&!!Lx.isAcute(r,t,e))},Ox.circumcentre=function(t,e,r){var n=r.x,i=r.y,o=t.x-n,s=t.y-i,a=e.x-n,u=e.y-i,l=2*Ox.det(o,s,a,u),c=Ox.det(s,o*o+s*s,u,a*a+u*u),h=Ox.det(o,o*o+s*s,a,a*a+u*u);return new s_(n-c/l,i+h/l)},Ox.perpendicularBisector=function(t,e){var r=e.x-t.x,n=e.y-t.y,i=new B_(t.x+r/2,t.y+n/2,1),o=new B_(t.x-n+r/2,t.y+r+n/2,1);return new B_(i,o)},Ox.angleBisector=function(t,e,r){var n=e.distance(t),i=n/(n+e.distance(r)),o=r.x-t.x,s=r.y-t.y;return new s_(t.x+i*o,t.y+i*s)},Ox.area3D=function(t,e,r){var n=e.x-t.x,i=e.y-t.y,o=e.z-t.z,s=r.x-t.x,a=r.y-t.y,u=r.z-t.z,l=i*u-o*a,c=o*s-n*u,h=n*a-i*s,f=l*l+c*c+h*h,p=Math.sqrt(f)/2;return p},Ox.centroid=function(t,e,r){var n=(t.x+e.x+r.x)/3,i=(t.y+e.y+r.y)/3;return new s_(n,i)},Ox.inCentre=function(t,e,r){var n=e.distance(r),i=t.distance(r),o=t.distance(e),s=n+i+o,a=(n*t.x+i*e.x+o*r.x)/s,u=(n*t.y+i*e.y+o*r.y)/s;return new s_(a,u)};var Fx=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new aI;var t=arguments[0],e=arguments[1],r=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=r};Fx.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),r=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(r,c_.EXTERIOR,c_.INTERIOR)},Fx.prototype.addPolygon=function(t){var e=this,r=this._distance,n=CE.LEFT;this._distance<0&&(r=-this._distance,n=CE.RIGHT);var i=t.getExteriorRing(),o=cI.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance))return null;if(this._distance<=0&&o.length<3)return null;this.addPolygonRing(o,r,n,c_.EXTERIOR,c_.INTERIOR);for(var s=0;s<t.getNumInteriorRing();s++){var a=t.getInteriorRingN(s),u=cI.removeRepeatedPoints(a.getCoordinates());e._distance>0&&e.isErodedCompletely(a,-e._distance)||e.addPolygonRing(u,r,CE.opposite(n),c_.INTERIOR,c_.EXTERIOR)}},Fx.prototype.isTriangleErodedCompletely=function(t,e){var r=new Ox(t[0],t[1],t[2]),n=r.inCentre();return j_.distancePointLine(n,r.p0,r.p1)<Math.abs(e)},Fx.prototype.addLineString=function(t){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var e=cI.removeRepeatedPoints(t.getCoordinates()),r=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(r,c_.EXTERIOR,c_.INTERIOR)},Fx.prototype.addCurve=function(t,e,r){if(null===t||t.length<2)return null;var n=new gx(t,new RE(0,c_.BOUNDARY,e,r));this._curveList.add(n)},Fx.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},Fx.prototype.addPolygonRing=function(t,e,r,n,i){if(0===e&&t.length<tE.MINIMUM_VALID_SIZE)return null;var o=n,s=i;t.length>=tE.MINIMUM_VALID_SIZE&&j_.isCCW(t)&&(o=i,s=n,r=CE.opposite(r));var a=this._curveBuilder.getRingCurve(t,r,e);this.addCurve(a,o,s)},Fx.prototype.add=function(t){if(t.isEmpty())return null;t instanceof ZI?this.addPolygon(t):t instanceof XI?this.addLineString(t):t instanceof WI?this.addPoint(t):(t instanceof $I||t instanceof QI||t instanceof eE||t instanceof PI)&&this.addCollection(t)},Fx.prototype.isErodedCompletely=function(t,e){var r=t.getCoordinates();if(r.length<4)return e<0;if(4===r.length)return this.isTriangleErodedCompletely(r,e);var n=t.getEnvelopeInternal(),i=Math.min(n.getHeight(),n.getWidth());return e<0&&2*Math.abs(e)>i},Fx.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var r=t.getGeometryN(e);this.add(r)}},Fx.prototype.interfaces_=function(){return[]},Fx.prototype.getClass=function(){return Fx};var Gx=function(){};Gx.prototype.locate=function(t){},Gx.prototype.interfaces_=function(){return[]},Gx.prototype.getClass=function(){return Gx};var Ux=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var t=arguments[0];this._parent=t,this._atStart=!0,this._index=0,this._max=t.getNumGeometries()};Ux.prototype.next=function(){if(this._atStart)return this._atStart=!1,Ux.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 sI;var t=this._parent.getGeometryN(this._index++);return t instanceof PI?(this._subcollectionIterator=new Ux(t),this._subcollectionIterator.next()):t},Ux.prototype.remove=function(){throw new Error(this.getClass().getName())},Ux.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)},Ux.prototype.interfaces_=function(){return[iI]},Ux.prototype.getClass=function(){return Ux},Ux.isAtomic=function(t){return!(t instanceof PI)};var qx=function(){this._geom=null;var t=arguments[0];this._geom=t};qx.prototype.locate=function(t){return qx.locate(t,this._geom)},qx.prototype.interfaces_=function(){return[Gx]},qx.prototype.getClass=function(){return qx},qx.isPointInRing=function(t,e){return!!e.getEnvelopeInternal().intersects(t)&&j_.isPointInRing(t,e.getCoordinates())},qx.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var r=e.getExteriorRing();if(!qx.isPointInRing(t,r))return!1;for(var n=0;n<e.getNumInteriorRing();n++){var i=e.getInteriorRingN(n);if(qx.isPointInRing(t,i))return!1}return!0},qx.containsPoint=function(t,e){if(e instanceof ZI)return qx.containsPointInPolygon(t,e);if(e instanceof PI)for(var r=new Ux(e);r.hasNext();){var n=r.next();if(n!==e&&qx.containsPoint(t,n))return!0}return!1},qx.locate=function(t,e){return e.isEmpty()?c_.EXTERIOR:qx.containsPoint(t,e)?c_.INTERIOR:c_.EXTERIOR};var jx=function(){this._edgeMap=new wI,this._edgeList=null,this._ptInAreaLocation=[c_.NONE,c_.NONE]};jx.prototype.getNextCW=function(t){this.getEdges();var e=this._edgeList.indexOf(t),r=e-1;return 0===e&&(r=this._edgeList.size()-1),this._edgeList.get(r)},jx.prototype.propagateSideLabels=function(t){for(var e=c_.NONE,r=this.iterator();r.hasNext();){var n=r.next().getLabel();n.isArea(t)&&n.getLocation(t,CE.LEFT)!==c_.NONE&&(e=n.getLocation(t,CE.LEFT))}if(e===c_.NONE)return null;for(var i=e,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getLabel();if(a.getLocation(t,CE.ON)===c_.NONE&&a.setLocation(t,CE.ON,i),a.isArea(t)){var u=a.getLocation(t,CE.LEFT),l=a.getLocation(t,CE.RIGHT);if(l!==c_.NONE){if(l!==i)throw new ME("side location conflict",s.getCoordinate());u===c_.NONE&&k_.shouldNeverReachHere("found single null side (at "+s.getCoordinate()+")"),i=u}else k_.isTrue(a.getLocation(t,CE.LEFT)===c_.NONE,"found single null side"),a.setLocation(t,CE.RIGHT,i),a.setLocation(t,CE.LEFT,i)}}},jx.prototype.getCoordinate=function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null},jx.prototype.print=function(t){b_.out.println("EdgeEndStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){e.next().print(t)}},jx.prototype.isAreaLabelsConsistent=function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},jx.prototype.checkAreaLabelsConsistent=function(t){var e=this.getEdges();if(e.size()<=0)return!0;var r=e.size()-1,n=e.get(r).getLabel().getLocation(t,CE.LEFT);k_.isTrue(n!==c_.NONE,"Found unlabelled area edge");for(var i=n,o=this.iterator();o.hasNext();){var s=o.next().getLabel();k_.isTrue(s.isArea(t),"Found non-area edge");var a=s.getLocation(t,CE.LEFT),u=s.getLocation(t,CE.RIGHT);if(a===u)return!1;if(u!==i)return!1;i=a}return!0},jx.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},jx.prototype.iterator=function(){return this.getEdges().iterator()},jx.prototype.getEdges=function(){return null===this._edgeList&&(this._edgeList=new aI(this._edgeMap.values())),this._edgeList},jx.prototype.getLocation=function(t,e,r){return this._ptInAreaLocation[t]===c_.NONE&&(this._ptInAreaLocation[t]=qx.locate(e,r[t].getGeometry())),this._ptInAreaLocation[t]},jx.prototype.toString=function(){var t=new A_;t.append("EdgeEndStar: "+this.getCoordinate()),t.append("\n");for(var e=this.iterator();e.hasNext();){var r=e.next();t.append(r),t.append("\n")}return t.toString()},jx.prototype.computeEdgeEndLabels=function(t){for(var e=this.iterator();e.hasNext();){e.next().computeLabel(t)}},jx.prototype.computeLabelling=function(t){this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var e=[!1,!1],r=this.iterator();r.hasNext();)for(var n=r.next().getLabel(),i=0;i<2;i++)n.isLine(i)&&n.getLocation(i)===c_.BOUNDARY&&(e[i]=!0);for(var o=this.iterator();o.hasNext();)for(var s=o.next(),a=s.getLabel(),u=0;u<2;u++)if(a.isAnyNull(u)){var l=c_.NONE;if(e[u])l=c_.EXTERIOR;else{var c=s.getCoordinate();l=this.getLocation(u,c,t)}a.setAllLocationsIfNull(u,l)}},jx.prototype.getDegree=function(){return this._edgeMap.size()},jx.prototype.insertEdgeEnd=function(t,e){this._edgeMap.put(t,e),this._edgeList=null},jx.prototype.interfaces_=function(){return[]},jx.prototype.getClass=function(){return jx};var Vx=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(){var t=this;this.getResultAreaEdges();for(var e=null,r=null,n=this._SCANNING_FOR_INCOMING,i=0;i<this._resultAreaEdgeList.size();i++){var o=t._resultAreaEdgeList.get(i),s=o.getSym();if(o.getLabel().isArea())switch(null===e&&o.isInResult()&&(e=o),n){case t._SCANNING_FOR_INCOMING:if(!s.isInResult())continue;r=s,n=t._LINKING_TO_OUTGOING;break;case t._LINKING_TO_OUTGOING:if(!o.isInResult())continue;r.setNext(o),n=t._SCANNING_FOR_INCOMING}}if(n===this._LINKING_TO_OUTGOING){if(null===e)throw new ME("no outgoing dirEdge found",this.getCoordinate());k_.isTrue(e.isInResult(),"unable to link last incoming dirEdge"),r.setNext(e)}},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 r=t.get(0);if(1===e)return r;var n=t.get(e-1),i=r.getQuadrant(),o=n.getQuadrant();return GE.isNorthern(i)&&GE.isNorthern(o)?r:GE.isNorthern(i)||GE.isNorthern(o)?0!==r.getDy()?r:0!==n.getDy()?n:(k_.shouldNeverReachHere("found two horizontal edges incident on node"),null):n},e.prototype.print=function(t){b_.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){var r=e.next();t.print("out "),r.print(t),t.println(),t.print("in "),r.getSym().print(t),t.println()}},e.prototype.getResultAreaEdges=function(){if(null!==this._resultAreaEdgeList)return this._resultAreaEdgeList;this._resultAreaEdgeList=new aI;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 r=e.next().getLabel();r.setAllLocationsIfNull(0,t.getLocation(0)),r.setAllLocationsIfNull(1,t.getLocation(1))}},e.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var t=null,e=null,r=this._edgeList.size()-1;r>=0;r--){var n=this._edgeList.get(r),i=n.getSym();null===e&&(e=i),null!==t&&i.setNext(t),t=n}e.setNext(t)},e.prototype.computeDepths=function(){if(1===arguments.length){var t=arguments[0],e=this.findIndex(t),r=t.getDepth(CE.LEFT),n=t.getDepth(CE.RIGHT),i=this.computeDepths(e+1,this._edgeList.size(),r);if(this.computeDepths(0,e,i)!==n)throw new ME("depth mismatch at "+t.getCoordinate())}else if(3===arguments.length){for(var o=arguments[1],s=arguments[2],a=arguments[0];a<o;a++){var u=this._edgeList.get(a);u.setEdgeDepths(CE.RIGHT,s),s=u.getDepth(CE.LEFT)}return s}},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=this,r=null,n=null,i=this._SCANNING_FOR_INCOMING,o=this._resultAreaEdgeList.size()-1;o>=0;o--){var s=e._resultAreaEdgeList.get(o),a=s.getSym();switch(null===r&&s.getEdgeRing()===t&&(r=s),i){case e._SCANNING_FOR_INCOMING:if(a.getEdgeRing()!==t)continue;n=a,i=e._LINKING_TO_OUTGOING;break;case e._LINKING_TO_OUTGOING:if(s.getEdgeRing()!==t)continue;n.setNextMin(s),i=e._SCANNING_FOR_INCOMING}}i===this._LINKING_TO_OUTGOING&&(k_.isTrue(null!==r,"found null for first outgoing dirEdge"),k_.isTrue(r.getEdgeRing()===t,"unable to link last incoming dirEdge"),n.setNextMin(r))},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 r=arguments[0],n=0,i=this.iterator();i.hasNext();){i.next().getEdgeRing()===r&&n++}return n}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var t=c_.NONE,e=this.iterator();e.hasNext();){var r=e.next(),n=r.getSym();if(!r.isLineEdge()){if(r.isInResult()){t=c_.INTERIOR;break}if(n.isInResult()){t=c_.EXTERIOR;break}}}if(t===c_.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===c_.INTERIOR):(s.isInResult()&&(i=c_.EXTERIOR),a.isInResult()&&(i=c_.INTERIOR))}},e.prototype.computeLabelling=function(e){t.prototype.computeLabelling.call(this,e),this._label=new RE(c_.NONE);for(var r=this.iterator();r.hasNext();)for(var n=r.next().getEdge().getLabel(),i=0;i<2;i++){var o=n.getLocation(i);o!==c_.INTERIOR&&o!==c_.BOUNDARY||this._label.setLocation(i,c_.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(jx),zx=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 OE(t,new Vx)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(VE),Yx=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};Yx.prototype.compareTo=function(t){var e=t;return Yx.compareOriented(this._pts,this._orientation,e._pts,e._orientation)},Yx.prototype.interfaces_=function(){return[r_]},Yx.prototype.getClass=function(){return Yx},Yx.orientation=function(t){return 1===cI.increasingDirection(t)},Yx.compareOriented=function(t,e,r,n){for(var i=e?1:-1,o=n?1:-1,s=e?t.length:-1,a=n?r.length:-1,u=e?0:t.length-1,l=n?0:r.length-1;;){var c=t[u].compareTo(r[l]);if(0!==c)return c;var h=(u+=i)===s,f=(l+=o)===a;if(h&&!f)return-1;if(!h&&f)return 1;if(h&&f)return 0}};var Hx=function(){this._edges=new aI,this._ocaMap=new wI};Hx.prototype.print=function(t){t.print("MULTILINESTRING ( ");for(var e=0;e<this._edges.size();e++){var r=this._edges.get(e);e>0&&t.print(","),t.print("(");for(var n=r.getCoordinates(),i=0;i<n.length;i++)i>0&&t.print(","),t.print(n[i].x+" "+n[i].y);t.println(")")}t.print(") ")},Hx.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())},Hx.prototype.findEdgeIndex=function(t){for(var e=0;e<this._edges.size();e++)if(this._edges.get(e).equals(t))return e;return-1},Hx.prototype.iterator=function(){return this._edges.iterator()},Hx.prototype.getEdges=function(){return this._edges},Hx.prototype.get=function(t){return this._edges.get(t)},Hx.prototype.findEqualEdge=function(t){var e=new Yx(t.getCoordinates());return this._ocaMap.get(e)},Hx.prototype.add=function(t){this._edges.add(t);var e=new Yx(t.getCoordinates());this._ocaMap.put(e,t)},Hx.prototype.interfaces_=function(){return[]},Hx.prototype.getClass=function(){return Hx};var Xx=function(){};Xx.prototype.processIntersections=function(t,e,r,n){},Xx.prototype.isDone=function(){},Xx.prototype.interfaces_=function(){return[]},Xx.prototype.getClass=function(){return Xx};var Jx=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var t=arguments[0];this._li=t};Jx.prototype.isTrivialIntersection=function(t,e,r,n){if(t===r&&1===this._li.getIntersectionNum()){if(Jx.isAdjacentSegments(e,n))return!0;if(t.isClosed()){var i=t.size()-1;if(0===e&&n===i||0===n&&e===i)return!0}}return!1},Jx.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Jx.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Jx.prototype.getLineIntersector=function(){return this._li},Jx.prototype.hasProperIntersection=function(){return this._hasProper},Jx.prototype.processIntersections=function(t,e,r,n){if(t===r&&e===n)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,e,r,n)||(this._hasIntersection=!0,t.addIntersections(this._li,e,0),r.addIntersections(this._li,n,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},Jx.prototype.hasIntersection=function(){return this._hasIntersection},Jx.prototype.isDone=function(){return!1},Jx.prototype.hasInteriorIntersection=function(){return this._hasInterior},Jx.prototype.interfaces_=function(){return[Xx]},Jx.prototype.getClass=function(){return Jx},Jx.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var Wx=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],e=arguments[1],r=arguments[2];this.coord=new s_(t),this.segmentIndex=e,this.dist=r};Wx.prototype.getSegmentIndex=function(){return this.segmentIndex},Wx.prototype.getCoordinate=function(){return this.coord},Wx.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)},Wx.prototype.compareTo=function(t){var e=t;return this.compare(e.segmentIndex,e.dist)},Wx.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&0===this.dist||this.segmentIndex===t},Wx.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},Wx.prototype.getDistance=function(){return this.dist},Wx.prototype.compare=function(t,e){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<e?-1:this.dist>e?1:0},Wx.prototype.interfaces_=function(){return[r_]},Wx.prototype.getClass=function(){return Wx};var Kx=function(){this._nodeMap=new wI,this.edge=null;var t=arguments[0];this.edge=t};Kx.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){e.next().print(t)}},Kx.prototype.iterator=function(){return this._nodeMap.values().iterator()},Kx.prototype.addSplitEdges=function(t){this.addEndpoints();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next(),i=this.createSplitEdge(r,n);t.add(i),r=n}},Kx.prototype.addEndpoints=function(){var t=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[t],t,0)},Kx.prototype.createSplitEdge=function(t,e){var r=e.segmentIndex-t.segmentIndex+2,n=this.edge.pts[e.segmentIndex],i=e.dist>0||!e.coord.equals2D(n);i||r--;var o=new Array(r).fill(null),s=0;o[s++]=new s_(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this.edge.pts[a];return i&&(o[s]=e.coord),new rC(o,new RE(this.edge._label))},Kx.prototype.add=function(t,e,r){var n=new Wx(t,e,r),i=this._nodeMap.get(n);return null!==i?i:(this._nodeMap.put(n,n),n)},Kx.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){if(e.next().coord.equals(t))return!0}return!1},Kx.prototype.interfaces_=function(){return[]},Kx.prototype.getClass=function(){return Kx};var Zx=function(){};Zx.prototype.getChainStartIndices=function(t){var e=0,r=new aI;r.add(new d_(e));do{var n=this.findChainEnd(t,e);r.add(new d_(n)),e=n}while(e<t.length-1);return Zx.toIntArray(r)},Zx.prototype.findChainEnd=function(t,e){for(var r=GE.quadrant(t[e],t[e+1]),n=e+1;n<t.length;){if(GE.quadrant(t[n-1],t[n])!==r)break;n++}return n-1},Zx.prototype.interfaces_=function(){return[]},Zx.prototype.getClass=function(){return Zx},Zx.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),r=0;r<e.length;r++)e[r]=t.get(r).intValue();return e};var $x=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new S_,this.env2=new S_;var t=arguments[0];this.e=t,this.pts=t.getCoordinates();var e=new Zx;this.startIndex=e.getChainStartIndices(this.pts)};$x.prototype.getCoordinates=function(){return this.pts},$x.prototype.getMaxX=function(t){var e=this.pts[this.startIndex[t]].x,r=this.pts[this.startIndex[t+1]].x;return e>r?e:r},$x.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,r=this.pts[this.startIndex[t+1]].x;return e<r?e:r},$x.prototype.computeIntersectsForChain=function(){if(4===arguments.length){var t=arguments[0],e=arguments[1],r=arguments[2],n=arguments[3];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],e,e.startIndex[r],e.startIndex[r+1],n)}else if(6===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3],u=arguments[4],l=arguments[5],c=this.pts[i],h=this.pts[o],f=s.pts[a],p=s.pts[u];if(o-i==1&&u-a==1)return l.addIntersections(this.e,i,s.e,a),null;if(this.env1.init(c,h),this.env2.init(f,p),!this.env1.intersects(this.env2))return null;var g=Math.trunc((i+o)/2),A=Math.trunc((a+u)/2);i<g&&(a<A&&this.computeIntersectsForChain(i,g,s,a,A,l),A<u&&this.computeIntersectsForChain(i,g,s,A,u,l)),g<o&&(a<A&&this.computeIntersectsForChain(g,o,s,a,A,l),A<u&&this.computeIntersectsForChain(g,o,s,A,u,l))}},$x.prototype.getStartIndexes=function(){return this.startIndex},$x.prototype.computeIntersects=function(t,e){for(var r=0;r<this.startIndex.length-1;r++)for(var n=0;n<t.startIndex.length-1;n++)this.computeIntersectsForChain(r,t,n,e)},$x.prototype.interfaces_=function(){return[]},$x.prototype.getClass=function(){return $x};var tC=function t(){this._depth=Array(2).fill().map((function(){return Array(3)}));for(var e=0;e<2;e++)for(var r=0;r<3;r++)this._depth[e][r]=t.NULL_VALUE},eC={NULL_VALUE:{configurable:!0}};tC.prototype.getDepth=function(t,e){return this._depth[t][e]},tC.prototype.setDepth=function(t,e,r){this._depth[t][e]=r},tC.prototype.isNull=function(){if(0===arguments.length){for(var t=0;t<2;t++)for(var e=0;e<3;e++)if(this._depth[t][e]!==tC.NULL_VALUE)return!1;return!0}if(1===arguments.length){var r=arguments[0];return this._depth[r][1]===tC.NULL_VALUE}if(2===arguments.length){var n=arguments[0],i=arguments[1];return this._depth[n][i]===tC.NULL_VALUE}},tC.prototype.normalize=function(){for(var t=this,e=0;e<2;e++)if(!t.isNull(e)){var r=t._depth[e][1];t._depth[e][2]<r&&(r=t._depth[e][2]),r<0&&(r=0);for(var n=1;n<3;n++){var i=0;t._depth[e][n]>r&&(i=1),t._depth[e][n]=i}}},tC.prototype.getDelta=function(t){return this._depth[t][CE.RIGHT]-this._depth[t][CE.LEFT]},tC.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?c_.EXTERIOR:c_.INTERIOR},tC.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},tC.prototype.add=function(){var t=this;if(1===arguments.length)for(var e=arguments[0],r=0;r<2;r++)for(var n=1;n<3;n++){var i=e.getLocation(r,n);i!==c_.EXTERIOR&&i!==c_.INTERIOR||(t.isNull(r,n)?t._depth[r][n]=tC.depthAtLocation(i):t._depth[r][n]+=tC.depthAtLocation(i))}else if(3===arguments.length){var o=arguments[0],s=arguments[1];arguments[2]===c_.INTERIOR&&this._depth[o][s]++}},tC.prototype.interfaces_=function(){return[]},tC.prototype.getClass=function(){return tC},tC.depthAtLocation=function(t){return t===c_.EXTERIOR?0:t===c_.INTERIOR?1:tC.NULL_VALUE},eC.NULL_VALUE.get=function(){return-1},Object.defineProperties(tC,eC);var rC=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new Kx(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new tC,this._depthDelta=0,1===arguments.length){var r=arguments[0];e.call(this,r,null)}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.pts=n,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[0]=this.pts[0],t[1]=this.pts[1],new e(t,RE.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 r=t;if(this.pts.length!==r.pts.length)return!1;for(var n=!0,i=!0,o=this.pts.length,s=0;s<this.pts.length;s++)if(this.pts[s].equals2D(r.pts[s])||(n=!1),this.pts[s].equals2D(r.pts[--o])||(i=!1),!n&&!i)return!1;return!0},e.prototype.getCoordinate=function(){if(0===arguments.length)return this.pts.length>0?this.pts[0]:null;if(1===arguments.length){var t=arguments[0];return this.pts[t]}},e.prototype.print=function(t){t.print("edge "+this._name+": "),t.print("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.print(","),t.print(this.pts[e].x+" "+this.pts[e].y);t.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(t){e.updateIM(this._label,t)},e.prototype.isCollapsed=function(){return!!this._label.isArea()&&(3===this.pts.length&&!!this.pts[0].equals(this.pts[2]))},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(t){t.print("edge "+this._name+": ");for(var e=this.pts.length-1;e>=0;e--)t.print(this.pts[e]+" ");t.println("")},e.prototype.getMonotoneChainEdge=function(){return null===this._mce&&(this._mce=new $x(this)),this._mce},e.prototype.getEnvelope=function(){if(null===this._env){this._env=new S_;for(var t=0;t<this.pts.length;t++)this._env.expandToInclude(this.pts[t])}return this._env},e.prototype.addIntersection=function(t,e,r,n){var i=new s_(t.getIntersection(n)),o=e,s=t.getEdgeDistance(r,n),a=o+1;if(a<this.pts.length){var u=this.pts[a];i.equals2D(u)&&(o=a,s=0)}this.eiList.add(i,o,s)},e.prototype.toString=function(){var t=new A_;t.append("edge "+this._name+": "),t.append("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.append(","),t.append(this.pts[e].x+" "+this.pts[e].y);return t.append(") "+this._label+" "+this._depthDelta),t.toString()},e.prototype.isPointwiseEqual=function(t){if(this.pts.length!==t.pts.length)return!1;for(var e=0;e<this.pts.length;e++)if(!this.pts[e].equals2D(t.pts[e]))return!1;return!0},e.prototype.setDepthDelta=function(t){this._depthDelta=t},e.prototype.getEdgeIntersectionList=function(){return this.eiList},e.prototype.addIntersections=function(t,e,r){for(var n=0;n<t.getIntersectionNum();n++)this.addIntersection(t,e,r,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.updateIM=function(){if(2!==arguments.length)return t.prototype.updateIM.apply(this,arguments);var e=arguments[0],r=arguments[1];r.setAtLeastIfValid(e.getLocation(0,CE.ON),e.getLocation(1,CE.ON),1),e.isArea()&&(r.setAtLeastIfValid(e.getLocation(0,CE.LEFT),e.getLocation(1,CE.LEFT),2),r.setAtLeastIfValid(e.getLocation(0,CE.RIGHT),e.getLocation(1,CE.RIGHT),2))},e}(kE),nC=function(t){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new Hx,this._bufParams=t||null};nC.prototype.setWorkingPrecisionModel=function(t){this._workingPrecisionModel=t},nC.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var r=e.getLabel(),n=t.getLabel();e.isPointwiseEqual(t)||(n=new RE(t.getLabel())).flip(),r.merge(n);var i=nC.depthDelta(n),o=e.getDepthDelta()+i;e.setDepthDelta(o)}else this._edgeList.add(t),t.setDepthDelta(nC.depthDelta(t.getLabel()))},nC.prototype.buildSubgraphs=function(t,e){for(var r=new aI,n=t.iterator();n.hasNext();){var i=n.next(),o=i.getRightmostCoordinate(),s=new Px(r).getDepth(o);i.computeDepth(s),i.findResultEdges(),r.add(i),e.add(i.getDirectedEdges(),i.getNodes())}},nC.prototype.createSubgraphs=function(t){for(var e=new aI,r=t.getNodes().iterator();r.hasNext();){var n=r.next();if(!n.isVisited()){var i=new NE;i.create(n),e.add(i)}}return tx.sort(e,tx.reverseOrder()),e},nC.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},nC.prototype.getNoder=function(t){if(null!==this._workingNoder)return this._workingNoder;var e=new Ex,r=new G_;return r.setPrecisionModel(t),e.setSegmentIntersector(new Jx(r)),e},nC.prototype.buffer=function(t,e){var r=this._workingPrecisionModel;null===r&&(r=t.getPrecisionModel()),this._geomFact=t.getFactory();var n=new Dx(r,this._bufParams),i=new Fx(t,e,n).getCurves();if(i.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(i,r),this._graph=new zE(new zx),this._graph.addEdges(this._edgeList.getEdges());var o=this.createSubgraphs(this._graph),s=new YE(this._geomFact);this.buildSubgraphs(o,s);var a=s.getPolygons();return a.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(a)},nC.prototype.computeNodedEdges=function(t,e){var r=this.getNoder(e);r.computeNodes(t);for(var n=r.getNodedSubstrings().iterator();n.hasNext();){var i=n.next(),o=i.getCoordinates();if(2!==o.length||!o[0].equals2D(o[1])){var s=i.getData(),a=new rC(i.getCoordinates(),new RE(s));this.insertUniqueEdge(a)}}},nC.prototype.setNoder=function(t){this._workingNoder=t},nC.prototype.interfaces_=function(){return[]},nC.prototype.getClass=function(){return nC},nC.depthDelta=function(t){var e=t.getLocation(0,CE.LEFT),r=t.getLocation(0,CE.RIGHT);return e===c_.INTERIOR&&r===c_.EXTERIOR?1:e===c_.EXTERIOR&&r===c_.INTERIOR?-1:0},nC.convertSegStrings=function(t){for(var e=new dE,r=new aI;t.hasNext();){var n=t.next(),i=e.createLineString(n.getCoordinates());r.add(i)}return e.buildGeometry(r)};var iC=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,2===arguments.length){var t=arguments[0],e=arguments[1];this._noder=t,this._scaleFactor=e,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(4===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2],o=arguments[3];this._noder=r,this._scaleFactor=n,this._offsetX=i,this._offsetY=o,this._isScaled=!this.isIntegerPrecision()}};iC.prototype.rescale=function(){var t=this;if(f_(arguments[0],rI))for(var e=arguments[0].iterator();e.hasNext();){var r=e.next();t.rescale(r.getCoordinates())}else if(arguments[0]instanceof Array){for(var n=arguments[0],i=0;i<n.length;i++)n[i].x=n[i].x/t._scaleFactor+t._offsetX,n[i].y=n[i].y/t._scaleFactor+t._offsetY;2===n.length&&n[0].equals2D(n[1])&&b_.out.println(n)}},iC.prototype.scale=function(){var t=this;if(f_(arguments[0],rI)){for(var e=arguments[0],r=new aI,n=e.iterator();n.hasNext();){var i=n.next();r.add(new gx(t.scale(i.getCoordinates()),i.getData()))}return r}if(arguments[0]instanceof Array){for(var o=arguments[0],s=new Array(o.length).fill(null),a=0;a<o.length;a++)s[a]=new s_(Math.round((o[a].x-t._offsetX)*t._scaleFactor),Math.round((o[a].y-t._offsetY)*t._scaleFactor),o[a].z);return cI.removeRepeatedPoints(s)}},iC.prototype.isIntegerPrecision=function(){return 1===this._scaleFactor},iC.prototype.getNodedSubstrings=function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t},iC.prototype.computeNodes=function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)},iC.prototype.interfaces_=function(){return[_x]},iC.prototype.getClass=function(){return iC};var oC=function(){this._li=new G_,this._segStrings=null;var t=arguments[0];this._segStrings=t},sC={fact:{configurable:!0}};oC.prototype.checkEndPtVertexIntersections=function(){var t=this;if(0===arguments.length)for(var e=this._segStrings.iterator();e.hasNext();){var r=e.next().getCoordinates();t.checkEndPtVertexIntersections(r[0],t._segStrings),t.checkEndPtVertexIntersections(r[r.length-1],t._segStrings)}else if(2===arguments.length)for(var n=arguments[0],i=arguments[1].iterator();i.hasNext();)for(var o=i.next().getCoordinates(),s=1;s<o.length-1;s++)if(o[s].equals(n))throw new P_("found endpt/interior pt intersection at index "+s+" :pt "+n)},oC.prototype.checkInteriorIntersections=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();)for(var e=t.next(),r=this._segStrings.iterator();r.hasNext();){var n=r.next();this.checkInteriorIntersections(e,n)}else if(2===arguments.length)for(var i=arguments[0],o=arguments[1],s=i.getCoordinates(),a=o.getCoordinates(),u=0;u<s.length-1;u++)for(var l=0;l<a.length-1;l++)this.checkInteriorIntersections(i,u,o,l);else if(4===arguments.length){var c=arguments[0],h=arguments[1],f=arguments[2],p=arguments[3];if(c===f&&h===p)return null;var g=c.getCoordinates()[h],A=c.getCoordinates()[h+1],d=f.getCoordinates()[p],y=f.getCoordinates()[p+1];if(this._li.computeIntersection(g,A,d,y),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,g,A)||this.hasInteriorIntersection(this._li,d,y)))throw new P_("found non-noded intersection at "+g+"-"+A+" and "+d+"-"+y)}},oC.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},oC.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 r=arguments[0].getCoordinates(),n=0;n<r.length-2;n++)this.checkCollapse(r[n],r[n+1],r[n+2])},oC.prototype.hasInteriorIntersection=function(t,e,r){for(var n=0;n<t.getIntersectionNum();n++){var i=t.getIntersection(n);if(!i.equals(e)&&!i.equals(r))return!0}return!1},oC.prototype.checkCollapse=function(t,e,r){if(t.equals(r))throw new P_("found non-noded collapse at "+oC.fact.createLineString([t,e,r]))},oC.prototype.interfaces_=function(){return[]},oC.prototype.getClass=function(){return oC},sC.fact.get=function(){return new dE},Object.defineProperties(oC,sC);var aC=function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var t=arguments[0],e=arguments[1],r=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=e,this._li=r,e<=0)throw new $m("Scale factor must be non-zero");1!==e&&(this._pt=new s_(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new s_,this._p1Scaled=new s_),this.initCorners(this._pt)},uC={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};aC.prototype.intersectsScaled=function(t,e){var r=Math.min(t.x,e.x),n=Math.max(t.x,e.x),i=Math.min(t.y,e.y),o=Math.max(t.y,e.y),s=this._maxx<r||this._minx>n||this._maxy<i||this._miny>o;if(s)return!1;var a=this.intersectsToleranceSquare(t,e);return k_.isTrue(!(s&&a),"Found bad envelope test"),a},aC.prototype.initCorners=function(t){var e=.5;this._minx=t.x-e,this._maxx=t.x+e,this._miny=t.y-e,this._maxy=t.y+e,this._corner[0]=new s_(this._maxx,this._maxy),this._corner[1]=new s_(this._minx,this._maxy),this._corner[2]=new s_(this._minx,this._miny),this._corner[3]=new s_(this._maxx,this._miny)},aC.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))},aC.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},aC.prototype.getCoordinate=function(){return this._originalPt},aC.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},aC.prototype.getSafeEnvelope=function(){if(null===this._safeEnv){var t=aC.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new S_(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},aC.prototype.intersectsPixelClosure=function(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))},aC.prototype.intersectsToleranceSquare=function(t,e){var r=!1,n=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),!!this._li.isProper()||(!(!r||!n)||(!!t.equals(this._pt)||!!e.equals(this._pt))))))},aC.prototype.addSnappedNode=function(t,e){var r=t.getCoordinate(e),n=t.getCoordinate(e+1);return!!this.intersects(r,n)&&(t.addIntersection(this.getCoordinate(),e),!0)},aC.prototype.interfaces_=function(){return[]},aC.prototype.getClass=function(){return aC},uC.SAFE_ENV_EXPANSION_FACTOR.get=function(){return.75},Object.defineProperties(aC,uC);var lC=function(){this.tempEnv1=new S_,this.selectedSegment=new Ax};lC.prototype.select=function(){if(1===arguments.length);else if(2===arguments.length){var t=arguments[1];arguments[0].getLineSegment(t,this.selectedSegment),this.select(this.selectedSegment)}},lC.prototype.interfaces_=function(){return[]},lC.prototype.getClass=function(){return lC};var cC=function(){this._index=null;var t=arguments[0];this._index=t},hC={HotPixelSnapAction:{configurable:!0}};cC.prototype.snap=function(){if(1===arguments.length){var t=arguments[0];return this.snap(t,null,-1)}if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2],i=e.getSafeEnvelope(),o=new fC(e,r,n);return this._index.query(i,{interfaces_:function(){return[WE]},visitItem:function(t){t.select(i,o)}}),o.isNodeAdded()}},cC.prototype.interfaces_=function(){return[]},cC.prototype.getClass=function(){return cC},hC.HotPixelSnapAction.get=function(){return fC},Object.defineProperties(cC,hC);var fC=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var e=arguments[0],r=arguments[1],n=arguments[2];this._hotPixel=e,this._parentEdge=r,this._hotPixelVertexIndex=n}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[1],r=arguments[0].getContext();if(null!==this._parentEdge&&r===this._parentEdge&&e===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(r,e)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(lC),pC=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new aI};pC.prototype.processIntersections=function(t,e,r,n){if(t===r&&e===n)return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];if(this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var u=0;u<this._li.getIntersectionNum();u++)this._interiorIntersections.add(this._li.getIntersection(u));t.addIntersections(this._li,e,0),r.addIntersections(this._li,n,1)}},pC.prototype.isDone=function(){return!1},pC.prototype.getInteriorIntersections=function(){return this._interiorIntersections},pC.prototype.interfaces_=function(){return[Xx]},pC.prototype.getClass=function(){return pC};var gC=function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var t=arguments[0];this._pm=t,this._li=new G_,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()};gC.prototype.checkCorrectness=function(t){var e=gx.getNodedSubstrings(t),r=new oC(e);try{r.checkValid()}catch(t){if(!(t instanceof C_))throw t;t.printStackTrace()}},gC.prototype.getNodedSubstrings=function(){return gx.getNodedSubstrings(this._nodedSegStrings)},gC.prototype.snapRound=function(t,e){var r=this.findInteriorIntersections(t,e);this.computeIntersectionSnaps(r),this.computeVertexSnaps(t)},gC.prototype.findInteriorIntersections=function(t,e){var r=new pC(e);return this._noder.setSegmentIntersector(r),this._noder.computeNodes(t),r.getInteriorIntersections()},gC.prototype.computeVertexSnaps=function(){var t=this;if(f_(arguments[0],rI))for(var e=arguments[0].iterator();e.hasNext();){var r=e.next();t.computeVertexSnaps(r)}else if(arguments[0]instanceof gx)for(var n=arguments[0],i=n.getCoordinates(),o=0;o<i.length;o++){var s=new aC(i[o],t._scaleFactor,t._li);t._pointSnapper.snap(s,n,o)&&n.addIntersection(i[o],o)}},gC.prototype.computeNodes=function(t){this._nodedSegStrings=t,this._noder=new Ex,this._pointSnapper=new cC(this._noder.getIndex()),this.snapRound(t,this._li)},gC.prototype.computeIntersectionSnaps=function(t){for(var e=this,r=t.iterator();r.hasNext();){var n=r.next(),i=new aC(n,e._scaleFactor,e._li);e._pointSnapper.snap(i)}},gC.prototype.interfaces_=function(){return[_x]},gC.prototype.getClass=function(){return gC};var AC=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new Cx,this._resultGeometry=null,this._saveException=null,1===arguments.length){var t=arguments[0];this._argGeom=t}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this._argGeom=e,this._bufParams=r}},dC={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};AC.prototype.bufferFixedPrecision=function(t){var e=new iC(new gC(new fE(1)),t.getScale()),r=new nC(this._bufParams);r.setWorkingPrecisionModel(t),r.setNoder(e),this._resultGeometry=r.buffer(this._argGeom,this._distance)},AC.prototype.bufferReducedPrecision=function(){var t=this;if(0===arguments.length){for(var e=AC.MAX_PRECISION_DIGITS;e>=0;e--){try{t.bufferReducedPrecision(e)}catch(e){if(!(e instanceof ME))throw e;t._saveException=e}if(null!==t._resultGeometry)return null}throw this._saveException}if(1===arguments.length){var r=arguments[0],n=AC.precisionScaleFactor(this._argGeom,this._distance,r),i=new fE(n);this.bufferFixedPrecision(i)}},AC.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===fE.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},AC.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},AC.prototype.bufferOriginalPrecision=function(){try{var t=new nC(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof P_))throw t;this._saveException=t}},AC.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},AC.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},AC.prototype.interfaces_=function(){return[]},AC.prototype.getClass=function(){return AC},AC.bufferOp=function(){if(2===arguments.length){var t=arguments[1];return new AC(arguments[0]).getResultGeometry(t)}if(3===arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Y_&&"number"==typeof arguments[1]){var e=arguments[1],r=arguments[2],n=new AC(arguments[0]);return n.setQuadrantSegments(r),n.getResultGeometry(e)}if(arguments[2]instanceof Cx&&arguments[0]instanceof Y_&&"number"==typeof arguments[1]){var i=arguments[1];return new AC(arguments[0],arguments[2]).getResultGeometry(i)}}else if(4===arguments.length){var o=arguments[1],s=arguments[2],a=arguments[3],u=new AC(arguments[0]);return u.setQuadrantSegments(s),u.setEndCapStyle(a),u.getResultGeometry(o)}},AC.precisionScaleFactor=function(t,e,r){var n=t.getEnvelopeInternal(),i=p_.max(Math.abs(n.getMaxX()),Math.abs(n.getMaxY()),Math.abs(n.getMinX()),Math.abs(n.getMinY()))+2*(e>0?e:0),o=r-Math.trunc(Math.log(i)/Math.log(10)+1);return Math.pow(10,o)},dC.CAP_ROUND.get=function(){return Cx.CAP_ROUND},dC.CAP_BUTT.get=function(){return Cx.CAP_FLAT},dC.CAP_FLAT.get=function(){return Cx.CAP_FLAT},dC.CAP_SQUARE.get=function(){return Cx.CAP_SQUARE},dC.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(AC,dC);var yC=function(){this._pt=[new s_,new s_],this._distance=t_.NaN,this._isNull=!0};yC.prototype.getCoordinates=function(){return this._pt},yC.prototype.getCoordinate=function(t){return this._pt[t]},yC.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n<this._distance&&this.initialize(e,r,n)}},yC.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this._pt[0].setCoordinate(r),this._pt[1].setCoordinate(n),this._distance=i,this._isNull=!1}},yC.prototype.getDistance=function(){return this._distance},yC.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n>this._distance&&this.initialize(e,r,n)}},yC.prototype.interfaces_=function(){return[]},yC.prototype.getClass=function(){return yC};var vC=function(){};vC.prototype.interfaces_=function(){return[]},vC.prototype.getClass=function(){return vC},vC.computeDistance=function(){if(arguments[2]instanceof yC&&arguments[0]instanceof XI&&arguments[1]instanceof s_)for(var t=arguments[1],e=arguments[2],r=arguments[0].getCoordinates(),n=new Ax,i=0;i<r.length-1;i++){n.setCoordinates(r[i],r[i+1]);var o=n.closestPoint(t);e.setMinimum(o,t)}else if(arguments[2]instanceof yC&&arguments[0]instanceof ZI&&arguments[1]instanceof s_){var s=arguments[0],a=arguments[1],u=arguments[2];vC.computeDistance(s.getExteriorRing(),a,u);for(var l=0;l<s.getNumInteriorRing();l++)vC.computeDistance(s.getInteriorRingN(l),a,u)}else if(arguments[2]instanceof yC&&arguments[0]instanceof Y_&&arguments[1]instanceof s_){var c=arguments[0],h=arguments[1],f=arguments[2];if(c instanceof XI)vC.computeDistance(c,h,f);else if(c instanceof ZI)vC.computeDistance(c,h,f);else if(c instanceof PI)for(var p=c,g=0;g<p.getNumGeometries();g++){var A=p.getGeometryN(g);vC.computeDistance(A,h,f)}else f.setMinimum(c.getCoordinate(),h)}else if(arguments[2]instanceof yC&&arguments[0]instanceof Ax&&arguments[1]instanceof s_){var d=arguments[1],y=arguments[2],v=arguments[0].closestPoint(d);y.setMinimum(v,d)}};var mC=function(t){this._maxPtDist=new yC,this._inputGeom=t||null},_C={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};mC.prototype.computeMaxMidpointDistance=function(t){var e=new EC(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},mC.prototype.computeMaxVertexDistance=function(t){var e=new IC(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},mC.prototype.findDistance=function(t){return this.computeMaxVertexDistance(t),this.computeMaxMidpointDistance(t),this._maxPtDist.getDistance()},mC.prototype.getDistancePoints=function(){return this._maxPtDist},mC.prototype.interfaces_=function(){return[]},mC.prototype.getClass=function(){return mC},_C.MaxPointDistanceFilter.get=function(){return IC},_C.MaxMidpointDistanceFilter.get=function(){return EC},Object.defineProperties(mC,_C);var IC=function(t){this._maxPtDist=new yC,this._minPtDist=new yC,this._geom=t||null};IC.prototype.filter=function(t){this._minPtDist.initialize(),vC.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},IC.prototype.getMaxPointDistance=function(){return this._maxPtDist},IC.prototype.interfaces_=function(){return[J_]},IC.prototype.getClass=function(){return IC};var EC=function(t){this._maxPtDist=new yC,this._minPtDist=new yC,this._geom=t||null};EC.prototype.filter=function(t,e){if(0===e)return null;var r=t.getCoordinate(e-1),n=t.getCoordinate(e),i=new s_((r.x+n.x)/2,(r.y+n.y)/2);this._minPtDist.initialize(),vC.computeDistance(this._geom,i,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},EC.prototype.isDone=function(){return!1},EC.prototype.isGeometryChanged=function(){return!1},EC.prototype.getMaxPointDistance=function(){return this._maxPtDist},EC.prototype.interfaces_=function(){return[DI]},EC.prototype.getClass=function(){return EC};var xC=function(t){this._comps=t||null};xC.prototype.filter=function(t){t instanceof ZI&&this._comps.add(t)},xC.prototype.interfaces_=function(){return[RI]},xC.prototype.getClass=function(){return xC},xC.getPolygons=function(){if(1===arguments.length)return xC.getPolygons(arguments[0],new aI);if(2===arguments.length){var t=arguments[0],e=arguments[1];return t instanceof ZI?e.add(t):t instanceof PI&&t.apply(new xC(e)),e}};var CC=function(){if(this._lines=null,this._isForcedToLineString=!1,1===arguments.length){var t=arguments[0];this._lines=t}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this._lines=e,this._isForcedToLineString=r}};CC.prototype.filter=function(t){if(this._isForcedToLineString&&t instanceof tE){var e=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(e),null}t instanceof XI&&this._lines.add(t)},CC.prototype.setForceToLineString=function(t){this._isForcedToLineString=t},CC.prototype.interfaces_=function(){return[z_]},CC.prototype.getClass=function(){return CC},CC.getGeometry=function(){if(1===arguments.length){var t=arguments[0];return t.getFactory().buildGeometry(CC.getLines(t))}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e.getFactory().buildGeometry(CC.getLines(e,r))}},CC.getLines=function(){if(1===arguments.length)return CC.getLines(arguments[0],!1);if(2===arguments.length){if(f_(arguments[0],rI)&&f_(arguments[1],rI)){for(var t=arguments[1],e=arguments[0].iterator();e.hasNext();){var r=e.next();CC.getLines(r,t)}return t}if(arguments[0]instanceof Y_&&"boolean"==typeof arguments[1]){var n=arguments[0],i=arguments[1],o=new aI;return n.apply(new CC(o,i)),o}if(arguments[0]instanceof Y_&&f_(arguments[1],rI)){var s=arguments[0],a=arguments[1];return s instanceof XI?a.add(s):s.apply(new CC(a)),a}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&f_(arguments[0],rI)&&f_(arguments[1],rI)){for(var u=arguments[1],l=arguments[2],c=arguments[0].iterator();c.hasNext();){var h=c.next();CC.getLines(h,u,l)}return u}if("boolean"==typeof arguments[2]&&arguments[0]instanceof Y_&&f_(arguments[1],rI)){var f=arguments[1],p=arguments[2];return arguments[0].apply(new CC(f,p)),f}}};var wC=function(){if(this._boundaryRule=W_.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];if(null===t)throw new $m("Rule must be non-null");this._boundaryRule=t}};wC.prototype.locateInternal=function(){if(arguments[0]instanceof s_&&arguments[1]instanceof ZI){var t=arguments[0],e=arguments[1];if(e.isEmpty())return c_.EXTERIOR;var r=e.getExteriorRing(),n=this.locateInPolygonRing(t,r);if(n===c_.EXTERIOR)return c_.EXTERIOR;if(n===c_.BOUNDARY)return c_.BOUNDARY;for(var i=0;i<e.getNumInteriorRing();i++){var o=e.getInteriorRingN(i),s=this.locateInPolygonRing(t,o);if(s===c_.INTERIOR)return c_.EXTERIOR;if(s===c_.BOUNDARY)return c_.BOUNDARY}return c_.INTERIOR}if(arguments[0]instanceof s_&&arguments[1]instanceof XI){var a=arguments[0],u=arguments[1];if(!u.getEnvelopeInternal().intersects(a))return c_.EXTERIOR;var l=u.getCoordinates();return u.isClosed()||!a.equals(l[0])&&!a.equals(l[l.length-1])?j_.isOnLine(a,l)?c_.INTERIOR:c_.EXTERIOR:c_.BOUNDARY}if(arguments[0]instanceof s_&&arguments[1]instanceof WI){var c=arguments[0];return arguments[1].getCoordinate().equals2D(c)?c_.INTERIOR:c_.EXTERIOR}},wC.prototype.locateInPolygonRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?j_.locatePointInRing(t,e.getCoordinates()):c_.EXTERIOR},wC.prototype.intersects=function(t,e){return this.locate(t,e)!==c_.EXTERIOR},wC.prototype.updateLocationInfo=function(t){t===c_.INTERIOR&&(this._isIn=!0),t===c_.BOUNDARY&&this._numBoundaries++},wC.prototype.computeLocation=function(t,e){var r=this;if(e instanceof WI&&this.updateLocationInfo(this.locateInternal(t,e)),e instanceof XI)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof ZI)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof QI)for(var n=e,i=0;i<n.getNumGeometries();i++){var o=n.getGeometryN(i);r.updateLocationInfo(r.locateInternal(t,o))}else if(e instanceof eE)for(var s=e,a=0;a<s.getNumGeometries();a++){var u=s.getGeometryN(a);r.updateLocationInfo(r.locateInternal(t,u))}else if(e instanceof PI)for(var l=new Ux(e);l.hasNext();){var c=l.next();c!==e&&r.computeLocation(t,c)}},wC.prototype.locate=function(t,e){return e.isEmpty()?c_.EXTERIOR:e instanceof XI||e instanceof ZI?this.locateInternal(t,e):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,e),this._boundaryRule.isInBoundary(this._numBoundaries)?c_.BOUNDARY:this._numBoundaries>0||this._isIn?c_.INTERIOR:c_.EXTERIOR)},wC.prototype.interfaces_=function(){return[]},wC.prototype.getClass=function(){return wC};var bC=function t(){if(this._component=null,this._segIndex=null,this._pt=null,2===arguments.length)t.call(this,arguments[0],t.INSIDE_AREA,arguments[1]);else if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2];this._component=e,this._segIndex=r,this._pt=n}},BC={INSIDE_AREA:{configurable:!0}};bC.prototype.isInsideArea=function(){return this._segIndex===bC.INSIDE_AREA},bC.prototype.getCoordinate=function(){return this._pt},bC.prototype.getGeometryComponent=function(){return this._component},bC.prototype.getSegmentIndex=function(){return this._segIndex},bC.prototype.interfaces_=function(){return[]},bC.prototype.getClass=function(){return bC},BC.INSIDE_AREA.get=function(){return-1},Object.defineProperties(bC,BC);var SC=function(t){this._pts=t||null};SC.prototype.filter=function(t){t instanceof WI&&this._pts.add(t)},SC.prototype.interfaces_=function(){return[RI]},SC.prototype.getClass=function(){return SC},SC.getPoints=function(){if(1===arguments.length){var t=arguments[0];return t instanceof WI?tx.singletonList(t):SC.getPoints(t,new aI)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e instanceof WI?r.add(e):e instanceof PI&&e.apply(new SC(r)),r}};var MC=function(){this._locations=null;var t=arguments[0];this._locations=t};MC.prototype.filter=function(t){(t instanceof WI||t instanceof XI||t instanceof ZI)&&this._locations.add(new bC(t,0,t.getCoordinate()))},MC.prototype.interfaces_=function(){return[RI]},MC.prototype.getClass=function(){return MC},MC.getLocations=function(t){var e=new aI;return t.apply(new MC(e)),e};var LC=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new wC,this._minDistanceLocation=null,this._minDistance=t_.MAX_VALUE,2===arguments.length){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=r,this._geom[1]=n,this._terminateDistance=i}};LC.prototype.computeContainmentDistance=function(){var t=this;if(0===arguments.length){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(2===arguments.length){var r=arguments[0],n=arguments[1],i=1-r,o=xC.getPolygons(this._geom[r]);if(o.size()>0){var s=MC.getLocations(this._geom[i]);if(this.computeContainmentDistance(s,o,n),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[i]=n[0],this._minDistanceLocation[r]=n[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&f_(arguments[0],oI)&&f_(arguments[1],oI)){for(var a=arguments[0],u=arguments[1],l=arguments[2],c=0;c<a.size();c++)for(var h=a.get(c),f=0;f<u.size();f++)if(t.computeContainmentDistance(h,u.get(f),l),t._minDistance<=t._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof bC&&arguments[1]instanceof ZI){var p=arguments[0],g=arguments[1],A=arguments[2],d=p.getCoordinate();if(c_.EXTERIOR!==this._ptLocator.locate(d,g))return this._minDistance=0,A[0]=p,A[1]=new bC(g,d),null}},LC.prototype.computeMinDistanceLinesPoints=function(t,e,r){for(var n=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s);if(n.computeMinDistance(o,a,r),n._minDistance<=n._terminateDistance)return null}},LC.prototype.computeFacetDistance=function(){var t=new Array(2).fill(null),e=CC.getLines(this._geom[0]),r=CC.getLines(this._geom[1]),n=SC.getPoints(this._geom[0]),i=SC.getPoints(this._geom[1]);return this.computeMinDistanceLines(e,r,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(e,i,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(r,n,t),this.updateMinDistance(t,!0),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistancePoints(n,i,t),void this.updateMinDistance(t,!1))))},LC.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},LC.prototype.updateMinDistance=function(t,e){if(null===t[0])return null;e?(this._minDistanceLocation[0]=t[1],this._minDistanceLocation[1]=t[0]):(this._minDistanceLocation[0]=t[0],this._minDistanceLocation[1]=t[1])},LC.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},LC.prototype.computeMinDistance=function(){var t=this;if(0===arguments.length){if(null!==this._minDistanceLocation)return null;if(this._minDistanceLocation=new Array(2).fill(null),this.computeContainmentDistance(),this._minDistance<=this._terminateDistance)return null;this.computeFacetDistance()}else if(3===arguments.length)if(arguments[2]instanceof Array&&arguments[0]instanceof XI&&arguments[1]instanceof WI){var e=arguments[0],r=arguments[1],n=arguments[2];if(e.getEnvelopeInternal().distance(r.getEnvelopeInternal())>this._minDistance)return null;for(var i=e.getCoordinates(),o=r.getCoordinate(),s=0;s<i.length-1;s++){var a=j_.distancePointLine(o,i[s],i[s+1]);if(a<t._minDistance){t._minDistance=a;var u=new Ax(i[s],i[s+1]).closestPoint(o);n[0]=new bC(e,s,u),n[1]=new bC(r,0,o)}if(t._minDistance<=t._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof XI&&arguments[1]instanceof XI){var l=arguments[0],c=arguments[1],h=arguments[2];if(l.getEnvelopeInternal().distance(c.getEnvelopeInternal())>this._minDistance)return null;for(var f=l.getCoordinates(),p=c.getCoordinates(),g=0;g<f.length-1;g++)for(var A=0;A<p.length-1;A++){var d=j_.distanceLineLine(f[g],f[g+1],p[A],p[A+1]);if(d<t._minDistance){t._minDistance=d;var y=new Ax(f[g],f[g+1]),v=new Ax(p[A],p[A+1]),m=y.closestPoints(v);h[0]=new bC(l,g,m[0]),h[1]=new bC(c,A,m[1])}if(t._minDistance<=t._terminateDistance)return null}}},LC.prototype.computeMinDistancePoints=function(t,e,r){for(var n=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s),u=o.getCoordinate().distance(a.getCoordinate());if(u<n._minDistance&&(n._minDistance=u,r[0]=new bC(o,0,o.getCoordinate()),r[1]=new bC(a,0,a.getCoordinate())),n._minDistance<=n._terminateDistance)return null}},LC.prototype.distance=function(){if(null===this._geom[0]||null===this._geom[1])throw new $m("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},LC.prototype.computeMinDistanceLines=function(t,e,r){for(var n=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s);if(n.computeMinDistance(o,a,r),n._minDistance<=n._terminateDistance)return null}},LC.prototype.interfaces_=function(){return[]},LC.prototype.getClass=function(){return LC},LC.distance=function(t,e){return new LC(t,e).distance()},LC.isWithinDistance=function(t,e,r){return new LC(t,e,r).distance()<=r},LC.nearestPoints=function(t,e){return new LC(t,e).nearestPoints()};var NC=function(){this._pt=[new s_,new s_],this._distance=t_.NaN,this._isNull=!0};NC.prototype.getCoordinates=function(){return this._pt},NC.prototype.getCoordinate=function(t){return this._pt[t]},NC.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n<this._distance&&this.initialize(e,r,n)}},NC.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this._pt[0].setCoordinate(r),this._pt[1].setCoordinate(n),this._distance=i,this._isNull=!1}},NC.prototype.toString=function(){return D_.toLineString(this._pt[0],this._pt[1])},NC.prototype.getDistance=function(){return this._distance},NC.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n>this._distance&&this.initialize(e,r,n)}},NC.prototype.interfaces_=function(){return[]},NC.prototype.getClass=function(){return NC};var TC=function(){};TC.prototype.interfaces_=function(){return[]},TC.prototype.getClass=function(){return TC},TC.computeDistance=function(){if(arguments[2]instanceof NC&&arguments[0]instanceof XI&&arguments[1]instanceof s_)for(var t=arguments[0],e=arguments[1],r=arguments[2],n=new Ax,i=t.getCoordinates(),o=0;o<i.length-1;o++){n.setCoordinates(i[o],i[o+1]);var s=n.closestPoint(e);r.setMinimum(s,e)}else if(arguments[2]instanceof NC&&arguments[0]instanceof ZI&&arguments[1]instanceof s_){var a=arguments[0],u=arguments[1],l=arguments[2];TC.computeDistance(a.getExteriorRing(),u,l);for(var c=0;c<a.getNumInteriorRing();c++)TC.computeDistance(a.getInteriorRingN(c),u,l)}else if(arguments[2]instanceof NC&&arguments[0]instanceof Y_&&arguments[1]instanceof s_){var h=arguments[0],f=arguments[1],p=arguments[2];if(h instanceof XI)TC.computeDistance(h,f,p);else if(h instanceof ZI)TC.computeDistance(h,f,p);else if(h instanceof PI)for(var g=h,A=0;A<g.getNumGeometries();A++){var d=g.getGeometryN(A);TC.computeDistance(d,f,p)}else p.setMinimum(h.getCoordinate(),f)}else if(arguments[2]instanceof NC&&arguments[0]instanceof Ax&&arguments[1]instanceof s_){var y=arguments[1],v=arguments[2],m=arguments[0].closestPoint(y);v.setMinimum(m,y)}};var RC=function(){this._g0=null,this._g1=null,this._ptDist=new NC,this._densifyFrac=0;var t=arguments[0],e=arguments[1];this._g0=t,this._g1=e},DC={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};RC.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},RC.prototype.setDensifyFraction=function(t){if(t>1||t<=0)throw new $m("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},RC.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},RC.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},RC.prototype.computeOrientedDistance=function(t,e,r){var n=new PC(e);if(t.apply(n),r.setMaximum(n.getMaxPointDistance()),this._densifyFrac>0){var i=new QC(e,this._densifyFrac);t.apply(i),r.setMaximum(i.getMaxPointDistance())}},RC.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},RC.prototype.interfaces_=function(){return[]},RC.prototype.getClass=function(){return RC},RC.distance=function(){if(2===arguments.length)return new RC(arguments[0],arguments[1]).distance();if(3===arguments.length){var t=arguments[2],e=new RC(arguments[0],arguments[1]);return e.setDensifyFraction(t),e.distance()}},DC.MaxPointDistanceFilter.get=function(){return PC},DC.MaxDensifiedByFractionDistanceFilter.get=function(){return QC},Object.defineProperties(RC,DC);var PC=function(){this._maxPtDist=new NC,this._minPtDist=new NC,this._euclideanDist=new TC,this._geom=null;var t=arguments[0];this._geom=t};PC.prototype.filter=function(t){this._minPtDist.initialize(),TC.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},PC.prototype.getMaxPointDistance=function(){return this._maxPtDist},PC.prototype.interfaces_=function(){return[J_]},PC.prototype.getClass=function(){return PC};var QC=function(){this._maxPtDist=new NC,this._minPtDist=new NC,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};QC.prototype.filter=function(t,e){var r=this;if(0===e)return null;for(var n=t.getCoordinate(e-1),i=t.getCoordinate(e),o=(i.x-n.x)/this._numSubSegs,s=(i.y-n.y)/this._numSubSegs,a=0;a<this._numSubSegs;a++){var u=n.x+a*o,l=n.y+a*s,c=new s_(u,l);r._minPtDist.initialize(),TC.computeDistance(r._geom,c,r._minPtDist),r._maxPtDist.setMaximum(r._minPtDist)}},QC.prototype.isDone=function(){return!1},QC.prototype.isGeometryChanged=function(){return!1},QC.prototype.getMaxPointDistance=function(){return this._maxPtDist},QC.prototype.interfaces_=function(){return[DI]},QC.prototype.getClass=function(){return QC};var kC=function(t,e,r){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=r||null},OC={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};kC.prototype.checkMaximumDistance=function(t,e,r){var n=new RC(e,t);if(n.setDensifyFraction(.25),this._maxDistanceFound=n.orientedDistance(),this._maxDistanceFound>r){this._isValid=!1;var i=n.getCoordinates();this._errorLocation=i[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+D_.toLineString(i[0],i[1])+")"}},kC.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=kC.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(),kC.VERBOSE&&b_.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},kC.prototype.checkNegativeValid=function(){if(!(this._input instanceof ZI||this._input instanceof eE||this._input instanceof PI))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)},kC.prototype.getErrorIndicator=function(){return this._errorIndicator},kC.prototype.checkMinimumDistance=function(t,e,r){var n=new LC(t,e,r);if(this._minDistanceFound=n.distance(),this._minDistanceFound<r){this._isValid=!1;var i=n.nearestPoints();this._errorLocation=n.nearestPoints()[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+D_.toLineString(i[0],i[1])+" )"}},kC.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)},kC.prototype.getErrorLocation=function(){return this._errorLocation},kC.prototype.getPolygonLines=function(t){for(var e=new aI,r=new CC(e),n=xC.getPolygons(t).iterator();n.hasNext();){n.next().apply(r)}return t.getFactory().buildGeometry(e)},kC.prototype.getErrorMessage=function(){return this._errMsg},kC.prototype.interfaces_=function(){return[]},kC.prototype.getClass=function(){return kC},OC.VERBOSE.get=function(){return!1},OC.MAX_DISTANCE_DIFF_FRAC.get=function(){return.012},Object.defineProperties(kC,OC);var FC=function(t,e,r){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._distance=e||null,this._result=r||null},GC={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};FC.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},FC.prototype.checkEnvelope=function(){if(this._distance<0)return null;var t=this._distance*FC.MAX_ENV_DIFF_FRAC;0===t&&(t=.001);var e=new S_(this._input.getEnvelopeInternal());e.expandBy(this._distance);var r=new S_(this._result.getEnvelopeInternal());r.expandBy(t),r.contains(e)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(r)),this.report("Envelope")},FC.prototype.checkDistance=function(){var t=new kC(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")},FC.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")},FC.prototype.checkPolygonal=function(){this._result instanceof ZI||this._result instanceof eE||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},FC.prototype.getErrorIndicator=function(){return this._errorIndicator},FC.prototype.getErrorLocation=function(){return this._errorLocation},FC.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"))},FC.prototype.report=function(t){if(!FC.VERBOSE)return null;b_.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},FC.prototype.getErrorMessage=function(){return this._errorMsg},FC.prototype.interfaces_=function(){return[]},FC.prototype.getClass=function(){return FC},FC.isValidMsg=function(t,e,r){var n=new FC(t,e,r);return n.isValid()?null:n.getErrorMessage()},FC.isValid=function(t,e,r){return!!new FC(t,e,r).isValid()},GC.VERBOSE.get=function(){return!1},GC.MAX_ENV_DIFF_FRAC.get=function(){return.012},Object.defineProperties(FC,GC);var UC=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};UC.prototype.getCoordinates=function(){return this._pts},UC.prototype.size=function(){return this._pts.length},UC.prototype.getCoordinate=function(t){return this._pts[t]},UC.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},UC.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:hx.octant(this.getCoordinate(t),this.getCoordinate(t+1))},UC.prototype.setData=function(t){this._data=t},UC.prototype.getData=function(){return this._data},UC.prototype.toString=function(){return D_.toLineString(new aE(this._pts))},UC.prototype.interfaces_=function(){return[fx]},UC.prototype.getClass=function(){return UC};var qC=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new aI,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};qC.prototype.getInteriorIntersection=function(){return this._interiorIntersection},qC.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},qC.prototype.getIntersectionSegments=function(){return this._intSegments},qC.prototype.count=function(){return this._intersectionCount},qC.prototype.getIntersections=function(){return this._intersections},qC.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},qC.prototype.setKeepIntersections=function(t){this._keepIntersections=t},qC.prototype.processIntersections=function(t,e,r,n){if(!this._findAllIntersections&&this.hasIntersection())return null;if(t===r&&e===n)return null;if(this._isCheckEndSegmentsOnly&&!(this.isEndSegment(t,e)||this.isEndSegment(r,n)))return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=i,this._intSegments[1]=o,this._intSegments[2]=s,this._intSegments[3]=a,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},qC.prototype.isEndSegment=function(t,e){return 0===e||e>=t.size()-2},qC.prototype.hasIntersection=function(){return null!==this._interiorIntersection},qC.prototype.isDone=function(){return!this._findAllIntersections&&null!==this._interiorIntersection},qC.prototype.interfaces_=function(){return[Xx]},qC.prototype.getClass=function(){return qC},qC.createAllIntersectionsFinder=function(t){var e=new qC(t);return e.setFindAllIntersections(!0),e},qC.createAnyIntersectionFinder=function(t){return new qC(t)},qC.createIntersectionCounter=function(t){var e=new qC(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var jC=function(){this._li=new G_,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};jC.prototype.execute=function(){if(null!==this._segInt)return null;this.checkInteriorIntersections()},jC.prototype.getIntersections=function(){return this._segInt.getIntersections()},jC.prototype.isValid=function(){return this.execute(),this._isValid},jC.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},jC.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new qC(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new Ex;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},jC.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new ME(this.getErrorMessage(),this._segInt.getInteriorIntersection())},jC.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+D_.toLineString(t[0],t[1])+" and "+D_.toLineString(t[2],t[3])},jC.prototype.interfaces_=function(){return[]},jC.prototype.getClass=function(){return jC},jC.computeIntersections=function(t){var e=new jC(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var VC=function t(){this._nv=null;var e=arguments[0];this._nv=new jC(t.toSegmentStrings(e))};VC.prototype.checkValid=function(){this._nv.checkValid()},VC.prototype.interfaces_=function(){return[]},VC.prototype.getClass=function(){return VC},VC.toSegmentStrings=function(t){for(var e=new aI,r=t.iterator();r.hasNext();){var n=r.next();e.add(new UC(n.getCoordinates(),n))}return e},VC.checkValid=function(t){new VC(t).checkValid()};var zC=function(t){this._mapOp=t};zC.prototype.map=function(t){for(var e=new aI,r=0;r<t.getNumGeometries();r++){var n=this._mapOp.map(t.getGeometryN(r));n.isEmpty()||e.add(n)}return t.getFactory().createGeometryCollection(dE.toGeometryArray(e))},zC.prototype.interfaces_=function(){return[]},zC.prototype.getClass=function(){return zC},zC.map=function(t,e){return new zC(e).map(t)};var YC=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new aI,this._resultLineList=new aI;var t=arguments[0],e=arguments[1],r=arguments[2];this._op=t,this._geometryFactory=e,this._ptLocator=r};YC.prototype.collectLines=function(t){for(var e=this,r=this._op.getGraph().getEdgeEnds().iterator();r.hasNext();){var n=r.next();e.collectLineEdge(n,t,e._lineEdgesList),e.collectBoundaryTouchEdge(n,t,e._lineEdgesList)}},YC.prototype.labelIsolatedLine=function(t,e){var r=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(e));t.getLabel().setLocation(e,r)},YC.prototype.build=function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList},YC.prototype.collectLineEdge=function(t,e,r){var n=t.getLabel(),i=t.getEdge();t.isLineEdge()&&(t.isVisited()||!bw.isResultOfOp(n,e)||i.isCovered()||(r.add(i),t.setVisitedEdge(!0)))},YC.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 r=e.next(),n=r.getEdge();if(r.isLineEdge()&&!n.isCoveredSet()){var i=this._op.isCoveredByA(r.getCoordinate());n.setCovered(i)}}},YC.prototype.labelIsolatedLines=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next(),n=r.getLabel();r.isIsolated()&&(n.isNull(0)?this.labelIsolatedLine(r,0):this.labelIsolatedLine(r,1))}},YC.prototype.buildLines=function(t){for(var e=this._lineEdgesList.iterator();e.hasNext();){var r=e.next(),n=this._geometryFactory.createLineString(r.getCoordinates());this._resultLineList.add(n),r.setInResult(!0)}},YC.prototype.collectBoundaryTouchEdge=function(t,e,r){var n=t.getLabel();return t.isLineEdge()||t.isVisited()||t.isInteriorAreaEdge()||t.getEdge().isInResult()?null:(k_.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void(bw.isResultOfOp(n,e)&&e===bw.INTERSECTION&&(r.add(t.getEdge()),t.setVisitedEdge(!0))))},YC.prototype.interfaces_=function(){return[]},YC.prototype.getClass=function(){return YC};var HC=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new aI;var t=arguments[0],e=arguments[1];this._op=t,this._geometryFactory=e};HC.prototype.filterCoveredNodeToPoint=function(t){var e=t.getCoordinate();if(!this._op.isCoveredByLA(e)){var r=this._geometryFactory.createPoint(e);this._resultPointList.add(r)}},HC.prototype.extractNonCoveredResultNodes=function(t){for(var e=this._op.getGraph().getNodes().iterator();e.hasNext();){var r=e.next();if(!r.isInResult()&&(!r.isIncidentEdgeInResult()&&(0===r.getEdges().getDegree()||t===bw.INTERSECTION))){var n=r.getLabel();bw.isResultOfOp(n,t)&&this.filterCoveredNodeToPoint(r)}}},HC.prototype.build=function(t){return this.extractNonCoveredResultNodes(t),this._resultPointList},HC.prototype.interfaces_=function(){return[]},HC.prototype.getClass=function(){return HC};var XC=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};XC.prototype.transformPoint=function(t,e){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},XC.prototype.transformPolygon=function(t,e){var r=!0,n=this.transformLinearRing(t.getExteriorRing(),t);null!==n&&n instanceof tE&&!n.isEmpty()||(r=!1);for(var i=new aI,o=0;o<t.getNumInteriorRing();o++){var s=this.transformLinearRing(t.getInteriorRingN(o),t);null===s||s.isEmpty()||(s instanceof tE||(r=!1),i.add(s))}if(r)return this._factory.createPolygon(n,i.toArray([]));var a=new aI;return null!==n&&a.add(n),a.addAll(i),this._factory.buildGeometry(a)},XC.prototype.createCoordinateSequence=function(t){return this._factory.getCoordinateSequenceFactory().create(t)},XC.prototype.getInputGeometry=function(){return this._inputGeom},XC.prototype.transformMultiLineString=function(t,e){for(var r=new aI,n=0;n<t.getNumGeometries();n++){var i=this.transformLineString(t.getGeometryN(n),t);null!==i&&(i.isEmpty()||r.add(i))}return this._factory.buildGeometry(r)},XC.prototype.transformCoordinates=function(t,e){return this.copy(t)},XC.prototype.transformLineString=function(t,e){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},XC.prototype.transformMultiPoint=function(t,e){for(var r=new aI,n=0;n<t.getNumGeometries();n++){var i=this.transformPoint(t.getGeometryN(n),t);null!==i&&(i.isEmpty()||r.add(i))}return this._factory.buildGeometry(r)},XC.prototype.transformMultiPolygon=function(t,e){for(var r=new aI,n=0;n<t.getNumGeometries();n++){var i=this.transformPolygon(t.getGeometryN(n),t);null!==i&&(i.isEmpty()||r.add(i))}return this._factory.buildGeometry(r)},XC.prototype.copy=function(t){return t.copy()},XC.prototype.transformGeometryCollection=function(t,e){for(var r=new aI,n=0;n<t.getNumGeometries();n++){var i=this.transform(t.getGeometryN(n));null!==i&&(this._pruneEmptyGeometry&&i.isEmpty()||r.add(i))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(dE.toGeometryArray(r)):this._factory.buildGeometry(r)},XC.prototype.transform=function(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof WI)return this.transformPoint(t,null);if(t instanceof $I)return this.transformMultiPoint(t,null);if(t instanceof tE)return this.transformLinearRing(t,null);if(t instanceof XI)return this.transformLineString(t,null);if(t instanceof QI)return this.transformMultiLineString(t,null);if(t instanceof ZI)return this.transformPolygon(t,null);if(t instanceof eE)return this.transformMultiPolygon(t,null);if(t instanceof PI)return this.transformGeometryCollection(t,null);throw new $m("Unknown Geometry subtype: "+t.getClass().getName())},XC.prototype.transformLinearRing=function(t,e){var r=this.transformCoordinates(t.getCoordinateSequence(),t);if(null===r)return this._factory.createLinearRing(null);var n=r.size();return n>0&&n<4&&!this._preserveType?this._factory.createLineString(r):this._factory.createLinearRing(r)},XC.prototype.interfaces_=function(){return[]},XC.prototype.getClass=function(){return XC};var JC=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new Ax,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof XI&&"number"==typeof arguments[1]){var e=arguments[1];t.call(this,arguments[0].getCoordinates(),e)}else if(arguments[0]instanceof Array&&"number"==typeof arguments[1]){var r=arguments[0],n=arguments[1];this._srcPts=r,this._isClosed=t.isClosed(r),this._snapTolerance=n}};JC.prototype.snapVertices=function(t,e){for(var r=this._isClosed?t.size()-1:t.size(),n=0;n<r;n++){var i=t.get(n),o=this.findSnapForVertex(i,e);null!==o&&(t.set(n,new s_(o)),0===n&&this._isClosed&&t.set(t.size()-1,new s_(o)))}},JC.prototype.findSnapForVertex=function(t,e){for(var r=0;r<e.length;r++){if(t.equals2D(e[r]))return null;if(t.distance(e[r])<this._snapTolerance)return e[r]}return null},JC.prototype.snapTo=function(t){var e=new lI(this._srcPts);return this.snapVertices(e,t),this.snapSegments(e,t),e.toCoordinateArray()},JC.prototype.snapSegments=function(t,e){if(0===e.length)return null;var r=e.length;e[0].equals2D(e[e.length-1])&&(r=e.length-1);for(var n=0;n<r;n++){var i=e[n],o=this.findSegmentIndexToSnap(i,t);o>=0&&t.add(o+1,new s_(i),!1)}},JC.prototype.findSegmentIndexToSnap=function(t,e){for(var r=this,n=t_.MAX_VALUE,i=-1,o=0;o<e.size()-1;o++){if(r._seg.p0=e.get(o),r._seg.p1=e.get(o+1),r._seg.p0.equals2D(t)||r._seg.p1.equals2D(t)){if(r._allowSnappingToSourceVertices)continue;return-1}var s=r._seg.distance(t);s<r._snapTolerance&&s<n&&(n=s,i=o)}return i},JC.prototype.setAllowSnappingToSourceVertices=function(t){this._allowSnappingToSourceVertices=t},JC.prototype.interfaces_=function(){return[]},JC.prototype.getClass=function(){return JC},JC.isClosed=function(t){return!(t.length<=1)&&t[0].equals2D(t[t.length-1])};var WC=function(t){this._srcGeom=t||null},KC={SNAP_PRECISION_FACTOR:{configurable:!0}};WC.prototype.snapTo=function(t,e){var r=this.extractTargetCoordinates(t);return new ZC(e,r).transform(this._srcGeom)},WC.prototype.snapToSelf=function(t,e){var r=this.extractTargetCoordinates(this._srcGeom),n=new ZC(t,r,!0).transform(this._srcGeom),i=n;return e&&f_(i,KI)&&(i=n.buffer(0)),i},WC.prototype.computeSnapTolerance=function(t){return this.computeMinimumSegmentLength(t)/10},WC.prototype.extractTargetCoordinates=function(t){for(var e=new SI,r=t.getCoordinates(),n=0;n<r.length;n++)e.add(r[n]);return e.toArray(new Array(0).fill(null))},WC.prototype.computeMinimumSegmentLength=function(t){for(var e=t_.MAX_VALUE,r=0;r<t.length-1;r++){var n=t[r].distance(t[r+1]);n<e&&(e=n)}return e},WC.prototype.interfaces_=function(){return[]},WC.prototype.getClass=function(){return WC},WC.snap=function(t,e,r){var n=new Array(2).fill(null),i=new WC(t);n[0]=i.snapTo(e,r);var o=new WC(e);return n[1]=o.snapTo(n[0],r),n},WC.computeOverlaySnapTolerance=function(){if(1===arguments.length){var t=arguments[0],e=WC.computeSizeBasedSnapTolerance(t),r=t.getPrecisionModel();if(r.getType()===fE.FIXED){var n=1/r.getScale()*2/1.415;n>e&&(e=n)}return e}if(2===arguments.length){var i=arguments[0],o=arguments[1];return Math.min(WC.computeOverlaySnapTolerance(i),WC.computeOverlaySnapTolerance(o))}},WC.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*WC.SNAP_PRECISION_FACTOR},WC.snapToSelf=function(t,e,r){return new WC(t).snapToSelf(e,r)},KC.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(WC,KC);var ZC=function(t){function e(e,r,n){t.call(this),this._snapTolerance=e||null,this._snapPts=r||null,this._isSelfSnap=void 0!==n&&n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(t,e){var r=new JC(t,this._snapTolerance);return r.setAllowSnappingToSourceVertices(this._isSelfSnap),r.snapTo(e)},e.prototype.transformCoordinates=function(t,e){var r=t.toCoordinateArray(),n=this.snapLine(r,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(XC),$C=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};$C.prototype.getCommon=function(){return t_.longBitsToDouble(this._commonBits)},$C.prototype.add=function(t){var e=t_.doubleToLongBits(t);return this._isFirst?(this._commonBits=e,this._commonSignExp=$C.signExpBits(this._commonBits),this._isFirst=!1,null):$C.signExpBits(e)!==this._commonSignExp?(this._commonBits=0,null):(this._commonMantissaBitsCount=$C.numCommonMostSigMantissaBits(this._commonBits,e),void(this._commonBits=$C.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))))},$C.prototype.toString=function(){if(1===arguments.length){var t=arguments[0],e=t_.longBitsToDouble(t),r="0000000000000000000000000000000000000000000000000000000000000000"+t_.toBinaryString(t),n=r.substring(r.length-64);return n.substring(0,1)+" "+n.substring(1,12)+"(exp) "+n.substring(12)+" [ "+e+" ]"}},$C.prototype.interfaces_=function(){return[]},$C.prototype.getClass=function(){return $C},$C.getBit=function(t,e){return 0!=(t&1<<e)?1:0},$C.signExpBits=function(t){return t>>52},$C.zeroLowerBits=function(t,e){return t&~((1<<e)-1)},$C.numCommonMostSigMantissaBits=function(t,e){for(var r=0,n=52;n>=0;n--){if($C.getBit(t,n)!==$C.getBit(e,n))return r;r++}return 52};var tw=function(){this._commonCoord=null,this._ccFilter=new rw},ew={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};tw.prototype.addCommonBits=function(t){var e=new nw(this._commonCoord);t.apply(e),t.geometryChanged()},tw.prototype.removeCommonBits=function(t){if(0===this._commonCoord.x&&0===this._commonCoord.y)return t;var e=new s_(this._commonCoord);e.x=-e.x,e.y=-e.y;var r=new nw(e);return t.apply(r),t.geometryChanged(),t},tw.prototype.getCommonCoordinate=function(){return this._commonCoord},tw.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},tw.prototype.interfaces_=function(){return[]},tw.prototype.getClass=function(){return tw},ew.CommonCoordinateFilter.get=function(){return rw},ew.Translater.get=function(){return nw},Object.defineProperties(tw,ew);var rw=function(){this._commonBitsX=new $C,this._commonBitsY=new $C};rw.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},rw.prototype.getCommonCoordinate=function(){return new s_(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},rw.prototype.interfaces_=function(){return[J_]},rw.prototype.getClass=function(){return rw};var nw=function(){this.trans=null;var t=arguments[0];this.trans=t};nw.prototype.filter=function(t,e){var r=t.getOrdinate(e,0)+this.trans.x,n=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,r),t.setOrdinate(e,1,n)},nw.prototype.isDone=function(){return!1},nw.prototype.isGeometryChanged=function(){return!0},nw.prototype.interfaces_=function(){return[DI]},nw.prototype.getClass=function(){return nw};var iw=function(t,e){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()};iw.prototype.selfSnap=function(t){return new WC(t).snapTo(t,this._snapTolerance)},iw.prototype.removeCommonBits=function(t){this._cbr=new tw,this._cbr.add(t[0]),this._cbr.add(t[1]);var e=new Array(2).fill(null);return e[0]=this._cbr.removeCommonBits(t[0].copy()),e[1]=this._cbr.removeCommonBits(t[1].copy()),e},iw.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},iw.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),r=bw.overlayOp(e[0],e[1],t);return this.prepareResult(r)},iw.prototype.checkValid=function(t){t.isValid()||b_.out.println("Snapped geometry is invalid")},iw.prototype.computeSnapTolerance=function(){this._snapTolerance=WC.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},iw.prototype.snap=function(t){var e=this.removeCommonBits(t);return WC.snap(e[0],e[1],this._snapTolerance)},iw.prototype.interfaces_=function(){return[]},iw.prototype.getClass=function(){return iw},iw.overlayOp=function(t,e,r){return new iw(t,e).getResultGeometry(r)},iw.union=function(t,e){return iw.overlayOp(t,e,bw.UNION)},iw.intersection=function(t,e){return iw.overlayOp(t,e,bw.INTERSECTION)},iw.symDifference=function(t,e){return iw.overlayOp(t,e,bw.SYMDIFFERENCE)},iw.difference=function(t,e){return iw.overlayOp(t,e,bw.DIFFERENCE)};var ow=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};ow.prototype.getResultGeometry=function(t){var e=null,r=!1,n=null;try{e=bw.overlayOp(this._geom[0],this._geom[1],t);r=!0}catch(t){if(!(t instanceof P_))throw t;n=t}if(!r)try{e=iw.overlayOp(this._geom[0],this._geom[1],t)}catch(t){throw t instanceof P_?n:t}return e},ow.prototype.interfaces_=function(){return[]},ow.prototype.getClass=function(){return ow},ow.overlayOp=function(t,e,r){return new ow(t,e).getResultGeometry(r)},ow.union=function(t,e){return ow.overlayOp(t,e,bw.UNION)},ow.intersection=function(t,e){return ow.overlayOp(t,e,bw.INTERSECTION)},ow.symDifference=function(t,e){return ow.overlayOp(t,e,bw.SYMDIFFERENCE)},ow.difference=function(t,e){return ow.overlayOp(t,e,bw.DIFFERENCE)};var sw=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};sw.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},sw.prototype.interfaces_=function(){return[]},sw.prototype.getClass=function(){return sw};var aw=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,2===arguments.length){var e=arguments[0],r=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=r}else if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];this._eventType=t.INSERT,this._label=n,this._xValue=i,this._obj=o}},uw={INSERT:{configurable:!0},DELETE:{configurable:!0}};aw.prototype.isDelete=function(){return this._eventType===aw.DELETE},aw.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},aw.prototype.getObject=function(){return this._obj},aw.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},aw.prototype.getInsertEvent=function(){return this._insertEvent},aw.prototype.isInsert=function(){return this._eventType===aw.INSERT},aw.prototype.isSameLabel=function(t){return null!==this._label&&this._label===t._label},aw.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},aw.prototype.interfaces_=function(){return[r_]},aw.prototype.getClass=function(){return aw},uw.INSERT.get=function(){return 1},uw.DELETE.get=function(){return 2},Object.defineProperties(aw,uw);var lw=function(){};lw.prototype.interfaces_=function(){return[]},lw.prototype.getClass=function(){return lw};var cw=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],e=arguments[1],r=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=r};cw.prototype.isTrivialIntersection=function(t,e,r,n){if(t===r&&1===this._li.getIntersectionNum()){if(cw.isAdjacentSegments(e,n))return!0;if(t.isClosed()){var i=t.getNumPoints()-1;if(0===e&&n===i||0===n&&e===i)return!0}}return!1},cw.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},cw.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},cw.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},cw.prototype.isBoundaryPointInternal=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next().getCoordinate();if(t.isIntersection(n))return!0}return!1},cw.prototype.hasProperIntersection=function(){return this._hasProper},cw.prototype.hasIntersection=function(){return this._hasIntersection},cw.prototype.isDone=function(){return this._isDone},cw.prototype.isBoundaryPoint=function(t,e){return null!==e&&(!!this.isBoundaryPointInternal(t,e[0])||!!this.isBoundaryPointInternal(t,e[1]))},cw.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e},cw.prototype.addIntersections=function(t,e,r,n){if(t===r&&e===n)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),r.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,r,n)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(t.addIntersections(this._li,e,0),r.addIntersections(this._li,n,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))))},cw.prototype.interfaces_=function(){return[]},cw.prototype.getClass=function(){return cw},cw.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var hw=function(t){function e(){t.call(this),this.events=new aI,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){tx.sort(this.events);for(var t=0;t<this.events.size();t++){var e=this.events.get(t);e.isDelete()&&e.getInsertEvent().setDeleteEventIndex(t)}},e.prototype.computeIntersections=function(){if(1===arguments.length){var t=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var e=0;e<this.events.size();e++){var r=this.events.get(e);if(r.isInsert()&&this.processOverlaps(e,r.getDeleteEventIndex(),r,t),t.isDone())break}}else if(3===arguments.length)if(arguments[2]instanceof cw&&f_(arguments[0],oI)&&f_(arguments[1],oI)){var n=arguments[0],i=arguments[1],o=arguments[2];this.addEdges(n,n),this.addEdges(i,i),this.computeIntersections(o)}else if("boolean"==typeof arguments[2]&&f_(arguments[0],oI)&&arguments[1]instanceof cw){var s=arguments[0],a=arguments[1];arguments[2]?this.addEdges(s,null):this.addEdges(s),this.computeIntersections(a)}},e.prototype.addEdge=function(t,e){for(var r=t.getMonotoneChainEdge(),n=r.getStartIndexes(),i=0;i<n.length-1;i++){var o=new sw(r,i),s=new aw(e,r.getMinX(i),o);this.events.add(s),this.events.add(new aw(r.getMaxX(i),s))}},e.prototype.processOverlaps=function(t,e,r,n){for(var i=r.getObject(),o=t;o<e;o++){var s=this.events.get(o);if(s.isInsert()){var a=s.getObject();r.isSameLabel(s)||(i.computeIntersections(a,n),this.nOverlaps++)}}},e.prototype.addEdges=function(){if(1===arguments.length)for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.addEdge(e,e)}else if(2===arguments.length)for(var r=arguments[1],n=arguments[0].iterator();n.hasNext();){var i=n.next();this.addEdge(i,r)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(lw),fw=function(){this._min=t_.POSITIVE_INFINITY,this._max=t_.NEGATIVE_INFINITY},pw={NodeComparator:{configurable:!0}};fw.prototype.getMin=function(){return this._min},fw.prototype.intersects=function(t,e){return!(this._min>e||this._max<t)},fw.prototype.getMax=function(){return this._max},fw.prototype.toString=function(){return D_.toLineString(new s_(this._min,0),new s_(this._max,0))},fw.prototype.interfaces_=function(){return[]},fw.prototype.getClass=function(){return fw},pw.NodeComparator.get=function(){return gw},Object.defineProperties(fw,pw);var gw=function(){};gw.prototype.compare=function(t,e){var r=t,n=e,i=(r._min+r._max)/2,o=(n._min+n._max)/2;return i<o?-1:i>o?1:0},gw.prototype.interfaces_=function(){return[i_]},gw.prototype.getClass=function(){return gw};var Aw=function(t){function e(){t.call(this),this._item=null;var e=arguments[0],r=arguments[1],n=arguments[2];this._min=e,this._max=r,this._item=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(t,e,r){if(!this.intersects(t,e))return null;r.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(fw),dw=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var e=arguments[0],r=arguments[1];this._node1=e,this._node2=r,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,r){if(!this.intersects(t,e))return null;null!==this._node1&&this._node1.query(t,e,r),null!==this._node2&&this._node2.query(t,e,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(fw),yw=function(){this._leaves=new aI,this._root=null,this._level=0};yw.prototype.buildTree=function(){tx.sort(this._leaves,new fw.NodeComparator);for(var t=this._leaves,e=null,r=new aI;;){if(this.buildLevel(t,r),1===r.size())return r.get(0);e=t,t=r,r=e}},yw.prototype.insert=function(t,e,r){if(null!==this._root)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new Aw(t,e,r))},yw.prototype.query=function(t,e,r){this.init(),this._root.query(t,e,r)},yw.prototype.buildRoot=function(){if(null!==this._root)return null;this._root=this.buildTree()},yw.prototype.printNode=function(t){b_.out.println(D_.toLineString(new s_(t._min,this._level),new s_(t._max,this._level)))},yw.prototype.init=function(){if(null!==this._root)return null;this.buildRoot()},yw.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var r=0;r<t.size();r+=2){var n=t.get(r);if(null===(r+1<t.size()?t.get(r):null))e.add(n);else{var i=new dw(t.get(r),t.get(r+1));e.add(i)}}},yw.prototype.interfaces_=function(){return[]},yw.prototype.getClass=function(){return yw};var vw=function(){this._items=new aI};vw.prototype.visitItem=function(t){this._items.add(t)},vw.prototype.getItems=function(){return this._items},vw.prototype.interfaces_=function(){return[WE]},vw.prototype.getClass=function(){return vw};var mw=function(){this._index=null;var t=arguments[0];if(!f_(t,KI))throw new $m("Argument must be Polygonal");this._index=new Ew(t)},_w={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};mw.prototype.locate=function(t){var e=new q_(t),r=new Iw(e);return this._index.query(t.y,t.y,r),e.getLocation()},mw.prototype.interfaces_=function(){return[Gx]},mw.prototype.getClass=function(){return mw},_w.SegmentVisitor.get=function(){return Iw},_w.IntervalIndexedGeometry.get=function(){return Ew},Object.defineProperties(mw,_w);var Iw=function(){this._counter=null;var t=arguments[0];this._counter=t};Iw.prototype.visitItem=function(t){var e=t;this._counter.countSegment(e.getCoordinate(0),e.getCoordinate(1))},Iw.prototype.interfaces_=function(){return[WE]},Iw.prototype.getClass=function(){return Iw};var Ew=function(){this._index=new yw;var t=arguments[0];this.init(t)};Ew.prototype.init=function(t){for(var e=CC.getLines(t).iterator();e.hasNext();){var r=e.next().getCoordinates();this.addLine(r)}},Ew.prototype.addLine=function(t){for(var e=1;e<t.length;e++){var r=new Ax(t[e-1],t[e]),n=Math.min(r.p0.y,r.p1.y),i=Math.max(r.p0.y,r.p1.y);this._index.insert(n,i,r)}},Ew.prototype.query=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],r=new vw;return this._index.query(t,e,r),r.getItems()}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];this._index.query(n,i,o)}},Ew.prototype.interfaces_=function(){return[]},Ew.prototype.getClass=function(){return Ew};var xw=function(t){function e(){if(t.call(this),this._parentGeom=null,this._lineEdgeMap=new hE,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new wC,2===arguments.length){var e=arguments[0],r=arguments[1],n=W_.OGC_SFS_BOUNDARY_RULE;this._argIndex=e,this._parentGeom=r,this._boundaryNodeRule=n,null!==r&&this.add(r)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];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,r){var n=this._nodes.addNode(r).getLabel(),i=1;n.getLocation(t,CE.ON)===c_.BOUNDARY&&i++;var o=e.determineBoundary(this._boundaryNodeRule,i);n.setLocation(t,o)},e.prototype.computeSelfNodes=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.computeSelfNodes(t,e,!1)}if(3===arguments.length){var r=arguments[1],n=arguments[2],i=new cw(arguments[0],!0,!1);i.setIsDoneIfProperInt(n);var o=this.createEdgeSetIntersector(),s=this._parentGeom instanceof tE||this._parentGeom instanceof ZI||this._parentGeom instanceof eE,a=r||!s;return o.computeIntersections(this._edges,i,a),this.addSelfIntersectionNodes(this._argIndex),i}},e.prototype.computeSplitEdges=function(t){for(var e=this._edges.iterator();e.hasNext();){e.next().eiList.addSplitEdges(t)}},e.prototype.computeEdgeIntersections=function(t,e,r){var n=new cw(e,r,!0);return n.setBoundaryNodes(this.getBoundaryNodes(),t.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,t._edges,n),n},e.prototype.getGeometry=function(){return this._parentGeom},e.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},e.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},e.prototype.addPoint=function(){if(arguments[0]instanceof WI){var t=arguments[0].getCoordinate();this.insertPoint(this._argIndex,t,c_.INTERIOR)}else if(arguments[0]instanceof s_){var e=arguments[0];this.insertPoint(this._argIndex,e,c_.INTERIOR)}},e.prototype.addPolygon=function(t){this.addPolygonRing(t.getExteriorRing(),c_.EXTERIOR,c_.INTERIOR);for(var e=0;e<t.getNumInteriorRing();e++){var r=t.getInteriorRingN(e);this.addPolygonRing(r,c_.INTERIOR,c_.EXTERIOR)}},e.prototype.addEdge=function(t){this.insertEdge(t);var e=t.getCoordinates();this.insertPoint(this._argIndex,e[0],c_.BOUNDARY),this.insertPoint(this._argIndex,e[e.length-1],c_.BOUNDARY)},e.prototype.addLineString=function(t){var e=cI.removeRepeatedPoints(t.getCoordinates());if(e.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=e[0],null;var r=new rC(e,new RE(this._argIndex,c_.INTERIOR));this._lineEdgeMap.put(t,r),this.insertEdge(r),k_.isTrue(e.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,e[0]),this.insertBoundaryPoint(this._argIndex,e[e.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var t=this.getBoundaryNodes(),e=new Array(t.size()).fill(null),r=0,n=t.iterator();n.hasNext();){var i=n.next();e[r++]=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,r){if(this.isBoundaryNode(t,e))return null;r===c_.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(t,e):this.insertPoint(t,e,r)},e.prototype.addPolygonRing=function(t,e,r){if(t.isEmpty())return null;var n=cI.removeRepeatedPoints(t.getCoordinates());if(n.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=n[0],null;var i=e,o=r;j_.isCCW(n)&&(i=r,o=e);var s=new rC(n,new RE(this._argIndex,c_.BOUNDARY,i,o));this._lineEdgeMap.put(t,s),this.insertEdge(s),this.insertPoint(this._argIndex,n[0],c_.BOUNDARY)},e.prototype.insertPoint=function(t,e,r){var n=this._nodes.addNode(e),i=n.getLabel();null===i?n._label=new RE(t,r):i.setLocation(t,r)},e.prototype.createEdgeSetIntersector=function(){return new hw},e.prototype.addSelfIntersectionNodes=function(t){for(var e=this._edges.iterator();e.hasNext();)for(var r=e.next(),n=r.getLabel().getLocation(t),i=r.eiList.iterator();i.hasNext();){var o=i.next();this.addSelfIntersectionNode(t,o.coord,n)}},e.prototype.add=function(){if(1!==arguments.length)return t.prototype.add.apply(this,arguments);var e=arguments[0];if(e.isEmpty())return null;if(e instanceof eE&&(this._useBoundaryDeterminationRule=!1),e instanceof ZI)this.addPolygon(e);else if(e instanceof XI)this.addLineString(e);else if(e instanceof WI)this.addPoint(e);else if(e instanceof $I)this.addCollection(e);else if(e instanceof QI)this.addCollection(e);else if(e instanceof eE)this.addCollection(e);else{if(!(e instanceof PI))throw new Error(e.getClass().getName());this.addCollection(e)}},e.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var r=t.getGeometryN(e);this.add(r)}},e.prototype.locate=function(t){return f_(this._parentGeom,KI)&&this._parentGeom.getNumGeometries()>50?(null===this._areaPtLocator&&(this._areaPtLocator=new mw(this._parentGeom)),this._areaPtLocator.locate(t)):this._ptLocator.locate(t,this._parentGeom)},e.prototype.findEdge=function(){if(1===arguments.length){var e=arguments[0];return this._lineEdgeMap.get(e)}return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(t,e){return t.isInBoundary(e)?c_.BOUNDARY:c_.INTERIOR},e}(zE),Cw=function(){if(this._li=new G_,this._resultPrecisionModel=null,this._arg=null,1===arguments.length){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new xw(0,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1],n=W_.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(r.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(r.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new xw(0,e,n),this._arg[1]=new xw(1,r,n)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];i.getPrecisionModel().compareTo(o.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(o.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new xw(0,i,s),this._arg[1]=new xw(1,o,s)}};Cw.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},Cw.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},Cw.prototype.interfaces_=function(){return[]},Cw.prototype.getClass=function(){return Cw};var ww=function(){};ww.prototype.interfaces_=function(){return[]},ww.prototype.getClass=function(){return ww},ww.map=function(){if(arguments[0]instanceof Y_&&f_(arguments[1],ww.MapOp)){for(var t=arguments[0],e=arguments[1],r=new aI,n=0;n<t.getNumGeometries();n++){var i=e.map(t.getGeometryN(n));null!==i&&r.add(i)}return t.getFactory().buildGeometry(r)}if(f_(arguments[0],rI)&&f_(arguments[1],ww.MapOp)){for(var o=arguments[0],s=arguments[1],a=new aI,u=o.iterator();u.hasNext();){var l=u.next(),c=s.map(l);null!==c&&a.add(c)}return a}},ww.MapOp=function(){};var bw=function(t){function e(){var e=arguments[0],r=arguments[1];t.call(this,e,r),this._ptLocator=new wC,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new Hx,this._resultPolyList=new aI,this._resultLineList=new aI,this._resultPointList=new aI,this._graph=new zE(new zx),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 r=e.getLabel(),n=t.getLabel();e.isPointwiseEqual(t)||(n=new RE(t.getLabel())).flip();var i=e.getDepth();i.isNull()&&i.add(r),i.add(n),r.merge(n)}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(),r=e.getSym();e.isInResult()&&r.isInResult()&&(e.setInResult(!1),r.setInResult(!1))}},e.prototype.isCoveredByLA=function(t){return!!this.isCovered(t,this._resultLineList)||!!this.isCovered(t,this._resultPolyList)},e.prototype.computeGeometry=function(t,r,n,i){var o=new aI;return o.addAll(t),o.addAll(r),o.addAll(n),o.isEmpty()?e.createEmptyResult(i,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(o)},e.prototype.mergeSymLabels=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){t.next().getEdges().mergeSymLabels()}},e.prototype.isCovered=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();if(this._ptLocator.locate(t,n)!==c_.EXTERIOR)return!0}return!1},e.prototype.replaceCollapsedEdges=function(){for(var t=new aI,e=this._edgeList.iterator();e.hasNext();){var r=e.next();r.isCollapsed()&&(e.remove(),t.add(r.getCollapsedEdge()))}this._edgeList.addAll(t)},e.prototype.updateNodeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),r=e.getEdges().getLabel();e.getLabel().merge(r)}},e.prototype.getResultGeometry=function(t){return this.computeOverlay(t),this._resultGeom},e.prototype.insertUniqueEdges=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next();this.insertUniqueEdge(r)}},e.prototype.computeOverlay=function(t){this.copyPoints(0),this.copyPoints(1),this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1),this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!0);var e=new aI;this._arg[0].computeSplitEdges(e),this._arg[1].computeSplitEdges(e),this.insertUniqueEdges(e),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),VC.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(t),this.cancelDuplicateResultEdges();var r=new YE(this._geomFact);r.add(this._graph),this._resultPolyList=r.getPolygons();var n=new YC(this,this._geomFact,this._ptLocator);this._resultLineList=n.build(t);var i=new HC(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 r=this._ptLocator.locate(t.getCoordinate(),this._arg[e].getGeometry());t.getLabel().setLocation(e,r)},e.prototype.copyPoints=function(t){for(var e=this._arg[t].getNodeIterator();e.hasNext();){var r=e.next();this._graph.addNode(r.getCoordinate()).setLabel(t,r.getLabel().getLocation(t))}},e.prototype.findResultAreaEdges=function(t){for(var r=this._graph.getEdgeEnds().iterator();r.hasNext();){var n=r.next(),i=n.getLabel();i.isArea()&&!n.isInteriorAreaEdge()&&e.isResultOfOp(i.getLocation(0,CE.RIGHT),i.getLocation(1,CE.RIGHT),t)&&n.setInResult(!0)}},e.prototype.computeLabelsFromDepths=function(){for(var t=this._edgeList.iterator();t.hasNext();){var e=t.next(),r=e.getLabel(),n=e.getDepth();if(!n.isNull()){n.normalize();for(var i=0;i<2;i++)r.isNull(i)||!r.isArea()||n.isNull(i)||(0===n.getDelta(i)?r.toLine(i):(k_.isTrue(!n.isNull(i,CE.LEFT),"depth of LEFT side has not been initialized"),r.setLocation(i,CE.LEFT,n.getLocation(i,CE.LEFT)),k_.isTrue(!n.isNull(i,CE.RIGHT),"depth of RIGHT side has not been initialized"),r.setLocation(i,CE.RIGHT,n.getLocation(i,CE.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(),r=e.getLabel();e.isIsolated()&&(r.isNull(0)?this.labelIncompleteNode(e,0):this.labelIncompleteNode(e,1)),e.getEdges().updateLabelling(r)}},e.prototype.isCoveredByA=function(t){return!!this.isCovered(t,this._resultPolyList)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Cw);bw.overlayOp=function(t,e,r){return new bw(t,e).getResultGeometry(r)},bw.intersection=function(t,e){if(t.isEmpty()||e.isEmpty())return bw.createEmptyResult(bw.INTERSECTION,t,e,t.getFactory());if(t.isGeometryCollection()){var r=e;return zC.map(t,{interfaces_:function(){return[ww.MapOp]},map:function(t){return t.intersection(r)}})}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),ow.overlayOp(t,e,bw.INTERSECTION)},bw.symDifference=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return bw.createEmptyResult(bw.SYMDIFFERENCE,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),ow.overlayOp(t,e,bw.SYMDIFFERENCE)},bw.resultDimension=function(t,e,r){var n=e.getDimension(),i=r.getDimension(),o=-1;switch(t){case bw.INTERSECTION:o=Math.min(n,i);break;case bw.UNION:o=Math.max(n,i);break;case bw.DIFFERENCE:o=n;break;case bw.SYMDIFFERENCE:o=Math.max(n,i)}return o},bw.createEmptyResult=function(t,e,r,n){var i=null;switch(bw.resultDimension(t,e,r)){case-1:i=n.createGeometryCollection(new Array(0).fill(null));break;case 0:i=n.createPoint();break;case 1:i=n.createLineString();break;case 2:i=n.createPolygon()}return i},bw.difference=function(t,e){return t.isEmpty()?bw.createEmptyResult(bw.DIFFERENCE,t,e,t.getFactory()):e.isEmpty()?t.copy():(t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),ow.overlayOp(t,e,bw.DIFFERENCE))},bw.isResultOfOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],r=t.getLocation(0),n=t.getLocation(1);return bw.isResultOfOp(r,n,e)}if(3===arguments.length){var i=arguments[0],o=arguments[1];switch(i===c_.BOUNDARY&&(i=c_.INTERIOR),o===c_.BOUNDARY&&(o=c_.INTERIOR),arguments[2]){case bw.INTERSECTION:return i===c_.INTERIOR&&o===c_.INTERIOR;case bw.UNION:return i===c_.INTERIOR||o===c_.INTERIOR;case bw.DIFFERENCE:return i===c_.INTERIOR&&o!==c_.INTERIOR;case bw.SYMDIFFERENCE:return i===c_.INTERIOR&&o!==c_.INTERIOR||i!==c_.INTERIOR&&o===c_.INTERIOR}return!1}},bw.INTERSECTION=1,bw.UNION=2,bw.DIFFERENCE=3,bw.SYMDIFFERENCE=4;var Bw=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new wC,this._seg=new Ax;var t=arguments[0],e=arguments[1];this._g=t,this._boundaryDistanceTolerance=e,this._linework=this.extractLinework(t)};Bw.prototype.isWithinToleranceOfBoundary=function(t){for(var e=this,r=0;r<this._linework.getNumGeometries();r++)for(var n=e._linework.getGeometryN(r).getCoordinateSequence(),i=0;i<n.size()-1;i++){if(n.getCoordinate(i,e._seg.p0),n.getCoordinate(i+1,e._seg.p1),e._seg.distance(t)<=e._boundaryDistanceTolerance)return!0}return!1},Bw.prototype.getLocation=function(t){return this.isWithinToleranceOfBoundary(t)?c_.BOUNDARY:this._ptLocator.locate(t,this._g)},Bw.prototype.extractLinework=function(t){var e=new Sw;t.apply(e);var r=e.getLinework(),n=dE.toLineStringArray(r);return t.getFactory().createMultiLineString(n)},Bw.prototype.interfaces_=function(){return[]},Bw.prototype.getClass=function(){return Bw};var Sw=function(){this._linework=null,this._linework=new aI};Sw.prototype.getLinework=function(){return this._linework},Sw.prototype.filter=function(t){if(t instanceof ZI){var e=t;this._linework.add(e.getExteriorRing());for(var r=0;r<e.getNumInteriorRing();r++)this._linework.add(e.getInteriorRingN(r))}},Sw.prototype.interfaces_=function(){return[RI]},Sw.prototype.getClass=function(){return Sw};var Mw=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var t=arguments[0];this._g=t};Mw.prototype.extractPoints=function(t,e,r){for(var n=t.getCoordinates(),i=0;i<n.length-1;i++)this.computeOffsetPoints(n[i],n[i+1],e,r)},Mw.prototype.setSidesToGenerate=function(t,e){this._doLeft=t,this._doRight=e},Mw.prototype.getPoints=function(t){for(var e=new aI,r=CC.getLines(this._g).iterator();r.hasNext();){var n=r.next();this.extractPoints(n,t,e)}return e},Mw.prototype.computeOffsetPoints=function(t,e,r,n){var i=e.x-t.x,o=e.y-t.y,s=Math.sqrt(i*i+o*o),a=r*i/s,u=r*o/s,l=(e.x+t.x)/2,c=(e.y+t.y)/2;if(this._doLeft){var h=new s_(l-u,c+a);n.add(h)}if(this._doRight){var f=new s_(l+u,c-a);n.add(f)}},Mw.prototype.interfaces_=function(){return[]},Mw.prototype.getClass=function(){return Mw};var Lw=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 aI;var e=arguments[0],r=arguments[1],n=arguments[2];this._boundaryDistanceTolerance=t.computeBoundaryDistanceTolerance(e,r),this._geom=[e,r,n],this._locFinder=[new Bw(this._geom[0],this._boundaryDistanceTolerance),new Bw(this._geom[1],this._boundaryDistanceTolerance),new Bw(this._geom[2],this._boundaryDistanceTolerance)]},Nw={TOLERANCE:{configurable:!0}};Lw.prototype.reportResult=function(t,e,r){b_.out.println("Overlay result invalid - A:"+c_.toLocationSymbol(e[0])+" B:"+c_.toLocationSymbol(e[1])+" expected:"+(r?"i":"e")+" actual:"+c_.toLocationSymbol(e[2]))},Lw.prototype.isValid=function(t){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var e=this.checkValid(t);return e},Lw.prototype.checkValid=function(){var t=this;if(1===arguments.length){for(var e=arguments[0],r=0;r<this._testCoords.size();r++){var n=t._testCoords.get(r);if(!t.checkValid(e,n))return t._invalidLocation=n,!1}return!0}if(2===arguments.length){var i=arguments[0],o=arguments[1];return this._location[0]=this._locFinder[0].getLocation(o),this._location[1]=this._locFinder[1].getLocation(o),this._location[2]=this._locFinder[2].getLocation(o),!!Lw.hasLocation(this._location,c_.BOUNDARY)||this.isValidResult(i,this._location)}},Lw.prototype.addTestPts=function(t){var e=new Mw(t);this._testCoords.addAll(e.getPoints(5*this._boundaryDistanceTolerance))},Lw.prototype.isValidResult=function(t,e){var r=bw.isResultOfOp(e[0],e[1],t),n=!(r^e[2]===c_.INTERIOR);return n||this.reportResult(t,e,r),n},Lw.prototype.getInvalidLocation=function(){return this._invalidLocation},Lw.prototype.interfaces_=function(){return[]},Lw.prototype.getClass=function(){return Lw},Lw.hasLocation=function(t,e){for(var r=0;r<3;r++)if(t[r]===e)return!0;return!1},Lw.computeBoundaryDistanceTolerance=function(t,e){return Math.min(WC.computeSizeBasedSnapTolerance(t),WC.computeSizeBasedSnapTolerance(e))},Lw.isValid=function(t,e,r,n){return new Lw(t,e,n).isValid(r)},Nw.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(Lw,Nw);var Tw=function t(e){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=t.extractFactory(e),this._inputGeoms=e};Tw.prototype.extractElements=function(t,e){if(null===t)return null;for(var r=0;r<t.getNumGeometries();r++){var n=t.getGeometryN(r);this._skipEmpty&&n.isEmpty()||e.add(n)}},Tw.prototype.combine=function(){for(var t=new aI,e=this._inputGeoms.iterator();e.hasNext();){var r=e.next();this.extractElements(r,t)}return 0===t.size()?null!==this._geomFactory?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(t)},Tw.prototype.interfaces_=function(){return[]},Tw.prototype.getClass=function(){return Tw},Tw.combine=function(){return 1===arguments.length?new Tw(arguments[0]).combine():2===arguments.length?new Tw(Tw.createList(arguments[0],arguments[1])).combine():3===arguments.length?new Tw(Tw.createList(arguments[0],arguments[1],arguments[2])).combine():void 0},Tw.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},Tw.createList=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],r=new aI;return r.add(t),r.add(e),r}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2],s=new aI;return s.add(n),s.add(i),s.add(o),s}};var Rw=function(){this._inputPolys=null,this._geomFactory=null;var t=arguments[0];this._inputPolys=t,null===this._inputPolys&&(this._inputPolys=new aI)},Dw={STRTREE_NODE_CAPACITY:{configurable:!0}};Rw.prototype.reduceToGeometries=function(t){for(var e=new aI,r=t.iterator();r.hasNext();){var n=r.next(),i=null;f_(n,oI)?i=this.unionTree(n):n instanceof Y_&&(i=n),e.add(i)}return e},Rw.prototype.extractByEnvelope=function(t,e,r){for(var n=new aI,i=0;i<e.getNumGeometries();i++){var o=e.getGeometryN(i);o.getEnvelopeInternal().intersects(t)?n.add(o):r.add(o)}return this._geomFactory.buildGeometry(n)},Rw.prototype.unionOptimized=function(t,e){var r=t.getEnvelopeInternal(),n=e.getEnvelopeInternal();if(!r.intersects(n))return Tw.combine(t,e);if(t.getNumGeometries()<=1&&e.getNumGeometries()<=1)return this.unionActual(t,e);var i=r.intersection(n);return this.unionUsingEnvelopeIntersection(t,e,i)},Rw.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 sx(Rw.STRTREE_NODE_CAPACITY),e=this._inputPolys.iterator();e.hasNext();){var r=e.next();t.insert(r.getEnvelopeInternal(),r)}this._inputPolys=null;var n=t.itemsTree();return this.unionTree(n)},Rw.prototype.binaryUnion=function(){if(1===arguments.length){var t=arguments[0];return this.binaryUnion(t,0,t.size())}if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2];if(n-r<=1){var i=Rw.getGeometry(e,r);return this.unionSafe(i,null)}if(n-r==2)return this.unionSafe(Rw.getGeometry(e,r),Rw.getGeometry(e,r+1));var o=Math.trunc((n+r)/2),s=this.binaryUnion(e,r,o),a=this.binaryUnion(e,o,n);return this.unionSafe(s,a)}},Rw.prototype.repeatedUnion=function(t){for(var e=null,r=t.iterator();r.hasNext();){var n=r.next();e=null===e?n.copy():e.union(n)}return e},Rw.prototype.unionSafe=function(t,e){return null===t&&null===e?null:null===t?e.copy():null===e?t.copy():this.unionOptimized(t,e)},Rw.prototype.unionActual=function(t,e){return Rw.restrictToPolygons(t.union(e))},Rw.prototype.unionTree=function(t){var e=this.reduceToGeometries(t);return this.binaryUnion(e)},Rw.prototype.unionUsingEnvelopeIntersection=function(t,e,r){var n=new aI,i=this.extractByEnvelope(r,t,n),o=this.extractByEnvelope(r,e,n),s=this.unionActual(i,o);return n.add(s),Tw.combine(n)},Rw.prototype.bufferUnion=function(){if(1===arguments.length){var t=arguments[0];return t.get(0).getFactory().buildGeometry(t).buffer(0)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e.getFactory().createGeometryCollection([e,r]).buffer(0)}},Rw.prototype.interfaces_=function(){return[]},Rw.prototype.getClass=function(){return Rw},Rw.restrictToPolygons=function(t){if(f_(t,KI))return t;var e=xC.getPolygons(t);return 1===e.size()?e.get(0):t.getFactory().createMultiPolygon(dE.toPolygonArray(e))},Rw.getGeometry=function(t,e){return e>=t.size()?null:t.get(e)},Rw.union=function(t){return new Rw(t).union()},Dw.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(Rw,Dw);var Pw=function(){};function Qw(){return new kw}function kw(){this.reset()}Pw.prototype.interfaces_=function(){return[]},Pw.prototype.getClass=function(){return Pw},Pw.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return bw.createEmptyResult(bw.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),ow.overlayOp(t,e,bw.UNION)},kw.prototype={constructor:kw,reset:function(){this.s=this.t=0},add:function(t){Fw(Ow,t,this.t),Fw(this,Ow.s,this.s),this.s?this.t+=Ow.t:this.s=Ow.t},valueOf:function(){return this.s}};var Ow=new kw;function Fw(t,e,r){var n=t.s=e+r,i=n-e,o=n-i;t.t=e-o+(r-i)}var Gw=1e-6,Uw=Math.PI,qw=Uw/2,jw=Uw/4,Vw=2*Uw,zw=180/Uw,Yw=Uw/180,Hw=Math.abs,Xw=Math.atan,Jw=Math.atan2,Ww=Math.cos,Kw=Math.sin,Zw=Math.sqrt;function $w(t){return t>1?0:t<-1?Uw:Math.acos(t)}function tb(t){return t>1?qw:t<-1?-qw:Math.asin(t)}function eb(){}function rb(t,e){t&&sb.hasOwnProperty(t.type)&&sb[t.type](t,e)}var nb,ib,ob={Feature:function(t,e){rb(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n<i;)rb(r[n].geometry,e)}},sb={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)t=r[n],e.point(t[0],t[1],t[2])},LineString:function(t,e){ab(t.coordinates,e,0)},MultiLineString:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)ab(r[n],e,0)},Polygon:function(t,e){ub(t.coordinates,e)},MultiPolygon:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)ub(r[n],e)},GeometryCollection:function(t,e){for(var r=t.geometries,n=-1,i=r.length;++n<i;)rb(r[n],e)}};function ab(t,e,r){var n,i=-1,o=t.length-r;for(e.lineStart();++i<o;)n=t[i],e.point(n[0],n[1],n[2]);e.lineEnd()}function ub(t,e){var r=-1,n=t.length;for(e.polygonStart();++r<n;)ab(t[r],e,1);e.polygonEnd()}function lb(t){return[Jw(t[1],t[0]),tb(t[2])]}function cb(t){var e=t[0],r=t[1],n=Ww(r);return[n*Ww(e),n*Kw(e),Kw(r)]}function hb(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function fb(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function pb(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function gb(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Ab(t){var e=Zw(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function db(t,e){function r(r,n){return r=t(r,n),e(r[0],r[1])}return t.invert&&e.invert&&(r.invert=function(r,n){return(r=e.invert(r,n))&&t.invert(r[0],r[1])}),r}function yb(t,e){return[t>Uw?t-Vw:t<-Uw?t+Vw:t,e]}function vb(t){return function(e,r){return[(e+=t)>Uw?e-Vw:e<-Uw?e+Vw:e,r]}}function mb(t){var e=vb(t);return e.invert=vb(-t),e}function _b(t,e){var r=Ww(t),n=Kw(t),i=Ww(e),o=Kw(e);function s(t,e){var s=Ww(e),a=Ww(t)*s,u=Kw(t)*s,l=Kw(e),c=l*r+a*n;return[Jw(u*i-c*o,a*r-l*n),tb(c*i+u*o)]}return s.invert=function(t,e){var s=Ww(e),a=Ww(t)*s,u=Kw(t)*s,l=Kw(e),c=l*i-u*o;return[Jw(u*i+l*o,a*r+c*n),tb(c*r-a*n)]},s}function Ib(t,e){(e=cb(e))[0]-=t,Ab(e);var r=$w(-e[1]);return((-e[2]<0?-r:r)+Vw-Gw)%Vw}function Eb(){var t,e=[];return{point:function(e,r){t.push([e,r])},lineStart:function(){e.push(t=[])},lineEnd:eb,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var r=e;return e=[],t=null,r}}}function xb(t,e){return Hw(t[0]-e[0])<Gw&&Hw(t[1]-e[1])<Gw}function Cb(t,e,r,n){this.x=t,this.z=e,this.o=r,this.e=n,this.v=!1,this.n=this.p=null}function wb(t,e,r,n,i){var o,s,a=[],u=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,r,n=t[0],s=t[e];if(xb(n,s)){for(i.lineStart(),o=0;o<e;++o)i.point((n=t[o])[0],n[1]);i.lineEnd()}else a.push(r=new Cb(n,t,null,!0)),u.push(r.o=new Cb(n,null,r,!1)),a.push(r=new Cb(s,t,null,!1)),u.push(r.o=new Cb(s,null,r,!0))}})),a.length){for(u.sort(e),bb(a),bb(u),o=0,s=u.length;o<s;++o)u[o].e=r=!r;for(var l,c,h=a[0];;){for(var f=h,p=!0;f.v;)if((f=f.n)===h)return;l=f.z,i.lineStart();do{if(f.v=f.o.v=!0,f.e){if(p)for(o=0,s=l.length;o<s;++o)i.point((c=l[o])[0],c[1]);else n(f.x,f.n.x,1,i);f=f.n}else{if(p)for(l=f.p.z,o=l.length-1;o>=0;--o)i.point((c=l[o])[0],c[1]);else n(f.x,f.p.x,-1,i);f=f.p}l=(f=f.o).z,p=!p}while(!f.v);i.lineEnd()}}}function bb(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n<e;)i.n=r=t[n],r.p=i,i=r;i.n=r=t[0],r.p=i}}function Bb(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function Sb(t){for(var e,r,n,i=t.length,o=-1,s=0;++o<i;)s+=t[o].length;for(r=new Array(s);--i>=0;)for(e=(n=t[i]).length;--e>=0;)r[--s]=n[e];return r}Qw(),Qw(),Qw(),yb.invert=yb,1===(nb=Bb).length&&(ib=nb,nb=function(t,e){return Bb(ib(t),e)});var Mb=1e9,Lb=-Mb;function Nb(t,e,r,n){function i(i,o){return t<=i&&i<=r&&e<=o&&o<=n}function o(i,o,a,l){var c=0,h=0;if(null==i||(c=s(i,a))!==(h=s(o,a))||u(i,o)<0^a>0)do{l.point(0===c||3===c?t:r,c>1?n:e)}while((c=(c+a+4)%4)!==h);else l.point(o[0],o[1])}function s(n,i){return Hw(n[0]-t)<Gw?i>0?0:3:Hw(n[0]-r)<Gw?i>0?2:1:Hw(n[1]-e)<Gw?i>0?1:0:i>0?3:2}function a(t,e){return u(t.x,e.x)}function u(t,e){var r=s(t,1),n=s(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(s){var u,l,c,h,f,p,g,A,d,y,v,m=s,_=Eb(),I={point:E,lineStart:function(){I.point=x,l&&l.push(c=[]);y=!0,d=!1,g=A=NaN},lineEnd:function(){u&&(x(h,f),p&&d&&_.rejoin(),u.push(_.result()));I.point=E,d&&m.lineEnd()},polygonStart:function(){m=_,u=[],l=[],v=!0},polygonEnd:function(){var e=function(){for(var e=0,r=0,i=l.length;r<i;++r)for(var o,s,a=l[r],u=1,c=a.length,h=a[0],f=h[0],p=h[1];u<c;++u)o=f,s=p,f=(h=a[u])[0],p=h[1],s<=n?p>n&&(f-o)*(n-s)>(p-s)*(t-o)&&++e:p<=n&&(f-o)*(n-s)<(p-s)*(t-o)&&--e;return e}(),r=v&&e,i=(u=Sb(u)).length;(r||i)&&(s.polygonStart(),r&&(s.lineStart(),o(null,null,1,s),s.lineEnd()),i&&wb(u,a,e,o,s),s.polygonEnd());m=s,u=l=c=null}};function E(t,e){i(t,e)&&m.point(t,e)}function x(o,s){var a=i(o,s);if(l&&c.push([o,s]),y)h=o,f=s,p=a,y=!1,a&&(m.lineStart(),m.point(o,s));else if(a&&d)m.point(o,s);else{var u=[g=Math.max(Lb,Math.min(Mb,g)),A=Math.max(Lb,Math.min(Mb,A))],_=[o=Math.max(Lb,Math.min(Mb,o)),s=Math.max(Lb,Math.min(Mb,s))];!function(t,e,r,n,i,o){var s,a=t[0],u=t[1],l=0,c=1,h=e[0]-a,f=e[1]-u;if(s=r-a,h||!(s>0)){if(s/=h,h<0){if(s<l)return;s<c&&(c=s)}else if(h>0){if(s>c)return;s>l&&(l=s)}if(s=i-a,h||!(s<0)){if(s/=h,h<0){if(s>c)return;s>l&&(l=s)}else if(h>0){if(s<l)return;s<c&&(c=s)}if(s=n-u,f||!(s>0)){if(s/=f,f<0){if(s<l)return;s<c&&(c=s)}else if(f>0){if(s>c)return;s>l&&(l=s)}if(s=o-u,f||!(s<0)){if(s/=f,f<0){if(s>c)return;s>l&&(l=s)}else if(f>0){if(s<l)return;s<c&&(c=s)}return l>0&&(t[0]=a+l*h,t[1]=u+l*f),c<1&&(e[0]=a+c*h,e[1]=u+c*f),!0}}}}}(u,_,t,e,r,n)?a&&(m.lineStart(),m.point(o,s),v=!1):(d||(m.lineStart(),m.point(u[0],u[1])),m.point(_[0],_[1]),a||m.lineEnd(),v=!1)}g=o,A=s,d=a}return I}}var Tb=Qw();function Rb(t){return t}Qw(),Qw(),Qw();var Db=1/0,Pb=Db,Qb=-Db,kb=Qb,Ob={point:function(t,e){t<Db&&(Db=t);t>Qb&&(Qb=t);e<Pb&&(Pb=e);e>kb&&(kb=e)},lineStart:eb,lineEnd:eb,polygonStart:eb,polygonEnd:eb,result:function(){var t=[[Db,Pb],[Qb,kb]];return Qb=kb=-(Pb=Db=1/0),t}};function Fb(t,e,r,n){return function(i,o){var s,a,u,l=e(o),c=i.invert(n[0],n[1]),h=Eb(),f=e(h),p=!1,g={point:A,lineStart:y,lineEnd:v,polygonStart:function(){g.point=m,g.lineStart=_,g.lineEnd=I,a=[],s=[]},polygonEnd:function(){g.point=A,g.lineStart=y,g.lineEnd=v,a=Sb(a);var t=function(t,e){var r=e[0],n=e[1],i=[Kw(r),-Ww(r),0],o=0,s=0;Tb.reset();for(var a=0,u=t.length;a<u;++a)if(c=(l=t[a]).length)for(var l,c,h=l[c-1],f=h[0],p=h[1]/2+jw,g=Kw(p),A=Ww(p),d=0;d<c;++d,f=v,g=_,A=I,h=y){var y=l[d],v=y[0],m=y[1]/2+jw,_=Kw(m),I=Ww(m),E=v-f,x=E>=0?1:-1,C=x*E,w=C>Uw,b=g*_;if(Tb.add(Jw(b*x*Kw(C),A*I+b*Ww(C))),o+=w?E+x*Vw:E,w^f>=r^v>=r){var B=fb(cb(h),cb(y));Ab(B);var S=fb(i,B);Ab(S);var M=(w^E>=0?-1:1)*tb(S[2]);(n>M||n===M&&(B[0]||B[1]))&&(s+=w^E>=0?1:-1)}}return(o<-Gw||o<Gw&&Tb<-Gw)^1&s}(s,c);a.length?(p||(o.polygonStart(),p=!0),wb(a,Ub,t,r,o)):t&&(p||(o.polygonStart(),p=!0),o.lineStart(),r(null,null,1,o),o.lineEnd()),p&&(o.polygonEnd(),p=!1),a=s=null},sphere:function(){o.polygonStart(),o.lineStart(),r(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function A(e,r){var n=i(e,r);t(e=n[0],r=n[1])&&o.point(e,r)}function d(t,e){var r=i(t,e);l.point(r[0],r[1])}function y(){g.point=d,l.lineStart()}function v(){g.point=A,l.lineEnd()}function m(t,e){u.push([t,e]);var r=i(t,e);f.point(r[0],r[1])}function _(){f.lineStart(),u=[]}function I(){m(u[0][0],u[0][1]),f.lineEnd();var t,e,r,n,i=f.clean(),l=h.result(),c=l.length;if(u.pop(),s.push(u),u=null,c)if(1&i){if((e=(r=l[0]).length-1)>0){for(p||(o.polygonStart(),p=!0),o.lineStart(),t=0;t<e;++t)o.point((n=r[t])[0],n[1]);o.lineEnd()}}else c>1&&2&i&&l.push(l.pop().concat(l.shift())),a.push(l.filter(Gb))}return g}}function Gb(t){return t.length>1}function Ub(t,e){return((t=t.x)[0]<0?t[1]-qw-Gw:qw-t[1])-((e=e.x)[0]<0?e[1]-qw-Gw:qw-e[1])}Qw();var qb=Fb((function(){return!0}),(function(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,s){var a=o>0?Uw:-Uw,u=Hw(o-r);Hw(u-Uw)<Gw?(t.point(r,n=(n+s)/2>0?qw:-qw),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(a,n),t.point(o,n),e=0):i!==a&&u>=Uw&&(Hw(r-i)<Gw&&(r-=i*Gw),Hw(o-a)<Gw&&(o-=a*Gw),n=function(t,e,r,n){var i,o,s=Kw(t-r);return Hw(s)>Gw?Xw((Kw(e)*(o=Ww(n))*Kw(r)-Kw(n)*(i=Ww(e))*Kw(t))/(i*o*s)):(e+n)/2}(r,n,o,s),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(a,n),e=0),t.point(r=o,n=s),i=a},lineEnd:function(){t.lineEnd(),r=n=NaN},clean:function(){return 2-e}}}),(function(t,e,r,n){var i;if(null==t)i=r*qw,n.point(-Uw,i),n.point(0,i),n.point(Uw,i),n.point(Uw,0),n.point(Uw,-i),n.point(0,-i),n.point(-Uw,-i),n.point(-Uw,0),n.point(-Uw,i);else if(Hw(t[0]-e[0])>Gw){var o=t[0]<e[0]?Uw:-Uw;i=r*o/2,n.point(-o,i),n.point(0,i),n.point(o,i)}else n.point(e[0],e[1])}),[-Uw,-qw]);function jb(t,e){var r=Ww(t),n=r>0,i=Hw(r)>Gw;function o(t,e){return Ww(t)*Ww(e)>r}function s(t,e,n){var i=[1,0,0],o=fb(cb(t),cb(e)),s=hb(o,o),a=o[0],u=s-a*a;if(!u)return!n&&t;var l=r*s/u,c=-r*a/u,h=fb(i,o),f=gb(i,l);pb(f,gb(o,c));var p=h,g=hb(f,p),A=hb(p,p),d=g*g-A*(hb(f,f)-1);if(!(d<0)){var y=Zw(d),v=gb(p,(-g-y)/A);if(pb(v,f),v=lb(v),!n)return v;var m,_=t[0],I=e[0],E=t[1],x=e[1];I<_&&(m=_,_=I,I=m);var C=I-_,w=Hw(C-Uw)<Gw;if(!w&&x<E&&(m=E,E=x,x=m),w||C<Gw?w?E+x>0^v[1]<(Hw(v[0]-_)<Gw?E:x):E<=v[1]&&v[1]<=x:C>Uw^(_<=v[0]&&v[0]<=I)){var b=gb(p,(-g+y)/A);return pb(b,f),[v,lb(b)]}}}function a(e,r){var i=n?t:Uw-t,o=0;return e<-i?o|=1:e>i&&(o|=2),r<-i?o|=4:r>i&&(o|=8),o}return Fb(o,(function(t){var e,r,u,l,c;return{lineStart:function(){l=u=!1,c=1},point:function(h,f){var p,g=[h,f],A=o(h,f),d=n?A?0:a(h,f):A?a(h+(h<0?Uw:-Uw),f):0;if(!e&&(l=u=A)&&t.lineStart(),A!==u&&(!(p=s(e,g))||xb(e,p)||xb(g,p))&&(g[0]+=Gw,g[1]+=Gw,A=o(g[0],g[1])),A!==u)c=0,A?(t.lineStart(),p=s(g,e),t.point(p[0],p[1])):(p=s(e,g),t.point(p[0],p[1]),t.lineEnd()),e=p;else if(i&&e&&n^A){var y;d&r||!(y=s(g,e,!0))||(c=0,n?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1])))}!A||e&&xb(e,g)||t.point(g[0],g[1]),e=g,u=A,r=d},lineEnd:function(){u&&t.lineEnd(),e=null},clean:function(){return c|(l&&u)<<1}}}),(function(r,n,i,o){!function(t,e,r,n,i,o){if(r){var s=Ww(e),a=Kw(e),u=n*r;null==i?(i=e+n*Vw,o=e-u/2):(i=Ib(s,i),o=Ib(s,o),(n>0?i<o:i>o)&&(i+=n*Vw));for(var l,c=i;n>0?c>o:c<o;c-=u)l=lb([s,-a*Ww(c),-a*Kw(c)]),t.point(l[0],l[1])}}(o,t,e,i,r,n)}),n?[0,-t]:[-Uw,t-Uw])}function Vb(t){return function(e){var r=new zb;for(var n in t)r[n]=t[n];return r.stream=e,r}}function zb(){}function Yb(t,e,r){var n=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),function(t,e){t&&ob.hasOwnProperty(t.type)?ob[t.type](t,e):rb(t,e)}(r,t.stream(Ob));var s=Ob.result(),a=Math.min(n/(s[1][0]-s[0][0]),i/(s[1][1]-s[0][1])),u=+e[0][0]+(n-a*(s[1][0]+s[0][0]))/2,l=+e[0][1]+(i-a*(s[1][1]+s[0][1]))/2;return null!=o&&t.clipExtent(o),t.scale(150*a).translate([u,l])}zb.prototype={constructor:zb,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 Hb=16,Xb=Ww(30*Yw);function Jb(t,e){return+e?function(t,e){function r(n,i,o,s,a,u,l,c,h,f,p,g,A,d){var y=l-n,v=c-i,m=y*y+v*v;if(m>4*e&&A--){var _=s+f,I=a+p,E=u+g,x=Zw(_*_+I*I+E*E),C=tb(E/=x),w=Hw(Hw(E)-1)<Gw||Hw(o-h)<Gw?(o+h)/2:Jw(I,_),b=t(w,C),B=b[0],S=b[1],M=B-n,L=S-i,N=v*M-y*L;(N*N/m>e||Hw((y*M+v*L)/m-.5)>.3||s*f+a*p+u*g<Xb)&&(r(n,i,o,s,a,u,B,S,w,_/=x,I/=x,E,A,d),d.point(B,S),r(B,S,w,_,I,E,l,c,h,f,p,g,A,d))}}return function(e){var n,i,o,s,a,u,l,c,h,f,p,g,A={point:d,lineStart:y,lineEnd:m,polygonStart:function(){e.polygonStart(),A.lineStart=_},polygonEnd:function(){e.polygonEnd(),A.lineStart=y}};function d(r,n){r=t(r,n),e.point(r[0],r[1])}function y(){c=NaN,A.point=v,e.lineStart()}function v(n,i){var o=cb([n,i]),s=t(n,i);r(c,h,l,f,p,g,c=s[0],h=s[1],l=n,f=o[0],p=o[1],g=o[2],Hb,e),e.point(c,h)}function m(){A.point=d,e.lineEnd()}function _(){y(),A.point=I,A.lineEnd=E}function I(t,e){v(n=t,e),i=c,o=h,s=f,a=p,u=g,A.point=v}function E(){r(c,h,l,f,p,g,i,o,n,s,a,u,Hb,e),A.lineEnd=m,m()}return A}}(t,e):function(t){return Vb({point:function(e,r){e=t(e,r),this.stream.point(e[0],e[1])}})}(t)}var Wb=Vb({point:function(t,e){this.stream.point(t*Yw,e*Yw)}});function Kb(t){return function(t){var e,r,n,i,o,s,a,u,l,c,h=150,f=480,p=250,g=0,A=0,d=0,y=0,v=0,m=null,_=qb,I=null,E=Rb,x=.5,C=Jb(B,x);function w(t){return[(t=o(t[0]*Yw,t[1]*Yw))[0]*h+r,n-t[1]*h]}function b(t){return(t=o.invert((t[0]-r)/h,(n-t[1])/h))&&[t[0]*zw,t[1]*zw]}function B(t,i){return[(t=e(t,i))[0]*h+r,n-t[1]*h]}function S(){o=db(i=function(t,e,r){return(t%=Vw)?e||r?db(mb(t),_b(e,r)):mb(t):e||r?_b(e,r):yb}(d,y,v),e);var t=e(g,A);return r=f-t[0]*h,n=p+t[1]*h,M()}function M(){return l=c=null,w}return w.stream=function(t){return l&&c===t?l:l=Wb(_(i,C(E(c=t))))},w.clipAngle=function(t){return arguments.length?(_=+t?jb(m=t*Yw,6*Yw):(m=null,qb),M()):m*zw},w.clipExtent=function(t){return arguments.length?(E=null==t?(I=s=a=u=null,Rb):Nb(I=+t[0][0],s=+t[0][1],a=+t[1][0],u=+t[1][1]),M()):null==I?null:[[I,s],[a,u]]},w.scale=function(t){return arguments.length?(h=+t,S()):h},w.translate=function(t){return arguments.length?(f=+t[0],p=+t[1],S()):[f,p]},w.center=function(t){return arguments.length?(g=t[0]%360*Yw,A=t[1]%360*Yw,S()):[g*zw,A*zw]},w.rotate=function(t){return arguments.length?(d=t[0]%360*Yw,y=t[1]%360*Yw,v=t.length>2?t[2]%360*Yw:0,S()):[d*zw,y*zw,v*zw]},w.precision=function(t){return arguments.length?(C=Jb(B,x=t*t),M()):Zw(x)},w.fitExtent=function(t,e){return Yb(w,t,e)},w.fitSize=function(t,e){return function(t,e,r){return Yb(t,[[0,0],e],r)}(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&b,S()}}((function(){return t}))()}function Zb(t){return function(e,r){var n=Ww(e),i=Ww(r),o=t(n*i);return[o*i*Kw(e),o*Kw(r)]}}function $b(t){return function(e,r){var n=Zw(e*e+r*r),i=t(n),o=Kw(i),s=Ww(i);return[Jw(e*o,n*s),tb(n&&r*o/n)]}}Zb((function(t){return Zw(2/(1+t))})).invert=$b((function(t){return 2*tb(t/2)}));var tB=Zb((function(t){return(t=$w(t))&&t/Kw(t)}));function eB(){return Kb(tB).scale(79.4188).clipAngle(179.999)}function rB(t,e){return[t,e]}function nB(t,e,r,n){var i=t.properties||{},o="Feature"===t.type?t.geometry:t;if("GeometryCollection"===o.type){var s=[];return Va(t,(function(t){var i=nB(t,e,r,n);i&&s.push(i)})),At(s)}var a=function(t){var e=Jc(t).geometry.coordinates,r=[-e[0],-e[1]];return eB().rotate(r).scale(nt)}(o),u={type:o.type,coordinates:oB(o.coordinates,a)},l=(new EE).read(u),c=It(Et(e,r),"meters"),h=AC.bufferOp(l,c,n);if(!iB((h=(new xE).write(h)).coordinates))return at({type:h.type,coordinates:sB(h.coordinates,a)},i)}function iB(t){return Array.isArray(t[0])?iB(t[0]):isNaN(t[0])}function oB(t,e){return"object"!=typeof t[0]?e(t):t.map((function(t){return oB(t,e)}))}function sB(t,e){return"object"!=typeof t[0]?e.invert(t):t.map((function(t){return sB(t,e)}))}function aB(t,e,r){void 0===r&&(r={});var n=Gt(t),i=Gt(e),o=Km.intersection(n.coordinates,i.coordinates);return 0===o.length?null:1===o.length?ht(o[0],r.properties):vt(o,r.properties)}function uB(t,e,r){void 0===r&&(r={});var n=JSON.stringify(r.properties||{}),i=t[0],o=t[1],s=t[2],a=t[3],u=(o+a)/2,l=(i+s)/2,c=2*e/jt([i,u],[s,u],r)*(s-i),h=2*e/jt([l,o],[l,a],r)*(a-o),f=c/2,p=2*f,g=Math.sqrt(3)/2*h,A=s-i,d=a-o,y=3/4*p,v=g,m=(A-p)/(p-f/2),_=Math.floor(m),I=(_*y-f/2-A)/2-f/2+y/2,E=Math.floor((d-g)/g),x=(d-E*g)/2,C=E*g-d>g/2;C&&(x-=g/4);for(var w=[],b=[],B=0;B<6;B++){var S=2*Math.PI/6*B;w.push(Math.cos(S)),b.push(Math.sin(S))}for(var M=[],L=0;L<=_;L++)for(var N=0;N<=E;N++){var T=L%2==1;if((0!==N||!T)&&(0!==N||!C)){var R=L*y+i-I,D=N*v+o+x;if(T&&(D-=g/2),!0===r.triangles)cB([R,D],c/2,h/2,JSON.parse(n),w,b).forEach((function(t){r.mask?aB(r.mask,t)&&M.push(t):M.push(t)}));else{var P=lB([R,D],c/2,h/2,JSON.parse(n),w,b);r.mask?aB(r.mask,P)&&M.push(P):M.push(P)}}}return At(M)}function lB(t,e,r,n,i,o){for(var s=[],a=0;a<6;a++){var u=t[0]+e*i[a],l=t[1]+r*o[a];s.push([u,l])}return s.push(s[0].slice()),ht([s],n)}function cB(t,e,r,n,i,o){for(var s=[],a=0;a<6;a++){var u=[];u.push(t),u.push([t[0]+e*i[a],t[1]+r*o[a]]),u.push([t[0]+e*i[(a+1)%6],t[1]+r*o[(a+1)%6]]),u.push(t),s.push(ht([u],n))}return s}function hB(t){return vt(t)}function fB(t){return ht(t&&t.geometry.coordinates||[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]])}function pB(t,e,r){return void 0===r&&(r={}),function(t,e,r,n){void 0===n&&(n={});for(var i=[],o=t[0],s=t[1],a=t[2],u=t[3],l=e/jt([o,s],[a,s],n)*(a-o),c=r/jt([o,s],[o,u],n)*(u-s),h=a-o,f=u-s,p=Math.floor(h/l),g=Math.floor(f/c),A=(f-g*c)/2,d=o+(h-p*l)/2,y=0;y<p;y++){for(var v=s+A,m=0;m<g;m++){var _=ht([[[d,v],[d,v+c],[d+l,v+c],[d+l,v],[d,v]]],n.properties);n.mask?Iy(n.mask,_)&&i.push(_):i.push(_),v+=c}d+=l}return At(i)}(t,e,e,r)}function gB(t,e,r){void 0===r&&(r={});for(var n=[],i=e/jt([t[0],t[1]],[t[2],t[1]],r)*(t[2]-t[0]),o=e/jt([t[0],t[1]],[t[0],t[3]],r)*(t[3]-t[1]),s=0,a=t[0];a<=t[2];){for(var u=0,l=t[1];l<=t[3];){var c=null,h=null;s%2==0&&u%2==0?(c=ht([[[a,l],[a,l+o],[a+i,l],[a,l]]],r.properties),h=ht([[[a,l+o],[a+i,l+o],[a+i,l],[a,l+o]]],r.properties)):s%2==0&&u%2==1?(c=ht([[[a,l],[a+i,l+o],[a+i,l],[a,l]]],r.properties),h=ht([[[a,l],[a,l+o],[a+i,l+o],[a,l]]],r.properties)):u%2==0&&s%2==1?(c=ht([[[a,l],[a,l+o],[a+i,l+o],[a,l]]],r.properties),h=ht([[[a,l],[a+i,l+o],[a+i,l],[a,l]]],r.properties)):u%2==1&&s%2==1&&(c=ht([[[a,l],[a,l+o],[a+i,l],[a,l]]],r.properties),h=ht([[[a,l+o],[a+i,l+o],[a+i,l],[a,l+o]]],r.properties)),r.mask?(aB(r.mask,c)&&n.push(c),aB(r.mask,h)&&n.push(h)):(n.push(c),n.push(h)),l+=o,u++}s++,a+=i}return At(n)}tB.invert=$b((function(t){return t})),rB.invert=rB;var AB=Object.freeze({__proto__:null,projection:zv,random:$v,clusters:am,helpers:Rt,invariant:qt,meta:tu,isolines:function(t,e,r){if(!Lt(r=r||{}))throw new Error("options is invalid");var n=r.zProperty||"elevation",i=r.commonProperties||{},o=r.breaksProperties||[];if(Ft(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(!Lt(i))throw new Error("commonProperties must be an Object");if(!Array.isArray(o))throw new Error("breaksProperties must be an Array");var s=el(t,{zProperty:n,flip:!0}),a=function(t,e,r,n,i){for(var o=[],s=1;s<e.length;s++){var a=+e[s],u=Hu({},n,i[s]);u[r]=a;var l=dt(Wu(t,a),u);o.push(l)}return o}(s,e,n,i,o),u=function(t,e,r){var n=ju(r),i=n[2]-n[0],o=n[3]-n[1],s=n[0],a=n[1],u=e[0].length-1,l=e.length-1,c=i/u,h=o/l,f=function(t){t[0]=t[0]*c+s,t[1]=t[1]*h+a};return t.forEach((function(t){ka(t,f)})),t}(a,s,t);return At(u)},convex:Hl,pointsWithinPolygon:Xl,within:Xl,concave:function(t,e){void 0===e&&(e={});var r=e.maxEdge||1/0,n=function(t){var e=[],r={};return Ua(t,(function(t){if(t.geometry){var n=t.geometry.coordinates.join("-");Object.prototype.hasOwnProperty.call(r,n)||(e.push(t),r[n]=!0)}})),At(e)}(t),i=Jl(n);if(i.features=i.features.filter((function(t){var n=t.geometry.coordinates[0][0],i=t.geometry.coordinates[0][1],o=t.geometry.coordinates[0][2],s=jt(n,i,e),a=jt(i,o,e),u=jt(n,o,e);return s<=r&&a<=r&&u<=r})),i.features.length<1)return null;var o=xc(i);return 1===o.coordinates.length&&(o.coordinates=o.coordinates[0],o.type="Polygon"),at(o)},collect:function(t,e,r,n){var i=Gc(6),o=e.features.map((function(t){var e;return{minX:t.geometry.coordinates[0],minY:t.geometry.coordinates[1],maxX:t.geometry.coordinates[0],maxY:t.geometry.coordinates[1],property:null===(e=t.properties)||void 0===e?void 0:e[r]}}));return i.load(o),t.features.forEach((function(t){t.properties||(t.properties={});var e=ju(t),r=i.search({minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]}),o=[];r.forEach((function(e){Vt([e.minX,e.minY],t)&&o.push(e.property)})),t.properties[n]=o})),t},flip:function(t,e){if(!Lt(e=e||{}))throw new Error("options is invalid");var r=e.mutate;if(!t)throw new Error("geojson is required");return!1!==r&&void 0!==r||(t=Ta(t)),ka(t,(function(t){var e=t[0],r=t[1];t[0]=r,t[1]=e})),t},simplify:ou,bezier:qc,bezierSpline:qc,tag:function(t,e,r,n){return t=Ta(t),e=Ta(e),Ua(t,(function(t){t.properties||(t.properties={}),Ua(e,(function(e){void 0===t.properties[n]&&Vt(t,e)&&(t.properties[n]=e.properties[r])}))})),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");var r=At(function(t,e){var r,n,i=t.slice(0),o=t.length,s=o-e;for(;o-- >s;)r=i[n=Math.floor((o+1)*Math.random())],i[n]=i[o],i[o]=r;return i.slice(s)}(t.features,e));return r},envelope:Vc,square:zc,circle:Hc,midpoint:function(t,e){return Yc(t,jt(t,e)/2,Xc(t,e))},center:Jc,centerOfMass:function t(e,r){switch(void 0===r&&(r={}),Ut(e)){case"Point":return lt(Dt(e),r.properties);case"Polygon":var n=[];ka(e,(function(t){n.push(t)}));var i,o,s,a,u,l,c,h,f=Wc(e,{properties:r.properties}),p=f.geometry.coordinates,g=0,A=0,d=0,y=n.map((function(t){return[t[0]-p[0],t[1]-p[1]]}));for(i=0;i<n.length-1;i++)a=(o=y[i])[0],l=o[1],u=(s=y[i+1])[0],d+=h=a*(c=s[1])-u*l,g+=(a+u)*h,A+=(l+c)*h;if(0===d)return f;var v=1/(6*(.5*d));return lt([p[0]+v*g,p[1]+v*A],r.properties);default:var m=Hl(e);return m?t(m,{properties:r.properties}):Wc(e,{properties:r.properties})}},centroid:Wc,combine:function(t){var e={MultiPoint:{coordinates:[],properties:[]},MultiLineString:{coordinates:[],properties:[]},MultiPolygon:{coordinates:[],properties:[]}};return Ua(t,(function(t){var r,n,i,o;switch(null===(o=t.geometry)||void 0===o?void 0:o.type){case"Point":e.MultiPoint.coordinates.push(t.geometry.coordinates),e.MultiPoint.properties.push(t.properties);break;case"MultiPoint":(r=e.MultiPoint.coordinates).push.apply(r,t.geometry.coordinates),e.MultiPoint.properties.push(t.properties);break;case"LineString":e.MultiLineString.coordinates.push(t.geometry.coordinates),e.MultiLineString.properties.push(t.properties);break;case"MultiLineString":(n=e.MultiLineString.coordinates).push.apply(n,t.geometry.coordinates),e.MultiLineString.properties.push(t.properties);break;case"Polygon":e.MultiPolygon.coordinates.push(t.geometry.coordinates),e.MultiPolygon.properties.push(t.properties);break;case"MultiPolygon":(i=e.MultiPolygon.coordinates).push.apply(i,t.geometry.coordinates),e.MultiPolygon.properties.push(t.properties)}})),At(Object.keys(e).filter((function(t){return e[t].coordinates.length})).sort().map((function(t){return at({type:t,coordinates:e[t].coordinates},{collectedProperties:e[t].properties})})))},distance:jt,explode:Kc,bbox:ju,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=Zc(t.geometry.coordinates):t.geometry.coordinates.forEach((function(t){e.features=e.features.concat(Zc(t))})),e},bboxPolygon:jc,booleanPointInPolygon:Vt,inside:Vt,nearest:$c,nearestPoint:$c,nearestPointOnLine:Vh,pointOnLine:Vh,nearestPointToLine:function(t,e,r){void 0===r&&(r={});var n=r.units,i=r.properties||{},o=function(t){var e=[];switch(t.geometry?t.geometry.type:t.type){case"GeometryCollection":return Va(t,(function(t){"Point"===t.type&&e.push({type:"Feature",properties:{},geometry:t})})),{type:"FeatureCollection",features:e};case"FeatureCollection":return t.features=t.features.filter((function(t){return"Point"===t.geometry.type})),t;default:throw new Error("points must be a Point Collection")}}(t);if(!o.features.length)throw new Error("points must contain features");if(!e)throw new Error("line is required");if("LineString"!==Ut(e))throw new Error("line must be a LineString");var s=1/0,a=null;return Ua(o,(function(t){var r=Yh(t,e,{units:n});r<s&&(s=r,a=t)})),a&&(a.properties=Hu({dist:s},a.properties,i)),a},planepoint:function(t,e){var r=Dt(t),n=Gt(e).coordinates[0];if(n.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=r[0],l=r[1],c=n[0][0],h=n[0][1],f=void 0!==o?o:n[0][2],p=n[1][0],g=n[1][1],A=void 0!==s?s:n[1][2],d=n[2][0],y=n[2][1],v=void 0!==a?a:n[2][2];return(v*(u-c)*(l-g)+f*(u-p)*(l-y)+A*(u-d)*(l-h)-A*(u-c)*(l-y)-v*(u-p)*(l-h)-f*(u-d)*(l-g))/((u-c)*(l-g)+(u-p)*(l-y)+(u-d)*(l-h)-(u-c)*(l-y)-(u-p)*(l-h)-(u-d)*(l-g))},tin:Jl,bearing:Xc,destination:Yc,kinks:function(t){var e,r,n={type:"FeatureCollection",features:[]};if("LineString"===(r="Feature"===t.type?t.geometry:t).type)e=[r.coordinates];else if("MultiLineString"===r.type)e=r.coordinates;else if("MultiPolygon"===r.type)e=[].concat.apply([],r.coordinates);else{if("Polygon"!==r.type)throw new Error("Input must be a LineString, MultiLineString, Polygon, or MultiPolygon Feature or Geometry");e=r.coordinates}return e.forEach((function(t){e.forEach((function(e){for(var r=0;r<t.length-1;r++)for(var i=r;i<e.length-1;i++){if(t===e){if(1===Math.abs(r-i))continue;if(0===r&&i===t.length-2&&t[r][0]===t[t.length-1][0]&&t[r][1]===t[t.length-1][1])continue}var o=Jh(t[r][0],t[r][1],t[r+1][0],t[r+1][1],e[i][0],e[i][1],e[i+1][0],e[i+1][1]);o&&n.features.push(lt([o[0],o[1]]))}}))})),n},pointOnFeature:Wh,pointOnSurface:Wh,area:$h,along:function(t,e,r){void 0===r&&(r={});for(var n=Gt(t).coordinates,i=0,o=0;o<n.length&&!(e>=i&&o===n.length-1);o++){if(i>=e){var s=e-i;if(s){var a=Xc(n[o],n[o-1])-180;return Yc(n[o],s,a,r)}return lt(n[o])}i+=jt(n[o],n[o+1],r)}return lt(n[n.length-1])},length:nf,lineDistance:nf,lineSlice:function(t,e,r){var n=Pt(r);if("LineString"!==Ut(r))throw new Error("line must be a LineString");for(var i,o=Vh(r,t),s=Vh(r,e),a=[(i=o.properties.index<=s.properties.index?[o,s]:[s,o])[0].geometry.coordinates],u=i[0].properties.index+1;u<i[1].properties.index+1;u++)a.push(n[u]);return a.push(i[1].geometry.coordinates),pt(a,r.properties)},lineSliceAlong:of,pointGrid:ff,truncate:pf,flatten:gf,lineIntersect:qh,lineChunk:function(t,e,r){if(!Lt(r=r||{}))throw new Error("options is invalid");var n=r.units,i=r.reverse;if(!t)throw new Error("geojson is required");if(e<=0)throw new Error("segmentLength must be greater than 0");var o=[];return Ya(t,(function(t){i&&(t.geometry.coordinates=t.geometry.coordinates.reverse()),function(t,e,r,n){var i=nf(t,{units:r});if(i<=e)return n(t);var o=i/e;Number.isInteger(o)||(o=Math.floor(o)+1);for(var s=0;s<o;s++){n(of(t,e*s,e*(s+1),{units:r}),s)}}(t,e,n,(function(t){o.push(t)}))})),At(o)},unkinkPolygon:function(t){var e=[];return Ya(t,(function(t){"Polygon"===t.geometry.type&&Ua(yf(t),(function(r){e.push(ht(r.geometry.coordinates,t.properties))}))})),At(e)},greatCircle:function(t,e,r){if("object"!=typeof(r=r||{}))throw new Error("options is invalid");var n=r.properties,i=r.npoints,o=r.offset;return t=Dt(t),e=Dt(e),n=n||{},i=i||100,o=o||10,new Mf({x:t[0],y:t[1]},{x:e[0],y:e[1]},n).Arc(i,{offset:o}).json()},lineSegment:th,lineSplit:function(t,e){if(!t)throw new Error("line is required");if(!e)throw new Error("splitter is required");var r=Ut(t),n=Ut(e);if("LineString"!==r)throw new Error("line must be LineString");if("FeatureCollection"===n)throw new Error("splitter cannot be a FeatureCollection");if("GeometryCollection"===n)throw new Error("splitter cannot be a GeometryCollection");var i=pf(e,{precision:7});switch(n){case"Point":return Nf(t,i);case"MultiPoint":return Lf(t,i);case"LineString":case"MultiLineString":case"Polygon":case"MultiPolygon":return Lf(t,qh(t,i))}},lineArc:Df,polygonToLine:Qf,polygonToLineString:Qf,lineStringToPolygon:Ff,lineToPolygon:Ff,bboxClip:function(t,e){var r=Gt(t),n=r.type,i="Feature"===t.type?t.properties:{},o=r.coordinates;switch(n){case"LineString":case"MultiLineString":var s=[];return"LineString"===n&&(o=[o]),o.forEach((function(t){!function(t,e,r){var n,i,o,s,a,u=t.length,l=Vf(t[0],e),c=[];for(r||(r=[]),n=1;n<u;n++){for(s=t[n-1],i=o=Vf(a=t[n],e);;){if(!(l|i)){c.push(s),i!==o?(c.push(a),n<u-1&&(r.push(c),c=[])):n===u-1&&c.push(a);break}if(l&i)break;l?l=Vf(s=jf(s,a,l,e),e):i=Vf(a=jf(s,a,i,e),e)}l=o}c.length&&r.push(c)}(t,e,s)})),1===s.length?pt(s[0],i):dt(s,i);case"Polygon":return ht(zf(o,e),i);case"MultiPolygon":return vt(o.map((function(t){return zf(t,e)})),i);default:throw new Error("geometry "+n+" not supported")}},lineOverlap:bA,sector:function(t,e,r,n,i){if(!Lt(i=i||{}))throw new Error("options is invalid");var o=i.properties;if(!t)throw new Error("center is required");if(null==r)throw new Error("bearing1 is required");if(null==n)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(SA(r)===SA(n))return Hc(t,e,i);var s=Pt(t),a=Df(t,e,r,n,i),u=[[s]];return ka(a,(function(t){u[0].push(t)})),u[0].push(s),ht(u,o)},rhumbBearing:MA,rhumbDistance:zh,rhumbDestination:NA,polygonTangents:function(t,e){var r,n,i,o,s=Pt(t),a=Pt(e),u=ju(e),l=0,c=null;switch(s[0]>u[0]&&s[0]<u[2]&&s[1]>u[1]&&s[1]<u[3]&&(l=(c=$c(t,Kc(e))).properties.featureIndex),Ut(e)){case"Polygon":r=a[0][l],n=a[0][0],null!==c&&c.geometry.coordinates[1]<s[1]&&(n=a[0][l]),o=DA(a[0][0],a[0][a[0].length-1],s);var h=TA(a[0],s,o,i,r,n);r=h[0],n=h[1];break;case"MultiPolygon":for(var f=0,p=0,g=0,A=0;A<a[0].length;A++){f=A;for(var d=!1,y=0;y<a[0][A].length;y++){if(p=y,g===l){d=!0;break}g++}if(d)break}r=a[0][f][p],n=a[0][f][p],o=DA(a[0][0][0],a[0][0][a[0][0].length-1],s),a.forEach((function(t){var e=TA(t[0],s,o,i,r,n);r=e[0],n=e[1]}))}return At([lt(r),lt(n)])},rewind:function(t,e){if(!Lt(e=e||{}))throw new Error("options is invalid");var r=e.reverse||!1,n=e.mutate||!1;if(!t)throw new Error("<geojson> is required");if("boolean"!=typeof r)throw new Error("<reverse> must be a boolean");if("boolean"!=typeof n)throw new Error("<mutate> must be a boolean");!1===n&&(t=Ta(t));var i=[];switch(t.type){case"GeometryCollection":return Va(t,(function(t){QA(t,r)})),t;case"FeatureCollection":return Ua(t,(function(t){Ua(QA(t,r),(function(t){i.push(t)}))})),At(i)}return QA(t,r)},isobands:function(t,e,r){if(!Lt(r=r||{}))throw new Error("options is invalid");var n=r.zProperty||"elevation",i=r.commonProperties||{},o=r.breaksProperties||[];if(Ft(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(!Lt(i))throw new Error("commonProperties is not an Object");if(!Array.isArray(o))throw new Error("breaksProperties is not an Array");var s=FA(t,{zProperty:n,flip:!0}),a=function(t,e,r){for(var n=[],i=1;i<e.length;i++){var o=+e[i-1],s=+e[i],a=Gd(Fd(qA(t,o,s-o))),u={};u.groupedRings=a,u[r]=o+"-"+s,n.push(u)}return n}(s,e,n);a=function(t,e,r){var n=ju(r),i=n[2]-n[0],o=n[3]-n[1],s=n[0],a=n[1],u=e[0].length-1,l=e.length-1,c=i/u,h=o/l,f=function(t){t[0]=t[0]*c+s,t[1]=t[1]*h+a};return t.forEach((function(t){t.groupedRings.forEach((function(t){t.forEach((function(t){t.forEach(f)}))}))})),t}(a,s,t);var u=a.map((function(t,e){if(o[e]&&!Lt(o[e]))throw new Error("Each mappedProperty is required to be an Object");var r=Hu({},i,o[e]);return r[n]=t[n],vt(t.groupedRings,r)}));return At(u)},transformRotate:jd,transformScale:Vd,transformTranslate:function(t,e,r,n){if(!Lt(n=n||{}))throw new Error("options is invalid");var i=n.units,o=n.zTranslation,s=n.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==r||isNaN(r))throw new Error("direction is required");return e<0&&(e=-e,r+=180),!1!==s&&void 0!==s||(t=Ta(t)),ka(t,(function(t){var n=Pt(NA(t,e,r,{units:i}));t[0]=n[0],t[1]=n[1],o&&3===t.length&&(t[2]+=o)})),t},lineOffset:function(t,e,r){if(!Lt(r=r||{}))throw new Error("options is invalid");var n=r.units;if(!t)throw new Error("geojson is required");if(null==e||isNaN(e))throw new Error("distance is required");var i=Ut(t),o=t.properties;switch(i){case"LineString":return Jd(t,e,n);case"MultiLineString":var s=[];return Ya(t,(function(t){s.push(Jd(t,e,n).geometry.coordinates)})),dt(s,o);default:throw new Error("geometry "+i+" is not supported")}},polygonize:function(t){var e=ny.fromGeoJson(t);e.deleteDangles(),e.deleteCutEdges();var r=[],n=[];return e.getEdgeRings().filter((function(t){return t.isValid()})).forEach((function(t){t.isHole()?r.push(t):n.push(t)})),r.forEach((function(t){ey.findEdgeRingContaining(t,n)&&n.push(t)})),At(n.map((function(t){return t.toPolygon()})))},booleanDisjoint:iy,booleanContains:function(t,e){var r=Gt(t),n=Gt(e),i=r.type,o=n.type,s=r.coordinates,a=n.coordinates;switch(i){case"Point":if("Point"===o)return ly(s,a);throw new Error("feature2 "+o+" geometry not supported");case"MultiPoint":switch(o){case"Point":return function(t,e){var r,n=!1;for(r=0;r<t.coordinates.length;r++)if(ly(t.coordinates[r],e.coordinates)){n=!0;break}return n}(r,n);case"MultiPoint":return function(t,e){for(var r=0,n=e.coordinates;r<n.length;r++){for(var i=n[r],o=!1,s=0,a=t.coordinates;s<a.length;s++){if(ly(i,a[s])){o=!0;break}}if(!o)return!1}return!0}(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"Point":return sf(n,r,{ignoreEndVertices:!0});case"LineString":return function(t,e){for(var r=!1,n=0,i=e.coordinates;n<i.length;n++){var o=i[n];if(sf({type:"Point",coordinates:o},t,{ignoreEndVertices:!0})&&(r=!0),!sf({type:"Point",coordinates:o},t,{ignoreEndVertices:!1}))return!1}return r}(r,n);case"MultiPoint":return function(t,e){for(var r=!1,n=0,i=e.coordinates;n<i.length;n++){var o=i[n];if(sf(o,t,{ignoreEndVertices:!0})&&(r=!0),!sf(o,t))return!1}if(r)return!0;return!1}(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"Point":return Vt(n,r,{ignoreBoundary:!0});case"LineString":return function(t,e){var r=!1,n=0,i=ju(t),o=ju(e);if(!uy(i,o))return!1;for(;n<e.coordinates.length-1;n++){if(Vt({type:"Point",coordinates:cy(e.coordinates[n],e.coordinates[n+1])},t,{ignoreBoundary:!0})){r=!0;break}}return r}(r,n);case"Polygon":return function(t,e){if("Feature"===t.type&&null===t.geometry)return!1;if("Feature"===e.type&&null===e.geometry)return!1;var r=ju(t),n=ju(e);if(!uy(r,n))return!1;for(var i=Gt(e).coordinates,o=0,s=i;o<s.length;o++)for(var a=0,u=s[o];a<u.length;a++){if(!Vt(u[a],t))return!1}return!0}(r,n);case"MultiPoint":return function(t,e){for(var r=0,n=e.coordinates;r<n.length;r++){if(!Vt(n[r],t,{ignoreBoundary:!0}))return!1}return!0}(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}},booleanCrosses:function(t,e){var r=Gt(t),n=Gt(e),i=r.type,o=n.type;switch(i){case"MultiPoint":switch(o){case"LineString":return hy(r,n);case"Polygon":return py(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"MultiPoint":return hy(n,r);case"LineString":return function(t,e){if(qh(t,e).features.length>0)for(var r=0;r<t.coordinates.length-1;r++)for(var n=0;n<e.coordinates.length-1;n++){var i=!0;if(0!==n&&n!==e.coordinates.length-2||(i=!1),gy(t.coordinates[r],t.coordinates[r+1],e.coordinates[n],i))return!0}return!1}(r,n);case"Polygon":return fy(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"MultiPoint":return py(n,r);case"LineString":return fy(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}},booleanClockwise:PA,booleanOverlap:function(t,e){var r=Gt(t),n=Gt(e),i=r.type,o=n.type;if("MultiPoint"===i&&"MultiPoint"!==o||("LineString"===i||"MultiLineString"===i)&&"LineString"!==o&&"MultiLineString"!==o||("Polygon"===i||"MultiPolygon"===i)&&"Polygon"!==o&&"MultiPolygon"!==o)throw new Error("features must be of the same type");if("Point"===i)throw new Error("Point geometry not supported");if(new _y({precision:6}).compare(t,e))return!1;var s=0;switch(i){case"MultiPoint":for(var a=0;a<r.coordinates.length;a++)for(var u=0;u<n.coordinates.length;u++){var l=r.coordinates[a],c=n.coordinates[u];if(l[0]===c[0]&&l[1]===c[1])return!0}return!1;case"LineString":case"MultiLineString":Xa(t,(function(t){Xa(e,(function(e){bA(t,e).features.length&&s++}))}));break;case"Polygon":case"MultiPolygon":Xa(t,(function(t){Xa(e,(function(e){qh(t,e).features.length&&s++}))}))}return s>0},booleanPointOnLine:sf,booleanEqual:function(t,e){return Gt(t).type===Gt(e).type&&new _y({precision:6}).compare(Sa(t),Sa(e))},booleanWithin:uf,booleanIntersects:Iy,clone:Ta,cleanCoords:Sa,clustersDbscan:function(t,e,r){void 0===r&&(r={}),!0!==r.mutate&&(t=Ta(t)),r.minPoints=r.minPoints||3;var n=new Sy.DBSCAN,i=n.run(ja(t),Bt(e,r.units),r.minPoints,jt),o=-1;return i.forEach((function(e){o++,e.forEach((function(e){var r=t.features[e];r.properties||(r.properties={}),r.properties.cluster=o,r.properties.dbscan="core"}))})),n.noise.forEach((function(e){var r=t.features[e];r.properties||(r.properties={}),r.properties.cluster?r.properties.dbscan="edge":r.properties.dbscan="noise"})),t},clustersKmeans:function(t,e){void 0===e&&(e={});var r=t.features.length;e.numberOfClusters=e.numberOfClusters||Math.round(Math.sqrt(r/2)),e.numberOfClusters>r&&(e.numberOfClusters=r),!0!==e.mutate&&(t=Ta(t));var n=ja(t),i=n.slice(0,e.numberOfClusters),o=ky(n,e.numberOfClusters,i),s={};return o.centroids.forEach((function(t,e){s[e]=t})),Ua(t,(function(t,e){var r=o.idxs[e];t.properties.cluster=r,t.properties.centroid=s[r]})),t},pointToLineDistance:Yh,booleanParallel:function(t,e){if(!t)throw new Error("line1 is required");if(!e)throw new Error("line2 is required");if("LineString"!==Fy(t,"line1"))throw new Error("line1 must be a LineString");if("LineString"!==Fy(e,"line2"))throw new Error("line2 must be a LineString");for(var r=th(Sa(t)).features,n=th(Sa(e)).features,i=0;i<r.length;i++){var o=r[i].geometry.coordinates;if(!n[i])break;if(!Oy(o,n[i].geometry.coordinates))return!1}return!0},shortestPath:function(t,e,r){if(!Lt(r=r||{}))throw new Error("options is invalid");var n=r.resolution,i=r.minDistance,o=r.obstacles||At([]);if(!t)throw new Error("start is required");if(!e)throw new Error("end is required");if(n&&!Mt(n)||n<=0)throw new Error("options.resolution must be a number, greater than 0");if(i)throw new Error("options.minDistance is not yet implemented");var s=Dt(t),a=Dt(e);switch(t=lt(s),e=lt(a),Ut(o)){case"FeatureCollection":if(0===o.features.length)return pt([s,a]);break;case"Polygon":o=At([at(Gt(o))]);break;default:throw new Error("invalid obstacles")}var u=o;u.features.push(t),u.features.push(e);var l=ju(Vd(jc(ju(u)),1.15));n||(n=jt([l[0],l[1]],[l[2],l[1]],r)/100),u.features.pop(),u.features.pop();for(var c=l[0],h=l[1],f=l[2],p=l[3],g=n/jt([c,h],[f,h],r)*(f-c),A=n/jt([c,h],[c,p],r)*(p-h),d=f-c,y=p-h,v=Math.floor(d/g),m=Math.floor(y/A),_=(d-v*g)/2,I=[],E=[],x=[],C=[],w=1/0,b=1/0,B=p-(y-m*A)/2,S=0;B>=h;){for(var M=[],L=[],N=c+_,T=0;N<=f;){var R=lt([N,B]),D=zy(R,o);M.push(D?0:1),L.push(N+"|"+B);var P=jt(R,t);!D&&P<w&&(w=P,x={x:T,y:S});var Q=jt(R,e);!D&&Q<b&&(b=Q,C={x:T,y:S}),N+=g,T++}E.push(M),I.push(L),B-=A,S++}var k=new qy(E,{diagonal:!0}),O=k.grid[x.y][x.x],F=k.grid[C.y][C.x],G=Uy.search(k,O,F),U=[s];return G.forEach((function(t){var e=I[t.x][t.y].split("|");U.push([+e[0],+e[1]])})),U.push(a),Sa(pt(U))},voronoi:function(t,e){if(!Lt(e=e||{}))throw new Error("options is invalid");var r=e.bbox||[-180,-85,180,85];if(!t)throw new Error("points is required");if(!Array.isArray(r))throw new Error("bbox is invalid");return Ft(t,"Point","points"),At(function(){var t=Hy,e=Xy,r=null;function n(n){return new Sv(n.map((function(r,i){var o=[Math.round(t(r,i,n)/wv)*wv,Math.round(e(r,i,n)/wv)*wv];return o.index=i,o.data=r,o})),r)}return n.polygons=function(t){return n(t).polygons()},n.links=function(t){return n(t).links()},n.triangles=function(t){return n(t).triangles()},n.x=function(e){return arguments.length?(t="function"==typeof e?e:Yy(+e),n):t},n.y=function(t){return arguments.length?(e="function"==typeof t?t:Yy(+t),n):e},n.extent=function(t){return arguments.length?(r=null==t?null:[[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]],n):r&&[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},n.size=function(t){return arguments.length?(r=null==t?null:[[0,0],[+t[0],+t[1]]],n):r&&[r[1][0]-r[0][0],r[1][1]-r[0][1]]},n}().x((function(t){return t.geometry.coordinates[0]})).y((function(t){return t.geometry.coordinates[1]})).extent([[r[0],r[1]],[r[2],r[3]]]).polygons(t.features).map(Mv))},ellipse:Lv,centerMean:Tv,centerMedian:function(t,e){if(void 0===e&&(e={}),!Lt(e=e||{}))throw new Error("options is invalid");var r=e.counter||10;if(!Mt(r))throw new Error("counter must be a number");var n=e.weight,i=Tv(t,{weight:e.weight}),o=At([]);Ua(t,(function(t){var e;o.features.push(Wc(t,{properties:{weight:null===(e=t.properties)||void 0===e?void 0:e[n]}}))}));var s={tolerance:e.tolerance,medianCandidates:[]};return Rv(i.geometry.coordinates,[0,0],o,s,r)},standardDeviationalEllipse:function(t,e){if(!Lt(e=e||{}))throw new Error("options is invalid");var r=e.steps||64,n=e.weight,i=e.properties||{};if(!Mt(r))throw new Error("steps must be a number");if(!Lt(i))throw new Error("properties must be a number");var o=ja(t).length,s=Tv(t,{weight:n}),a=0,u=0,l=0;Ua(t,(function(t){var e=t.properties[n]||1,r=Dv(Pt(t),Pt(s));a+=Math.pow(r.x,2)*e,u+=Math.pow(r.y,2)*e,l+=r.x*r.y*e}));var c=a-u,h=Math.sqrt(Math.pow(c,2)+4*Math.pow(l,2)),f=2*l,p=Math.atan((c+h)/f),g=180*p/Math.PI,A=0,d=0,y=0;Ua(t,(function(t){var e=t.properties[n]||1,r=Dv(Pt(t),Pt(s));A+=Math.pow(r.x*Math.cos(p)-r.y*Math.sin(p),2)*e,d+=Math.pow(r.x*Math.sin(p)+r.y*Math.cos(p),2)*e,y+=e}));var v=Math.sqrt(2*A/y),m=Math.sqrt(2*d/y),_=Lv(s,v,m,{units:"degrees",angle:g,steps:r,properties:i}),I=Xl(t,At([_])),E={meanCenterCoordinates:Pt(s),semiMajorAxis:v,semiMinorAxis:m,numberOfFeatures:o,angle:g,percentageWithinEllipse:100*ja(I).length/o};return _.properties.standardDeviationalEllipse=E,_},angle:function(t,e,r,n){if(void 0===n&&(n={}),!Lt(n))throw new Error("options is invalid");if(!t)throw new Error("startPoint is required");if(!e)throw new Error("midPoint is required");if(!r)throw new Error("endPoint is required");var i=t,o=e,s=r,a=Ct(!0!==n.mercator?Xc(i,o):MA(i,o)),u=Ct(!0!==n.mercator?Xc(s,o):MA(s,o)),l=Math.abs(a-u);return!0===n.explementary?360-l:l},polygonSmooth:function(t,e){var r=[],n=e.iterations||1;if(!t)throw new Error("inputPolys is required");return Va(t,(function(t,e,i){var o,s,a;switch(t.type){case"Polygon":o=[[]];for(var u=0;u<n;u++)a=[[]],s=t,u>0&&(s=ht(o).geometry),Pv(s,a),o=a.slice(0);r.push(ht(o,i));break;case"MultiPolygon":o=[[[]]];for(var l=0;l<n;l++)a=[[[]]],s=t,l>0&&(s=vt(o).geometry),Qv(s,a),o=a.slice(0);r.push(vt(o,i));break;default:throw new Error("geometry is invalid, must be Polygon or MultiPolygon")}})),At(r)},moranIndex:function(t,e){var r=e.inputField,n=e.threshold||1e5,i=e.p||2,o=e.binary||!1,s=Ov(t,{alpha:e.alpha||-1,binary:o,p:i,standardization:e.standardization||!0,threshold:n}),a=[];Ua(t,(function(t){var e=t.properties||{};a.push(e[r])}));for(var u=Fv(a),l=function(t){for(var e=Fv(t),r=0,n=0,i=t;n<i.length;n++){var o=i[n];r+=Math.pow(o-e,2)}return r/t.length}(a),c=0,h=0,f=0,p=0,g=s.length,A=0;A<g;A++){for(var d=0,y=0;y<g;y++)c+=s[A][y]*(a[A]-u)*(a[y]-u),h+=s[A][y],f+=Math.pow(s[A][y]+s[y][A],2),d+=s[A][y]+s[y][A];p+=Math.pow(d,2)}var v=c/h/l,m=-1/(g-1),_=(g*g*(f*=.5)-g*p+h*h*3)/((g-1)*(g+1)*(h*h))-m*m,I=Math.sqrt(_);return{expectedMoranIndex:m,moranIndex:v,stdNorm:I,zNorm:(v-m)/I}},distanceWeight:Ov,bearingToAngle:Ct,convertDistance:Bt,degrees2radians:bt,distanceToDegrees:xt,distanceToRadians:Et,radians2degrees:wt,radiansToDistance:It,difference:function(t,e){var r=Gt(t),n=Gt(e),i=t.properties||{},o=Km.difference(r.coordinates,n.coordinates);return 0===o.length?null:1===o.length?ht(o[0],i):vt(o,i)},buffer:function(t,e,r){var n=(r=r||{}).units||"kilometers",i=r.steps||8;if(!t)throw new Error("geojson is required");if("object"!=typeof r)throw new Error("options must be an object");if("number"!=typeof i)throw new Error("steps must be an number");if(void 0===e)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");var o=[];switch(t.type){case"GeometryCollection":return Va(t,(function(t){var r=nB(t,e,n,i);r&&o.push(r)})),At(o);case"FeatureCollection":return Ua(t,(function(t){var r=nB(t,e,n,i);r&&Ua(r,(function(t){t&&o.push(t)}))})),At(o)}return nB(t,e,n,i)},union:function(t,e,r){void 0===r&&(r={});var n=Gt(t),i=Gt(e),o=Km.union(n.coordinates,i.coordinates);return 0===o.length?null:1===o.length?ht(o[0],r.properties):vt(o,r.properties)},intersect:aB,dissolve:function(t,e){if(!Lt(e=e||{}))throw new Error("options is invalid");var r=e.propertyName;Ft(t,"Polygon","dissolve");var n=[];if(!e.propertyName)return gf(vt(Km.union.apply(null,t.features.map((function(t){return t.geometry.coordinates})))));var i={};Ua(t,(function(t){Object.prototype.hasOwnProperty.call(i,t.properties[r])||(i[t.properties[r]]=[]),i[t.properties[r]].push(t)}));for(var o=Object.keys(i),s=0;s<o.length;s++){var a=vt(Km.union.apply(null,i[o[s]].map((function(t){return t.geometry.coordinates}))));a.properties[r]=o[s],n.push(a)}return gf(At(n))},hexGrid:uB,mask:function(t,e){var r,n,i=fB(e),o=null;return"FeatureCollection"===t.type?(n=2===(r=t).features.length?Km.union(r.features[0].geometry.coordinates,r.features[1].geometry.coordinates):Km.union.apply(Km,r.features.map((function(t){return t.geometry.coordinates}))),o=hB(n)):o=hB(Km.union(t.geometry.coordinates)),o.geometry.coordinates.forEach((function(t){i.geometry.coordinates.push(t[0])})),i},squareGrid:pB,triangleGrid:gB,interpolate:function(t,e,r){if("object"!=typeof(r=r||{}))throw new Error("options is invalid");var n=r.gridType,i=r.property,o=r.weight;if(!t)throw new Error("points is required");if(Ft(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",n=n||"square",o=o||1;var s,a=ju(t);switch(n){case"point":case"points":s=ff(a,e,r);break;case"square":case"squares":s=pB(a,e,r);break;case"hex":case"hexes":s=uB(a,e,r);break;case"triangle":case"triangles":s=gB(a,e,r);break;default:throw new Error("invalid gridType")}var u=[];return Ua(s,(function(e){var s=0,a=0;Ua(t,(function(t){var u,l=jt("point"===n?e:Wc(e),t,r);if(void 0!==i&&(u=t.properties[i]),void 0===u&&(u=t.geometry.coordinates[2]),void 0===u)throw new Error("zValue is missing");0===l&&(s=u);var c=1/Math.pow(l,o);a+=c,s+=c*u}));var l=Ta(e);l.properties[i]=s/a,u.push(l)})),At(u)},toMercator:Gv,toWgs84:Uv,randomPosition:Hv,randomPoint:Xv,randomPolygon:Jv,randomLineString:Wv,getCluster:tm,clusterEach:em,clusterReduce:rm,createBins:nm,applyFilter:im,propertiesContainsFilter:om,filterProperties:sm,earthRadius:nt,factors:it,unitsFactors:ot,areaFactors:st,feature:at,geometry:ut,point:lt,points:ct,polygon:ht,polygons:ft,lineString:pt,lineStrings:gt,featureCollection:At,multiLineString:dt,multiPoint:yt,multiPolygon:vt,geometryCollection:mt,round:_t,radiansToLength:It,lengthToRadians:Et,lengthToDegrees:xt,bearingToAzimuth:Ct,radiansToDegrees:wt,degreesToRadians:bt,convertLength:Bt,convertArea:St,isNumber:Mt,isObject:Lt,validateBBox:Nt,validateId:Tt,getCoord:Dt,getCoords:Pt,containsNumber:Qt,geojsonType:kt,featureOf:Ot,collectionOf:Ft,getGeom:Gt,getType:Ut,coordAll:ja,coordEach:ka,coordReduce:Oa,featureEach:Ua,featureReduce:qa,findPoint:$a,findSegment:Za,flattenEach:Ya,flattenReduce:Ha,geomEach:Va,geomReduce:za,lineEach:Wa,lineReduce:Ka,propEach:Fa,propReduce:Ga,segmentEach:Xa,segmentReduce:Ja});exports.Arrow3D=wa,exports.CoordinateTransform=qu,exports.LineGeometry=ha,exports.LineMaterial=js,exports.TextureAnimator=Z,exports.drawTool=Uu,exports.gisCommon=Ht,exports.gltfLoadClass=Po,exports.imgClass=j,exports.layerClass=Gu,exports.line2Object=xa,exports.lineLength=G,exports.planeGifClass=va,exports.planeMark=ce,exports.planeSectorClass=$,exports.polygonClass=Fu,exports.polylineClass=Vs,exports.radarClass=Y,exports.rippleWallClass=Fs,exports.sectorClass=J,exports.shockClass=rt,exports.sleep=R,exports.tileClass=To,exports.tripHeight=ba,exports.tripLineClass=Ba,exports.tubeClass=Ia,exports.turf=AB,exports.verticalFatLineClass=Aa;