@gausslib/gauss-core 0.0.8 → 0.0.10

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.
@@ -1,8 +1,8 @@
1
- (function(Tt,Qn){typeof exports=="object"&&typeof module<"u"?Qn(exports,require("cesium")):typeof define=="function"&&define.amd?define(["exports","cesium"],Qn):(Tt=typeof globalThis<"u"?globalThis:Tt||self,Qn(Tt.Gauss={},Tt.Cesium))})(this,(function(Tt,Qn){"use strict";function dh(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>t[i]})}}return e.default=t,Object.freeze(e)}const qo=dh(Qn);var Ke=63710088e-1,Xr={centimeters:Ke*100,centimetres:Ke*100,degrees:360/(2*Math.PI),feet:Ke*3.28084,inches:Ke*39.37,kilometers:Ke/1e3,kilometres:Ke/1e3,meters:Ke,metres:Ke,miles:Ke/1609.344,millimeters:Ke*1e3,millimetres:Ke*1e3,nauticalmiles:Ke/1852,radians:1,yards:Ke*1.0936},Ur={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,nauticalmiles:29155334959812285e-23,millimeters:1e6,millimetres:1e6,yards:1.195990046};function We(t,e,i={}){const s={type:"Feature"};return(i.id===0||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function Bo(t,e,i={}){switch(t){case"Point":return _e(e).geometry;case"LineString":return Pe(e).geometry;case"Polygon":return ye(e).geometry;case"MultiPoint":return jn(e).geometry;case"MultiLineString":return tn(e).geometry;case"MultiPolygon":return ft(e).geometry;default:throw new Error(t+" is invalid")}}function _e(t,e,i={}){if(!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Je(t[0])||!Je(t[1]))throw new Error("coordinates must contain numbers");return We({type:"Point",coordinates:t},e,i)}function Go(t,e,i={}){return he(t.map(s=>_e(s,e)),i)}function ye(t,e,i={}){for(const o of t){if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(o[o.length-1].length!==o[0].length)throw new Error("First and last Position are not equivalent.");for(let l=0;l<o[o.length-1].length;l++)if(o[o.length-1][l]!==o[0][l])throw new Error("First and last Position are not equivalent.")}return We({type:"Polygon",coordinates:t},e,i)}function Yo(t,e,i={}){return he(t.map(s=>ye(s,e)),i)}function Pe(t,e,i={}){if(t.length<2)throw new Error("coordinates must be an array of two or more positions");return We({type:"LineString",coordinates:t},e,i)}function zo(t,e,i={}){return he(t.map(s=>Pe(s,e)),i)}function he(t,e={}){const i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function tn(t,e,i={}){return We({type:"MultiLineString",coordinates:t},e,i)}function jn(t,e,i={}){return We({type:"MultiPoint",coordinates:t},e,i)}function ft(t,e,i={}){return We({type:"MultiPolygon",coordinates:t},e,i)}function es(t,e,i={}){return We({type:"GeometryCollection",geometries:t},e,i)}function Xo(t,e=0){if(e&&!(e>=0))throw new Error("precision must be a positive number");const i=Math.pow(10,e||0);return Math.round(t*i)/i}function er(t,e="kilometers"){const i=Xr[e];if(!i)throw new Error(e+" units is invalid");return t*i}function Mn(t,e="kilometers"){const i=Xr[e];if(!i)throw new Error(e+" units is invalid");return t/i}function Vr(t,e){return Ot(Mn(t,e))}function Sn(t){let e=t%360;return e<0&&(e+=360),e}function Uo(t){return t=t%360,t>180?t-360:t<-180?t+360:t}function Ot(t){return t%(2*Math.PI)*180/Math.PI}function Ze(t){return t%360*Math.PI/180}function fn(t,e="kilometers",i="kilometers"){if(!(t>=0))throw new Error("length must be a positive number");return er(Mn(t,e),i)}function ts(t,e="meters",i="kilometers"){if(!(t>=0))throw new Error("area must be a positive number");const s=Ur[e];if(!s)throw new Error("invalid original units");const o=Ur[i];if(!o)throw new Error("invalid final units");return t/s*o}function Je(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}function Ce(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function tr(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(t.length!==4&&t.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach(e=>{if(!Je(e))throw new Error("bbox must only contain numbers")})}function Vo(t){if(!t)throw new Error("id is required");if(["string","number"].indexOf(typeof t)===-1)throw new Error("id must be a number or a string")}const vh=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:Ur,azimuthToBearing:Uo,bearingToAzimuth:Sn,convertArea:ts,convertLength:fn,degreesToRadians:Ze,earthRadius:Ke,factors:Xr,feature:We,featureCollection:he,geometry:Bo,geometryCollection:es,isNumber:Je,isObject:Ce,lengthToDegrees:Vr,lengthToRadians:Mn,lineString:Pe,lineStrings:zo,multiLineString:tn,multiPoint:jn,multiPolygon:ft,point:_e,points:Go,polygon:ye,polygons:Yo,radiansToDegrees:Ot,radiansToLength:er,round:Xo,validateBBox:tr,validateId:Vo},Symbol.toStringTag,{value:"Module"}));function Te(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if(t.type==="Feature"&&t.geometry!==null&&t.geometry.type==="Point")return[...t.geometry.coordinates];if(t.type==="Point")return[...t.coordinates]}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return[...t];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function ve(t){if(Array.isArray(t))return t;if(t.type==="Feature"){if(t.geometry!==null)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function ns(t){if(t.length>1&&Je(t[0])&&Je(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return ns(t[0]);throw new Error("coordinates must only contain numbers")}function Ho(t,e,i){if(!e||!i)throw new Error("type and name required");if(!t||t.type!==e)throw new Error("Invalid input to "+i+": must be a "+e+", given "+t.type)}function nr(t,e,i){if(!t)throw new Error("No feature passed");if(!i)throw new Error(".featureOf() requires a name");if(!t||t.type!=="Feature"||!t.geometry)throw new Error("Invalid input to "+i+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+i+": must be a "+e+", given "+t.geometry.type)}function Ut(t,e,i){if(!t)throw new Error("No featureCollection passed");if(!i)throw new Error(".collectionOf() requires a name");if(!t||t.type!=="FeatureCollection")throw new Error("Invalid input to "+i+", FeatureCollection required");for(const s of t.features){if(!s||s.type!=="Feature"||!s.geometry)throw new Error("Invalid input to "+i+", Feature with geometry required");if(!s.geometry||s.geometry.type!==e)throw new Error("Invalid input to "+i+": must be a "+e+", given "+s.geometry.type)}}function qe(t){return t.type==="Feature"?t.geometry:t}function gt(t,e){return t.type==="FeatureCollection"?"FeatureCollection":t.type==="GeometryCollection"?"GeometryCollection":t.type==="Feature"&&t.geometry!==null?t.geometry.type:t.type}const yh=Object.freeze(Object.defineProperty({__proto__:null,collectionOf:Ut,containsNumber:ns,featureOf:nr,geojsonType:Ho,getCoord:Te,getCoords:ve,getGeom:qe,getType:gt},Symbol.toStringTag,{value:"Module"}));function nn(t,e,i={}){if(i.final===!0)return mh(t,e);const s=Te(t),o=Te(e),l=Ze(s[0]),h=Ze(o[0]),c=Ze(s[1]),g=Ze(o[1]),d=Math.sin(h-l)*Math.cos(g),y=Math.cos(c)*Math.sin(g)-Math.sin(c)*Math.cos(g)*Math.cos(h-l);return Ot(Math.atan2(d,y))}function mh(t,e){let i=nn(e,t);return i=(i+180)%360,i}function rn(t,e,i,s={}){const o=Te(t),l=Ze(o[0]),h=Ze(o[1]),c=Ze(i),g=Mn(e,s.units),d=Math.asin(Math.sin(h)*Math.cos(g)+Math.cos(h)*Math.sin(g)*Math.cos(c)),y=l+Math.atan2(Math.sin(c)*Math.sin(g)*Math.cos(h),Math.cos(g)-Math.sin(h)*Math.sin(d)),v=Ot(y),_=Ot(d);return o[2]!==void 0?_e([v,_,o[2]],s.properties):_e([v,_],s.properties)}function Be(t,e,i={}){var s=Te(t),o=Te(e),l=Ze(o[1]-s[1]),h=Ze(o[0]-s[0]),c=Ze(s[1]),g=Ze(o[1]),d=Math.pow(Math.sin(l/2),2)+Math.pow(Math.sin(h/2),2)*Math.cos(c)*Math.cos(g);return er(2*Math.atan2(Math.sqrt(d),Math.sqrt(1-d)),i.units)}function ph(t,e,i={}){const o=qe(t).coordinates;let l=0;for(let h=0;h<o.length&&!(e>=l&&h===o.length-1);h++)if(l>=e){const c=e-l;if(c){const g=nn(o[h],o[h-1])-180;return rn(o[h],c,g,i)}else return _e(o[h])}else l+=Be(o[h],o[h+1],i);return _e(o[o.length-1])}function gn(t,e,i={}){let s;return i.final?s=$o(Te(e),Te(t)):s=$o(Te(t),Te(e)),s>180?-(360-s):s}function $o(t,e){const i=Ze(t[1]),s=Ze(e[1]);let o=Ze(e[0]-t[0]);o>Math.PI&&(o-=2*Math.PI),o<-Math.PI&&(o+=2*Math.PI);const l=Math.log(Math.tan(s/2+Math.PI/4)/Math.tan(i/2+Math.PI/4)),h=Math.atan2(o,l);return(Ot(h)+360)%360}function _h(t,e,i,s={}){if(!Ce(s))throw new Error("options is invalid");if(!t)throw new Error("startPoint is required");if(!e)throw new Error("midPoint is required");if(!i)throw new Error("endPoint is required");const o=t,l=e,h=i,c=Sn(s.mercator!==!0?nn(l,o):gn(l,o));let g=Sn(s.mercator!==!0?nn(l,h):gn(l,h));g<c&&(g=g+360);const d=g-c;return s.explementary===!0?360-d:d}function Xe(t,e,i){if(t!==null)for(var s,o,l,h,c,g,d,y=0,v=0,_,E=t.type,M=E==="FeatureCollection",R=E==="Feature",Y=M?t.features.length:1,H=0;H<Y;H++){d=M?t.features[H].geometry:R?t.geometry:t,_=d?d.type==="GeometryCollection":!1,c=_?d.geometries.length:1;for(var x=0;x<c;x++){var S=0,b=0;if(h=_?d.geometries[x]:d,h!==null){g=h.coordinates;var C=h.type;switch(y=i&&(C==="Polygon"||C==="MultiPolygon")?1:0,C){case null:break;case"Point":if(e(g,v,H,S,b)===!1)return!1;v++,S++;break;case"LineString":case"MultiPoint":for(s=0;s<g.length;s++){if(e(g[s],v,H,S,b)===!1)return!1;v++,C==="MultiPoint"&&S++}C==="LineString"&&S++;break;case"Polygon":case"MultiLineString":for(s=0;s<g.length;s++){for(o=0;o<g[s].length-y;o++){if(e(g[s][o],v,H,S,b)===!1)return!1;v++}C==="MultiLineString"&&S++,C==="Polygon"&&b++}C==="Polygon"&&S++;break;case"MultiPolygon":for(s=0;s<g.length;s++){for(b=0,o=0;o<g[s].length;o++){for(l=0;l<g[s][o].length-y;l++){if(e(g[s][o][l],v,H,S,b)===!1)return!1;v++}b++}S++}break;case"GeometryCollection":for(s=0;s<h.geometries.length;s++)if(Xe(h.geometries[s],e,i)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function rs(t,e,i,s){var o=i;return Xe(t,function(l,h,c,g,d){h===0&&i===void 0?o=l:o=e(o,l,h,c,g,d)},s),o}function is(t,e){var i;switch(t.type){case"FeatureCollection":for(i=0;i<t.features.length&&e(t.features[i].properties,i)!==!1;i++);break;case"Feature":e(t.properties,0);break}}function Zo(t,e,i){var s=i;return is(t,function(o,l){l===0&&i===void 0?s=o:s=e(s,o,l)}),s}function Le(t,e){if(t.type==="Feature")e(t,0);else if(t.type==="FeatureCollection")for(var i=0;i<t.features.length&&e(t.features[i],i)!==!1;i++);}function ss(t,e,i){var s=i;return Le(t,function(o,l){l===0&&i===void 0?s=o:s=e(s,o,l)}),s}function rr(t){var e=[];return Xe(t,function(i){e.push(i)}),e}function rt(t,e){var i,s,o,l,h,c,g,d,y,v,_=0,E=t.type==="FeatureCollection",M=t.type==="Feature",R=E?t.features.length:1;for(i=0;i<R;i++){for(c=E?t.features[i].geometry:M?t.geometry:t,d=E?t.features[i].properties:M?t.properties:{},y=E?t.features[i].bbox:M?t.bbox:void 0,v=E?t.features[i].id:M?t.id:void 0,g=c?c.type==="GeometryCollection":!1,h=g?c.geometries.length:1,o=0;o<h;o++){if(l=g?c.geometries[o]:c,l===null){if(e(null,_,d,y,v)===!1)return!1;continue}switch(l.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(e(l,_,d,y,v)===!1)return!1;break}case"GeometryCollection":{for(s=0;s<l.geometries.length;s++)if(e(l.geometries[s],_,d,y,v)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}_++}}function os(t,e,i){var s=i;return rt(t,function(o,l,h,c,g){l===0&&i===void 0?s=o:s=e(s,o,l,h,c,g)}),s}function Qe(t,e){rt(t,function(i,s,o,l,h){var c=i===null?null:i.type;switch(c){case null:case"Point":case"LineString":case"Polygon":return e(We(i,o,{bbox:l,id:h}),s,0)===!1?!1:void 0}var g;switch(c){case"MultiPoint":g="Point";break;case"MultiLineString":g="LineString";break;case"MultiPolygon":g="Polygon";break}for(var d=0;d<i.coordinates.length;d++){var y=i.coordinates[d],v={type:g,coordinates:y};if(e(We(v,o),s,d)===!1)return!1}})}function Wo(t,e,i){var s=i;return Qe(t,function(o,l,h){l===0&&h===0&&i===void 0?s=o:s=e(s,o,l,h)}),s}function Vt(t,e){Qe(t,function(i,s,o){var l=0;if(i.geometry){var h=i.geometry.type;if(!(h==="Point"||h==="MultiPoint")){var c,g=0,d=0,y=0;if(Xe(i,function(v,_,E,M,R){if(c===void 0||s>g||M>d||R>y){c=v,g=s,d=M,y=R,l=0;return}var Y=Pe([c,v],i.properties);if(e(Y,s,o,R,l)===!1)return!1;l++,c=v})===!1)return!1}}})}function as(t,e,i){var s=i,o=!1;return Vt(t,function(l,h,c,g,d){o===!1&&i===void 0?s=l:s=e(s,l,h,c,g,d),o=!0}),s}function us(t,e){if(!t)throw new Error("geojson is required");Qe(t,function(i,s,o){if(i.geometry!==null){var l=i.geometry.type,h=i.geometry.coordinates;switch(l){case"LineString":if(e(i,s,o,0,0)===!1)return!1;break;case"Polygon":for(var c=0;c<h.length;c++)if(e(Pe(h[c],i.properties),s,o,c)===!1)return!1;break}}})}function ls(t,e,i){var s=i;return us(t,function(o,l,h,c){l===0&&i===void 0?s=o:s=e(s,o,l,h,c)}),s}function Ko(t,e){if(e=e||{},!Ce(e))throw new Error("options is invalid");var i=e.featureIndex||0,s=e.multiFeatureIndex||0,o=e.geometryIndex||0,l=e.segmentIndex||0,h=e.properties,c;switch(t.type){case"FeatureCollection":i<0&&(i=t.features.length+i),h=h||t.features[i].properties,c=t.features[i].geometry;break;case"Feature":h=h||t.properties,c=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":c=t;break;default:throw new Error("geojson is invalid")}if(c===null)return null;var g=c.coordinates;switch(c.type){case"Point":case"MultiPoint":return null;case"LineString":return l<0&&(l=g.length+l-1),Pe([g[l],g[l+1]],h,e);case"Polygon":return o<0&&(o=g.length+o),l<0&&(l=g[o].length+l-1),Pe([g[o][l],g[o][l+1]],h,e);case"MultiLineString":return s<0&&(s=g.length+s),l<0&&(l=g[s].length+l-1),Pe([g[s][l],g[s][l+1]],h,e);case"MultiPolygon":return s<0&&(s=g.length+s),o<0&&(o=g[s].length+o),l<0&&(l=g[s][o].length-l-1),Pe([g[s][o][l],g[s][o][l+1]],h,e)}throw new Error("geojson is invalid")}function Jo(t,e){if(e=e||{},!Ce(e))throw new Error("options is invalid");var i=e.featureIndex||0,s=e.multiFeatureIndex||0,o=e.geometryIndex||0,l=e.coordIndex||0,h=e.properties,c;switch(t.type){case"FeatureCollection":i<0&&(i=t.features.length+i),h=h||t.features[i].properties,c=t.features[i].geometry;break;case"Feature":h=h||t.properties,c=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":c=t;break;default:throw new Error("geojson is invalid")}if(c===null)return null;var g=c.coordinates;switch(c.type){case"Point":return _e(g,h,e);case"MultiPoint":return s<0&&(s=g.length+s),_e(g[s],h,e);case"LineString":return l<0&&(l=g.length+l),_e(g[l],h,e);case"Polygon":return o<0&&(o=g.length+o),l<0&&(l=g[o].length+l),_e(g[o][l],h,e);case"MultiLineString":return s<0&&(s=g.length+s),l<0&&(l=g[s].length+l),_e(g[s][l],h,e);case"MultiPolygon":return s<0&&(s=g.length+s),o<0&&(o=g[s].length+o),l<0&&(l=g[s][o].length-l),_e(g[s][o][l],h,e)}throw new Error("geojson is invalid")}const xh=Object.freeze(Object.defineProperty({__proto__:null,coordAll:rr,coordEach:Xe,coordReduce:rs,featureEach:Le,featureReduce:ss,findPoint:Jo,findSegment:Ko,flattenEach:Qe,flattenReduce:Wo,geomEach:rt,geomReduce:os,lineEach:us,lineReduce:ls,propEach:is,propReduce:Zo,segmentEach:Vt,segmentReduce:as},Symbol.toStringTag,{value:"Module"}));function ir(t){return os(t,(e,i)=>e+Eh(i),0)}function Eh(t){let e=0,i;switch(t.type){case"Polygon":return Qo(t.coordinates);case"MultiPolygon":for(i=0;i<t.coordinates.length;i++)e+=Qo(t.coordinates[i]);return e;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}function Qo(t){let e=0;if(t&&t.length>0){e+=Math.abs(jo(t[0]));for(let i=1;i<t.length;i++)e-=Math.abs(jo(t[i]))}return e}var wh=Ke*Ke/2,cs=Math.PI/180;function jo(t){const e=t.length-1;if(e<=2)return 0;let i=0,s=0;for(;s<e;){const o=t[s],l=t[s+1===e?0:s+1],h=t[s+2>=e?(s+2)%e:s+2],c=o[0]*cs,g=l[1]*cs,d=h[0]*cs;i+=(d-c)*Math.sin(g),s++}return i*wh}function Fe(t,e={}){if(t.bbox!=null&&e.recompute!==!0)return t.bbox;const i=[1/0,1/0,-1/0,-1/0];return Xe(t,s=>{i[0]>s[0]&&(i[0]=s[0]),i[1]>s[1]&&(i[1]=s[1]),i[2]<s[0]&&(i[2]=s[0]),i[3]<s[1]&&(i[3]=s[1])}),i}function kh(t,e,i){var s=t.length,o=Pn(t[0],e),l=[],h,c,g;let d,y;for(i||(i=[]),h=1;h<s;h++){for(d=t[h-1],y=t[h],c=g=Pn(y,e);;)if(o|c){if(o&c)break;o?(d=hs(d,y,o,e),o=Pn(d,e)):(y=hs(d,y,c,e),c=Pn(y,e))}else{l.push(d),c!==g?(l.push(y),h<s-1&&(i.push(l),l=[])):h===s-1&&l.push(y);break}o=g}return l.length&&i.push(l),i}function Ih(t,e){var i,s,o,l,h,c,g;for(s=1;s<=8;s*=2){for(i=[],o=t[t.length-1],l=!(Pn(o,e)&s),h=0;h<t.length;h++)c=t[h],g=!(Pn(c,e)&s),g!==l&&i.push(hs(o,c,s,e)),g&&i.push(c),o=c,l=g;if(t=i,!t.length)break}return i}function hs(t,e,i,s){return i&8?[t[0]+(e[0]-t[0])*(s[3]-t[1])/(e[1]-t[1]),s[3]]:i&4?[t[0]+(e[0]-t[0])*(s[1]-t[1])/(e[1]-t[1]),s[1]]:i&2?[s[2],t[1]+(e[1]-t[1])*(s[2]-t[0])/(e[0]-t[0])]:i&1?[s[0],t[1]+(e[1]-t[1])*(s[0]-t[0])/(e[0]-t[0])]:null}function Pn(t,e){var i=0;return t[0]<e[0]?i|=1:t[0]>e[2]&&(i|=2),t[1]<e[1]?i|=4:t[1]>e[3]&&(i|=8),i}function Nh(t,e){const i=qe(t),s=i.type,o=t.type==="Feature"?t.properties:{};let l=i.coordinates;switch(s){case"LineString":case"MultiLineString":{const h=[];return s==="LineString"&&(l=[l]),l.forEach(c=>{kh(c,e,h)}),h.length===1?Pe(h[0],o):tn(h,o)}case"Polygon":return ye(ea(l,e),o);case"MultiPolygon":return ft(l.map(h=>ea(h,e)),o);default:throw new Error("geometry "+s+" not supported")}}function ea(t,e){const i=[];for(const s of t){const o=Ih(s,e);o.length>0&&((o[0][0]!==o[o.length-1][0]||o[0][1]!==o[o.length-1][1])&&o.push(o[0]),o.length>=4&&i.push(o))}return i}function sr(t,e={}){const i=Number(t[0]),s=Number(t[1]),o=Number(t[2]),l=Number(t[3]);if(t.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");const h=[i,s];return ye([[h,[o,s],[o,l],[i,l],h]],e.properties,{bbox:t,id:e.id})}var Mh=class{constructor(t){this.points=t.points||[],this.duration=t.duration||1e4,this.sharpness=t.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=t.stepLength||60,this.length=this.points.length,this.delay=0;for(let e=0;e<this.length;e++)this.points[e].z=this.points[e].z||0;for(let e=0;e<this.length-1;e++){const i=this.points[e],s=this.points[e+1];this.centers.push({x:(i.x+s.x)/2,y:(i.y+s.y)/2,z:(i.z+s.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(let e=0;e<this.centers.length-1;e++){const i=this.points[e+1].x-(this.centers[e].x+this.centers[e+1].x)/2,s=this.points[e+1].y-(this.centers[e].y+this.centers[e+1].y)/2,o=this.points[e+1].z-(this.centers[e].y+this.centers[e+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e].x+i),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e].y+s),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e].z+o)},{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e+1].x+i),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e+1].y+s),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e+1].z+o)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}cacheSteps(t){const e=[];let i=this.pos(0);e.push(0);for(let s=0;s<this.duration;s+=10){const o=this.pos(s);Math.sqrt((o.x-i.x)*(o.x-i.x)+(o.y-i.y)*(o.y-i.y)+(o.z-i.z)*(o.z-i.z))>t&&(e.push(s),i=o)}return e}vector(t){const e=this.pos(t+10),i=this.pos(t-10);return{angle:180*Math.atan2(e.y-i.y,e.x-i.x)/3.14,speed:Math.sqrt((i.x-e.x)*(i.x-e.x)+(i.y-e.y)*(i.y-e.y)+(i.z-e.z)*(i.z-e.z))}}pos(t){let e=t-this.delay;e<0&&(e=0),e>this.duration&&(e=this.duration-1);const i=e/this.duration;if(i>=1)return this.points[this.length-1];const s=Math.floor((this.points.length-1)*i),o=(this.length-1)*i-s;return Sh(o,this.points[s],this.controls[s][1],this.controls[s+1][0],this.points[s+1])}};function Sh(t,e,i,s,o){const l=Ph(t);return{x:o.x*l[0]+s.x*l[1]+i.x*l[2]+e.x*l[3],y:o.y*l[0]+s.y*l[1]+i.y*l[2]+e.y*l[3],z:o.z*l[0]+s.z*l[1]+i.z*l[2]+e.z*l[3]}}function Ph(t){const e=t*t;return[e*t,3*e*(1-t),3*t*(1-t)*(1-t),(1-t)*(1-t)*(1-t)]}function Lh(t,e={}){const i=e.resolution||1e4,s=e.sharpness||.85,o=[],l=qe(t).coordinates.map(d=>({x:d[0],y:d[1]})),h=new Mh({duration:i,points:l,sharpness:s}),c=d=>{var y=h.pos(d);Math.floor(d/100)%2===0&&o.push([y.x,y.y])};for(var g=0;g<h.duration;g+=10)c(g);return c(h.duration),Pe(o,e.properties)}function Hr(t){const e=ve(t);let i=0,s=1,o,l;for(;s<e.length;)o=l||e[0],l=e[s],i+=(l[0]-o[0])*(l[1]+o[1]),s++;return i>0}function bh(t){const e=qe(t).coordinates;if(e[0].length<=4)return!1;let i=!1;const s=e[0].length-1;for(let o=0;o<s;o++){const l=e[0][(o+2)%s][0]-e[0][(o+1)%s][0],h=e[0][(o+2)%s][1]-e[0][(o+1)%s][1],c=e[0][o][0]-e[0][(o+1)%s][0],g=e[0][o][1]-e[0][(o+1)%s][1],d=l*g-h*c;if(o===0)i=d>0;else if(i!==d>0)return!0}return!1}const Ht=11102230246251565e-32,st=134217729,Ch=(3+8*Ht)*Ht;function fs(t,e,i,s,o){let l,h,c,g,d=e[0],y=s[0],v=0,_=0;y>d==y>-d?(l=d,d=e[++v]):(l=y,y=s[++_]);let E=0;if(v<t&&_<i)for(y>d==y>-d?(h=d+l,c=l-(h-d),d=e[++v]):(h=y+l,c=l-(h-y),y=s[++_]),l=h,c!==0&&(o[E++]=c);v<t&&_<i;)y>d==y>-d?(h=l+d,g=h-l,c=l-(h-g)+(d-g),d=e[++v]):(h=l+y,g=h-l,c=l-(h-g)+(y-g),y=s[++_]),l=h,c!==0&&(o[E++]=c);for(;v<t;)h=l+d,g=h-l,c=l-(h-g)+(d-g),d=e[++v],l=h,c!==0&&(o[E++]=c);for(;_<i;)h=l+y,g=h-l,c=l-(h-g)+(y-g),y=s[++_],l=h,c!==0&&(o[E++]=c);return(l!==0||E===0)&&(o[E++]=l),E}function Th(t,e){let i=e[0];for(let s=1;s<t;s++)i+=e[s];return i}function or(t){return new Float64Array(t)}const Oh=(3+16*Ht)*Ht,Rh=(2+12*Ht)*Ht,Ah=(9+64*Ht)*Ht*Ht,Ln=or(4),ta=or(8),na=or(12),ra=or(16),lt=or(4);function Dh(t,e,i,s,o,l,h){let c,g,d,y,v,_,E,M,R,Y,H,x,S,b,C,A,q,w;const N=t-o,L=i-o,D=e-l,F=s-l;b=N*F,_=st*N,E=_-(_-N),M=N-E,_=st*F,R=_-(_-F),Y=F-R,C=M*Y-(b-E*R-M*R-E*Y),A=D*L,_=st*D,E=_-(_-D),M=D-E,_=st*L,R=_-(_-L),Y=L-R,q=M*Y-(A-E*R-M*R-E*Y),H=C-q,v=C-H,Ln[0]=C-(H+v)+(v-q),x=b+H,v=x-b,S=b-(x-v)+(H-v),H=S-A,v=S-H,Ln[1]=S-(H+v)+(v-A),w=x+H,v=w-x,Ln[2]=x-(w-v)+(H-v),Ln[3]=w;let X=Th(4,Ln),z=Rh*h;if(X>=z||-X>=z||(v=t-N,c=t-(N+v)+(v-o),v=i-L,d=i-(L+v)+(v-o),v=e-D,g=e-(D+v)+(v-l),v=s-F,y=s-(F+v)+(v-l),c===0&&g===0&&d===0&&y===0)||(z=Ah*h+Ch*Math.abs(X),X+=N*y+F*c-(D*d+L*g),X>=z||-X>=z))return X;b=c*F,_=st*c,E=_-(_-c),M=c-E,_=st*F,R=_-(_-F),Y=F-R,C=M*Y-(b-E*R-M*R-E*Y),A=g*L,_=st*g,E=_-(_-g),M=g-E,_=st*L,R=_-(_-L),Y=L-R,q=M*Y-(A-E*R-M*R-E*Y),H=C-q,v=C-H,lt[0]=C-(H+v)+(v-q),x=b+H,v=x-b,S=b-(x-v)+(H-v),H=S-A,v=S-H,lt[1]=S-(H+v)+(v-A),w=x+H,v=w-x,lt[2]=x-(w-v)+(H-v),lt[3]=w;const V=fs(4,Ln,4,lt,ta);b=N*y,_=st*N,E=_-(_-N),M=N-E,_=st*y,R=_-(_-y),Y=y-R,C=M*Y-(b-E*R-M*R-E*Y),A=D*d,_=st*D,E=_-(_-D),M=D-E,_=st*d,R=_-(_-d),Y=d-R,q=M*Y-(A-E*R-M*R-E*Y),H=C-q,v=C-H,lt[0]=C-(H+v)+(v-q),x=b+H,v=x-b,S=b-(x-v)+(H-v),H=S-A,v=S-H,lt[1]=S-(H+v)+(v-A),w=x+H,v=w-x,lt[2]=x-(w-v)+(H-v),lt[3]=w;const k=fs(V,ta,4,lt,na);b=c*y,_=st*c,E=_-(_-c),M=c-E,_=st*y,R=_-(_-y),Y=y-R,C=M*Y-(b-E*R-M*R-E*Y),A=g*d,_=st*g,E=_-(_-g),M=g-E,_=st*d,R=_-(_-d),Y=d-R,q=M*Y-(A-E*R-M*R-E*Y),H=C-q,v=C-H,lt[0]=C-(H+v)+(v-q),x=b+H,v=x-b,S=b-(x-v)+(H-v),H=S-A,v=S-H,lt[1]=S-(H+v)+(v-A),w=x+H,v=w-x,lt[2]=x-(w-v)+(H-v),lt[3]=w;const T=fs(k,na,4,lt,ra);return ra[T-1]}function Fh(t,e,i,s,o,l){const h=(e-l)*(i-o),c=(t-o)*(s-l),g=h-c,d=Math.abs(h+c);return Math.abs(g)>=Oh*d?g:-Dh(t,e,i,s,o,l,d)}function qh(t,e){var i,s,o=0,l,h,c,g,d,y,v,_=t[0],E=t[1],M=e.length;for(i=0;i<M;i++){s=0;var R=e[i],Y=R.length-1;if(y=R[0],y[0]!==R[Y][0]&&y[1]!==R[Y][1])throw new Error("First and last coordinates in a ring must be the same");for(h=y[0]-_,c=y[1]-E,s;s<Y;s++){if(v=R[s+1],g=v[0]-_,d=v[1]-E,c===0&&d===0){if(g<=0&&h>=0||h<=0&&g>=0)return 0}else if(d>=0&&c<=0||d<=0&&c>=0){if(l=Fh(h,g,c,d,0,0),l===0)return 0;(l>0&&d>0&&c<=0||l<0&&d<=0&&c>0)&&o++}y=v,c=d,h=g}}return o%2!==0}function xe(t,e,i={}){if(!t)throw new Error("point is required");if(!e)throw new Error("polygon is required");const s=Te(t),o=qe(e),l=o.type,h=e.bbox;let c=o.coordinates;if(h&&Bh(s,h)===!1)return!1;l==="Polygon"&&(c=[c]);let g=!1;for(var d=0;d<c.length;++d){const y=qh(s,c[d]);if(y===0)return!i.ignoreBoundary;y&&(g=!0)}return g}function Bh(t,e){return e[0]<=t[0]&&e[1]<=t[1]&&e[2]>=t[0]&&e[3]>=t[1]}function we(t,e,i={}){const s=Te(t),o=ve(e);for(let l=0;l<o.length-1;l++){let h=!1;if(i.ignoreEndVertices&&(l===0&&(h="start"),l===o.length-2&&(h="end"),l===0&&l+1===o.length-1&&(h="both")),Gh(o[l],o[l+1],s,h,typeof i.epsilon>"u"?null:i.epsilon))return!0}return!1}function Gh(t,e,i,s,o){const l=i[0],h=i[1],c=t[0],g=t[1],d=e[0],y=e[1],v=i[0]-c,_=i[1]-g,E=d-c,M=y-g,R=v*M-_*E;if(o!==null){if(Math.abs(R)>o)return!1}else if(R!==0)return!1;if(Math.abs(E)===Math.abs(M)&&Math.abs(E)===0)return s?!1:i[0]===t[0]&&i[1]===t[1];if(s){if(s==="start")return Math.abs(E)>=Math.abs(M)?E>0?c<l&&l<=d:d<=l&&l<c:M>0?g<h&&h<=y:y<=h&&h<g;if(s==="end")return Math.abs(E)>=Math.abs(M)?E>0?c<=l&&l<d:d<l&&l<=c:M>0?g<=h&&h<y:y<h&&h<=g;if(s==="both")return Math.abs(E)>=Math.abs(M)?E>0?c<l&&l<d:d<l&&l<c:M>0?g<h&&h<y:y<h&&h<g}else return Math.abs(E)>=Math.abs(M)?E>0?c<=l&&l<=d:d<=l&&l<=c:M>0?g<=h&&h<=y:y<=h&&h<=g;return!1}function Yh(t,e){const i=qe(t),s=qe(e),o=i.type,l=s.type,h=i.coordinates,c=s.coordinates;switch(o){case"Point":if(l==="Point")return gs(h,c);throw new Error("feature2 "+l+" geometry not supported");case"MultiPoint":switch(l){case"Point":return Xh(i,s);case"MultiPoint":return Uh(i,s);default:throw new Error("feature2 "+l+" geometry not supported")}case"LineString":switch(l){case"Point":return we(s,i,{ignoreEndVertices:!0});case"LineString":return $h(i,s);case"MultiPoint":return Vh(i,s);default:throw new Error("feature2 "+l+" geometry not supported")}case"Polygon":switch(l){case"Point":return xe(s,i,{ignoreBoundary:!0});case"LineString":return Zh(i,s);case"Polygon":return ia(i,s);case"MultiPoint":return Hh(i,s);default:throw new Error("feature2 "+l+" geometry not supported")}case"MultiPolygon":if(l==="Polygon")return zh(i,s);throw new Error("feature2 "+l+" geometry not supported");default:throw new Error("feature1 "+o+" geometry not supported")}}function zh(t,e){return t.coordinates.some(i=>ia({type:"Polygon",coordinates:i},e))}function Xh(t,e){let i,s=!1;for(i=0;i<t.coordinates.length;i++)if(gs(t.coordinates[i],e.coordinates)){s=!0;break}return s}function Uh(t,e){for(const i of e.coordinates){let s=!1;for(const o of t.coordinates)if(gs(i,o)){s=!0;break}if(!s)return!1}return!0}function Vh(t,e){let i=!1;for(const s of e.coordinates)if(we(s,t,{ignoreEndVertices:!0})&&(i=!0),!we(s,t))return!1;return!!i}function Hh(t,e){for(const i of e.coordinates)if(!xe(i,t,{ignoreBoundary:!0}))return!1;return!0}function $h(t,e){let i=!1;for(const s of e.coordinates)if(we({type:"Point",coordinates:s},t,{ignoreEndVertices:!0})&&(i=!0),!we({type:"Point",coordinates:s},t,{ignoreEndVertices:!1}))return!1;return i}function Zh(t,e){let i=!1,s=0;const o=Fe(t),l=Fe(e);if(!sa(o,l))return!1;for(s;s<e.coordinates.length-1;s++){const h=Wh(e.coordinates[s],e.coordinates[s+1]);if(xe({type:"Point",coordinates:h},t,{ignoreBoundary:!0})){i=!0;break}}return i}function ia(t,e){if(t.type==="Feature"&&t.geometry===null||e.type==="Feature"&&e.geometry===null)return!1;const i=Fe(t),s=Fe(e);if(!sa(i,s))return!1;const o=qe(e).coordinates;for(const l of o)for(const h of l)if(!xe(h,t))return!1;return!0}function sa(t,e){return!(t[0]>e[0]||t[2]<e[2]||t[1]>e[1]||t[3]<e[3])}function gs(t,e){return t[0]===e[0]&&t[1]===e[1]}function Wh(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2]}let oa=class{constructor(e=[],i=Kh){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],i=this.data.pop();return this.length--,this.length>0&&(this.data[0]=i,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:i,compare:s}=this,o=i[e];for(;e>0;){const l=e-1>>1,h=i[l];if(s(o,h)>=0)break;i[e]=h,e=l}i[e]=o}_down(e){const{data:i,compare:s}=this,o=this.length>>1,l=i[e];for(;e<o;){let h=(e<<1)+1,c=i[h];const g=h+1;if(g<this.length&&s(i[g],c)<0&&(h=g,c=i[g]),s(c,l)>=0)break;i[e]=c,e=h}i[e]=l}};function Kh(t,e){return t<e?-1:t>e?1:0}function aa(t,e){return t.p.x>e.p.x?1:t.p.x<e.p.x?-1:t.p.y!==e.p.y?t.p.y>e.p.y?1:-1:1}function Jh(t,e){return t.rightSweepEvent.p.x>e.rightSweepEvent.p.x?1:t.rightSweepEvent.p.x<e.rightSweepEvent.p.x?-1:t.rightSweepEvent.p.y!==e.rightSweepEvent.p.y?t.rightSweepEvent.p.y<e.rightSweepEvent.p.y?1:-1:1}class ua{constructor(e,i,s,o){this.p={x:e[0],y:e[1]},this.featureId=i,this.ringId=s,this.eventId=o,this.otherEvent=null,this.isLeftEndpoint=null}isSamePoint(e){return this.p.x===e.p.x&&this.p.y===e.p.y}}function Qh(t,e){if(t.type==="FeatureCollection"){const i=t.features;for(let s=0;s<i.length;s++)la(i[s],e)}else la(t,e)}let $r=0,Zr=0,Wr=0;function la(t,e){const i=t.type==="Feature"?t.geometry:t;let s=i.coordinates;(i.type==="Polygon"||i.type==="MultiLineString")&&(s=[s]),i.type==="LineString"&&(s=[[s]]);for(let o=0;o<s.length;o++)for(let l=0;l<s[o].length;l++){let h=s[o][l][0],c=null;Zr=Zr+1;for(let g=0;g<s[o][l].length-1;g++){c=s[o][l][g+1];const d=new ua(h,$r,Zr,Wr),y=new ua(c,$r,Zr,Wr+1);d.otherEvent=y,y.otherEvent=d,aa(d,y)>0?(y.isLeftEndpoint=!0,d.isLeftEndpoint=!1):(d.isLeftEndpoint=!0,y.isLeftEndpoint=!1),e.push(d),e.push(y),h=c,Wr=Wr+1}}$r=$r+1}let jh=class{constructor(e){this.leftSweepEvent=e,this.rightSweepEvent=e.otherEvent}};function ef(t,e){if(t===null||e===null||t.leftSweepEvent.ringId===e.leftSweepEvent.ringId&&(t.rightSweepEvent.isSamePoint(e.leftSweepEvent)||t.rightSweepEvent.isSamePoint(e.leftSweepEvent)||t.rightSweepEvent.isSamePoint(e.rightSweepEvent)||t.leftSweepEvent.isSamePoint(e.leftSweepEvent)||t.leftSweepEvent.isSamePoint(e.rightSweepEvent)))return!1;const i=t.leftSweepEvent.p.x,s=t.leftSweepEvent.p.y,o=t.rightSweepEvent.p.x,l=t.rightSweepEvent.p.y,h=e.leftSweepEvent.p.x,c=e.leftSweepEvent.p.y,g=e.rightSweepEvent.p.x,d=e.rightSweepEvent.p.y,y=(d-c)*(o-i)-(g-h)*(l-s),v=(g-h)*(s-c)-(d-c)*(i-h),_=(o-i)*(s-c)-(l-s)*(i-h);if(y===0)return!1;const E=v/y,M=_/y;if(E>=0&&E<=1&&M>=0&&M<=1){const R=i+E*(o-i),Y=s+E*(l-s);return[R,Y]}return!1}function tf(t,e){e=e||!1;const i=[],s=new oa([],Jh);for(;t.length;){const o=t.pop();if(o.isLeftEndpoint){const l=new jh(o);for(let h=0;h<s.data.length;h++){const c=s.data[h];if(e&&c.leftSweepEvent.featureId===o.featureId)continue;const g=ef(l,c);g!==!1&&i.push(g)}s.push(l)}else o.isLeftEndpoint===!1&&s.pop()}return i}function nf(t,e){const i=new oa([],aa);return Qh(t,i),tf(i,e)}var rf=nf;function Rt(t,e,i={}){const{removeDuplicates:s=!0,ignoreSelfIntersections:o=!0}=i;let l=[];t.type==="FeatureCollection"?l=l.concat(t.features):t.type==="Feature"?l.push(t):(t.type==="LineString"||t.type==="Polygon"||t.type==="MultiLineString"||t.type==="MultiPolygon")&&l.push(We(t)),e.type==="FeatureCollection"?l=l.concat(e.features):e.type==="Feature"?l.push(e):(e.type==="LineString"||e.type==="Polygon"||e.type==="MultiLineString"||e.type==="MultiPolygon")&&l.push(We(e));const h=rf(he(l),o);let c=[];if(s){const g={};h.forEach(d=>{const y=d.join(",");g[y]||(g[y]=!0,c.push(d))})}else c=h;return he(c.map(g=>_e(g)))}function bn(t,e={}){const i=qe(t);switch(!e.properties&&t.type==="Feature"&&(e.properties=t.properties),i.type){case"Polygon":return sf(i,e);case"MultiPolygon":return of(i,e);default:throw new Error("invalid poly")}}function sf(t,e={}){const s=qe(t).coordinates,o=e.properties?e.properties:t.type==="Feature"?t.properties:{};return ca(s,o)}function of(t,e={}){const s=qe(t).coordinates,o=e.properties?e.properties:t.type==="Feature"?t.properties:{},l=[];return s.forEach(h=>{l.push(ca(h,o))}),he(l)}function ca(t,e){return t.length>1?tn(t,e):Pe(t[0],e)}function ha(t,e){var i=qe(t),s=qe(e),o=i.type,l=s.type;switch(o){case"MultiPoint":switch(l){case"LineString":return fa(i,s);case"Polygon":return da(i,s);default:throw new Error("feature2 "+l+" geometry not supported")}case"LineString":switch(l){case"MultiPoint":return fa(s,i);case"LineString":return af(i,s);case"Polygon":return ga(i,s);default:throw new Error("feature2 "+l+" geometry not supported")}case"Polygon":switch(l){case"MultiPoint":return da(s,i);case"LineString":return ga(s,i);default:throw new Error("feature2 "+l+" geometry not supported")}default:throw new Error("feature1 "+o+" geometry not supported")}}function fa(t,e){for(var i=!1,s=!1,o=t.coordinates.length,l=0;l<o&&!i&&!s;){for(var h=0;h<e.coordinates.length-1;h++){var c=!0;(h===0||h===e.coordinates.length-2)&&(c=!1),va(e.coordinates[h],e.coordinates[h+1],t.coordinates[l],c)?i=!0:s=!0}l++}return i&&s}function af(t,e){var i=Rt(t,e);if(i.features.length>0)for(var s=0;s<t.coordinates.length-1;s++)for(var o=0;o<e.coordinates.length-1;o++){var l=!0;if((o===0||o===e.coordinates.length-2)&&(l=!1),va(t.coordinates[s],t.coordinates[s+1],e.coordinates[o],l))return!0}return!1}function ga(t,e){const i=bn(e);return Rt(t,i).features.length>0}function da(t,e){var i=!1,s=!1,o=t.coordinates.length;for(let l=0;l<o&&(!i||!s);l++)xe(_e(t.coordinates[l]),e)?i=!0:s=!0;return s&&i}function va(t,e,i,s){var o=i[0]-t[0],l=i[1]-t[1],h=e[0]-t[0],c=e[1]-t[1],g=o*c-l*h;return g!==0?!1:s?Math.abs(h)>=Math.abs(c)?h>0?t[0]<=i[0]&&i[0]<=e[0]:e[0]<=i[0]&&i[0]<=t[0]:c>0?t[1]<=i[1]&&i[1]<=e[1]:e[1]<=i[1]&&i[1]<=t[1]:Math.abs(h)>=Math.abs(c)?h>0?t[0]<i[0]&&i[0]<e[0]:e[0]<i[0]&&i[0]<t[0]:c>0?t[1]<i[1]&&i[1]<e[1]:e[1]<i[1]&&i[1]<t[1]}function ds(t,e,{ignoreSelfIntersections:i=!0}={ignoreSelfIntersections:!0}){let s=!0;return Qe(t,o=>{Qe(e,l=>{if(s===!1)return!1;s=uf(o.geometry,l.geometry,i)})}),s}function uf(t,e,i){switch(t.type){case"Point":switch(e.type){case"Point":return!ff(t.coordinates,e.coordinates);case"LineString":return!ya(e,t);case"Polygon":return!xe(t,e)}break;case"LineString":switch(e.type){case"Point":return!ya(t,e);case"LineString":return!lf(t,e,i);case"Polygon":return!ma(e,t,i)}break;case"Polygon":switch(e.type){case"Point":return!xe(e,t);case"LineString":return!ma(t,e,i);case"Polygon":return!cf(e,t,i)}}return!1}function ya(t,e){for(let i=0;i<t.coordinates.length-1;i++)if(hf(t.coordinates[i],t.coordinates[i+1],e.coordinates))return!0;return!1}function lf(t,e,i){return Rt(t,e,{ignoreSelfIntersections:i}).features.length>0}function ma(t,e,i){for(const o of e.coordinates)if(xe(o,t))return!0;return Rt(e,bn(t),{ignoreSelfIntersections:i}).features.length>0}function cf(t,e,i){for(const o of t.coordinates[0])if(xe(o,e))return!0;for(const o of e.coordinates[0])if(xe(o,t))return!0;return Rt(bn(t),bn(e),{ignoreSelfIntersections:i}).features.length>0}function hf(t,e,i){const s=i[0]-t[0],o=i[1]-t[1],l=e[0]-t[0],h=e[1]-t[1];return s*h-o*l!==0?!1:Math.abs(l)>=Math.abs(h)?l>0?t[0]<=i[0]&&i[0]<=e[0]:e[0]<=i[0]&&i[0]<=t[0]:h>0?t[1]<=i[1]&&i[1]<=e[1]:e[1]<=i[1]&&i[1]<=t[1]}function ff(t,e){return t[0]===e[0]&&t[1]===e[1]}var gf=Object.defineProperty,Cn=(t,e)=>gf(t,"name",{value:e,configurable:!0}),pa=class{constructor(e){this.direction=!1,this.compareProperties=!0;var i,s,o;this.precision=10**-((i=e?.precision)!=null?i:17),this.direction=(s=e?.direction)!=null?s:!1,this.compareProperties=(o=e?.compareProperties)!=null?o:!0}compare(e,i){if(e.type!==i.type||!ar(e,i))return!1;switch(e.type){case"Point":return this.compareCoord(e.coordinates,i.coordinates);case"LineString":return this.compareLine(e.coordinates,i.coordinates);case"Polygon":return this.comparePolygon(e,i);case"GeometryCollection":return this.compareGeometryCollection(e,i);case"Feature":return this.compareFeature(e,i);case"FeatureCollection":return this.compareFeatureCollection(e,i);default:if(e.type.startsWith("Multi")){const s=vs(e),o=vs(i);return s.every(l=>o.some(h=>this.compare(l,h)))}}return!1}compareCoord(e,i){return e.length===i.length&&e.every((s,o)=>Math.abs(s-i[o])<this.precision)}compareLine(e,i,s=0,o=!1){if(!ar(e,i))return!1;const l=e;let h=i;if(o&&!this.compareCoord(l[0],h[0])){const g=this.fixStartIndex(h,l);if(g)h=g;else return!1}const c=this.compareCoord(l[s],h[s]);return this.direction||c?this.comparePath(l,h):this.compareCoord(l[s],h[h.length-(1+s)])?this.comparePath(l.slice().reverse(),h):!1}fixStartIndex(e,i){let s,o=-1;for(let l=0;l<e.length;l++)if(this.compareCoord(e[l],i[0])){o=l;break}return o>=0&&(s=[].concat(e.slice(o,e.length),e.slice(1,o+1))),s}comparePath(e,i){return e.every((s,o)=>this.compareCoord(s,i[o]))}comparePolygon(e,i){if(this.compareLine(e.coordinates[0],i.coordinates[0],1,!0)){const s=e.coordinates.slice(1,e.coordinates.length),o=i.coordinates.slice(1,i.coordinates.length);return s.every(l=>o.some(h=>this.compareLine(l,h,1,!0)))}return!1}compareGeometryCollection(e,i){return ar(e.geometries,i.geometries)&&this.compareBBox(e,i)&&e.geometries.every((s,o)=>this.compare(s,i.geometries[o]))}compareFeature(e,i){return e.id===i.id&&(this.compareProperties?ms(e.properties,i.properties):!0)&&this.compareBBox(e,i)&&this.compare(e.geometry,i.geometry)}compareFeatureCollection(e,i){return ar(e.features,i.features)&&this.compareBBox(e,i)&&e.features.every((s,o)=>this.compare(s,i.features[o]))}compareBBox(e,i){return!e.bbox&&!i.bbox||(e.bbox&&i.bbox?this.compareCoord(e.bbox,i.bbox):!1)}};Cn(pa,"GeojsonEquality");var df=pa;function ar(t,e){return t.coordinates?t.coordinates.length===e.coordinates.length:t.length===e.length}Cn(ar,"sameLength");function vs(t){return t.coordinates.map(e=>({type:t.type.replace("Multi",""),coordinates:e}))}Cn(vs,"explode");function ys(t,e,i){return new df(i).compare(t,e)}Cn(ys,"geojsonEquality");function ms(t,e){if(t===null&&e===null)return!0;if(t===null||e===null)return!1;const i=Object.keys(t),s=Object.keys(e);if(i.length!==s.length)return!1;for(var o of i){const l=t[o],h=e[o],c=_a(l)&&_a(h);if(c&&!ms(l,h)||!c&&l!==h)return!1}return!0}Cn(ms,"equal");var _a=Cn(t=>t!=null&&typeof t=="object","isObject");function dn(t,e={}){var i=typeof e=="object"?e.mutate:e;if(!t)throw new Error("geojson is required");var s=gt(t),o=[];switch(s){case"LineString":o=ps(t,s);break;case"MultiLineString":case"Polygon":ve(t).forEach(function(h){o.push(ps(h,s))});break;case"MultiPolygon":ve(t).forEach(function(h){var c=[];h.forEach(function(g){c.push(ps(g,s))}),o.push(c)});break;case"Point":return t;case"MultiPoint":var l={};ve(t).forEach(function(h){var c=h.join("-");Object.prototype.hasOwnProperty.call(l,c)||(o.push(h),l[c]=!0)});break;default:throw new Error(s+" geometry not supported")}return t.coordinates?i===!0?(t.coordinates=o,t):{type:s,coordinates:o}:i===!0?(t.geometry.coordinates=o,t):We({type:s,coordinates:o},t.properties,{bbox:t.bbox,id:t.id})}function ps(t,e){const i=ve(t);if(i.length===2&&!xa(i[0],i[1]))return i;const s=[];let o=0,l=1,h=2;for(s.push(i[o]);h<i.length;)we(i[l],Pe([i[o],i[h]]))?l=h:(s.push(i[l]),o=l,l++,h=l),h++;if(s.push(i[l]),e==="Polygon"||e==="MultiPolygon"){if(we(s[0],Pe([s[1],s[s.length-2]]))&&(s.shift(),s.pop(),s.push(s[0])),s.length<4)throw new Error("invalid polygon, fewer than 4 points");if(!xa(s[0],s[s.length-1]))throw new Error("invalid polygon, first and last points not equal")}return s}function xa(t,e){return t[0]===e[0]&&t[1]===e[1]}function vf(t,e,i={}){let s=i.precision;if(s=s==null||isNaN(s)?6:s,typeof s!="number"||!(s>=0))throw new Error("precision must be a positive number");const o=qe(t).type,l=qe(e).type;return o!==l?!1:ys(dn(t),dn(e),{precision:s})}function Ea(t,e,{ignoreSelfIntersections:i=!0}={}){let s=!1;return Qe(t,o=>{Qe(e,l=>{if(s===!0)return!0;s=!ds(o.geometry,l.geometry,{ignoreSelfIntersections:i})})}),s}function yf(t,e,i,s,o){wa(t,e,i||0,s||t.length-1,o||mf)}function wa(t,e,i,s,o){for(;s>i;){if(s-i>600){var l=s-i+1,h=e-i+1,c=Math.log(l),g=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*g*(l-g)/l)*(h-l/2<0?-1:1),y=Math.max(i,Math.floor(e-h*g/l+d)),v=Math.min(s,Math.floor(e+(l-h)*g/l+d));wa(t,e,y,v,o)}var _=t[e],E=i,M=s;for(ur(t,i,e),o(t[s],_)>0&&ur(t,i,s);E<M;){for(ur(t,E,M),E++,M--;o(t[E],_)<0;)E++;for(;o(t[M],_)>0;)M--}o(t[i],_)===0?ur(t,i,M):(M++,ur(t,M,s)),M<=e&&(i=M+1),e<=M&&(s=M-1)}}function ur(t,e,i){var s=t[e];t[e]=t[i],t[i]=s}function mf(t,e){return t<e?-1:t>e?1:0}class dt{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let i=this.data;const s=[];if(!Jr(e,i))return s;const o=this.toBBox,l=[];for(;i;){for(let h=0;h<i.children.length;h++){const c=i.children[h],g=i.leaf?o(c):c;Jr(e,g)&&(i.leaf?s.push(c):xs(e,g)?this._all(c,s):l.push(c))}i=l.pop()}return s}collides(e){let i=this.data;if(!Jr(e,i))return!1;const s=[];for(;i;){for(let o=0;o<i.children.length;o++){const l=i.children[o],h=i.leaf?this.toBBox(l):l;if(Jr(e,h)){if(i.leaf||xs(e,h))return!0;s.push(l)}}i=s.pop()}return!1}load(e){if(!(e&&e.length))return this;if(e.length<this._minEntries){for(let s=0;s<e.length;s++)this.insert(e[s]);return this}let i=this._build(e.slice(),0,e.length-1,0);if(!this.data.children.length)this.data=i;else if(this.data.height===i.height)this._splitRoot(this.data,i);else{if(this.data.height<i.height){const s=this.data;this.data=i,i=s}this._insert(i,this.data.height-i.height-1,!0)}return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=On([]),this}remove(e,i){if(!e)return this;let s=this.data;const o=this.toBBox(e),l=[],h=[];let c,g,d;for(;s||l.length;){if(s||(s=l.pop(),g=l[l.length-1],c=h.pop(),d=!0),s.leaf){const y=pf(e,s.children,i);if(y!==-1)return s.children.splice(y,1),l.push(s),this._condense(l),this}!d&&!s.leaf&&xs(s,o)?(l.push(s),h.push(c),c=0,g=s,s=s.children[0]):g?(c++,s=g.children[c],d=!1):s=null}return this}toBBox(e){return e}compareMinX(e,i){return e.minX-i.minX}compareMinY(e,i){return e.minY-i.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,i){const s=[];for(;e;)e.leaf?i.push(...e.children):s.push(...e.children),e=s.pop();return i}_build(e,i,s,o){const l=s-i+1;let h=this._maxEntries,c;if(l<=h)return c=On(e.slice(i,s+1)),Tn(c,this.toBBox),c;o||(o=Math.ceil(Math.log(l)/Math.log(h)),h=Math.ceil(l/Math.pow(h,o-1))),c=On([]),c.leaf=!1,c.height=o;const g=Math.ceil(l/h),d=g*Math.ceil(Math.sqrt(h));ka(e,i,s,d,this.compareMinX);for(let y=i;y<=s;y+=d){const v=Math.min(y+d-1,s);ka(e,y,v,g,this.compareMinY);for(let _=y;_<=v;_+=g){const E=Math.min(_+g-1,v);c.children.push(this._build(e,_,E,o-1))}}return Tn(c,this.toBBox),c}_chooseSubtree(e,i,s,o){for(;o.push(i),!(i.leaf||o.length-1===s);){let l=1/0,h=1/0,c;for(let g=0;g<i.children.length;g++){const d=i.children[g],y=_s(d),v=Ef(e,d)-y;v<h?(h=v,l=y<l?y:l,c=d):v===h&&y<l&&(l=y,c=d)}i=c||i.children[0]}return i}_insert(e,i,s){const o=s?e:this.toBBox(e),l=[],h=this._chooseSubtree(o,this.data,i,l);for(h.children.push(e),cr(h,o);i>=0&&l[i].children.length>this._maxEntries;)this._split(l,i),i--;this._adjustParentBBoxes(o,l,i)}_split(e,i){const s=e[i],o=s.children.length,l=this._minEntries;this._chooseSplitAxis(s,l,o);const h=this._chooseSplitIndex(s,l,o),c=On(s.children.splice(h,s.children.length-h));c.height=s.height,c.leaf=s.leaf,Tn(s,this.toBBox),Tn(c,this.toBBox),i?e[i-1].children.push(c):this._splitRoot(s,c)}_splitRoot(e,i){this.data=On([e,i]),this.data.height=e.height+1,this.data.leaf=!1,Tn(this.data,this.toBBox)}_chooseSplitIndex(e,i,s){let o,l=1/0,h=1/0;for(let c=i;c<=s-i;c++){const g=lr(e,0,c,this.toBBox),d=lr(e,c,s,this.toBBox),y=wf(g,d),v=_s(g)+_s(d);y<l?(l=y,o=c,h=v<h?v:h):y===l&&v<h&&(h=v,o=c)}return o||s-i}_chooseSplitAxis(e,i,s){const o=e.leaf?this.compareMinX:_f,l=e.leaf?this.compareMinY:xf,h=this._allDistMargin(e,i,s,o),c=this._allDistMargin(e,i,s,l);h<c&&e.children.sort(o)}_allDistMargin(e,i,s,o){e.children.sort(o);const l=this.toBBox,h=lr(e,0,i,l),c=lr(e,s-i,s,l);let g=Kr(h)+Kr(c);for(let d=i;d<s-i;d++){const y=e.children[d];cr(h,e.leaf?l(y):y),g+=Kr(h)}for(let d=s-i-1;d>=i;d--){const y=e.children[d];cr(c,e.leaf?l(y):y),g+=Kr(c)}return g}_adjustParentBBoxes(e,i,s){for(let o=s;o>=0;o--)cr(i[o],e)}_condense(e){for(let i=e.length-1,s;i>=0;i--)e[i].children.length===0?i>0?(s=e[i-1].children,s.splice(s.indexOf(e[i]),1)):this.clear():Tn(e[i],this.toBBox)}}function pf(t,e,i){if(!i)return e.indexOf(t);for(let s=0;s<e.length;s++)if(i(t,e[s]))return s;return-1}function Tn(t,e){lr(t,0,t.children.length,e,t)}function lr(t,e,i,s,o){o||(o=On(null)),o.minX=1/0,o.minY=1/0,o.maxX=-1/0,o.maxY=-1/0;for(let l=e;l<i;l++){const h=t.children[l];cr(o,t.leaf?s(h):h)}return o}function cr(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function _f(t,e){return t.minX-e.minX}function xf(t,e){return t.minY-e.minY}function _s(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Kr(t){return t.maxX-t.minX+(t.maxY-t.minY)}function Ef(t,e){return(Math.max(e.maxX,t.maxX)-Math.min(e.minX,t.minX))*(Math.max(e.maxY,t.maxY)-Math.min(e.minY,t.minY))}function wf(t,e){const i=Math.max(t.minX,e.minX),s=Math.max(t.minY,e.minY),o=Math.min(t.maxX,e.maxX),l=Math.min(t.maxY,e.maxY);return Math.max(0,o-i)*Math.max(0,l-s)}function xs(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function Jr(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function On(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function ka(t,e,i,s,o){const l=[e,i];for(;l.length;){if(i=l.pop(),e=l.pop(),i-e<=s)continue;const h=e+Math.ceil((i-e)/s/2)*s;yf(t,h,e,i,o),l.push(e,h,h,i)}}function Qr(t){var e=new dt(t);return e.insert=function(i){if(i.type!=="Feature")throw new Error("invalid feature");return i.bbox=i.bbox?i.bbox:Fe(i),dt.prototype.insert.call(this,i)},e.load=function(i){var s=[];return Array.isArray(i)?i.forEach(function(o){if(o.type!=="Feature")throw new Error("invalid features");o.bbox=o.bbox?o.bbox:Fe(o),s.push(o)}):Le(i,function(o){if(o.type!=="Feature")throw new Error("invalid features");o.bbox=o.bbox?o.bbox:Fe(o),s.push(o)}),dt.prototype.load.call(this,s)},e.remove=function(i,s){if(i.type!=="Feature")throw new Error("invalid feature");return i.bbox=i.bbox?i.bbox:Fe(i),dt.prototype.remove.call(this,i,s)},e.clear=function(){return dt.prototype.clear.call(this)},e.search=function(i){var s=dt.prototype.search.call(this,this.toBBox(i));return he(s)},e.collides=function(i){return dt.prototype.collides.call(this,this.toBBox(i))},e.all=function(){var i=dt.prototype.all.call(this);return he(i)},e.toJSON=function(){return dt.prototype.toJSON.call(this)},e.fromJSON=function(i){return dt.prototype.fromJSON.call(this,i)},e.toBBox=function(i){var s;if(i.bbox)s=i.bbox;else if(Array.isArray(i)&&i.length===4)s=i;else if(Array.isArray(i)&&i.length===6)s=[i[0],i[1],i[3],i[4]];else if(i.type==="Feature")s=Fe(i);else if(i.type==="FeatureCollection")s=Fe(i);else throw new Error("invalid geojson");return{minX:s[0],minY:s[1],maxX:s[2],maxY:s[3]}},e}function hr(t){if(!t)throw new Error("geojson is required");const e=[];return Qe(t,i=>{kf(i,e)}),he(e)}function kf(t,e){let i=[];const s=t.geometry;if(s!==null){switch(s.type){case"Polygon":i=ve(s);break;case"LineString":i=[ve(s)]}i.forEach(o=>{If(o,t.properties).forEach(h=>{h.id=e.length,e.push(h)})})}}function If(t,e){const i=[];return t.reduce((s,o)=>{const l=Pe([s,o],e);return l.bbox=Nf(s,o),i.push(l),o}),i}function Nf(t,e){const i=t[0],s=t[1],o=e[0],l=e[1],h=i<o?i:o,c=s<l?s:l,g=i>o?i:o,d=s>l?s:l;return[h,c,g,d]}var Mf=Object.defineProperty,Sf=Object.defineProperties,Pf=Object.getOwnPropertyDescriptors,Ia=Object.getOwnPropertySymbols,Lf=Object.prototype.hasOwnProperty,bf=Object.prototype.propertyIsEnumerable,Na=(t,e,i)=>e in t?Mf(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Ma=(t,e)=>{for(var i in e||(e={}))Lf.call(e,i)&&Na(t,i,e[i]);if(Ia)for(var i of Ia(e))bf.call(e,i)&&Na(t,i,e[i]);return t},Sa=(t,e)=>Sf(t,Pf(e));function $t(t,e,i={}){if(!t||!e)throw new Error("lines and pt are required arguments");const s=Te(e);let o=_e([1/0,1/0],{dist:1/0,index:-1,multiFeatureIndex:-1,location:-1}),l=0;return Qe(t,function(h,c,g){const d=ve(h);for(let y=0;y<d.length-1;y++){const v=_e(d[y]),_=Te(v),E=_e(d[y+1]),M=Te(E),R=Be(v,E,i);let Y,H;M[0]===s[0]&&M[1]===s[1]?[Y,H]=[M,!0]:_[0]===s[0]&&_[1]===s[1]?[Y,H]=[_,!1]:[Y,H]=Of(_,M,s);const x=_e(Y,{dist:Be(e,Y,i),multiFeatureIndex:g,location:l+Be(v,Y,i)});x.properties.dist<o.properties.dist&&(o=Sa(Ma({},x),{properties:Sa(Ma({},x.properties),{index:H?y+1:y})})),l+=R}}),o}function vn(t,e){const[i,s,o]=t,[l,h,c]=e;return i*l+s*h+o*c}function fr(t,e){const[i,s,o]=t,[l,h,c]=e;return[s*c-o*h,o*l-i*c,i*h-s*l]}function Cf(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2))}function Pa(t){const e=Cf(t);return[t[0]/e,t[1]/e,t[2]/e]}function Es(t){const e=Ze(t[1]),i=Ze(t[0]);return[Math.cos(e)*Math.cos(i),Math.cos(e)*Math.sin(i),Math.sin(e)]}function Tf(t){const[e,i,s]=t,o=Math.min(Math.max(s,-1),1),l=Ot(Math.asin(o));return[Ot(Math.atan2(i,e)),l]}function Of(t,e,i){const s=Es(t),o=Es(e),l=Es(i),h=fr(s,o);if(h[0]===0&&h[1]===0&&h[2]===0)return vn(s,o)>0?[[...e],!0]:[[...i],!1];const c=fr(h,l);if(c[0]===0&&c[1]===0&&c[2]===0)return[[...e],!0];const g=fr(c,h),d=Pa(g),y=[-d[0],-d[1],-d[2]],v=vn(l,d)>vn(l,y)?d:y,_=Pa(h),E=vn(fr(s,v),_),M=vn(fr(v,o),_);return E>=0&&M>=0?[Tf(v),!1]:vn(s,l)>vn(o,l)?[[...t],!1]:[[...e],!0]}function gr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Rf(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var i=function s(){var o=!1;try{o=this instanceof s}catch{}return o?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};i.prototype=e.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(t).forEach(function(s){var o=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(i,s,o.get?o:{enumerable:!0,get:function(){return t[s]}})}),i}var ws,La;function Af(){return La||(La=1,ws=function t(e,i){if(e===i)return!0;if(e&&i&&typeof e=="object"&&typeof i=="object"){if(e.constructor!==i.constructor)return!1;var s,o,l;if(Array.isArray(e)){if(s=e.length,s!=i.length)return!1;for(o=s;o--!==0;)if(!t(e[o],i[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===i.source&&e.flags===i.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===i.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===i.toString();if(l=Object.keys(e),s=l.length,s!==Object.keys(i).length)return!1;for(o=s;o--!==0;)if(!Object.prototype.hasOwnProperty.call(i,l[o]))return!1;for(o=s;o--!==0;){var h=l[o];if(!t(e[h],i[h]))return!1}return!0}return e!==e&&i!==i}),ws}var Df=Af();const dr=gr(Df);function ba(t,e,i={}){if(i=i||{},!Ce(i))throw new Error("options is invalid");var s=i.tolerance||0,o=[],l=Qr();const h=hr(t);l.load(h);var c;let g=[];return Vt(e,function(d){var y=!1;d&&(Le(l.search(d),function(v){if(y===!1){var _=ve(d).sort(),E=ve(v).sort();if(dr(_,E))y=!0,c?c=ks(c,d)||c:c=d;else if(s===0?we(_[0],v)&&we(_[1],v):$t(v,_[0]).properties.dist<=s&&$t(v,_[1]).properties.dist<=s)y=!0,c?c=ks(c,d)||c:c=d;else if(s===0?we(E[0],d)&&we(E[1],d):$t(d,E[0]).properties.dist<=s&&$t(d,E[1]).properties.dist<=s)if(c){const M=ks(c,v);M?c=M:g.push(v)}else c=v}}),y===!1&&c&&(o.push(c),g.length&&(o=o.concat(g),g=[]),c=void 0))}),c&&o.push(c),he(o)}function ks(t,e){var i=ve(e),s=ve(t),o=s[0],l=s[s.length-1],h=t.geometry.coordinates;if(dr(i[0],o))h.unshift(i[1]);else if(dr(i[0],l))h.push(i[1]);else if(dr(i[1],o))h.unshift(i[0]);else if(dr(i[1],l))h.push(i[0]);else return;return t}function Ff(t,e){const i=qe(t),s=qe(e),o=i.type,l=s.type;if(o==="MultiPoint"&&l!=="MultiPoint"||(o==="LineString"||o==="MultiLineString")&&l!=="LineString"&&l!=="MultiLineString"||(o==="Polygon"||o==="MultiPolygon")&&l!=="Polygon"&&l!=="MultiPolygon")throw new Error("features must be of the same type");if(o==="Point")throw new Error("Point geometry not supported");if(ys(t,e,{precision:6}))return!1;let h=0;switch(o){case"MultiPoint":for(var c=0;c<i.coordinates.length;c++)for(var g=0;g<s.coordinates.length;g++){var d=i.coordinates[c],y=s.coordinates[g];if(d[0]===y[0]&&d[1]===y[1])return!0}return!1;case"LineString":case"MultiLineString":Vt(t,v=>{Vt(e,_=>{ba(v,_).features.length&&h++})});break;case"Polygon":case"MultiPolygon":Vt(t,v=>{Vt(e,_=>{Rt(v,_).features.length&&h++})});break}return h>0}function qf(t,e){if(!t)throw new Error("line1 is required");if(!e)throw new Error("line2 is required");var i=Ca(t,"line1");if(i!=="LineString")throw new Error("line1 must be a LineString");var s=Ca(e,"line2");if(s!=="LineString")throw new Error("line2 must be a LineString");for(var o=hr(dn(t)).features,l=hr(dn(e)).features,h=0;h<o.length;h++){var c=o[h].geometry.coordinates;if(!l[h])break;var g=l[h].geometry.coordinates;if(!Bf(c,g))return!1}return!0}function Bf(t,e){var i=Sn(gn(t[0],t[1])),s=Sn(gn(e[0],e[1]));return i===s||(s-i)%180===0}function Ca(t,e){if(t.geometry&&t.geometry.type)return t.geometry.type;if(t.type)return t.type;throw new Error("Invalid GeoJSON object for "+e)}function Gf(t,e){var i=qe(t),s=qe(e),o=i.type,l=s.type;switch(o){case"Point":switch(l){case"LineString":return ot(i,s);case"MultiLineString":for(var h=!1,c=0;c<s.coordinates.length;c++)ot(i,{coordinates:s.coordinates[c]})&&(h=!0);return h;case"Polygon":for(var g=0;g<s.coordinates.length;g++)if(we(i,{type:"LineString",coordinates:s.coordinates[g]}))return!0;return!1;case"MultiPolygon":for(var g=0;g<s.coordinates.length;g++)for(var c=0;c<s.coordinates[g].length;c++)if(we(i,{type:"LineString",coordinates:s.coordinates[g][c]}))return!0;return!1;default:throw new Error("feature2 "+l+" geometry not supported")}case"MultiPoint":switch(l){case"LineString":for(var h=!1,g=0;g<i.coordinates.length;g++)if(h||ot({coordinates:i.coordinates[g]},s)&&(h=!0),we({type:"Point",coordinates:i.coordinates[g]},s,{ignoreEndVertices:!0}))return!1;return h;case"MultiLineString":for(var h=!1,g=0;g<i.coordinates.length;g++)for(var c=0;c<s.coordinates.length;c++)if(h||ot({coordinates:i.coordinates[g]},{coordinates:s.coordinates[c]})&&(h=!0),we({type:"Point",coordinates:i.coordinates[g]},{type:"LineString",coordinates:s.coordinates[c]},{ignoreEndVertices:!0}))return!1;return h;case"Polygon":for(var h=!1,g=0;g<i.coordinates.length;g++)if(h||we({type:"Point",coordinates:i.coordinates[g]},{type:"LineString",coordinates:s.coordinates[0]})&&(h=!0),xe({type:"Point",coordinates:i.coordinates[g]},s,{ignoreBoundary:!0}))return!1;return h;case"MultiPolygon":for(var h=!1,g=0;g<i.coordinates.length;g++)for(var c=0;c<s.coordinates.length;c++)if(h||we({type:"Point",coordinates:i.coordinates[g]},{type:"LineString",coordinates:s.coordinates[c][0]})&&(h=!0),xe({type:"Point",coordinates:i.coordinates[g]},{type:"Polygon",coordinates:s.coordinates[c]},{ignoreBoundary:!0}))return!1;return h;default:throw new Error("feature2 "+l+" geometry not supported")}case"LineString":switch(l){case"Point":return ot(s,i);case"MultiPoint":for(var h=!1,g=0;g<s.coordinates.length;g++)if(h||ot({coordinates:s.coordinates[g]},i)&&(h=!0),we({type:"Point",coordinates:s.coordinates[g]},i,{ignoreEndVertices:!0}))return!1;return h;case"LineString":var d=!1;if(ot({coordinates:i.coordinates[0]},s)&&(d=!0),ot({coordinates:i.coordinates[i.coordinates.length-1]},s)&&(d=!0),d===!1)return!1;for(var g=0;g<i.coordinates.length;g++)if(we({type:"Point",coordinates:i.coordinates[g]},s,{ignoreEndVertices:!0}))return!1;return d;case"MultiLineString":for(var d=!1,g=0;g<s.coordinates.length;g++){ot({coordinates:i.coordinates[0]},{coordinates:s.coordinates[g]})&&(d=!0),ot({coordinates:i.coordinates[i.coordinates.length-1]},{coordinates:s.coordinates[g]})&&(d=!0);for(var c=0;c<i.coordinates[g].length;c++)if(we({type:"Point",coordinates:i.coordinates[c]},{type:"LineString",coordinates:s.coordinates[g]},{ignoreEndVertices:!0}))return!1}return d;case"Polygon":for(var h=!1,g=0;g<i.coordinates.length;g++)if(h||we({type:"Point",coordinates:i.coordinates[g]},{type:"LineString",coordinates:s.coordinates[0]})&&(h=!0),xe({type:"Point",coordinates:i.coordinates[g]},s,{ignoreBoundary:!0}))return!1;return h;case"MultiPolygon":for(var h=!1,g=0;g<i.coordinates.length;g++){for(var c=0;c<s.coordinates.length;c++)h||we({type:"Point",coordinates:i.coordinates[g]},{type:"LineString",coordinates:s.coordinates[c][0]})&&(h=!0);if(xe({type:"Point",coordinates:i.coordinates[g]},s,{ignoreBoundary:!0}))return!1}return h;default:throw new Error("feature2 "+l+" geometry not supported")}case"MultiLineString":switch(l){case"Point":for(var g=0;g<i.coordinates.length;g++)if(ot(s,{coordinates:i.coordinates[g]}))return!0;return!1;case"MultiPoint":for(var h=!1,g=0;g<i.coordinates.length;g++)for(var c=0;c<s.coordinates.length;c++)if(h||ot({coordinates:s.coordinates[c]},{coordinates:i.coordinates[c]})&&(h=!0),we({type:"Point",coordinates:s.coordinates[c]},{type:"LineString",coordinates:i.coordinates[c]},{ignoreEndVertices:!0}))return!1;return h;case"LineString":for(var d=!1,g=0;g<i.coordinates.length;g++){ot({coordinates:i.coordinates[g][0]},s)&&(d=!0),ot({coordinates:i.coordinates[g][i.coordinates[g].length-1]},s)&&(d=!0);for(var c=0;c<s.coordinates.length;c++)if(we({type:"Point",coordinates:s.coordinates[c]},{type:"LineString",coordinates:i.coordinates[g]},{ignoreEndVertices:!0}))return!1}return d;case"MultiLineString":for(var d=!1,g=0;g<i.coordinates.length;g++)for(var c=0;c<s.coordinates.length;c++){ot({coordinates:i.coordinates[g][0]},{coordinates:s.coordinates[c]})&&(d=!0),ot({coordinates:i.coordinates[g][i.coordinates[g].length-1]},{coordinates:s.coordinates[c]})&&(d=!0);for(var y=0;y<i.coordinates[g].length;y++)if(we({type:"Point",coordinates:i.coordinates[g][y]},{type:"LineString",coordinates:s.coordinates[c]},{ignoreEndVertices:!0}))return!1}return d;case"Polygon":for(var h=!1,g=0;g<i.coordinates.length;g++)for(var c=0;c<i.coordinates.length;c++)if(h||we({type:"Point",coordinates:i.coordinates[g][c]},{type:"LineString",coordinates:s.coordinates[0]})&&(h=!0),xe({type:"Point",coordinates:i.coordinates[g][c]},s,{ignoreBoundary:!0}))return!1;return h;case"MultiPolygon":for(var h=!1,g=0;g<s.coordinates[0].length;g++)for(var c=0;c<i.coordinates.length;c++)for(var y=0;y<i.coordinates[c].length;y++)if(h||we({type:"Point",coordinates:i.coordinates[c][y]},{type:"LineString",coordinates:s.coordinates[0][g]})&&(h=!0),xe({type:"Point",coordinates:i.coordinates[c][y]},{type:"Polygon",coordinates:[s.coordinates[0][g]]},{ignoreBoundary:!0}))return!1;return h;default:throw new Error("feature2 "+l+" geometry not supported")}case"Polygon":switch(l){case"Point":for(var g=0;g<i.coordinates.length;g++)if(we(s,{type:"LineString",coordinates:i.coordinates[g]}))return!0;return!1;case"MultiPoint":for(var h=!1,g=0;g<s.coordinates.length;g++)if(h||we({type:"Point",coordinates:s.coordinates[g]},{type:"LineString",coordinates:i.coordinates[0]})&&(h=!0),xe({type:"Point",coordinates:s.coordinates[g]},i,{ignoreBoundary:!0}))return!1;return h;case"LineString":for(var h=!1,g=0;g<s.coordinates.length;g++)if(h||we({type:"Point",coordinates:s.coordinates[g]},{type:"LineString",coordinates:i.coordinates[0]})&&(h=!0),xe({type:"Point",coordinates:s.coordinates[g]},i,{ignoreBoundary:!0}))return!1;return h;case"MultiLineString":for(var h=!1,g=0;g<s.coordinates.length;g++)for(var c=0;c<s.coordinates[g].length;c++)if(h||we({type:"Point",coordinates:s.coordinates[g][c]},{type:"LineString",coordinates:i.coordinates[0]})&&(h=!0),xe({type:"Point",coordinates:s.coordinates[g][c]},i,{ignoreBoundary:!0}))return!1;return h;case"Polygon":for(var h=!1,g=0;g<i.coordinates[0].length;g++)if(h||we({type:"Point",coordinates:i.coordinates[0][g]},{type:"LineString",coordinates:s.coordinates[0]})&&(h=!0),xe({type:"Point",coordinates:i.coordinates[0][g]},s,{ignoreBoundary:!0}))return!1;return h;case"MultiPolygon":for(var h=!1,g=0;g<s.coordinates[0].length;g++)for(var c=0;c<i.coordinates[0].length;c++)if(h||we({type:"Point",coordinates:i.coordinates[0][c]},{type:"LineString",coordinates:s.coordinates[0][g]})&&(h=!0),xe({type:"Point",coordinates:i.coordinates[0][c]},{type:"Polygon",coordinates:s.coordinates[0][g]},{ignoreBoundary:!0}))return!1;return h;default:throw new Error("feature2 "+l+" geometry not supported")}case"MultiPolygon":switch(l){case"Point":for(var g=0;g<i.coordinates[0].length;g++)if(we(s,{type:"LineString",coordinates:i.coordinates[0][g]}))return!0;return!1;case"MultiPoint":for(var h=!1,g=0;g<i.coordinates[0].length;g++)for(var c=0;c<s.coordinates.length;c++)if(h||we({type:"Point",coordinates:s.coordinates[c]},{type:"LineString",coordinates:i.coordinates[0][g]})&&(h=!0),xe({type:"Point",coordinates:s.coordinates[c]},{type:"Polygon",coordinates:i.coordinates[0][g]},{ignoreBoundary:!0}))return!1;return h;case"LineString":for(var h=!1,g=0;g<i.coordinates[0].length;g++)for(var c=0;c<s.coordinates.length;c++)if(h||we({type:"Point",coordinates:s.coordinates[c]},{type:"LineString",coordinates:i.coordinates[0][g]})&&(h=!0),xe({type:"Point",coordinates:s.coordinates[c]},{type:"Polygon",coordinates:i.coordinates[0][g]},{ignoreBoundary:!0}))return!1;return h;case"MultiLineString":for(var h=!1,g=0;g<i.coordinates.length;g++)for(var c=0;c<s.coordinates.length;c++)for(var y=0;y<s.coordinates[c].length;y++)if(h||we({type:"Point",coordinates:s.coordinates[c][y]},{type:"LineString",coordinates:i.coordinates[g][0]})&&(h=!0),xe({type:"Point",coordinates:s.coordinates[c][y]},{type:"Polygon",coordinates:[i.coordinates[g][0]]},{ignoreBoundary:!0}))return!1;return h;case"Polygon":for(var h=!1,g=0;g<i.coordinates[0].length;g++)for(var c=0;c<i.coordinates[0][g].length;c++)if(h||we({type:"Point",coordinates:i.coordinates[0][g][c]},{type:"LineString",coordinates:s.coordinates[0]})&&(h=!0),xe({type:"Point",coordinates:i.coordinates[0][g][c]},s,{ignoreBoundary:!0}))return!1;return h;case"MultiPolygon":for(var h=!1,g=0;g<i.coordinates[0].length;g++)for(var c=0;c<s.coordinates[0].length;c++)for(var y=0;y<i.coordinates[0].length;y++)if(h||we({type:"Point",coordinates:i.coordinates[0][g][y]},{type:"LineString",coordinates:s.coordinates[0][c]})&&(h=!0),xe({type:"Point",coordinates:i.coordinates[0][g][y]},{type:"Polygon",coordinates:s.coordinates[0][c]},{ignoreBoundary:!0}))return!1;return h;default:throw new Error("feature2 "+l+" geometry not supported")}default:throw new Error("feature1 "+o+" geometry not supported")}}function ot(t,e){return!!(Ta(e.coordinates[0],t.coordinates)||Ta(e.coordinates[e.coordinates.length-1],t.coordinates))}function Ta(t,e){return t[0]===e[0]&&t[1]===e[1]}function Yf(t){if(!t.type)return!1;const e=qe(t),i=e.type,s=e.coordinates;switch(i){case"Point":return s.length>1;case"MultiPoint":for(var o=0;o<s.length;o++)if(s[o].length<2)return!1;return!0;case"LineString":if(s.length<2)return!1;for(var o=0;o<s.length;o++)if(s[o].length<2)return!1;return!0;case"MultiLineString":if(s.length<2)return!1;for(var o=0;o<s.length;o++)if(s[o].length<2)return!1;return!0;case"Polygon":for(var o=0;o<e.coordinates.length;o++)if(s[o].length<4||!Oa(s[o])||Ra(s[o])||o>0&&Rt(ye([s[0]]),ye([s[o]])).features.length>1)return!1;return!0;case"MultiPolygon":for(var o=0;o<e.coordinates.length;o++)for(var l=e.coordinates[o],h=0;h<l.length;h++)if(l[h].length<4||!Oa(l[h])||Ra(l[h])||h===0&&!zf(l,e.coordinates,o)||h>0&&Rt(ye([l[0]]),ye([l[h]])).features.length>1)return!1;return!0;default:return!1}}function Oa(t){return t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]}function Ra(t){for(var e=0;e<t.length-1;e++)for(var i=t[e],s=e+1;s<t.length-2;s++){var o=[t[s],t[s+1]];if(we(i,Pe(o)))return!0}return!1}function zf(t,e,i){for(var s=ye(t),o=i+1;o<e.length;o++)if(!ds(s,ye(e[o]))&&ha(s,Pe(e[o][0])))return!1;return!0}function Aa(t,e){var i=qe(t),s=qe(e),o=i.type,l=s.type;switch(o){case"Point":switch(l){case"MultiPoint":return Xf(i,s);case"LineString":return we(i,s,{ignoreEndVertices:!0});case"Polygon":case"MultiPolygon":return xe(i,s,{ignoreBoundary:!0});default:throw new Error("feature2 "+l+" geometry not supported")}case"MultiPoint":switch(l){case"MultiPoint":return Uf(i,s);case"LineString":return Vf(i,s);case"Polygon":case"MultiPolygon":return Hf(i,s);default:throw new Error("feature2 "+l+" geometry not supported")}case"LineString":switch(l){case"LineString":return $f(i,s);case"Polygon":case"MultiPolygon":return Zf(i,s);default:throw new Error("feature2 "+l+" geometry not supported")}case"Polygon":switch(l){case"Polygon":case"MultiPolygon":return Wf(i,s);default:throw new Error("feature2 "+l+" geometry not supported")}default:throw new Error("feature1 "+o+" geometry not supported")}}function Xf(t,e){var i,s=!1;for(i=0;i<e.coordinates.length;i++)if(Fa(e.coordinates[i],t.coordinates)){s=!0;break}return s}function Uf(t,e){for(var i=0;i<t.coordinates.length;i++){for(var s=!1,o=0;o<e.coordinates.length;o++)Fa(t.coordinates[i],e.coordinates[o])&&(s=!0);if(!s)return!1}return!0}function Vf(t,e){for(var i=!1,s=0;s<t.coordinates.length;s++){if(!we(t.coordinates[s],e))return!1;i||(i=we(t.coordinates[s],e,{ignoreEndVertices:!0}))}return i}function Hf(t,e){for(var i=!0,s=!1,o=0;o<t.coordinates.length;o++){if(s=xe(t.coordinates[o],e),!s){i=!1;break}s=xe(t.coordinates[o],e,{ignoreBoundary:!0})}return i&&s}function $f(t,e){for(var i=0;i<t.coordinates.length;i++)if(!we(t.coordinates[i],e))return!1;return!0}function Zf(t,e){var i=Fe(e),s=Fe(t);if(!Da(i,s))return!1;for(var o=!1,l=0;l<t.coordinates.length;l++){if(!xe(t.coordinates[l],e))return!1;if(o||(o=xe(t.coordinates[l],e,{ignoreBoundary:!0})),!o&&l<t.coordinates.length-1){var h=Kf(t.coordinates[l],t.coordinates[l+1]);o=xe(h,e,{ignoreBoundary:!0})}}return o}function Wf(t,e){var i=Fe(t),s=Fe(e);if(!Da(s,i))return!1;for(var o=0;o<t.coordinates[0].length;o++)if(!xe(t.coordinates[0][o],e))return!1;return!0}function Da(t,e){return!(t[0]>e[0]||t[2]<e[2]||t[1]>e[1]||t[3]<e[3])}function Fa(t,e){return t[0]===e[0]&&t[1]===e[1]}function Kf(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2]}function jr(t,e={}){const i=Fe(t),s=(i[0]+i[2])/2,o=(i[1]+i[3])/2;return _e([s,o],e.properties,e)}var ei={exports:{}},Jf=ei.exports,qa;function Qf(){return qa||(qa=1,(function(t,e){(function(i,s){t.exports=s()})(Jf,(function(){function i(u,n){(n==null||n>u.length)&&(n=u.length);for(var r=0,a=Array(n);r<n;r++)a[r]=u[r];return a}function s(u,n,r){return n=y(n),(function(a,f){if(f&&(typeof f=="object"||typeof f=="function"))return f;if(f!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return(function(m){if(m===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m})(a)})(u,_()?Reflect.construct(n,r||[],y(u).constructor):n.apply(u,r))}function o(u,n){if(!(u instanceof n))throw new TypeError("Cannot call a class as a function")}function l(u,n,r){if(_())return Reflect.construct.apply(null,arguments);var a=[null];a.push.apply(a,n);var f=new(u.bind.apply(u,a));return r&&E(f,r.prototype),f}function h(u,n){for(var r=0;r<n.length;r++){var a=n[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(u,Y(a.key),a)}}function c(u,n,r){return n&&h(u.prototype,n),r&&h(u,r),Object.defineProperty(u,"prototype",{writable:!1}),u}function g(u,n){var r=typeof Symbol<"u"&&u[Symbol.iterator]||u["@@iterator"];if(!r){if(Array.isArray(u)||(r=H(u))||n){r&&(u=r);var a=0,f=function(){};return{s:f,n:function(){return a>=u.length?{done:!0}:{done:!1,value:u[a++]}},e:function(O){throw O},f}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var m,p=!0,I=!1;return{s:function(){r=r.call(u)},n:function(){var O=r.next();return p=O.done,O},e:function(O){I=!0,m=O},f:function(){try{p||r.return==null||r.return()}finally{if(I)throw m}}}}function d(){return d=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(u,n,r){var a=(function(m,p){for(;!{}.hasOwnProperty.call(m,p)&&(m=y(m))!==null;);return m})(u,n);if(a){var f=Object.getOwnPropertyDescriptor(a,n);return f.get?f.get.call(arguments.length<3?u:r):f.value}},d.apply(null,arguments)}function y(u){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},y(u)}function v(u,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");u.prototype=Object.create(n&&n.prototype,{constructor:{value:u,writable:!0,configurable:!0}}),Object.defineProperty(u,"prototype",{writable:!1}),n&&E(u,n)}function _(){try{var u=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch{}return(_=function(){return!!u})()}function E(u,n){return E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},E(u,n)}function M(u,n,r,a){var f=d(y(1&a?u.prototype:u),n,r);return 2&a&&typeof f=="function"?function(m){return f.apply(r,m)}:f}function R(u){return(function(n){if(Array.isArray(n))return i(n)})(u)||(function(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)})(u)||H(u)||(function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
3
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function Y(u){var n=(function(r,a){if(typeof r!="object"||!r)return r;var f=r[Symbol.toPrimitive];if(f!==void 0){var m=f.call(r,a);if(typeof m!="object")return m;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)})(u,"string");return typeof n=="symbol"?n:n+""}function H(u,n){if(u){if(typeof u=="string")return i(u,n);var r={}.toString.call(u).slice(8,-1);return r==="Object"&&u.constructor&&(r=u.constructor.name),r==="Map"||r==="Set"?Array.from(u):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(u,n):void 0}}function x(u){var n=typeof Map=="function"?new Map:void 0;return x=function(r){if(r===null||!(function(f){try{return Function.toString.call(f).indexOf("[native code]")!==-1}catch{return typeof f=="function"}})(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(n!==void 0){if(n.has(r))return n.get(r);n.set(r,a)}function a(){return l(r,arguments,y(this).constructor)}return a.prototype=Object.create(r.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),E(a,r)},x(u)}var S=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"getEndCapStyle",value:function(){return this._endCapStyle}},{key:"isSingleSided",value:function(){return this._isSingleSided}},{key:"setQuadrantSegments",value:function(n){this._quadrantSegments=n,this._quadrantSegments===0&&(this._joinStyle=u.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=u.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),n<=0&&(this._quadrantSegments=1),this._joinStyle!==u.JOIN_ROUND&&(this._quadrantSegments=u.DEFAULT_QUADRANT_SEGMENTS)}},{key:"getJoinStyle",value:function(){return this._joinStyle}},{key:"setJoinStyle",value:function(n){this._joinStyle=n}},{key:"setSimplifyFactor",value:function(n){this._simplifyFactor=n<0?0:n}},{key:"getSimplifyFactor",value:function(){return this._simplifyFactor}},{key:"getQuadrantSegments",value:function(){return this._quadrantSegments}},{key:"setEndCapStyle",value:function(n){this._endCapStyle=n}},{key:"getMitreLimit",value:function(){return this._mitreLimit}},{key:"setMitreLimit",value:function(n){this._mitreLimit=n}},{key:"setSingleSided",value:function(n){this._isSingleSided=n}}],[{key:"constructor_",value:function(){if(this._quadrantSegments=u.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=u.CAP_ROUND,this._joinStyle=u.JOIN_ROUND,this._mitreLimit=u.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=u.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this.setQuadrantSegments(n)}else if(arguments.length===2){var r=arguments[0],a=arguments[1];this.setQuadrantSegments(r),this.setEndCapStyle(a)}else if(arguments.length===4){var f=arguments[0],m=arguments[1],p=arguments[2],I=arguments[3];this.setQuadrantSegments(f),this.setEndCapStyle(m),this.setJoinStyle(p),this.setMitreLimit(I)}}}},{key:"bufferDistanceError",value:function(n){var r=Math.PI/2/n;return 1-Math.cos(r/2)}}])})();S.CAP_ROUND=1,S.CAP_FLAT=2,S.CAP_SQUARE=3,S.JOIN_ROUND=1,S.JOIN_MITRE=2,S.JOIN_BEVEL=3,S.DEFAULT_QUADRANT_SEGMENTS=8,S.DEFAULT_MITRE_LIMIT=5,S.DEFAULT_SIMPLIFY_FACTOR=.01;var b=(function(u){function n(r){var a;return o(this,n),(a=s(this,n,[r])).name=Object.keys({Exception:n})[0],a}return v(n,u),c(n,[{key:"toString",value:function(){return this.message}}])})(x(Error)),C=(function(u){function n(r){var a;return o(this,n),(a=s(this,n,[r])).name=Object.keys({IllegalArgumentException:n})[0],a}return v(n,u),c(n)})(b),A=(function(){return c((function u(){o(this,u)}),[{key:"filter",value:function(u){}}])})();function q(){}function w(){}function N(){}var L,D,F,X,z,V,k,T,P=(function(){return c((function u(){o(this,u)}),null,[{key:"equalsWithTolerance",value:function(u,n,r){return Math.abs(u-n)<=r}}])})(),G=(function(){return c((function u(n,r){o(this,u),this.low=r||0,this.high=n||0}),null,[{key:"toBinaryString",value:function(u){var n,r="";for(n=2147483648;n>0;n>>>=1)r+=(u.high&n)===n?"1":"0";for(n=2147483648;n>0;n>>>=1)r+=(u.low&n)===n?"1":"0";return r}}])})();function B(){}function Z(){}B.NaN=NaN,B.isNaN=function(u){return Number.isNaN(u)},B.isInfinite=function(u){return!Number.isFinite(u)},B.MAX_VALUE=Number.MAX_VALUE,B.POSITIVE_INFINITY=Number.POSITIVE_INFINITY,B.NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY,typeof Float64Array=="function"&&typeof Int32Array=="function"?(V=2146435072,k=new Float64Array(1),T=new Int32Array(k.buffer),B.doubleToLongBits=function(u){k[0]=u;var n=0|T[0],r=0|T[1];return(r&V)===V&&1048575&r&&n!==0&&(n=0,r=2146959360),new G(r,n)},B.longBitsToDouble=function(u){return T[0]=u.low,T[1]=u.high,k[0]}):(L=1023,D=Math.log2,F=Math.floor,X=Math.pow,z=(function(){for(var u=53;u>0;u--){var n=X(2,u)-1;if(F(D(n))+1===u)return n}return 0})(),B.doubleToLongBits=function(u){var n,r,a,f,m,p,I,O,U;if(u<0||1/u===Number.NEGATIVE_INFINITY?(p=1<<31,u=-u):p=0,u===0)return new G(O=p,U=0);if(u===1/0)return new G(O=2146435072|p,U=0);if(u!=u)return new G(O=2146959360,U=0);if(f=0,U=0,(n=F(u))>1)if(n<=z)(f=F(D(n)))<=20?(U=0,O=n<<20-f&1048575):(U=n%(r=X(2,a=f-20))<<32-a,O=n/r&1048575);else for(a=n,U=0;(a=F(r=a/2))!==0;)f++,U>>>=1,U|=(1&O)<<31,O>>>=1,r!==a&&(O|=524288);if(I=f+L,m=n===0,n=u-n,f<52&&n!==0)for(a=0;;){if((r=2*n)>=1?(n=r-1,m?(I--,m=!1):(a<<=1,a|=1,f++)):(n=r,m?--I==0&&(f++,m=!1):(a<<=1,f++)),f===20)O|=a,a=0;else if(f===52){U|=a;break}if(r===1){f<20?O|=a<<20-f:f<52&&(U|=a<<52-f);break}}return O|=I<<20,new G(O|=p,U)},B.longBitsToDouble=function(u){var n,r,a,f,m=u.high,p=u.low,I=m&1<<31?-1:1;for(a=((2146435072&m)>>20)-L,f=0,r=1<<19,n=1;n<=20;n++)m&r&&(f+=X(2,-n)),r>>>=1;for(r=1<<31,n=21;n<=52;n++)p&r&&(f+=X(2,-n)),r>>>=1;if(a===-1023){if(f===0)return 0*I;a=-1022}else{if(a===1024)return f===0?I/0:NaN;f+=1}return I*f*X(2,a)});var K=(function(u){function n(r){var a;return o(this,n),(a=s(this,n,[r])).name=Object.keys({RuntimeException:n})[0],a}return v(n,u),c(n)})(b),ee=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,null,[{key:"constructor_",value:function(){if(arguments.length===0)K.constructor_.call(this);else if(arguments.length===1){var r=arguments[0];K.constructor_.call(this,r)}}}])})(K),j=(function(){function u(){o(this,u)}return c(u,null,[{key:"shouldNeverReachHere",value:function(){if(arguments.length===0)u.shouldNeverReachHere(null);else if(arguments.length===1){var n=arguments[0];throw new ee("Should never reach here"+(n!==null?": "+n:""))}}},{key:"isTrue",value:function(){if(arguments.length===1){var n=arguments[0];u.isTrue(n,null)}else if(arguments.length===2){var r=arguments[1];if(!arguments[0])throw r===null?new ee:new ee(r)}}},{key:"equals",value:function(){if(arguments.length===2){var n=arguments[0],r=arguments[1];u.equals(n,r,null)}else if(arguments.length===3){var a=arguments[0],f=arguments[1],m=arguments[2];if(!f.equals(a))throw new ee("Expected "+a+" but encountered "+f+(m!==null?": "+m:""))}}}])})(),te=new ArrayBuffer(8),re=new Float64Array(te),se=new Int32Array(te),W=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"getM",value:function(){return B.NaN}},{key:"setOrdinate",value:function(n,r){switch(n){case u.X:this.x=r;break;case u.Y:this.y=r;break;case u.Z:this.setZ(r);break;default:throw new C("Invalid ordinate index: "+n)}}},{key:"equals2D",value:function(){if(arguments.length===1){var n=arguments[0];return this.x===n.x&&this.y===n.y}if(arguments.length===2){var r=arguments[0],a=arguments[1];return!!P.equalsWithTolerance(this.x,r.x,a)&&!!P.equalsWithTolerance(this.y,r.y,a)}}},{key:"setM",value:function(n){throw new C("Invalid ordinate index: "+u.M)}},{key:"getZ",value:function(){return this.z}},{key:"getOrdinate",value:function(n){switch(n){case u.X:return this.x;case u.Y:return this.y;case u.Z:return this.getZ()}throw new C("Invalid ordinate index: "+n)}},{key:"equals3D",value:function(n){return this.x===n.x&&this.y===n.y&&(this.getZ()===n.getZ()||B.isNaN(this.getZ())&&B.isNaN(n.getZ()))}},{key:"equals",value:function(n){return n instanceof u&&this.equals2D(n)}},{key:"equalInZ",value:function(n,r){return P.equalsWithTolerance(this.getZ(),n.getZ(),r)}},{key:"setX",value:function(n){this.x=n}},{key:"compareTo",value:function(n){var r=n;return this.x<r.x?-1:this.x>r.x?1:this.y<r.y?-1:this.y>r.y?1:0}},{key:"getX",value:function(){return this.x}},{key:"setZ",value:function(n){this.z=n}},{key:"clone",value:function(){try{return null}catch(n){if(n instanceof CloneNotSupportedException)return j.shouldNeverReachHere("this shouldn't happen because this class is Cloneable"),null;throw n}}},{key:"copy",value:function(){return new u(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+")"}},{key:"distance3D",value:function(n){var r=this.x-n.x,a=this.y-n.y,f=this.getZ()-n.getZ();return Math.sqrt(r*r+a*a+f*f)}},{key:"getY",value:function(){return this.y}},{key:"setY",value:function(n){this.y=n}},{key:"distance",value:function(n){var r=this.x-n.x,a=this.y-n.y;return Math.sqrt(r*r+a*a)}},{key:"hashCode",value:function(){var n=17;return n=37*(n=37*n+u.hashCode(this.x))+u.hashCode(this.y)}},{key:"setCoordinate",value:function(n){this.x=n.x,this.y=n.y,this.z=n.getZ()}},{key:"interfaces_",get:function(){return[q,w,N]}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)u.constructor_.call(this,0,0);else if(arguments.length===1){var n=arguments[0];u.constructor_.call(this,n.x,n.y,n.getZ())}else if(arguments.length===2){var r=arguments[0],a=arguments[1];u.constructor_.call(this,r,a,u.NULL_ORDINATE)}else if(arguments.length===3){var f=arguments[0],m=arguments[1],p=arguments[2];this.x=f,this.y=m,this.z=p}}},{key:"hashCode",value:function(n){return re[0]=n,se[0]^se[1]}}])})(),ge=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"compare",value:function(n,r){var a=u.compare(n.x,r.x);if(a!==0)return a;var f=u.compare(n.y,r.y);return f!==0?f:this._dimensionsToTest<=2?0:u.compare(n.getZ(),r.getZ())}},{key:"interfaces_",get:function(){return[Z]}}],[{key:"constructor_",value:function(){if(this._dimensionsToTest=2,arguments.length===0)u.constructor_.call(this,2);else if(arguments.length===1){var n=arguments[0];if(n!==2&&n!==3)throw new C("only 2 or 3 dimensions may be specified");this._dimensionsToTest=n}}},{key:"compare",value:function(n,r){return n<r?-1:n>r?1:B.isNaN(n)?B.isNaN(r)?0:-1:B.isNaN(r)?1:0}}])})();W.DimensionalComparator=ge,W.NULL_ORDINATE=B.NaN,W.X=0,W.Y=1,W.Z=2,W.M=3;var le=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"getArea",value:function(){return this.getWidth()*this.getHeight()}},{key:"equals",value:function(n){if(!(n instanceof u))return!1;var r=n;return this.isNull()?r.isNull():this._maxx===r.getMaxX()&&this._maxy===r.getMaxY()&&this._minx===r.getMinX()&&this._miny===r.getMinY()}},{key:"intersection",value:function(n){if(this.isNull()||n.isNull()||!this.intersects(n))return new u;var r=this._minx>n._minx?this._minx:n._minx,a=this._miny>n._miny?this._miny:n._miny;return new u(r,this._maxx<n._maxx?this._maxx:n._maxx,a,this._maxy<n._maxy?this._maxy:n._maxy)}},{key:"isNull",value:function(){return this._maxx<this._minx}},{key:"getMaxX",value:function(){return this._maxx}},{key:"covers",value:function(){if(arguments.length===1){if(arguments[0]instanceof W){var n=arguments[0];return this.covers(n.x,n.y)}if(arguments[0]instanceof u){var r=arguments[0];return!this.isNull()&&!r.isNull()&&r.getMinX()>=this._minx&&r.getMaxX()<=this._maxx&&r.getMinY()>=this._miny&&r.getMaxY()<=this._maxy}}else if(arguments.length===2){var a=arguments[0],f=arguments[1];return!this.isNull()&&a>=this._minx&&a<=this._maxx&&f>=this._miny&&f<=this._maxy}}},{key:"intersects",value:function(){if(arguments.length===1){if(arguments[0]instanceof u){var n=arguments[0];return!this.isNull()&&!n.isNull()&&!(n._minx>this._maxx||n._maxx<this._minx||n._miny>this._maxy||n._maxy<this._miny)}if(arguments[0]instanceof W){var r=arguments[0];return this.intersects(r.x,r.y)}}else if(arguments.length===2){if(arguments[0]instanceof W&&arguments[1]instanceof W){var a=arguments[0],f=arguments[1];return!this.isNull()&&!((a.x<f.x?a.x:f.x)>this._maxx)&&!((a.x>f.x?a.x:f.x)<this._minx)&&!((a.y<f.y?a.y:f.y)>this._maxy)&&!((a.y>f.y?a.y:f.y)<this._miny)}if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var m=arguments[0],p=arguments[1];return!this.isNull()&&!(m>this._maxx||m<this._minx||p>this._maxy||p<this._miny)}}}},{key:"getMinY",value:function(){return this._miny}},{key:"getDiameter",value:function(){if(this.isNull())return 0;var n=this.getWidth(),r=this.getHeight();return Math.sqrt(n*n+r*r)}},{key:"getMinX",value:function(){return this._minx}},{key:"expandToInclude",value:function(){if(arguments.length===1){if(arguments[0]instanceof W){var n=arguments[0];this.expandToInclude(n.x,n.y)}else if(arguments[0]instanceof u){var r=arguments[0];if(r.isNull())return null;this.isNull()?(this._minx=r.getMinX(),this._maxx=r.getMaxX(),this._miny=r.getMinY(),this._maxy=r.getMaxY()):(r._minx<this._minx&&(this._minx=r._minx),r._maxx>this._maxx&&(this._maxx=r._maxx),r._miny<this._miny&&(this._miny=r._miny),r._maxy>this._maxy&&(this._maxy=r._maxy))}}else if(arguments.length===2){var a=arguments[0],f=arguments[1];this.isNull()?(this._minx=a,this._maxx=a,this._miny=f,this._maxy=f):(a<this._minx&&(this._minx=a),a>this._maxx&&(this._maxx=a),f<this._miny&&(this._miny=f),f>this._maxy&&(this._maxy=f))}}},{key:"minExtent",value:function(){if(this.isNull())return 0;var n=this.getWidth(),r=this.getHeight();return n<r?n:r}},{key:"getWidth",value:function(){return this.isNull()?0:this._maxx-this._minx}},{key:"compareTo",value:function(n){var r=n;return this.isNull()?r.isNull()?0:-1:r.isNull()?1:this._minx<r._minx?-1:this._minx>r._minx?1:this._miny<r._miny?-1:this._miny>r._miny?1:this._maxx<r._maxx?-1:this._maxx>r._maxx?1:this._maxy<r._maxy?-1:this._maxy>r._maxy?1:0}},{key:"translate",value:function(n,r){if(this.isNull())return null;this.init(this.getMinX()+n,this.getMaxX()+n,this.getMinY()+r,this.getMaxY()+r)}},{key:"copy",value:function(){return new u(this)}},{key:"toString",value:function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"}},{key:"setToNull",value:function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1}},{key:"disjoint",value:function(n){return!(!this.isNull()&&!n.isNull())||n._minx>this._maxx||n._maxx<this._minx||n._miny>this._maxy||n._maxy<this._miny}},{key:"getHeight",value:function(){return this.isNull()?0:this._maxy-this._miny}},{key:"maxExtent",value:function(){if(this.isNull())return 0;var n=this.getWidth(),r=this.getHeight();return n>r?n:r}},{key:"expandBy",value:function(){if(arguments.length===1){var n=arguments[0];this.expandBy(n,n)}else if(arguments.length===2){var r=arguments[0],a=arguments[1];if(this.isNull())return null;this._minx-=r,this._maxx+=r,this._miny-=a,this._maxy+=a,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}}},{key:"contains",value:function(){if(arguments.length===1){if(arguments[0]instanceof u){var n=arguments[0];return this.covers(n)}if(arguments[0]instanceof W){var r=arguments[0];return this.covers(r)}}else if(arguments.length===2){var a=arguments[0],f=arguments[1];return this.covers(a,f)}}},{key:"centre",value:function(){return this.isNull()?null:new W((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)}},{key:"init",value:function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof W){var n=arguments[0];this.init(n.x,n.x,n.y,n.y)}else if(arguments[0]instanceof u){var r=arguments[0];this._minx=r._minx,this._maxx=r._maxx,this._miny=r._miny,this._maxy=r._maxy}}else if(arguments.length===2){var a=arguments[0],f=arguments[1];this.init(a.x,f.x,a.y,f.y)}else if(arguments.length===4){var m=arguments[0],p=arguments[1],I=arguments[2],O=arguments[3];m<p?(this._minx=m,this._maxx=p):(this._minx=p,this._maxx=m),I<O?(this._miny=I,this._maxy=O):(this._miny=O,this._maxy=I)}}},{key:"getMaxY",value:function(){return this._maxy}},{key:"distance",value:function(n){if(this.intersects(n))return 0;var r=0;this._maxx<n._minx?r=n._minx-this._maxx:this._minx>n._maxx&&(r=this._minx-n._maxx);var a=0;return this._maxy<n._miny?a=n._miny-this._maxy:this._miny>n._maxy&&(a=this._miny-n._maxy),r===0?a:a===0?r:Math.sqrt(r*r+a*a)}},{key:"hashCode",value:function(){var n=17;return n=37*(n=37*(n=37*(n=37*n+W.hashCode(this._minx))+W.hashCode(this._maxx))+W.hashCode(this._miny))+W.hashCode(this._maxy)}},{key:"interfaces_",get:function(){return[q,N]}}],[{key:"constructor_",value:function(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,arguments.length===0)this.init();else if(arguments.length===1){if(arguments[0]instanceof W){var n=arguments[0];this.init(n.x,n.x,n.y,n.y)}else if(arguments[0]instanceof u){var r=arguments[0];this.init(r)}}else if(arguments.length===2){var a=arguments[0],f=arguments[1];this.init(a.x,f.x,a.y,f.y)}else if(arguments.length===4){var m=arguments[0],p=arguments[1],I=arguments[2],O=arguments[3];this.init(m,p,I,O)}}},{key:"intersects",value:function(){if(arguments.length===3){var n=arguments[0],r=arguments[1],a=arguments[2];return a.x>=(n.x<r.x?n.x:r.x)&&a.x<=(n.x>r.x?n.x:r.x)&&a.y>=(n.y<r.y?n.y:r.y)&&a.y<=(n.y>r.y?n.y:r.y)}if(arguments.length===4){var f=arguments[0],m=arguments[1],p=arguments[2],I=arguments[3],O=Math.min(p.x,I.x),U=Math.max(p.x,I.x),J=Math.min(f.x,m.x),Q=Math.max(f.x,m.x);return!(J>U)&&!(Q<O)&&(O=Math.min(p.y,I.y),U=Math.max(p.y,I.y),J=Math.min(f.y,m.y),Q=Math.max(f.y,m.y),!(J>U)&&!(Q<O))}}}])})(),oe=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"isGeometryCollection",value:function(){return this.getTypeCode()===u.TYPECODE_GEOMETRYCOLLECTION}},{key:"getFactory",value:function(){return this._factory}},{key:"getGeometryN",value:function(n){return this}},{key:"getArea",value:function(){return 0}},{key:"isRectangle",value:function(){return!1}},{key:"equalsExact",value:function(n){return this===n||this.equalsExact(n,0)}},{key:"geometryChanged",value:function(){this.apply(u.geometryChangedFilter)}},{key:"geometryChangedAction",value:function(){this._envelope=null}},{key:"equalsNorm",value:function(n){return n!==null&&this.norm().equalsExact(n.norm())}},{key:"getLength",value:function(){return 0}},{key:"getNumGeometries",value:function(){return 1}},{key:"compareTo",value:function(){var n;if(arguments.length===1){var r=arguments[0];return n=r,this.getTypeCode()!==n.getTypeCode()?this.getTypeCode()-n.getTypeCode():this.isEmpty()&&n.isEmpty()?0:this.isEmpty()?-1:n.isEmpty()?1:this.compareToSameClass(r)}if(arguments.length===2){var a=arguments[0],f=arguments[1];return n=a,this.getTypeCode()!==n.getTypeCode()?this.getTypeCode()-n.getTypeCode():this.isEmpty()&&n.isEmpty()?0:this.isEmpty()?-1:n.isEmpty()?1:this.compareToSameClass(a,f)}}},{key:"getUserData",value:function(){return this._userData}},{key:"getSRID",value:function(){return this._SRID}},{key:"getEnvelope",value:function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())}},{key:"checkNotGeometryCollection",value:function(n){if(n.getTypeCode()===u.TYPECODE_GEOMETRYCOLLECTION)throw new C("This method does not support GeometryCollection arguments")}},{key:"equal",value:function(n,r,a){return a===0?n.equals(r):n.distance(r)<=a}},{key:"norm",value:function(){var n=this.copy();return n.normalize(),n}},{key:"reverse",value:function(){var n=this.reverseInternal();return this.envelope!=null&&(n.envelope=this.envelope.copy()),n.setSRID(this.getSRID()),n}},{key:"copy",value:function(){var n=this.copyInternal();return n.envelope=this._envelope==null?null:this._envelope.copy(),n._SRID=this._SRID,n._userData=this._userData,n}},{key:"getPrecisionModel",value:function(){return this._factory.getPrecisionModel()}},{key:"getEnvelopeInternal",value:function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new le(this._envelope)}},{key:"setSRID",value:function(n){this._SRID=n}},{key:"setUserData",value:function(n){this._userData=n}},{key:"compare",value:function(n,r){for(var a=n.iterator(),f=r.iterator();a.hasNext()&&f.hasNext();){var m=a.next(),p=f.next(),I=m.compareTo(p);if(I!==0)return I}return a.hasNext()?1:f.hasNext()?-1:0}},{key:"hashCode",value:function(){return this.getEnvelopeInternal().hashCode()}},{key:"isEquivalentClass",value:function(n){return this.getClass()===n.getClass()}},{key:"isGeometryCollectionOrDerived",value:function(){return this.getTypeCode()===u.TYPECODE_GEOMETRYCOLLECTION||this.getTypeCode()===u.TYPECODE_MULTIPOINT||this.getTypeCode()===u.TYPECODE_MULTILINESTRING||this.getTypeCode()===u.TYPECODE_MULTIPOLYGON}},{key:"interfaces_",get:function(){return[w,q,N]}},{key:"getClass",value:function(){return u}}],[{key:"hasNonEmptyElements",value:function(n){for(var r=0;r<n.length;r++)if(!n[r].isEmpty())return!0;return!1}},{key:"hasNullElements",value:function(n){for(var r=0;r<n.length;r++)if(n[r]===null)return!0;return!1}}])})();oe.constructor_=function(u){u&&(this._envelope=null,this._userData=null,this._factory=u,this._SRID=u.getSRID())},oe.TYPECODE_POINT=0,oe.TYPECODE_MULTIPOINT=1,oe.TYPECODE_LINESTRING=2,oe.TYPECODE_LINEARRING=3,oe.TYPECODE_MULTILINESTRING=4,oe.TYPECODE_POLYGON=5,oe.TYPECODE_MULTIPOLYGON=6,oe.TYPECODE_GEOMETRYCOLLECTION=7,oe.TYPENAME_POINT="Point",oe.TYPENAME_MULTIPOINT="MultiPoint",oe.TYPENAME_LINESTRING="LineString",oe.TYPENAME_LINEARRING="LinearRing",oe.TYPENAME_MULTILINESTRING="MultiLineString",oe.TYPENAME_POLYGON="Polygon",oe.TYPENAME_MULTIPOLYGON="MultiPolygon",oe.TYPENAME_GEOMETRYCOLLECTION="GeometryCollection",oe.geometryChangedFilter={get interfaces_(){return[A]},filter:function(u){u.geometryChangedAction()}};var $=(function(){function u(){o(this,u)}return c(u,null,[{key:"toLocationSymbol",value:function(n){switch(n){case u.EXTERIOR:return"e";case u.BOUNDARY:return"b";case u.INTERIOR:return"i";case u.NONE:return"-"}throw new C("Unknown location value: "+n)}}])})();$.INTERIOR=0,$.BOUNDARY=1,$.EXTERIOR=2,$.NONE=-1;var Me=(function(){return c((function u(){o(this,u)}),[{key:"add",value:function(){}},{key:"addAll",value:function(){}},{key:"isEmpty",value:function(){}},{key:"iterator",value:function(){}},{key:"size",value:function(){}},{key:"toArray",value:function(){}},{key:"remove",value:function(){}}])})(),Se=(function(u){function n(r){var a;return o(this,n),(a=s(this,n,[r])).name=Object.keys({NoSuchElementException:n})[0],a}return v(n,u),c(n)})(b),ue=(function(u){function n(r){var a;return o(this,n),(a=s(this,n,[r])).name=Object.keys({UnsupportedOperationException:n})[0],a}return v(n,u),c(n)})(b),ke=(function(u){function n(){return o(this,n),s(this,n,arguments)}return v(n,u),c(n,[{key:"contains",value:function(){}}])})(Me),ct=(function(u){function n(r){var a;return o(this,n),(a=s(this,n)).map=new Map,r instanceof Me&&a.addAll(r),a}return v(n,u),c(n,[{key:"contains",value:function(r){var a=r.hashCode?r.hashCode():r;return!!this.map.has(a)}},{key:"add",value:function(r){var a=r.hashCode?r.hashCode():r;return!this.map.has(a)&&!!this.map.set(a,r)}},{key:"addAll",value:function(r){var a,f=g(r);try{for(f.s();!(a=f.n()).done;){var m=a.value;this.add(m)}}catch(p){f.e(p)}finally{f.f()}return!0}},{key:"remove",value:function(){throw new ue}},{key:"size",value:function(){return this.map.size}},{key:"isEmpty",value:function(){return this.map.size===0}},{key:"toArray",value:function(){return Array.from(this.map.values())}},{key:"iterator",value:function(){return new Bt(this.map)}},{key:Symbol.iterator,value:function(){return this.map}}])})(ke),Bt=(function(){return c((function u(n){o(this,u),this.iterator=n.values();var r=this.iterator.next(),a=r.done,f=r.value;this.done=a,this.value=f}),[{key:"next",value:function(){if(this.done)throw new Se;var u=this.value,n=this.iterator.next(),r=n.done,a=n.value;return this.done=r,this.value=a,u}},{key:"hasNext",value:function(){return!this.done}},{key:"remove",value:function(){throw new ue}}])})(),ie=(function(){function u(){o(this,u)}return c(u,null,[{key:"opposite",value:function(n){return n===u.LEFT?u.RIGHT:n===u.RIGHT?u.LEFT:n}}])})();ie.ON=0,ie.LEFT=1,ie.RIGHT=2;var Yi=(function(u){function n(r){var a;return o(this,n),(a=s(this,n,[r])).name=Object.keys({EmptyStackException:n})[0],a}return v(n,u),c(n)})(b),zi=(function(u){function n(r){var a;return o(this,n),(a=s(this,n,[r])).name=Object.keys({IndexOutOfBoundsException:n})[0],a}return v(n,u),c(n)})(b),Jt=(function(u){function n(){return o(this,n),s(this,n,arguments)}return v(n,u),c(n,[{key:"get",value:function(){}},{key:"set",value:function(){}},{key:"isEmpty",value:function(){}}])})(Me),yo=(function(u){function n(){var r;return o(this,n),(r=s(this,n)).array=[],r}return v(n,u),c(n,[{key:"add",value:function(r){return this.array.push(r),!0}},{key:"get",value:function(r){if(r<0||r>=this.size())throw new zi;return this.array[r]}},{key:"push",value:function(r){return this.array.push(r),r}},{key:"pop",value:function(){if(this.array.length===0)throw new Yi;return this.array.pop()}},{key:"peek",value:function(){if(this.array.length===0)throw new Yi;return this.array[this.array.length-1]}},{key:"empty",value:function(){return this.array.length===0}},{key:"isEmpty",value:function(){return this.empty()}},{key:"search",value:function(r){return this.array.indexOf(r)}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}}])})(Jt);function Ie(u,n){return u.interfaces_&&u.interfaces_.indexOf(n)>-1}var ln=(function(){return c((function u(n){o(this,u),this.str=n}),[{key:"append",value:function(u){this.str+=u}},{key:"setCharAt",value:function(u,n){this.str=this.str.substr(0,u)+n+this.str.substr(u+1)}},{key:"toString",value:function(){return this.str}}])})(),cn=(function(){function u(n){o(this,u),this.value=n}return c(u,[{key:"intValue",value:function(){return this.value}},{key:"compareTo",value:function(n){return this.value<n?-1:this.value>n?1:0}}],[{key:"compare",value:function(n,r){return n<r?-1:n>r?1:0}},{key:"isNan",value:function(n){return Number.isNaN(n)}},{key:"valueOf",value:function(n){return new u(n)}}])})(),mo=(function(){return c((function u(){o(this,u)}),null,[{key:"isWhitespace",value:function(u){return u<=32&&u>=0||u===127}},{key:"toUpperCase",value:function(u){return u.toUpperCase()}}])})(),pe=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"le",value:function(n){return this._hi<n._hi||this._hi===n._hi&&this._lo<=n._lo}},{key:"extractSignificantDigits",value:function(n,r){var a=this.abs(),f=u.magnitude(a._hi),m=u.TEN.pow(f);(a=a.divide(m)).gt(u.TEN)?(a=a.divide(u.TEN),f+=1):a.lt(u.ONE)&&(a=a.multiply(u.TEN),f-=1);for(var p=f+1,I=new ln,O=u.MAX_PRINT_DIGITS-1,U=0;U<=O;U++){n&&U===p&&I.append(".");var J=Math.trunc(a._hi);if(J<0)break;var Q=!1,ne=0;J>9?(Q=!0,ne="9"):ne="0"+J,I.append(ne),a=a.subtract(u.valueOf(J)).multiply(u.TEN),Q&&a.selfAdd(u.TEN);var ce=!0,fe=u.magnitude(a._hi);if(fe<0&&Math.abs(fe)>=O-U&&(ce=!1),!ce)break}return r[0]=f,I.toString()}},{key:"sqr",value:function(){return this.multiply(this)}},{key:"doubleValue",value:function(){return this._hi+this._lo}},{key:"subtract",value:function(){if(arguments[0]instanceof u){var n=arguments[0];return this.add(n.negate())}if(typeof arguments[0]=="number"){var r=arguments[0];return this.add(-r)}}},{key:"equals",value:function(){if(arguments.length===1&&arguments[0]instanceof u){var n=arguments[0];return this._hi===n._hi&&this._lo===n._lo}}},{key:"isZero",value:function(){return this._hi===0&&this._lo===0}},{key:"selfSubtract",value:function(){if(arguments[0]instanceof u){var n=arguments[0];return this.isNaN()?this:this.selfAdd(-n._hi,-n._lo)}if(typeof arguments[0]=="number"){var r=arguments[0];return this.isNaN()?this:this.selfAdd(-r,0)}}},{key:"getSpecialNumberString",value:function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null}},{key:"min",value:function(n){return this.le(n)?this:n}},{key:"selfDivide",value:function(){if(arguments.length===1){if(arguments[0]instanceof u){var n=arguments[0];return this.selfDivide(n._hi,n._lo)}if(typeof arguments[0]=="number"){var r=arguments[0];return this.selfDivide(r,0)}}else if(arguments.length===2){var a,f,m,p,I=arguments[0],O=arguments[1],U=null,J=null,Q=null,ne=null;return m=this._hi/I,ne=(U=(Q=u.SPLIT*m)-(U=Q-m))*(J=(ne=u.SPLIT*I)-(J=ne-I))-(p=m*I)+U*(f=I-J)+(a=m-U)*J+a*f,ne=m+(Q=(this._hi-p-ne+this._lo-m*O)/I),this._hi=ne,this._lo=m-ne+Q,this}}},{key:"dump",value:function(){return"DD<"+this._hi+", "+this._lo+">"}},{key:"divide",value:function(){if(arguments[0]instanceof u){var n,r,a,f,m=arguments[0],p=null,I=null,O=null,U=null;return n=(a=this._hi/m._hi)-(p=(O=u.SPLIT*a)-(p=O-a)),U=p*(I=(U=u.SPLIT*m._hi)-(I=U-m._hi))-(f=a*m._hi)+p*(r=m._hi-I)+n*I+n*r,new u(U=a+(O=(this._hi-f-U+this._lo-a*m._lo)/m._hi),a-U+O)}if(typeof arguments[0]=="number"){var J=arguments[0];return B.isNaN(J)?u.createNaN():u.copy(this).selfDivide(J,0)}}},{key:"ge",value:function(n){return this._hi>n._hi||this._hi===n._hi&&this._lo>=n._lo}},{key:"pow",value:function(n){if(n===0)return u.valueOf(1);var r=new u(this),a=u.valueOf(1),f=Math.abs(n);if(f>1)for(;f>0;)f%2==1&&a.selfMultiply(r),(f/=2)>0&&(r=r.sqr());else a=r;return n<0?a.reciprocal():a}},{key:"ceil",value:function(){if(this.isNaN())return u.NaN;var n=Math.ceil(this._hi),r=0;return n===this._hi&&(r=Math.ceil(this._lo)),new u(n,r)}},{key:"compareTo",value:function(n){var r=n;return this._hi<r._hi?-1:this._hi>r._hi?1:this._lo<r._lo?-1:this._lo>r._lo?1:0}},{key:"rint",value:function(){return this.isNaN()?this:this.add(.5).floor()}},{key:"setValue",value:function(){if(arguments[0]instanceof u){var n=arguments[0];return this.init(n),this}if(typeof arguments[0]=="number"){var r=arguments[0];return this.init(r),this}}},{key:"max",value:function(n){return this.ge(n)?this:n}},{key:"sqrt",value:function(){if(this.isZero())return u.valueOf(0);if(this.isNegative())return u.NaN;var n=1/Math.sqrt(this._hi),r=this._hi*n,a=u.valueOf(r),f=this.subtract(a.sqr())._hi*(.5*n);return a.add(f)}},{key:"selfAdd",value:function(){if(arguments.length===1){if(arguments[0]instanceof u){var n=arguments[0];return this.selfAdd(n._hi,n._lo)}if(typeof arguments[0]=="number"){var r,a,f,m,p,I=arguments[0],O=null;return O=(f=this._hi+I)-(m=f-this._hi),a=(p=(O=I-m+(this._hi-O))+this._lo)+(f-(r=f+p)),this._hi=r+a,this._lo=a+(r-this._hi),this}}else if(arguments.length===2){var U,J,Q,ne,ce=arguments[0],fe=arguments[1],de=null,Re=null,be=null;Q=this._hi+ce,J=this._lo+fe,Re=Q-(be=Q-this._hi),de=J-(ne=J-this._lo);var Ye=(U=Q+(be=(Re=ce-be+(this._hi-Re))+J))+(be=(de=fe-ne+(this._lo-de))+(be+(Q-U))),it=be+(U-Ye);return this._hi=Ye,this._lo=it,this}}},{key:"selfMultiply",value:function(){if(arguments.length===1){if(arguments[0]instanceof u){var n=arguments[0];return this.selfMultiply(n._hi,n._lo)}if(typeof arguments[0]=="number"){var r=arguments[0];return this.selfMultiply(r,0)}}else if(arguments.length===2){var a,f,m=arguments[0],p=arguments[1],I=null,O=null,U=null,J=null;I=(U=u.SPLIT*this._hi)-this._hi,J=u.SPLIT*m,I=U-I,a=this._hi-I,O=J-m;var Q=(U=this._hi*m)+(J=I*(O=J-O)-U+I*(f=m-O)+a*O+a*f+(this._hi*p+this._lo*m)),ne=J+(I=U-Q);return this._hi=Q,this._lo=ne,this}}},{key:"selfSqr",value:function(){return this.selfMultiply(this)}},{key:"floor",value:function(){if(this.isNaN())return u.NaN;var n=Math.floor(this._hi),r=0;return n===this._hi&&(r=Math.floor(this._lo)),new u(n,r)}},{key:"negate",value:function(){return this.isNaN()?this:new u(-this._hi,-this._lo)}},{key:"clone",value:function(){try{return null}catch(n){if(n instanceof CloneNotSupportedException)return null;throw n}}},{key:"multiply",value:function(){if(arguments[0]instanceof u){var n=arguments[0];return n.isNaN()?u.createNaN():u.copy(this).selfMultiply(n)}if(typeof arguments[0]=="number"){var r=arguments[0];return B.isNaN(r)?u.createNaN():u.copy(this).selfMultiply(r,0)}}},{key:"isNaN",value:function(){return B.isNaN(this._hi)}},{key:"intValue",value:function(){return Math.trunc(this._hi)}},{key:"toString",value:function(){var n=u.magnitude(this._hi);return n>=-3&&n<=20?this.toStandardNotation():this.toSciNotation()}},{key:"toStandardNotation",value:function(){var n=this.getSpecialNumberString();if(n!==null)return n;var r=new Array(1).fill(null),a=this.extractSignificantDigits(!0,r),f=r[0]+1,m=a;if(a.charAt(0)===".")m="0"+a;else if(f<0)m="0."+u.stringOfChar("0",-f)+a;else if(a.indexOf(".")===-1){var p=f-a.length;m=a+u.stringOfChar("0",p)+".0"}return this.isNegative()?"-"+m:m}},{key:"reciprocal",value:function(){var n,r,a,f,m=null,p=null,I=null,O=null;n=(a=1/this._hi)-(m=(I=u.SPLIT*a)-(m=I-a)),p=(O=u.SPLIT*this._hi)-this._hi;var U=a+(I=(1-(f=a*this._hi)-(O=m*(p=O-p)-f+m*(r=this._hi-p)+n*p+n*r)-a*this._lo)/this._hi);return new u(U,a-U+I)}},{key:"toSciNotation",value:function(){if(this.isZero())return u.SCI_NOT_ZERO;var n=this.getSpecialNumberString();if(n!==null)return n;var r=new Array(1).fill(null),a=this.extractSignificantDigits(!1,r),f=u.SCI_NOT_EXPONENT_CHAR+r[0];if(a.charAt(0)==="0")throw new IllegalStateException("Found leading zero: "+a);var m="";a.length>1&&(m=a.substring(1));var p=a.charAt(0)+"."+m;return this.isNegative()?"-"+p+f:p+f}},{key:"abs",value:function(){return this.isNaN()?u.NaN:this.isNegative()?this.negate():new u(this)}},{key:"isPositive",value:function(){return this._hi>0||this._hi===0&&this._lo>0}},{key:"lt",value:function(n){return this._hi<n._hi||this._hi===n._hi&&this._lo<n._lo}},{key:"add",value:function(){if(arguments[0]instanceof u){var n=arguments[0];return u.copy(this).selfAdd(n)}if(typeof arguments[0]=="number"){var r=arguments[0];return u.copy(this).selfAdd(r)}}},{key:"init",value:function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var n=arguments[0];this._hi=n,this._lo=0}else if(arguments[0]instanceof u){var r=arguments[0];this._hi=r._hi,this._lo=r._lo}}else if(arguments.length===2){var a=arguments[0],f=arguments[1];this._hi=a,this._lo=f}}},{key:"gt",value:function(n){return this._hi>n._hi||this._hi===n._hi&&this._lo>n._lo}},{key:"isNegative",value:function(){return this._hi<0||this._hi===0&&this._lo<0}},{key:"trunc",value:function(){return this.isNaN()?u.NaN:this.isPositive()?this.floor():this.ceil()}},{key:"signum",value:function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0}},{key:"interfaces_",get:function(){return[N,q,w]}}],[{key:"constructor_",value:function(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var n=arguments[0];this.init(n)}else if(arguments[0]instanceof u){var r=arguments[0];this.init(r)}else if(typeof arguments[0]=="string"){var a=arguments[0];u.constructor_.call(this,u.parse(a))}}else if(arguments.length===2){var f=arguments[0],m=arguments[1];this.init(f,m)}}},{key:"determinant",value:function(){if(typeof arguments[3]=="number"&&typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],r=arguments[1],a=arguments[2],f=arguments[3];return u.determinant(u.valueOf(n),u.valueOf(r),u.valueOf(a),u.valueOf(f))}if(arguments[3]instanceof u&&arguments[2]instanceof u&&arguments[0]instanceof u&&arguments[1]instanceof u){var m=arguments[1],p=arguments[2],I=arguments[3];return arguments[0].multiply(I).selfSubtract(m.multiply(p))}}},{key:"sqr",value:function(n){return u.valueOf(n).selfMultiply(n)}},{key:"valueOf",value:function(){if(typeof arguments[0]=="string"){var n=arguments[0];return u.parse(n)}if(typeof arguments[0]=="number")return new u(arguments[0])}},{key:"sqrt",value:function(n){return u.valueOf(n).sqrt()}},{key:"parse",value:function(n){for(var r=0,a=n.length;mo.isWhitespace(n.charAt(r));)r++;var f=!1;if(r<a){var m=n.charAt(r);m!=="-"&&m!=="+"||(r++,m==="-"&&(f=!0))}for(var p=new u,I=0,O=0,U=0,J=!1;!(r>=a);){var Q=n.charAt(r);if(r++,mo.isDigit(Q)){var ne=Q-"0";p.selfMultiply(u.TEN),p.selfAdd(ne),I++}else{if(Q!=="."){if(Q==="e"||Q==="E"){var ce=n.substring(r);try{U=cn.parseInt(ce)}catch(Ye){throw Ye instanceof NumberFormatException?new NumberFormatException("Invalid exponent "+ce+" in string "+n):Ye}break}throw new NumberFormatException("Unexpected character '"+Q+"' at position "+r+" in string "+n)}O=I,J=!0}}var fe=p;J||(O=I);var de=I-O-U;if(de===0)fe=p;else if(de>0){var Re=u.TEN.pow(de);fe=p.divide(Re)}else if(de<0){var be=u.TEN.pow(-de);fe=p.multiply(be)}return f?fe.negate():fe}},{key:"createNaN",value:function(){return new u(B.NaN,B.NaN)}},{key:"copy",value:function(n){return new u(n)}},{key:"magnitude",value:function(n){var r=Math.abs(n),a=Math.log(r)/Math.log(10),f=Math.trunc(Math.floor(a));return 10*Math.pow(10,f)<=r&&(f+=1),f}},{key:"stringOfChar",value:function(n,r){for(var a=new ln,f=0;f<r;f++)a.append(n);return a.toString()}}])})();pe.PI=new pe(3.141592653589793,12246467991473532e-32),pe.TWO_PI=new pe(6.283185307179586,24492935982947064e-32),pe.PI_2=new pe(1.5707963267948966,6123233995736766e-32),pe.E=new pe(2.718281828459045,14456468917292502e-32),pe.NaN=new pe(B.NaN,B.NaN),pe.EPS=123259516440783e-46,pe.SPLIT=134217729,pe.MAX_PRINT_DIGITS=32,pe.TEN=pe.valueOf(10),pe.ONE=pe.valueOf(1),pe.SCI_NOT_EXPONENT_CHAR="E",pe.SCI_NOT_ZERO="0.0E0";var po=(function(){function u(){o(this,u)}return c(u,null,[{key:"orientationIndex",value:function(n,r,a){var f=u.orientationIndexFilter(n,r,a);if(f<=1)return f;var m=pe.valueOf(r.x).selfAdd(-n.x),p=pe.valueOf(r.y).selfAdd(-n.y),I=pe.valueOf(a.x).selfAdd(-r.x),O=pe.valueOf(a.y).selfAdd(-r.y);return m.selfMultiply(O).selfSubtract(p.selfMultiply(I)).signum()}},{key:"signOfDet2x2",value:function(){if(arguments[3]instanceof pe&&arguments[2]instanceof pe&&arguments[0]instanceof pe&&arguments[1]instanceof pe){var n=arguments[1],r=arguments[2],a=arguments[3];return arguments[0].multiply(a).selfSubtract(n.multiply(r)).signum()}if(typeof arguments[3]=="number"&&typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var f=arguments[0],m=arguments[1],p=arguments[2],I=arguments[3],O=pe.valueOf(f),U=pe.valueOf(m),J=pe.valueOf(p),Q=pe.valueOf(I);return O.multiply(Q).selfSubtract(U.multiply(J)).signum()}}},{key:"intersection",value:function(n,r,a,f){var m=new pe(n.y).selfSubtract(r.y),p=new pe(r.x).selfSubtract(n.x),I=new pe(n.x).selfMultiply(r.y).selfSubtract(new pe(r.x).selfMultiply(n.y)),O=new pe(a.y).selfSubtract(f.y),U=new pe(f.x).selfSubtract(a.x),J=new pe(a.x).selfMultiply(f.y).selfSubtract(new pe(f.x).selfMultiply(a.y)),Q=p.multiply(J).selfSubtract(U.multiply(I)),ne=O.multiply(I).selfSubtract(m.multiply(J)),ce=m.multiply(U).selfSubtract(O.multiply(p)),fe=Q.selfDivide(ce).doubleValue(),de=ne.selfDivide(ce).doubleValue();return B.isNaN(fe)||B.isInfinite(fe)||B.isNaN(de)||B.isInfinite(de)?null:new W(fe,de)}},{key:"orientationIndexFilter",value:function(n,r,a){var f=null,m=(n.x-a.x)*(r.y-a.y),p=(n.y-a.y)*(r.x-a.x),I=m-p;if(m>0){if(p<=0)return u.signum(I);f=m+p}else{if(!(m<0)||p>=0)return u.signum(I);f=-m-p}var O=u.DP_SAFE_EPSILON*f;return I>=O||-I>=O?u.signum(I):2}},{key:"signum",value:function(n){return n>0?1:n<0?-1:0}}])})();po.DP_SAFE_EPSILON=1e-15;var Oe=(function(){return c((function u(){o(this,u)}),[{key:"getM",value:function(u){if(this.hasM()){var n=this.getDimension()-this.getMeasures();return this.getOrdinate(u,n)}return B.NaN}},{key:"setOrdinate",value:function(u,n,r){}},{key:"getZ",value:function(u){return this.hasZ()?this.getOrdinate(u,2):B.NaN}},{key:"size",value:function(){}},{key:"getOrdinate",value:function(u,n){}},{key:"getCoordinate",value:function(){}},{key:"getCoordinateCopy",value:function(u){}},{key:"createCoordinate",value:function(){}},{key:"getDimension",value:function(){}},{key:"hasM",value:function(){return this.getMeasures()>0}},{key:"getX",value:function(u){}},{key:"hasZ",value:function(){return this.getDimension()-this.getMeasures()>2}},{key:"getMeasures",value:function(){return 0}},{key:"expandEnvelope",value:function(u){}},{key:"copy",value:function(){}},{key:"getY",value:function(u){}},{key:"toCoordinateArray",value:function(){}},{key:"interfaces_",get:function(){return[w]}}])})();Oe.X=0,Oe.Y=1,Oe.Z=2,Oe.M=3;var Ee=(function(){function u(){o(this,u)}return c(u,null,[{key:"index",value:function(n,r,a){return po.orientationIndex(n,r,a)}},{key:"isCCW",value:function(){if(arguments[0]instanceof Array){var n=arguments[0],r=n.length-1;if(r<3)throw new C("Ring has fewer than 4 points, so orientation cannot be determined");for(var a=n[0],f=0,m=1;m<=r;m++){var p=n[m];p.y>a.y&&(a=p,f=m)}var I=f;do(I-=1)<0&&(I=r);while(n[I].equals2D(a)&&I!==f);var O=f;do O=(O+1)%r;while(n[O].equals2D(a)&&O!==f);var U=n[I],J=n[O];if(U.equals2D(a)||J.equals2D(a)||U.equals2D(J))return!1;var Q=u.index(U,a,J);return Q===0?U.x>J.x:Q>0}if(Ie(arguments[0],Oe)){var ne=arguments[0],ce=ne.size()-1;if(ce<3)throw new C("Ring has fewer than 4 points, so orientation cannot be determined");for(var fe=ne.getCoordinate(0),de=0,Re=1;Re<=ce;Re++){var be=ne.getCoordinate(Re);be.y>fe.y&&(fe=be,de=Re)}var Ye=null,it=de;do(it-=1)<0&&(it=ce),Ye=ne.getCoordinate(it);while(Ye.equals2D(fe)&&it!==de);var ut=null,Nn=de;do Nn=(Nn+1)%ce,ut=ne.getCoordinate(Nn);while(ut.equals2D(fe)&&Nn!==de);if(Ye.equals2D(fe)||ut.equals2D(fe)||Ye.equals2D(ut))return!1;var Yr=u.index(Ye,fe,ut);return Yr===0?Ye.x>ut.x:Yr>0}}}])})();Ee.CLOCKWISE=-1,Ee.RIGHT=Ee.CLOCKWISE,Ee.COUNTERCLOCKWISE=1,Ee.LEFT=Ee.COUNTERCLOCKWISE,Ee.COLLINEAR=0,Ee.STRAIGHT=Ee.COLLINEAR;var Am=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"getCoordinate",value:function(){return this._minCoord}},{key:"getRightmostSide",value:function(u,n){var r=this.getRightmostSideOfSegment(u,n);return r<0&&(r=this.getRightmostSideOfSegment(u,n-1)),r<0&&(this._minCoord=null,this.checkForRightmostCoordinate(u)),r}},{key:"findRightmostEdgeAtVertex",value:function(){var u=this._minDe.getEdge().getCoordinates();j.isTrue(this._minIndex>0&&this._minIndex<u.length,"rightmost point expected to be interior vertex of edge");var n=u[this._minIndex-1],r=u[this._minIndex+1],a=Ee.index(this._minCoord,r,n),f=!1;(n.y<this._minCoord.y&&r.y<this._minCoord.y&&a===Ee.COUNTERCLOCKWISE||n.y>this._minCoord.y&&r.y>this._minCoord.y&&a===Ee.CLOCKWISE)&&(f=!0),f&&(this._minIndex=this._minIndex-1)}},{key:"getRightmostSideOfSegment",value:function(u,n){var r=u.getEdge().getCoordinates();if(n<0||n+1>=r.length||r[n].y===r[n+1].y)return-1;var a=ie.LEFT;return r[n].y<r[n+1].y&&(a=ie.RIGHT),a}},{key:"getEdge",value:function(){return this._orientedDe}},{key:"checkForRightmostCoordinate",value:function(u){for(var n=u.getEdge().getCoordinates(),r=0;r<n.length-1;r++)(this._minCoord===null||n[r].x>this._minCoord.x)&&(this._minDe=u,this._minIndex=r,this._minCoord=n[r])}},{key:"findRightmostEdgeAtNode",value:function(){var u=this._minDe.getNode().getEdges();this._minDe=u.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)}},{key:"findEdge",value:function(u){for(var n=u.iterator();n.hasNext();){var r=n.next();r.isForward()&&this.checkForRightmostCoordinate(r)}j.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===ie.LEFT&&(this._orientedDe=this._minDe.getSym())}}],[{key:"constructor_",value:function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null}}])})(),Qt=(function(u){function n(r,a){var f;return o(this,n),(f=s(this,n,[a?r+" [ "+a+" ]":r])).pt=a?new W(a):void 0,f.name=Object.keys({TopologyException:n})[0],f}return v(n,u),c(n,[{key:"getCoordinate",value:function(){return this.pt}}])})(K),Dm=(function(){return c((function u(){o(this,u),this.array=[]}),[{key:"addLast",value:function(u){this.array.push(u)}},{key:"removeFirst",value:function(){return this.array.shift()}},{key:"isEmpty",value:function(){return this.array.length===0}}])})(),me=(function(u){function n(r){var a;return o(this,n),(a=s(this,n)).array=[],r instanceof Me&&a.addAll(r),a}return v(n,u),c(n,[{key:"interfaces_",get:function(){return[Jt,Me]}},{key:"ensureCapacity",value:function(){}},{key:"add",value:function(r){return arguments.length===1?this.array.push(r):this.array.splice(arguments[0],0,arguments[1]),!0}},{key:"clear",value:function(){this.array=[]}},{key:"addAll",value:function(r){var a,f=g(r);try{for(f.s();!(a=f.n()).done;){var m=a.value;this.array.push(m)}}catch(p){f.e(p)}finally{f.f()}}},{key:"set",value:function(r,a){var f=this.array[r];return this.array[r]=a,f}},{key:"iterator",value:function(){return new Fm(this)}},{key:"get",value:function(r){if(r<0||r>=this.size())throw new zi;return this.array[r]}},{key:"isEmpty",value:function(){return this.array.length===0}},{key:"sort",value:function(r){r?this.array.sort((function(a,f){return r.compare(a,f)})):this.array.sort()}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}},{key:"remove",value:function(r){for(var a=0,f=this.array.length;a<f;a++)if(this.array[a]===r)return!!this.array.splice(a,1);return!1}},{key:Symbol.iterator,value:function(){return this.array.values()}}])})(Jt),Fm=(function(){return c((function u(n){o(this,u),this.arrayList=n,this.position=0}),[{key:"next",value:function(){if(this.position===this.arrayList.size())throw new Se;return this.arrayList.get(this.position++)}},{key:"hasNext",value:function(){return this.position<this.arrayList.size()}},{key:"set",value:function(u){return this.arrayList.set(this.position-1,u)}},{key:"remove",value:function(){this.arrayList.remove(this.arrayList.get(this.position))}}])})(),qm=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"clearVisitedEdges",value:function(){for(var u=this._dirEdgeList.iterator();u.hasNext();)u.next().setVisited(!1)}},{key:"getRightmostCoordinate",value:function(){return this._rightMostCoord}},{key:"computeNodeDepth",value:function(u){for(var n=null,r=u.getEdges().iterator();r.hasNext();){var a=r.next();if(a.isVisited()||a.getSym().isVisited()){n=a;break}}if(n===null)throw new Qt("unable to find edge to compute depths at "+u.getCoordinate());u.getEdges().computeDepths(n);for(var f=u.getEdges().iterator();f.hasNext();){var m=f.next();m.setVisited(!0),this.copySymDepths(m)}}},{key:"computeDepth",value:function(u){this.clearVisitedEdges();var n=this._finder.getEdge();n.getNode(),n.getLabel(),n.setEdgeDepths(ie.RIGHT,u),this.copySymDepths(n),this.computeDepths(n)}},{key:"create",value:function(u){this.addReachable(u),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()}},{key:"findResultEdges",value:function(){for(var u=this._dirEdgeList.iterator();u.hasNext();){var n=u.next();n.getDepth(ie.RIGHT)>=1&&n.getDepth(ie.LEFT)<=0&&!n.isInteriorAreaEdge()&&n.setInResult(!0)}}},{key:"computeDepths",value:function(u){var n=new ct,r=new Dm,a=u.getNode();for(r.addLast(a),n.add(a),u.setVisited(!0);!r.isEmpty();){var f=r.removeFirst();n.add(f),this.computeNodeDepth(f);for(var m=f.getEdges().iterator();m.hasNext();){var p=m.next().getSym();if(!p.isVisited()){var I=p.getNode();n.contains(I)||(r.addLast(I),n.add(I))}}}}},{key:"compareTo",value:function(u){var n=u;return this._rightMostCoord.x<n._rightMostCoord.x?-1:this._rightMostCoord.x>n._rightMostCoord.x?1:0}},{key:"getEnvelope",value:function(){if(this._env===null){for(var u=new le,n=this._dirEdgeList.iterator();n.hasNext();)for(var r=n.next().getEdge().getCoordinates(),a=0;a<r.length-1;a++)u.expandToInclude(r[a]);this._env=u}return this._env}},{key:"addReachable",value:function(u){var n=new yo;for(n.add(u);!n.empty();){var r=n.pop();this.add(r,n)}}},{key:"copySymDepths",value:function(u){var n=u.getSym();n.setDepth(ie.LEFT,u.getDepth(ie.RIGHT)),n.setDepth(ie.RIGHT,u.getDepth(ie.LEFT))}},{key:"add",value:function(u,n){u.setVisited(!0),this._nodes.add(u);for(var r=u.getEdges().iterator();r.hasNext();){var a=r.next();this._dirEdgeList.add(a);var f=a.getSym().getNode();f.isVisited()||n.push(f)}}},{key:"getNodes",value:function(){return this._nodes}},{key:"getDirectedEdges",value:function(){return this._dirEdgeList}},{key:"interfaces_",get:function(){return[q]}}],[{key:"constructor_",value:function(){this._finder=null,this._dirEdgeList=new me,this._nodes=new me,this._rightMostCoord=null,this._env=null,this._finder=new Am}}])})(),_o=(function(){return c((function u(){o(this,u)}),null,[{key:"intersection",value:function(u,n,r,a){var f=u.x<n.x?u.x:n.x,m=u.y<n.y?u.y:n.y,p=u.x>n.x?u.x:n.x,I=u.y>n.y?u.y:n.y,O=r.x<a.x?r.x:a.x,U=r.y<a.y?r.y:a.y,J=r.x>a.x?r.x:a.x,Q=r.y>a.y?r.y:a.y,ne=((f>O?f:O)+(p<J?p:J))/2,ce=((m>U?m:U)+(I<Q?I:Q))/2,fe=u.x-ne,de=u.y-ce,Re=n.x-ne,be=n.y-ce,Ye=r.x-ne,it=r.y-ce,ut=a.x-ne,Nn=a.y-ce,Yr=de-be,ih=Re-fe,sh=fe*be-Re*de,oh=it-Nn,ah=ut-Ye,uh=Ye*Nn-ut*it,lh=Yr*ah-oh*ih,Ao=(ih*uh-ah*sh)/lh,Do=(oh*sh-Yr*uh)/lh;return B.isNaN(Ao)||B.isInfinite(Ao)||B.isNaN(Do)||B.isInfinite(Do)?null:new W(Ao+ne,Do+ce)}}])})(),It=(function(){return c((function u(){o(this,u)}),null,[{key:"arraycopy",value:function(u,n,r,a,f){for(var m=0,p=n;p<n+f;p++)r[a+m]=u[p],m++}},{key:"getProperty",value:function(u){return{"line.separator":`
4
- `}[u]}}])})(),Or=(function(){function u(){o(this,u)}return c(u,null,[{key:"log10",value:function(n){var r=Math.log(n);return B.isInfinite(r)||B.isNaN(r)?r:r/u.LOG_10}},{key:"min",value:function(n,r,a,f){var m=n;return r<m&&(m=r),a<m&&(m=a),f<m&&(m=f),m}},{key:"clamp",value:function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],r=arguments[1],a=arguments[2];return n<r?r:n>a?a:n}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var f=arguments[0],m=arguments[1],p=arguments[2];return f<m?m:f>p?p:f}}},{key:"wrap",value:function(n,r){return n<0?r- -n%r:n%r}},{key:"max",value:function(){if(arguments.length===3){var n=arguments[1],r=arguments[2],a=arguments[0];return n>a&&(a=n),r>a&&(a=r),a}if(arguments.length===4){var f=arguments[1],m=arguments[2],p=arguments[3],I=arguments[0];return f>I&&(I=f),m>I&&(I=m),p>I&&(I=p),I}}},{key:"average",value:function(n,r){return(n+r)/2}}])})();Or.LOG_10=Math.log(10);var Gt=(function(){function u(){o(this,u)}return c(u,null,[{key:"segmentToSegment",value:function(n,r,a,f){if(n.equals(r))return u.pointToSegment(n,a,f);if(a.equals(f))return u.pointToSegment(f,n,r);var m=!1;if(le.intersects(n,r,a,f)){var p=(r.x-n.x)*(f.y-a.y)-(r.y-n.y)*(f.x-a.x);if(p===0)m=!0;else{var I=(n.y-a.y)*(f.x-a.x)-(n.x-a.x)*(f.y-a.y),O=((n.y-a.y)*(r.x-n.x)-(n.x-a.x)*(r.y-n.y))/p,U=I/p;(U<0||U>1||O<0||O>1)&&(m=!0)}}else m=!0;return m?Or.min(u.pointToSegment(n,a,f),u.pointToSegment(r,a,f),u.pointToSegment(a,n,r),u.pointToSegment(f,n,r)):0}},{key:"pointToSegment",value:function(n,r,a){if(r.x===a.x&&r.y===a.y)return n.distance(r);var f=(a.x-r.x)*(a.x-r.x)+(a.y-r.y)*(a.y-r.y),m=((n.x-r.x)*(a.x-r.x)+(n.y-r.y)*(a.y-r.y))/f;if(m<=0)return n.distance(r);if(m>=1)return n.distance(a);var p=((r.y-n.y)*(a.x-r.x)-(r.x-n.x)*(a.y-r.y))/f;return Math.abs(p)*Math.sqrt(f)}},{key:"pointToLinePerpendicular",value:function(n,r,a){var f=(a.x-r.x)*(a.x-r.x)+(a.y-r.y)*(a.y-r.y),m=((r.y-n.y)*(a.x-r.x)-(r.x-n.x)*(a.y-r.y))/f;return Math.abs(m)*Math.sqrt(f)}},{key:"pointToSegmentString",value:function(n,r){if(r.length===0)throw new C("Line array must contain at least one vertex");for(var a=n.distance(r[0]),f=0;f<r.length-1;f++){var m=u.pointToSegment(n,r[f],r[f+1]);m<a&&(a=m)}return a}}])})(),_c=(function(){return c((function u(){o(this,u)}),[{key:"create",value:function(){if(arguments.length===1)arguments[0]instanceof Array||Ie(arguments[0],Oe);else if(arguments.length!==2){if(arguments.length===3){var u=arguments[0],n=arguments[1];return this.create(u,n)}}}}])})(),Xi=(function(){return c((function u(){o(this,u)}),[{key:"filter",value:function(u){}}])})(),Bm=(function(){return c((function u(){o(this,u)}),null,[{key:"ofLine",value:function(u){var n=u.size();if(n<=1)return 0;var r=0,a=new W;u.getCoordinate(0,a);for(var f=a.x,m=a.y,p=1;p<n;p++){u.getCoordinate(p,a);var I=a.x,O=a.y,U=I-f,J=O-m;r+=Math.sqrt(U*U+J*J),f=I,m=O}return r}}])})(),xc=c((function u(){o(this,u)})),_n=(function(){function u(){o(this,u)}return c(u,null,[{key:"copyCoord",value:function(n,r,a,f){for(var m=Math.min(n.getDimension(),a.getDimension()),p=0;p<m;p++)a.setOrdinate(f,p,n.getOrdinate(r,p))}},{key:"isRing",value:function(n){var r=n.size();return r===0||!(r<=3)&&n.getOrdinate(0,Oe.X)===n.getOrdinate(r-1,Oe.X)&&n.getOrdinate(0,Oe.Y)===n.getOrdinate(r-1,Oe.Y)}},{key:"scroll",value:function(){if(arguments.length===2){if(Ie(arguments[0],Oe)&&Number.isInteger(arguments[1])){var n=arguments[0],r=arguments[1];u.scroll(n,r,u.isRing(n))}else if(Ie(arguments[0],Oe)&&arguments[1]instanceof W){var a=arguments[0],f=arguments[1],m=u.indexOf(f,a);if(m<=0)return null;u.scroll(a,m)}}else if(arguments.length===3){var p=arguments[0],I=arguments[1],O=arguments[2];if(I<=0)return null;for(var U=p.copy(),J=O?p.size()-1:p.size(),Q=0;Q<J;Q++)for(var ne=0;ne<p.getDimension();ne++)p.setOrdinate(Q,ne,U.getOrdinate((I+Q)%J,ne));if(O)for(var ce=0;ce<p.getDimension();ce++)p.setOrdinate(J,ce,p.getOrdinate(0,ce))}}},{key:"isEqual",value:function(n,r){var a=n.size();if(a!==r.size())return!1;for(var f=Math.min(n.getDimension(),r.getDimension()),m=0;m<a;m++)for(var p=0;p<f;p++){var I=n.getOrdinate(m,p),O=r.getOrdinate(m,p);if(n.getOrdinate(m,p)!==r.getOrdinate(m,p)&&(!B.isNaN(I)||!B.isNaN(O)))return!1}return!0}},{key:"minCoordinateIndex",value:function(){if(arguments.length===1){var n=arguments[0];return u.minCoordinateIndex(n,0,n.size()-1)}if(arguments.length===3){for(var r=arguments[0],a=arguments[2],f=-1,m=null,p=arguments[1];p<=a;p++){var I=r.getCoordinate(p);(m===null||m.compareTo(I)>0)&&(m=I,f=p)}return f}}},{key:"extend",value:function(n,r,a){var f=n.create(a,r.getDimension()),m=r.size();if(u.copy(r,0,f,0,m),m>0)for(var p=m;p<a;p++)u.copy(r,m-1,f,p,1);return f}},{key:"reverse",value:function(n){for(var r=n.size()-1,a=Math.trunc(r/2),f=0;f<=a;f++)u.swap(n,f,r-f)}},{key:"swap",value:function(n,r,a){if(r===a)return null;for(var f=0;f<n.getDimension();f++){var m=n.getOrdinate(r,f);n.setOrdinate(r,f,n.getOrdinate(a,f)),n.setOrdinate(a,f,m)}}},{key:"copy",value:function(n,r,a,f,m){for(var p=0;p<m;p++)u.copyCoord(n,r+p,a,f+p)}},{key:"ensureValidRing",value:function(n,r){var a=r.size();return a===0?r:a<=3?u.createClosedRing(n,r,4):r.getOrdinate(0,Oe.X)===r.getOrdinate(a-1,Oe.X)&&r.getOrdinate(0,Oe.Y)===r.getOrdinate(a-1,Oe.Y)?r:u.createClosedRing(n,r,a+1)}},{key:"indexOf",value:function(n,r){for(var a=0;a<r.size();a++)if(n.x===r.getOrdinate(a,Oe.X)&&n.y===r.getOrdinate(a,Oe.Y))return a;return-1}},{key:"createClosedRing",value:function(n,r,a){var f=n.create(a,r.getDimension()),m=r.size();u.copy(r,0,f,0,m);for(var p=m;p<a;p++)u.copy(r,0,f,p,1);return f}},{key:"minCoordinate",value:function(n){for(var r=null,a=0;a<n.size();a++){var f=n.getCoordinate(a);(r===null||r.compareTo(f)>0)&&(r=f)}return r}}])})(),ae=(function(){function u(){o(this,u)}return c(u,null,[{key:"toDimensionSymbol",value:function(n){switch(n){case u.FALSE:return u.SYM_FALSE;case u.TRUE:return u.SYM_TRUE;case u.DONTCARE:return u.SYM_DONTCARE;case u.P:return u.SYM_P;case u.L:return u.SYM_L;case u.A:return u.SYM_A}throw new C("Unknown dimension value: "+n)}},{key:"toDimensionValue",value:function(n){switch(mo.toUpperCase(n)){case u.SYM_FALSE:return u.FALSE;case u.SYM_TRUE:return u.TRUE;case u.SYM_DONTCARE:return u.DONTCARE;case u.SYM_P:return u.P;case u.SYM_L:return u.L;case u.SYM_A:return u.A}throw new C("Unknown dimension symbol: "+n)}}])})();ae.P=0,ae.L=1,ae.A=2,ae.FALSE=-1,ae.TRUE=-2,ae.DONTCARE=-3,ae.SYM_FALSE="F",ae.SYM_TRUE="T",ae.SYM_DONTCARE="*",ae.SYM_P="0",ae.SYM_L="1",ae.SYM_A="2";var Ui=(function(){return c((function u(){o(this,u)}),[{key:"filter",value:function(u){}}])})(),Vi=(function(){return c((function u(){o(this,u)}),[{key:"filter",value:function(u,n){}},{key:"isDone",value:function(){}},{key:"isGeometryChanged",value:function(){}}])})(),Rr=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"computeEnvelopeInternal",value:function(){return this.isEmpty()?new le:this._points.expandEnvelope(new le)}},{key:"isRing",value:function(){return this.isClosed()&&this.isSimple()}},{key:"getCoordinates",value:function(){return this._points.toCoordinateArray()}},{key:"copyInternal",value:function(){return new n(this._points.copy(),this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof oe){var r=arguments[0],a=arguments[1];if(!this.isEquivalentClass(r))return!1;var f=r;if(this._points.size()!==f._points.size())return!1;for(var m=0;m<this._points.size();m++)if(!this.equal(this._points.getCoordinate(m),f._points.getCoordinate(m),a))return!1;return!0}return M(n,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){for(var r=0;r<Math.trunc(this._points.size()/2);r++){var a=this._points.size()-1-r;if(!this._points.getCoordinate(r).equals(this._points.getCoordinate(a))){if(this._points.getCoordinate(r).compareTo(this._points.getCoordinate(a))>0){var f=this._points.copy();_n.reverse(f),this._points=f}return null}}}},{key:"getCoordinate",value:function(){return this.isEmpty()?null:this._points.getCoordinate(0)}},{key:"getBoundaryDimension",value:function(){return this.isClosed()?ae.FALSE:0}},{key:"isClosed",value:function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))}},{key:"reverseInternal",value:function(){var r=this._points.copy();return _n.reverse(r),this.getFactory().createLineString(r)}},{key:"getEndPoint",value:function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)}},{key:"getTypeCode",value:function(){return oe.TYPECODE_LINESTRING}},{key:"getDimension",value:function(){return 1}},{key:"getLength",value:function(){return Bm.ofLine(this._points)}},{key:"getNumPoints",value:function(){return this._points.size()}},{key:"compareToSameClass",value:function(){if(arguments.length===1){for(var r=arguments[0],a=0,f=0;a<this._points.size()&&f<r._points.size();){var m=this._points.getCoordinate(a).compareTo(r._points.getCoordinate(f));if(m!==0)return m;a++,f++}return a<this._points.size()?1:f<r._points.size()?-1:0}if(arguments.length===2){var p=arguments[0];return arguments[1].compare(this._points,p._points)}}},{key:"apply",value:function(){if(Ie(arguments[0],Xi))for(var r=arguments[0],a=0;a<this._points.size();a++)r.filter(this._points.getCoordinate(a));else if(Ie(arguments[0],Vi)){var f=arguments[0];if(this._points.size()===0)return null;for(var m=0;m<this._points.size()&&(f.filter(this._points,m),!f.isDone());m++);f.isGeometryChanged()&&this.geometryChanged()}else Ie(arguments[0],Ui)?arguments[0].filter(this):Ie(arguments[0],A)&&arguments[0].filter(this)}},{key:"getBoundary",value:function(){throw new ue}},{key:"isEquivalentClass",value:function(r){return r instanceof n}},{key:"getCoordinateN",value:function(r){return this._points.getCoordinate(r)}},{key:"getGeometryType",value:function(){return oe.TYPENAME_LINESTRING}},{key:"getCoordinateSequence",value:function(){return this._points}},{key:"isEmpty",value:function(){return this._points.size()===0}},{key:"init",value:function(r){if(r===null&&(r=this.getFactory().getCoordinateSequenceFactory().create([])),r.size()===1)throw new C("Invalid number of points in LineString (found "+r.size()+" - must be 0 or >= 2)");this._points=r}},{key:"isCoordinate",value:function(r){for(var a=0;a<this._points.size();a++)if(this._points.getCoordinate(a).equals(r))return!0;return!1}},{key:"getStartPoint",value:function(){return this.isEmpty()?null:this.getPointN(0)}},{key:"getPointN",value:function(r){return this.getFactory().createPoint(this._points.getCoordinate(r))}},{key:"interfaces_",get:function(){return[xc]}}],[{key:"constructor_",value:function(){if(this._points=null,arguments.length!==0){if(arguments.length===2){var r=arguments[0],a=arguments[1];oe.constructor_.call(this,a),this.init(r)}}}}])})(oe),Ec=c((function u(){o(this,u)})),xo=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"computeEnvelopeInternal",value:function(){if(this.isEmpty())return new le;var r=new le;return r.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),r}},{key:"getCoordinates",value:function(){return this.isEmpty()?[]:[this.getCoordinate()]}},{key:"copyInternal",value:function(){return new n(this._coordinates.copy(),this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof oe){var r=arguments[0],a=arguments[1];return!!this.isEquivalentClass(r)&&(!(!this.isEmpty()||!r.isEmpty())||this.isEmpty()===r.isEmpty()&&this.equal(r.getCoordinate(),this.getCoordinate(),a))}return M(n,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){}},{key:"getCoordinate",value:function(){return this._coordinates.size()!==0?this._coordinates.getCoordinate(0):null}},{key:"getBoundaryDimension",value:function(){return ae.FALSE}},{key:"reverseInternal",value:function(){return this.getFactory().createPoint(this._coordinates.copy())}},{key:"getTypeCode",value:function(){return oe.TYPECODE_POINT}},{key:"getDimension",value:function(){return 0}},{key:"getNumPoints",value:function(){return this.isEmpty()?0:1}},{key:"getX",value:function(){if(this.getCoordinate()===null)throw new IllegalStateException("getX called on empty Point");return this.getCoordinate().x}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var r=arguments[0];return this.getCoordinate().compareTo(r.getCoordinate())}if(arguments.length===2){var a=arguments[0];return arguments[1].compare(this._coordinates,a._coordinates)}}},{key:"apply",value:function(){if(Ie(arguments[0],Xi)){var r=arguments[0];if(this.isEmpty())return null;r.filter(this.getCoordinate())}else if(Ie(arguments[0],Vi)){var a=arguments[0];if(this.isEmpty())return null;a.filter(this._coordinates,0),a.isGeometryChanged()&&this.geometryChanged()}else Ie(arguments[0],Ui)?arguments[0].filter(this):Ie(arguments[0],A)&&arguments[0].filter(this)}},{key:"getBoundary",value:function(){return this.getFactory().createGeometryCollection()}},{key:"getGeometryType",value:function(){return oe.TYPENAME_POINT}},{key:"getCoordinateSequence",value:function(){return this._coordinates}},{key:"getY",value:function(){if(this.getCoordinate()===null)throw new IllegalStateException("getY called on empty Point");return this.getCoordinate().y}},{key:"isEmpty",value:function(){return this._coordinates.size()===0}},{key:"init",value:function(r){r===null&&(r=this.getFactory().getCoordinateSequenceFactory().create([])),j.isTrue(r.size()<=1),this._coordinates=r}},{key:"isSimple",value:function(){return!0}},{key:"interfaces_",get:function(){return[Ec]}}],[{key:"constructor_",value:function(){this._coordinates=null;var r=arguments[0],a=arguments[1];oe.constructor_.call(this,a),this.init(r)}}])})(oe),wc=(function(){function u(){o(this,u)}return c(u,null,[{key:"ofRing",value:function(){if(arguments[0]instanceof Array){var n=arguments[0];return Math.abs(u.ofRingSigned(n))}if(Ie(arguments[0],Oe)){var r=arguments[0];return Math.abs(u.ofRingSigned(r))}}},{key:"ofRingSigned",value:function(){if(arguments[0]instanceof Array){var n=arguments[0];if(n.length<3)return 0;for(var r=0,a=n[0].x,f=1;f<n.length-1;f++){var m=n[f].x-a,p=n[f+1].y;r+=m*(n[f-1].y-p)}return r/2}if(Ie(arguments[0],Oe)){var I=arguments[0],O=I.size();if(O<3)return 0;var U=new W,J=new W,Q=new W;I.getCoordinate(0,J),I.getCoordinate(1,Q);var ne=J.x;Q.x-=ne;for(var ce=0,fe=1;fe<O-1;fe++)U.y=J.y,J.x=Q.x,J.y=Q.y,I.getCoordinate(fe+1,Q),Q.x-=ne,ce+=J.x*(U.y-Q.y);return ce/2}}}])})(),xn=(function(){return c((function u(){o(this,u)}),null,[{key:"sort",value:function(){var u=arguments,n=arguments[0];if(arguments.length===1)n.sort((function(ne,ce){return ne.compareTo(ce)}));else if(arguments.length===2)n.sort((function(ne,ce){return u[1].compare(ne,ce)}));else if(arguments.length===3){var r=n.slice(arguments[1],arguments[2]);r.sort();var a=n.slice(0,arguments[1]).concat(r,n.slice(arguments[2],n.length));n.splice(0,n.length);var f,m=g(a);try{for(m.s();!(f=m.n()).done;){var p=f.value;n.push(p)}}catch(ne){m.e(ne)}finally{m.f()}}else if(arguments.length===4){var I=n.slice(arguments[1],arguments[2]);I.sort((function(ne,ce){return u[3].compare(ne,ce)}));var O=n.slice(0,arguments[1]).concat(I,n.slice(arguments[2],n.length));n.splice(0,n.length);var U,J=g(O);try{for(J.s();!(U=J.n()).done;){var Q=U.value;n.push(Q)}}catch(ne){J.e(ne)}finally{J.f()}}}},{key:"asList",value:function(u){var n,r=new me,a=g(u);try{for(a.s();!(n=a.n()).done;){var f=n.value;r.add(f)}}catch(m){a.e(m)}finally{a.f()}return r}},{key:"copyOf",value:function(u,n){return u.slice(0,n)}}])})(),kc=c((function u(){o(this,u)})),Hi=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"computeEnvelopeInternal",value:function(){return this._shell.getEnvelopeInternal()}},{key:"getCoordinates",value:function(){if(this.isEmpty())return[];for(var r=new Array(this.getNumPoints()).fill(null),a=-1,f=this._shell.getCoordinates(),m=0;m<f.length;m++)r[++a]=f[m];for(var p=0;p<this._holes.length;p++)for(var I=this._holes[p].getCoordinates(),O=0;O<I.length;O++)r[++a]=I[O];return r}},{key:"getArea",value:function(){var r=0;r+=wc.ofRing(this._shell.getCoordinateSequence());for(var a=0;a<this._holes.length;a++)r-=wc.ofRing(this._holes[a].getCoordinateSequence());return r}},{key:"copyInternal",value:function(){for(var r=this._shell.copy(),a=new Array(this._holes.length).fill(null),f=0;f<this._holes.length;f++)a[f]=this._holes[f].copy();return new n(r,a,this._factory)}},{key:"isRectangle",value:function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var r=this._shell.getCoordinateSequence(),a=this.getEnvelopeInternal(),f=0;f<5;f++){var m=r.getX(f);if(m!==a.getMinX()&&m!==a.getMaxX())return!1;var p=r.getY(f);if(p!==a.getMinY()&&p!==a.getMaxY())return!1}for(var I=r.getX(0),O=r.getY(0),U=1;U<=4;U++){var J=r.getX(U),Q=r.getY(U);if(J!==I==(Q!==O))return!1;I=J,O=Q}return!0}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof oe){var r=arguments[0],a=arguments[1];if(!this.isEquivalentClass(r))return!1;var f=r,m=this._shell,p=f._shell;if(!m.equalsExact(p,a)||this._holes.length!==f._holes.length)return!1;for(var I=0;I<this._holes.length;I++)if(!this._holes[I].equalsExact(f._holes[I],a))return!1;return!0}return M(n,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){if(arguments.length===0){this._shell=this.normalized(this._shell,!0);for(var r=0;r<this._holes.length;r++)this._holes[r]=this.normalized(this._holes[r],!1);xn.sort(this._holes)}else if(arguments.length===2){var a=arguments[0],f=arguments[1];if(a.isEmpty())return null;var m=a.getCoordinateSequence(),p=_n.minCoordinateIndex(m,0,m.size()-2);_n.scroll(m,p,!0),Ee.isCCW(m)===f&&_n.reverse(m)}}},{key:"getCoordinate",value:function(){return this._shell.getCoordinate()}},{key:"getNumInteriorRing",value:function(){return this._holes.length}},{key:"getBoundaryDimension",value:function(){return 1}},{key:"reverseInternal",value:function(){for(var r=this.getExteriorRing().reverse(),a=new Array(this.getNumInteriorRing()).fill(null),f=0;f<a.length;f++)a[f]=this.getInteriorRingN(f).reverse();return this.getFactory().createPolygon(r,a)}},{key:"getTypeCode",value:function(){return oe.TYPECODE_POLYGON}},{key:"getDimension",value:function(){return 2}},{key:"getLength",value:function(){var r=0;r+=this._shell.getLength();for(var a=0;a<this._holes.length;a++)r+=this._holes[a].getLength();return r}},{key:"getNumPoints",value:function(){for(var r=this._shell.getNumPoints(),a=0;a<this._holes.length;a++)r+=this._holes[a].getNumPoints();return r}},{key:"convexHull",value:function(){return this.getExteriorRing().convexHull()}},{key:"normalized",value:function(r,a){var f=r.copy();return this.normalize(f,a),f}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var r=arguments[0],a=this._shell,f=r._shell;return a.compareToSameClass(f)}if(arguments.length===2){var m=arguments[1],p=arguments[0],I=this._shell,O=p._shell,U=I.compareToSameClass(O,m);if(U!==0)return U;for(var J=this.getNumInteriorRing(),Q=p.getNumInteriorRing(),ne=0;ne<J&&ne<Q;){var ce=this.getInteriorRingN(ne),fe=p.getInteriorRingN(ne),de=ce.compareToSameClass(fe,m);if(de!==0)return de;ne++}return ne<J?1:ne<Q?-1:0}}},{key:"apply",value:function(){if(Ie(arguments[0],Xi)){var r=arguments[0];this._shell.apply(r);for(var a=0;a<this._holes.length;a++)this._holes[a].apply(r)}else if(Ie(arguments[0],Vi)){var f=arguments[0];if(this._shell.apply(f),!f.isDone())for(var m=0;m<this._holes.length&&(this._holes[m].apply(f),!f.isDone());m++);f.isGeometryChanged()&&this.geometryChanged()}else if(Ie(arguments[0],Ui))arguments[0].filter(this);else if(Ie(arguments[0],A)){var p=arguments[0];p.filter(this),this._shell.apply(p);for(var I=0;I<this._holes.length;I++)this._holes[I].apply(p)}}},{key:"getBoundary",value:function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var r=new Array(this._holes.length+1).fill(null);r[0]=this._shell;for(var a=0;a<this._holes.length;a++)r[a+1]=this._holes[a];return r.length<=1?this.getFactory().createLinearRing(r[0].getCoordinateSequence()):this.getFactory().createMultiLineString(r)}},{key:"getGeometryType",value:function(){return oe.TYPENAME_POLYGON}},{key:"getExteriorRing",value:function(){return this._shell}},{key:"isEmpty",value:function(){return this._shell.isEmpty()}},{key:"getInteriorRingN",value:function(r){return this._holes[r]}},{key:"interfaces_",get:function(){return[kc]}}],[{key:"constructor_",value:function(){this._shell=null,this._holes=null;var r=arguments[0],a=arguments[1],f=arguments[2];if(oe.constructor_.call(this,f),r===null&&(r=this.getFactory().createLinearRing()),a===null&&(a=[]),oe.hasNullElements(a))throw new C("holes must not contain null elements");if(r.isEmpty()&&oe.hasNonEmptyElements(a))throw new C("shell is empty but holes are not");this._shell=r,this._holes=a}}])})(oe),Gm=(function(u){function n(){return o(this,n),s(this,n,arguments)}return v(n,u),c(n)})(ke),Ic=(function(u){function n(r){var a;return o(this,n),(a=s(this,n)).array=[],r instanceof Me&&a.addAll(r),a}return v(n,u),c(n,[{key:"contains",value:function(r){var a,f=g(this.array);try{for(f.s();!(a=f.n()).done;)if(a.value.compareTo(r)===0)return!0}catch(m){f.e(m)}finally{f.f()}return!1}},{key:"add",value:function(r){if(this.contains(r))return!1;for(var a=0,f=this.array.length;a<f;a++)if(this.array[a].compareTo(r)===1)return!!this.array.splice(a,0,r);return this.array.push(r),!0}},{key:"addAll",value:function(r){var a,f=g(r);try{for(f.s();!(a=f.n()).done;){var m=a.value;this.add(m)}}catch(p){f.e(p)}finally{f.f()}return!0}},{key:"remove",value:function(){throw new ue}},{key:"size",value:function(){return this.array.length}},{key:"isEmpty",value:function(){return this.array.length===0}},{key:"toArray",value:function(){return this.array.slice()}},{key:"iterator",value:function(){return new Ym(this.array)}}])})(Gm),Ym=(function(){return c((function u(n){o(this,u),this.array=n,this.position=0}),[{key:"next",value:function(){if(this.position===this.array.length)throw new Se;return this.array[this.position++]}},{key:"hasNext",value:function(){return this.position<this.array.length}},{key:"remove",value:function(){throw new ue}}])})(),mt=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"computeEnvelopeInternal",value:function(){for(var r=new le,a=0;a<this._geometries.length;a++)r.expandToInclude(this._geometries[a].getEnvelopeInternal());return r}},{key:"getGeometryN",value:function(r){return this._geometries[r]}},{key:"getCoordinates",value:function(){for(var r=new Array(this.getNumPoints()).fill(null),a=-1,f=0;f<this._geometries.length;f++)for(var m=this._geometries[f].getCoordinates(),p=0;p<m.length;p++)r[++a]=m[p];return r}},{key:"getArea",value:function(){for(var r=0,a=0;a<this._geometries.length;a++)r+=this._geometries[a].getArea();return r}},{key:"copyInternal",value:function(){for(var r=new Array(this._geometries.length).fill(null),a=0;a<r.length;a++)r[a]=this._geometries[a].copy();return new n(r,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof oe){var r=arguments[0],a=arguments[1];if(!this.isEquivalentClass(r))return!1;var f=r;if(this._geometries.length!==f._geometries.length)return!1;for(var m=0;m<this._geometries.length;m++)if(!this._geometries[m].equalsExact(f._geometries[m],a))return!1;return!0}return M(n,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){for(var r=0;r<this._geometries.length;r++)this._geometries[r].normalize();xn.sort(this._geometries)}},{key:"getCoordinate",value:function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()}},{key:"getBoundaryDimension",value:function(){for(var r=ae.FALSE,a=0;a<this._geometries.length;a++)r=Math.max(r,this._geometries[a].getBoundaryDimension());return r}},{key:"reverseInternal",value:function(){for(var r=this._geometries.length,a=new me(r),f=0;f<r;f++)a.add(this._geometries[f].reverse());return this.getFactory().buildGeometry(a)}},{key:"getTypeCode",value:function(){return oe.TYPECODE_GEOMETRYCOLLECTION}},{key:"getDimension",value:function(){for(var r=ae.FALSE,a=0;a<this._geometries.length;a++)r=Math.max(r,this._geometries[a].getDimension());return r}},{key:"getLength",value:function(){for(var r=0,a=0;a<this._geometries.length;a++)r+=this._geometries[a].getLength();return r}},{key:"getNumPoints",value:function(){for(var r=0,a=0;a<this._geometries.length;a++)r+=this._geometries[a].getNumPoints();return r}},{key:"getNumGeometries",value:function(){return this._geometries.length}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var r=arguments[0],a=new Ic(xn.asList(this._geometries)),f=new Ic(xn.asList(r._geometries));return this.compare(a,f)}if(arguments.length===2){for(var m=arguments[1],p=arguments[0],I=this.getNumGeometries(),O=p.getNumGeometries(),U=0;U<I&&U<O;){var J=this.getGeometryN(U),Q=p.getGeometryN(U),ne=J.compareToSameClass(Q,m);if(ne!==0)return ne;U++}return U<I?1:U<O?-1:0}}},{key:"apply",value:function(){if(Ie(arguments[0],Xi))for(var r=arguments[0],a=0;a<this._geometries.length;a++)this._geometries[a].apply(r);else if(Ie(arguments[0],Vi)){var f=arguments[0];if(this._geometries.length===0)return null;for(var m=0;m<this._geometries.length&&(this._geometries[m].apply(f),!f.isDone());m++);f.isGeometryChanged()&&this.geometryChanged()}else if(Ie(arguments[0],Ui)){var p=arguments[0];p.filter(this);for(var I=0;I<this._geometries.length;I++)this._geometries[I].apply(p)}else if(Ie(arguments[0],A)){var O=arguments[0];O.filter(this);for(var U=0;U<this._geometries.length;U++)this._geometries[U].apply(O)}}},{key:"getBoundary",value:function(){return oe.checkNotGeometryCollection(this),j.shouldNeverReachHere(),null}},{key:"getGeometryType",value:function(){return oe.TYPENAME_GEOMETRYCOLLECTION}},{key:"isEmpty",value:function(){for(var r=0;r<this._geometries.length;r++)if(!this._geometries[r].isEmpty())return!1;return!0}}],[{key:"constructor_",value:function(){if(this._geometries=null,arguments.length!==0){if(arguments.length===2){var r=arguments[0],a=arguments[1];if(oe.constructor_.call(this,a),r===null&&(r=[]),oe.hasNullElements(r))throw new C("geometries must not contain null elements");this._geometries=r}}}}])})(oe),Eo=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"copyInternal",value:function(){for(var r=new Array(this._geometries.length).fill(null),a=0;a<r.length;a++)r[a]=this._geometries[a].copy();return new n(r,this._factory)}},{key:"isValid",value:function(){return!0}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof oe){var r=arguments[0],a=arguments[1];return!!this.isEquivalentClass(r)&&M(n,"equalsExact",this,1).call(this,r,a)}return M(n,"equalsExact",this,1).apply(this,arguments)}},{key:"getCoordinate",value:function(){if(arguments.length===1&&Number.isInteger(arguments[0])){var r=arguments[0];return this._geometries[r].getCoordinate()}return M(n,"getCoordinate",this,1).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return ae.FALSE}},{key:"getTypeCode",value:function(){return oe.TYPECODE_MULTIPOINT}},{key:"getDimension",value:function(){return 0}},{key:"getBoundary",value:function(){return this.getFactory().createGeometryCollection()}},{key:"getGeometryType",value:function(){return oe.TYPENAME_MULTIPOINT}},{key:"interfaces_",get:function(){return[Ec]}}],[{key:"constructor_",value:function(){var r=arguments[0],a=arguments[1];mt.constructor_.call(this,r,a)}}])})(mt),Ar=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"copyInternal",value:function(){return new n(this._points.copy(),this._factory)}},{key:"getBoundaryDimension",value:function(){return ae.FALSE}},{key:"isClosed",value:function(){return!!this.isEmpty()||M(n,"isClosed",this,1).call(this)}},{key:"reverseInternal",value:function(){var r=this._points.copy();return _n.reverse(r),this.getFactory().createLinearRing(r)}},{key:"getTypeCode",value:function(){return oe.TYPECODE_LINEARRING}},{key:"validateConstruction",value:function(){if(!this.isEmpty()&&!M(n,"isClosed",this,1).call(this))throw new C("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<n.MINIMUM_VALID_SIZE)throw new C("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")}},{key:"getGeometryType",value:function(){return oe.TYPENAME_LINEARRING}}],[{key:"constructor_",value:function(){var r=arguments[0],a=arguments[1];Rr.constructor_.call(this,r,a),this.validateConstruction()}}])})(Rr);Ar.MINIMUM_VALID_SIZE=4;var En=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"setOrdinate",value:function(r,a){switch(r){case n.X:this.x=a;break;case n.Y:this.y=a;break;default:throw new C("Invalid ordinate index: "+r)}}},{key:"getZ",value:function(){return W.NULL_ORDINATE}},{key:"getOrdinate",value:function(r){switch(r){case n.X:return this.x;case n.Y:return this.y}throw new C("Invalid ordinate index: "+r)}},{key:"setZ",value:function(r){throw new C("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new n(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+")"}},{key:"setCoordinate",value:function(r){this.x=r.x,this.y=r.y,this.z=r.getZ()}}],[{key:"constructor_",value:function(){if(arguments.length===0)W.constructor_.call(this);else if(arguments.length===1){if(arguments[0]instanceof n){var r=arguments[0];W.constructor_.call(this,r.x,r.y)}else if(arguments[0]instanceof W){var a=arguments[0];W.constructor_.call(this,a.x,a.y)}}else if(arguments.length===2){var f=arguments[0],m=arguments[1];W.constructor_.call(this,f,m,W.NULL_ORDINATE)}}}])})(W);En.X=0,En.Y=1,En.Z=-1,En.M=-1;var wn=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(r,a){switch(r){case n.X:this.x=a;break;case n.Y:this.y=a;break;case n.M:this._m=a;break;default:throw new C("Invalid ordinate index: "+r)}}},{key:"setM",value:function(r){this._m=r}},{key:"getZ",value:function(){return W.NULL_ORDINATE}},{key:"getOrdinate",value:function(r){switch(r){case n.X:return this.x;case n.Y:return this.y;case n.M:return this._m}throw new C("Invalid ordinate index: "+r)}},{key:"setZ",value:function(r){throw new C("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new n(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(r){this.x=r.x,this.y=r.y,this.z=r.getZ(),this._m=r.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,arguments.length===0)W.constructor_.call(this),this._m=0;else if(arguments.length===1){if(arguments[0]instanceof n){var r=arguments[0];W.constructor_.call(this,r.x,r.y),this._m=r._m}else if(arguments[0]instanceof W){var a=arguments[0];W.constructor_.call(this,a.x,a.y),this._m=this.getM()}}else if(arguments.length===3){var f=arguments[0],m=arguments[1],p=arguments[2];W.constructor_.call(this,f,m,W.NULL_ORDINATE),this._m=p}}}])})(W);wn.X=0,wn.Y=1,wn.Z=-1,wn.M=2;var wo=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(r,a){switch(r){case W.X:this.x=a;break;case W.Y:this.y=a;break;case W.Z:this.z=a;break;case W.M:this._m=a;break;default:throw new C("Invalid ordinate index: "+r)}}},{key:"setM",value:function(r){this._m=r}},{key:"getOrdinate",value:function(r){switch(r){case W.X:return this.x;case W.Y:return this.y;case W.Z:return this.getZ();case W.M:return this.getM()}throw new C("Invalid ordinate index: "+r)}},{key:"copy",value:function(){return new n(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(r){this.x=r.x,this.y=r.y,this.z=r.getZ(),this._m=r.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,arguments.length===0)W.constructor_.call(this),this._m=0;else if(arguments.length===1){if(arguments[0]instanceof n){var r=arguments[0];W.constructor_.call(this,r),this._m=r._m}else if(arguments[0]instanceof W){var a=arguments[0];W.constructor_.call(this,a),this._m=this.getM()}}else if(arguments.length===4){var f=arguments[0],m=arguments[1],p=arguments[2],I=arguments[3];W.constructor_.call(this,f,m,p),this._m=I}}}])})(W),$i=(function(){function u(){o(this,u)}return c(u,null,[{key:"measures",value:function(n){return n instanceof En?0:n instanceof wn||n instanceof wo?1:0}},{key:"dimension",value:function(n){return n instanceof En?2:n instanceof wn?3:n instanceof wo?4:3}},{key:"create",value:function(){if(arguments.length===1){var n=arguments[0];return u.create(n,0)}if(arguments.length===2){var r=arguments[0],a=arguments[1];return r===2?new En:r===3&&a===0?new W:r===3&&a===1?new wn:r===4&&a===1?new wo:new W}}}])})(),Dr=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"getCoordinate",value:function(r){return this.get(r)}},{key:"addAll",value:function(){if(arguments.length===2&&typeof arguments[1]=="boolean"&&Ie(arguments[0],Me)){for(var r=arguments[1],a=!1,f=arguments[0].iterator();f.hasNext();)this.add(f.next(),r),a=!0;return a}return M(n,"addAll",this,1).apply(this,arguments)}},{key:"clone",value:function(){for(var r=M(n,"clone",this,1).call(this),a=0;a<this.size();a++)r.add(a,this.get(a).clone());return r}},{key:"toCoordinateArray",value:function(){if(arguments.length===0)return this.toArray(n.coordArrayType);if(arguments.length===1){if(arguments[0])return this.toArray(n.coordArrayType);for(var r=this.size(),a=new Array(r).fill(null),f=0;f<r;f++)a[f]=this.get(r-f-1);return a}}},{key:"add",value:function(){if(arguments.length===1){var r=arguments[0];return M(n,"add",this,1).call(this,r)}if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var a=arguments[0],f=arguments[1];return this.add(a,f,!0),!0}if(arguments[0]instanceof W&&typeof arguments[1]=="boolean"){var m=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(m))return null;M(n,"add",this,1).call(this,m)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var p=arguments[0],I=arguments[1];return this.add(p,I),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var O=arguments[0],U=arguments[1];if(arguments[2])for(var J=0;J<O.length;J++)this.add(O[J],U);else for(var Q=O.length-1;Q>=0;Q--)this.add(O[Q],U);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof W){var ne=arguments[0],ce=arguments[1];if(!arguments[2]){var fe=this.size();if(fe>0&&(ne>0&&this.get(ne-1).equals2D(ce)||ne<fe&&this.get(ne).equals2D(ce)))return null}M(n,"add",this,1).call(this,ne,ce)}}else if(arguments.length===4){var de=arguments[0],Re=arguments[1],be=arguments[2],Ye=arguments[3],it=1;be>Ye&&(it=-1);for(var ut=be;ut!==Ye;ut+=it)this.add(de[ut],Re);return!0}}},{key:"closeRing",value:function(){if(this.size()>0){var r=this.get(0).copy();this.add(r,!1)}}}],[{key:"constructor_",value:function(){if(arguments.length!==0){if(arguments.length===1){var r=arguments[0];this.ensureCapacity(r.length),this.add(r,!0)}else if(arguments.length===2){var a=arguments[0],f=arguments[1];this.ensureCapacity(a.length),this.add(a,f)}}}}])})(me);Dr.coordArrayType=new Array(0).fill(null);var et=(function(){function u(){o(this,u)}return c(u,null,[{key:"isRing",value:function(n){return!(n.length<4)&&!!n[0].equals2D(n[n.length-1])}},{key:"ptNotInList",value:function(n,r){for(var a=0;a<n.length;a++){var f=n[a];if(u.indexOf(f,r)<0)return f}return null}},{key:"scroll",value:function(n,r){var a=u.indexOf(r,n);if(a<0)return null;var f=new Array(n.length).fill(null);It.arraycopy(n,a,f,0,n.length-a),It.arraycopy(n,0,f,n.length-a,a),It.arraycopy(f,0,n,0,n.length)}},{key:"equals",value:function(){if(arguments.length===2){var n=arguments[0],r=arguments[1];if(n===r)return!0;if(n===null||r===null||n.length!==r.length)return!1;for(var a=0;a<n.length;a++)if(!n[a].equals(r[a]))return!1;return!0}if(arguments.length===3){var f=arguments[0],m=arguments[1],p=arguments[2];if(f===m)return!0;if(f===null||m===null||f.length!==m.length)return!1;for(var I=0;I<f.length;I++)if(p.compare(f[I],m[I])!==0)return!1;return!0}}},{key:"intersection",value:function(n,r){for(var a=new Dr,f=0;f<n.length;f++)r.intersects(n[f])&&a.add(n[f],!0);return a.toCoordinateArray()}},{key:"measures",value:function(n){if(n===null||n.length===0)return 0;var r,a=0,f=g(n);try{for(f.s();!(r=f.n()).done;){var m=r.value;a=Math.max(a,$i.measures(m))}}catch(p){f.e(p)}finally{f.f()}return a}},{key:"hasRepeatedPoints",value:function(n){for(var r=1;r<n.length;r++)if(n[r-1].equals(n[r]))return!0;return!1}},{key:"removeRepeatedPoints",value:function(n){return u.hasRepeatedPoints(n)?new Dr(n,!1).toCoordinateArray():n}},{key:"reverse",value:function(n){for(var r=n.length-1,a=Math.trunc(r/2),f=0;f<=a;f++){var m=n[f];n[f]=n[r-f],n[r-f]=m}}},{key:"removeNull",value:function(n){for(var r=0,a=0;a<n.length;a++)n[a]!==null&&r++;var f=new Array(r).fill(null);if(r===0)return f;for(var m=0,p=0;p<n.length;p++)n[p]!==null&&(f[m++]=n[p]);return f}},{key:"copyDeep",value:function(){if(arguments.length===1){for(var n=arguments[0],r=new Array(n.length).fill(null),a=0;a<n.length;a++)r[a]=n[a].copy();return r}if(arguments.length===5)for(var f=arguments[0],m=arguments[1],p=arguments[2],I=arguments[3],O=arguments[4],U=0;U<O;U++)p[I+U]=f[m+U].copy()}},{key:"isEqualReversed",value:function(n,r){for(var a=0;a<n.length;a++){var f=n[a],m=r[n.length-a-1];if(f.compareTo(m)!==0)return!1}return!0}},{key:"envelope",value:function(n){for(var r=new le,a=0;a<n.length;a++)r.expandToInclude(n[a]);return r}},{key:"toCoordinateArray",value:function(n){return n.toArray(u.coordArrayType)}},{key:"dimension",value:function(n){if(n===null||n.length===0)return 3;var r,a=0,f=g(n);try{for(f.s();!(r=f.n()).done;){var m=r.value;a=Math.max(a,$i.dimension(m))}}catch(p){f.e(p)}finally{f.f()}return a}},{key:"atLeastNCoordinatesOrNothing",value:function(n,r){return r.length>=n?r:[]}},{key:"indexOf",value:function(n,r){for(var a=0;a<r.length;a++)if(n.equals(r[a]))return a;return-1}},{key:"increasingDirection",value:function(n){for(var r=0;r<Math.trunc(n.length/2);r++){var a=n.length-1-r,f=n[r].compareTo(n[a]);if(f!==0)return f}return 1}},{key:"compare",value:function(n,r){for(var a=0;a<n.length&&a<r.length;){var f=n[a].compareTo(r[a]);if(f!==0)return f;a++}return a<r.length?-1:a<n.length?1:0}},{key:"minCoordinate",value:function(n){for(var r=null,a=0;a<n.length;a++)(r===null||r.compareTo(n[a])>0)&&(r=n[a]);return r}},{key:"extract",value:function(n,r,a){r=Or.clamp(r,0,n.length);var f=(a=Or.clamp(a,-1,n.length))-r+1;a<0&&(f=0),r>=n.length&&(f=0),a<r&&(f=0);var m=new Array(f).fill(null);if(f===0)return m;for(var p=0,I=r;I<=a;I++)m[p++]=n[I];return m}}])})(),zm=(function(){return c((function u(){o(this,u)}),[{key:"compare",value:function(u,n){var r=u,a=n;return et.compare(r,a)}},{key:"interfaces_",get:function(){return[Z]}}])})(),Xm=(function(){return c((function u(){o(this,u)}),[{key:"compare",value:function(u,n){var r=u,a=n;if(r.length<a.length)return-1;if(r.length>a.length)return 1;if(r.length===0)return 0;var f=et.compare(r,a);return et.isEqualReversed(r,a)?0:f}},{key:"OLDcompare",value:function(u,n){var r=u,a=n;if(r.length<a.length)return-1;if(r.length>a.length)return 1;if(r.length===0)return 0;for(var f=et.increasingDirection(r),m=et.increasingDirection(a),p=f>0?0:r.length-1,I=m>0?0:r.length-1,O=0;O<r.length;O++){var U=r[p].compareTo(a[I]);if(U!==0)return U;p+=f,I+=m}return 0}},{key:"interfaces_",get:function(){return[Z]}}])})();et.ForwardComparator=zm,et.BidirectionalComparator=Xm,et.coordArrayType=new Array(0).fill(null);var Zi=(function(){return c((function u(n){o(this,u),this.str=n}),[{key:"append",value:function(u){this.str+=u}},{key:"setCharAt",value:function(u,n){this.str=this.str.substr(0,u)+n+this.str.substr(u+1)}},{key:"toString",value:function(){return this.str}}])})(),Fr=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"getM",value:function(n){return this.hasM()?this._coordinates[n].getM():B.NaN}},{key:"setOrdinate",value:function(n,r,a){switch(r){case Oe.X:this._coordinates[n].x=a;break;case Oe.Y:this._coordinates[n].y=a;break;default:this._coordinates[n].setOrdinate(r,a)}}},{key:"getZ",value:function(n){return this.hasZ()?this._coordinates[n].getZ():B.NaN}},{key:"size",value:function(){return this._coordinates.length}},{key:"getOrdinate",value:function(n,r){switch(r){case Oe.X:return this._coordinates[n].x;case Oe.Y:return this._coordinates[n].y;default:return this._coordinates[n].getOrdinate(r)}}},{key:"getCoordinate",value:function(){if(arguments.length===1){var n=arguments[0];return this._coordinates[n]}if(arguments.length===2){var r=arguments[0];arguments[1].setCoordinate(this._coordinates[r])}}},{key:"getCoordinateCopy",value:function(n){var r=this.createCoordinate();return r.setCoordinate(this._coordinates[n]),r}},{key:"createCoordinate",value:function(){return $i.create(this.getDimension(),this.getMeasures())}},{key:"getDimension",value:function(){return this._dimension}},{key:"getX",value:function(n){return this._coordinates[n].x}},{key:"getMeasures",value:function(){return this._measures}},{key:"expandEnvelope",value:function(n){for(var r=0;r<this._coordinates.length;r++)n.expandToInclude(this._coordinates[r]);return n}},{key:"copy",value:function(){for(var n=new Array(this.size()).fill(null),r=0;r<this._coordinates.length;r++){var a=this.createCoordinate();a.setCoordinate(this._coordinates[r]),n[r]=a}return new u(n,this._dimension,this._measures)}},{key:"toString",value:function(){if(this._coordinates.length>0){var n=new Zi(17*this._coordinates.length);n.append("("),n.append(this._coordinates[0]);for(var r=1;r<this._coordinates.length;r++)n.append(", "),n.append(this._coordinates[r]);return n.append(")"),n.toString()}return"()"}},{key:"getY",value:function(n){return this._coordinates[n].y}},{key:"toCoordinateArray",value:function(){return this._coordinates}},{key:"interfaces_",get:function(){return[Oe,N]}}],[{key:"constructor_",value:function(){if(this._dimension=3,this._measures=0,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];u.constructor_.call(this,n,et.dimension(n),et.measures(n))}else if(Number.isInteger(arguments[0])){var r=arguments[0];this._coordinates=new Array(r).fill(null);for(var a=0;a<r;a++)this._coordinates[a]=new W}else if(Ie(arguments[0],Oe)){var f=arguments[0];if(f===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=f.getDimension(),this._measures=f.getMeasures(),this._coordinates=new Array(f.size()).fill(null);for(var m=0;m<this._coordinates.length;m++)this._coordinates[m]=f.getCoordinateCopy(m)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var p=arguments[0],I=arguments[1];u.constructor_.call(this,p,I,et.measures(p))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var O=arguments[0],U=arguments[1];this._coordinates=new Array(O).fill(null),this._dimension=U;for(var J=0;J<O;J++)this._coordinates[J]=$i.create(U)}}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var Q=arguments[0],ne=arguments[1],ce=arguments[2];this._dimension=ne,this._measures=ce,this._coordinates=Q===null?new Array(0).fill(null):Q}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var fe=arguments[0],de=arguments[1],Re=arguments[2];this._coordinates=new Array(fe).fill(null),this._dimension=de,this._measures=Re;for(var be=0;be<fe;be++)this._coordinates[be]=this.createCoordinate()}}}}])})(),ko=(function(){function u(){o(this,u)}return c(u,[{key:"readResolve",value:function(){return u.instance()}},{key:"create",value:function(){if(arguments.length===1){if(arguments[0]instanceof Array)return new Fr(arguments[0]);if(Ie(arguments[0],Oe))return new Fr(arguments[0])}else{if(arguments.length===2){var n=arguments[1];return n>3&&(n=3),n<2&&(n=2),new Fr(arguments[0],n)}if(arguments.length===3){var r=arguments[2],a=arguments[1]-r;return r>1&&(r=1),a>3&&(a=3),a<2&&(a=2),new Fr(arguments[0],a+r,r)}}}},{key:"interfaces_",get:function(){return[_c,N]}}],[{key:"instance",value:function(){return u.instanceObject}}])})();ko.instanceObject=new ko;var Io=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"copyInternal",value:function(){for(var r=new Array(this._geometries.length).fill(null),a=0;a<r.length;a++)r[a]=this._geometries[a].copy();return new n(r,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof oe){var r=arguments[0],a=arguments[1];return!!this.isEquivalentClass(r)&&M(n,"equalsExact",this,1).call(this,r,a)}return M(n,"equalsExact",this,1).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return 1}},{key:"getTypeCode",value:function(){return oe.TYPECODE_MULTIPOLYGON}},{key:"getDimension",value:function(){return 2}},{key:"getBoundary",value:function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var r=new me,a=0;a<this._geometries.length;a++)for(var f=this._geometries[a].getBoundary(),m=0;m<f.getNumGeometries();m++)r.add(f.getGeometryN(m));var p=new Array(r.size()).fill(null);return this.getFactory().createMultiLineString(r.toArray(p))}},{key:"getGeometryType",value:function(){return oe.TYPENAME_MULTIPOLYGON}},{key:"interfaces_",get:function(){return[kc]}}],[{key:"constructor_",value:function(){var r=arguments[0],a=arguments[1];mt.constructor_.call(this,r,a)}}])})(mt),Nc=(function(){return c((function u(){o(this,u)}),[{key:"get",value:function(){}},{key:"put",value:function(){}},{key:"size",value:function(){}},{key:"values",value:function(){}},{key:"entrySet",value:function(){}}])})(),Um=(function(u){function n(){var r;return o(this,n),(r=s(this,n)).map=new Map,r}return v(n,u),c(n,[{key:"get",value:function(r){return this.map.get(r)||null}},{key:"put",value:function(r,a){return this.map.set(r,a),a}},{key:"values",value:function(){for(var r=new me,a=this.map.values(),f=a.next();!f.done;)r.add(f.value),f=a.next();return r}},{key:"entrySet",value:function(){var r=new ct;return this.map.entries().forEach((function(a){return r.add(a)})),r}},{key:"size",value:function(){return this.map.size()}}])})(Nc),bt=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"equals",value:function(n){if(!(n instanceof u))return!1;var r=n;return this._modelType===r._modelType&&this._scale===r._scale}},{key:"compareTo",value:function(n){var r=n,a=this.getMaximumSignificantDigits(),f=r.getMaximumSignificantDigits();return cn.compare(a,f)}},{key:"getScale",value:function(){return this._scale}},{key:"isFloating",value:function(){return this._modelType===u.FLOATING||this._modelType===u.FLOATING_SINGLE}},{key:"getType",value:function(){return this._modelType}},{key:"toString",value:function(){var n="UNKNOWN";return this._modelType===u.FLOATING?n="Floating":this._modelType===u.FLOATING_SINGLE?n="Floating-Single":this._modelType===u.FIXED&&(n="Fixed (Scale="+this.getScale()+")"),n}},{key:"makePrecise",value:function(){if(typeof arguments[0]=="number"){var n=arguments[0];return B.isNaN(n)||this._modelType===u.FLOATING_SINGLE?n:this._modelType===u.FIXED?Math.round(n*this._scale)/this._scale:n}if(arguments[0]instanceof W){var r=arguments[0];if(this._modelType===u.FLOATING)return null;r.x=this.makePrecise(r.x),r.y=this.makePrecise(r.y)}}},{key:"getMaximumSignificantDigits",value:function(){var n=16;return this._modelType===u.FLOATING?n=16:this._modelType===u.FLOATING_SINGLE?n=6:this._modelType===u.FIXED&&(n=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),n}},{key:"setScale",value:function(n){this._scale=Math.abs(n)}},{key:"interfaces_",get:function(){return[N,q]}}],[{key:"constructor_",value:function(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=u.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof Vn){var n=arguments[0];this._modelType=n,n===u.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var r=arguments[0];this._modelType=u.FIXED,this.setScale(r)}else if(arguments[0]instanceof u){var a=arguments[0];this._modelType=a._modelType,this._scale=a._scale}}}},{key:"mostPrecise",value:function(n,r){return n.compareTo(r)>=0?n:r}}])})(),Vn=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"readResolve",value:function(){return u.nameToTypeMap.get(this._name)}},{key:"toString",value:function(){return this._name}},{key:"interfaces_",get:function(){return[N]}}],[{key:"constructor_",value:function(){this._name=null;var n=arguments[0];this._name=n,u.nameToTypeMap.put(n,this)}}])})();Vn.nameToTypeMap=new Um,bt.Type=Vn,bt.FIXED=new Vn("FIXED"),bt.FLOATING=new Vn("FLOATING"),bt.FLOATING_SINGLE=new Vn("FLOATING SINGLE"),bt.maximumPreciseValue=9007199254740992;var No=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"copyInternal",value:function(){for(var r=new Array(this._geometries.length).fill(null),a=0;a<r.length;a++)r[a]=this._geometries[a].copy();return new n(r,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof oe){var r=arguments[0],a=arguments[1];return!!this.isEquivalentClass(r)&&M(n,"equalsExact",this,1).call(this,r,a)}return M(n,"equalsExact",this,1).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return this.isClosed()?ae.FALSE:0}},{key:"isClosed",value:function(){if(this.isEmpty())return!1;for(var r=0;r<this._geometries.length;r++)if(!this._geometries[r].isClosed())return!1;return!0}},{key:"getTypeCode",value:function(){return oe.TYPECODE_MULTILINESTRING}},{key:"getDimension",value:function(){return 1}},{key:"getBoundary",value:function(){throw new ue}},{key:"getGeometryType",value:function(){return oe.TYPENAME_MULTILINESTRING}},{key:"interfaces_",get:function(){return[xc]}}],[{key:"constructor_",value:function(){var r=arguments[0],a=arguments[1];mt.constructor_.call(this,r,a)}}])})(mt),Hn=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"createEmpty",value:function(n){switch(n){case-1:return this.createGeometryCollection();case 0:return this.createPoint();case 1:return this.createLineString();case 2:return this.createPolygon();default:throw new C("Invalid dimension: "+n)}}},{key:"toGeometry",value:function(n){return n.isNull()?this.createPoint():n.getMinX()===n.getMaxX()&&n.getMinY()===n.getMaxY()?this.createPoint(new W(n.getMinX(),n.getMinY())):n.getMinX()===n.getMaxX()||n.getMinY()===n.getMaxY()?this.createLineString([new W(n.getMinX(),n.getMinY()),new W(n.getMaxX(),n.getMaxY())]):this.createPolygon(this.createLinearRing([new W(n.getMinX(),n.getMinY()),new W(n.getMinX(),n.getMaxY()),new W(n.getMaxX(),n.getMaxY()),new W(n.getMaxX(),n.getMinY()),new W(n.getMinX(),n.getMinY())]),null)}},{key:"createLineString",value:function(){if(arguments.length===0)return this.createLineString(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return this.createLineString(n!==null?this.getCoordinateSequenceFactory().create(n):null)}if(Ie(arguments[0],Oe))return new Rr(arguments[0],this)}}},{key:"createMultiLineString",value:function(){return arguments.length===0?new No(null,this):arguments.length===1?new No(arguments[0],this):void 0}},{key:"buildGeometry",value:function(n){for(var r=null,a=!1,f=!1,m=n.iterator();m.hasNext();){var p=m.next(),I=p.getTypeCode();r===null&&(r=I),I!==r&&(a=!0),p instanceof mt&&(f=!0)}if(r===null)return this.createGeometryCollection();if(a||f)return this.createGeometryCollection(u.toGeometryArray(n));var O=n.iterator().next();if(n.size()>1){if(O instanceof Hi)return this.createMultiPolygon(u.toPolygonArray(n));if(O instanceof Rr)return this.createMultiLineString(u.toLineStringArray(n));if(O instanceof xo)return this.createMultiPoint(u.toPointArray(n));j.shouldNeverReachHere("Unhandled geometry type: "+O.getGeometryType())}return O}},{key:"createMultiPointFromCoords",value:function(n){return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}},{key:"createPoint",value:function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof W){var n=arguments[0];return this.createPoint(n!==null?this.getCoordinateSequenceFactory().create([n]):null)}if(Ie(arguments[0],Oe))return new xo(arguments[0],this)}}},{key:"getCoordinateSequenceFactory",value:function(){return this._coordinateSequenceFactory}},{key:"createPolygon",value:function(){if(arguments.length===0)return this.createPolygon(null,null);if(arguments.length===1){if(Ie(arguments[0],Oe)){var n=arguments[0];return this.createPolygon(this.createLinearRing(n))}if(arguments[0]instanceof Array){var r=arguments[0];return this.createPolygon(this.createLinearRing(r))}if(arguments[0]instanceof Ar){var a=arguments[0];return this.createPolygon(a,null)}}else if(arguments.length===2)return new Hi(arguments[0],arguments[1],this)}},{key:"getSRID",value:function(){return this._SRID}},{key:"createGeometryCollection",value:function(){return arguments.length===0?new mt(null,this):arguments.length===1?new mt(arguments[0],this):void 0}},{key:"getPrecisionModel",value:function(){return this._precisionModel}},{key:"createLinearRing",value:function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return this.createLinearRing(n!==null?this.getCoordinateSequenceFactory().create(n):null)}if(Ie(arguments[0],Oe))return new Ar(arguments[0],this)}}},{key:"createMultiPolygon",value:function(){return arguments.length===0?new Io(null,this):arguments.length===1?new Io(arguments[0],this):void 0}},{key:"createMultiPoint",value:function(){if(arguments.length===0)return new Eo(null,this);if(arguments.length===1){if(arguments[0]instanceof Array)return new Eo(arguments[0],this);if(Ie(arguments[0],Oe)){var n=arguments[0];if(n===null)return this.createMultiPoint(new Array(0).fill(null));for(var r=new Array(n.size()).fill(null),a=0;a<n.size();a++){var f=this.getCoordinateSequenceFactory().create(1,n.getDimension(),n.getMeasures());_n.copy(n,a,f,0,1),r[a]=this.createPoint(f)}return this.createMultiPoint(r)}}}},{key:"interfaces_",get:function(){return[N]}}],[{key:"constructor_",value:function(){if(this._precisionModel=null,this._coordinateSequenceFactory=null,this._SRID=null,arguments.length===0)u.constructor_.call(this,new bt,0);else if(arguments.length===1){if(Ie(arguments[0],_c)){var n=arguments[0];u.constructor_.call(this,new bt,0,n)}else if(arguments[0]instanceof bt){var r=arguments[0];u.constructor_.call(this,r,0,u.getDefaultCoordinateSequenceFactory())}}else if(arguments.length===2){var a=arguments[0],f=arguments[1];u.constructor_.call(this,a,f,u.getDefaultCoordinateSequenceFactory())}else if(arguments.length===3){var m=arguments[0],p=arguments[1],I=arguments[2];this._precisionModel=m,this._coordinateSequenceFactory=I,this._SRID=p}}},{key:"toMultiPolygonArray",value:function(n){var r=new Array(n.size()).fill(null);return n.toArray(r)}},{key:"toGeometryArray",value:function(n){if(n===null)return null;var r=new Array(n.size()).fill(null);return n.toArray(r)}},{key:"getDefaultCoordinateSequenceFactory",value:function(){return ko.instance()}},{key:"toMultiLineStringArray",value:function(n){var r=new Array(n.size()).fill(null);return n.toArray(r)}},{key:"toLineStringArray",value:function(n){var r=new Array(n.size()).fill(null);return n.toArray(r)}},{key:"toMultiPointArray",value:function(n){var r=new Array(n.size()).fill(null);return n.toArray(r)}},{key:"toLinearRingArray",value:function(n){var r=new Array(n.size()).fill(null);return n.toArray(r)}},{key:"toPointArray",value:function(n){var r=new Array(n.size()).fill(null);return n.toArray(r)}},{key:"toPolygonArray",value:function(n){var r=new Array(n.size()).fill(null);return n.toArray(r)}},{key:"createPointFromInternalCoord",value:function(n,r){return r.getPrecisionModel().makePrecise(n),r.getFactory().createPoint(n)}}])})(),Mo="XY",Vm="XYZ",Hm="XYM",$m="XYZM",Mc={POINT:"Point",LINE_STRING:"LineString",LINEAR_RING:"LinearRing",POLYGON:"Polygon",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon",GEOMETRY_COLLECTION:"GeometryCollection",CIRCLE:"Circle"},Sc="EMPTY",Wi=1,jt=2,hn=3,Pc=4,$n=5,Zm=6;for(var Wm in Mc)Mc[Wm].toUpperCase();var Km=(function(){return c((function u(n){o(this,u),this.wkt=n,this.index_=-1}),[{key:"isAlpha_",value:function(u){return u>="a"&&u<="z"||u>="A"&&u<="Z"}},{key:"isNumeric_",value:function(u,n){return u>="0"&&u<="9"||u=="."&&!(n!==void 0&&n)}},{key:"isWhiteSpace_",value:function(u){return u==" "||u==" "||u=="\r"||u==`
5
- `}},{key:"nextChar_",value:function(){return this.wkt.charAt(++this.index_)}},{key:"nextToken",value:function(){var u,n=this.nextChar_(),r=this.index_,a=n;if(n=="(")u=jt;else if(n==",")u=$n;else if(n==")")u=hn;else if(this.isNumeric_(n)||n=="-")u=Pc,a=this.readNumber_();else if(this.isAlpha_(n))u=Wi,a=this.readText_();else{if(this.isWhiteSpace_(n))return this.nextToken();if(n!=="")throw new Error("Unexpected character: "+n);u=Zm}return{position:r,value:a,type:u}}},{key:"readNumber_",value:function(){var u,n=this.index_,r=!1,a=!1;do u=="."?r=!0:u!="e"&&u!="E"||(a=!0),u=this.nextChar_();while(this.isNumeric_(u,r)||!a&&(u=="e"||u=="E")||a&&(u=="-"||u=="+"));return parseFloat(this.wkt.substring(n,this.index_--))}},{key:"readText_",value:function(){var u,n=this.index_;do u=this.nextChar_();while(this.isAlpha_(u));return this.wkt.substring(n,this.index_--).toUpperCase()}}])})(),Jm=(function(){return c((function u(n,r){o(this,u),this.lexer_=n,this.token_,this.layout_=Mo,this.factory=r}),[{key:"consume_",value:function(){this.token_=this.lexer_.nextToken()}},{key:"isTokenType",value:function(u){return this.token_.type==u}},{key:"match",value:function(u){var n=this.isTokenType(u);return n&&this.consume_(),n}},{key:"parse",value:function(){return this.consume_(),this.parseGeometry_()}},{key:"parseGeometryLayout_",value:function(){var u=Mo,n=this.token_;if(this.isTokenType(Wi)){var r=n.value;r==="Z"?u=Vm:r==="M"?u=Hm:r==="ZM"&&(u=$m),u!==Mo&&this.consume_()}return u}},{key:"parseGeometryCollectionText_",value:function(){if(this.match(jt)){var u=[];do u.push(this.parseGeometry_());while(this.match($n));if(this.match(hn))return u}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePointText_",value:function(){if(this.match(jt)){var u=this.parsePoint_();if(this.match(hn))return u}else if(this.isEmptyGeometry_())return null;throw new Error(this.formatErrorMessage_())}},{key:"parseLineStringText_",value:function(){if(this.match(jt)){var u=this.parsePointList_();if(this.match(hn))return u}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePolygonText_",value:function(){if(this.match(jt)){var u=this.parseLineStringTextList_();if(this.match(hn))return u}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPointText_",value:function(){var u;if(this.match(jt)){if(u=this.token_.type==jt?this.parsePointTextList_():this.parsePointList_(),this.match(hn))return u}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiLineStringText_",value:function(){if(this.match(jt)){var u=this.parseLineStringTextList_();if(this.match(hn))return u}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPolygonText_",value:function(){if(this.match(jt)){var u=this.parsePolygonTextList_();if(this.match(hn))return u}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePoint_",value:function(){for(var u=[],n=this.layout_.length,r=0;r<n;++r){var a=this.token_;if(!this.match(Pc))break;u.push(a.value)}if(u.length==n)return u;throw new Error(this.formatErrorMessage_())}},{key:"parsePointList_",value:function(){for(var u=[this.parsePoint_()];this.match($n);)u.push(this.parsePoint_());return u}},{key:"parsePointTextList_",value:function(){for(var u=[this.parsePointText_()];this.match($n);)u.push(this.parsePointText_());return u}},{key:"parseLineStringTextList_",value:function(){for(var u=[this.parseLineStringText_()];this.match($n);)u.push(this.parseLineStringText_());return u}},{key:"parsePolygonTextList_",value:function(){for(var u=[this.parsePolygonText_()];this.match($n);)u.push(this.parsePolygonText_());return u}},{key:"isEmptyGeometry_",value:function(){var u=this.isTokenType(Wi)&&this.token_.value==Sc;return u&&this.consume_(),u}},{key:"formatErrorMessage_",value:function(){return"Unexpected `"+this.token_.value+"` at position "+this.token_.position+" in `"+this.lexer_.wkt+"`"}},{key:"parseGeometry_",value:function(){var u=this.factory,n=function(de){return l(W,R(de))},r=function(de){var Re=de.map((function(be){return u.createLinearRing(be.map(n))}));return Re.length>1?u.createPolygon(Re[0],Re.slice(1)):u.createPolygon(Re[0])},a=this.token_;if(this.match(Wi)){var f=a.value;if(this.layout_=this.parseGeometryLayout_(),f=="GEOMETRYCOLLECTION"){var m=this.parseGeometryCollectionText_();return u.createGeometryCollection(m)}switch(f){case"POINT":var p=this.parsePointText_();return p?u.createPoint(l(W,R(p))):u.createPoint();case"LINESTRING":var I=this.parseLineStringText_().map(n);return u.createLineString(I);case"LINEARRING":var O=this.parseLineStringText_().map(n);return u.createLinearRing(O);case"POLYGON":var U=this.parsePolygonText_();return U&&U.length!==0?r(U):u.createPolygon();case"MULTIPOINT":var J=this.parseMultiPointText_();if(!J||J.length===0)return u.createMultiPoint();var Q=J.map(n).map((function(de){return u.createPoint(de)}));return u.createMultiPoint(Q);case"MULTILINESTRING":var ne=this.parseMultiLineStringText_().map((function(de){return u.createLineString(de.map(n))}));return u.createMultiLineString(ne);case"MULTIPOLYGON":var ce=this.parseMultiPolygonText_();if(!ce||ce.length===0)return u.createMultiPolygon();var fe=ce.map(r);return u.createMultiPolygon(fe);default:throw new Error("Invalid geometry type: "+f)}}throw new Error(this.formatErrorMessage_())}}])})();function Lc(u){if(u.isEmpty())return"";var n=u.getCoordinate(),r=[n.x,n.y];return n.z===void 0||Number.isNaN(n.z)||r.push(n.z),n.m===void 0||Number.isNaN(n.m)||r.push(n.m),r.join(" ")}function qr(u){for(var n=u.getCoordinates().map((function(m){var p=[m.x,m.y];return m.z===void 0||Number.isNaN(m.z)||p.push(m.z),m.m===void 0||Number.isNaN(m.m)||p.push(m.m),p})),r=[],a=0,f=n.length;a<f;++a)r.push(n[a].join(" "));return r.join(", ")}function bc(u){var n=[];n.push("("+qr(u.getExteriorRing())+")");for(var r=0,a=u.getNumInteriorRing();r<a;++r)n.push("("+qr(u.getInteriorRingN(r))+")");return n.join(", ")}var Qm={Point:Lc,LineString:qr,LinearRing:qr,Polygon:bc,MultiPoint:function(u){for(var n=[],r=0,a=u.getNumGeometries();r<a;++r)n.push("("+Lc(u.getGeometryN(r))+")");return n.join(", ")},MultiLineString:function(u){for(var n=[],r=0,a=u.getNumGeometries();r<a;++r)n.push("("+qr(u.getGeometryN(r))+")");return n.join(", ")},MultiPolygon:function(u){for(var n=[],r=0,a=u.getNumGeometries();r<a;++r)n.push("("+bc(u.getGeometryN(r))+")");return n.join(", ")},GeometryCollection:function(u){for(var n=[],r=0,a=u.getNumGeometries();r<a;++r)n.push(Cc(u.getGeometryN(r)));return n.join(", ")}};function Cc(u){var n=u.getGeometryType(),r=Qm[n];n=n.toUpperCase();var a=(function(f){var m="";if(f.isEmpty())return m;var p=f.getCoordinate();return p.z===void 0||Number.isNaN(p.z)||(m+="Z"),p.m===void 0||Number.isNaN(p.m)||(m+="M"),m})(u);return a.length>0&&(n+=" "+a),u.isEmpty()?n+" "+Sc:n+" ("+r(u)+")"}var jm=(function(){return c((function u(n){o(this,u),this.geometryFactory=n||new Hn,this.precisionModel=this.geometryFactory.getPrecisionModel()}),[{key:"read",value:function(u){var n=new Km(u);return new Jm(n,this.geometryFactory).parse()}},{key:"write",value:function(u){return Cc(u)}}])})(),So=(function(){return c((function u(n){o(this,u),this.parser=new jm(n)}),[{key:"write",value:function(u){return this.parser.write(u)}}],[{key:"toLineString",value:function(u,n){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+u.x+" "+u.y+", "+n.x+" "+n.y+" )"}}])})(),Ue=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"getIndexAlongSegment",value:function(n,r){return this.computeIntLineIndex(),this._intLineIndex[n][r]}},{key:"getTopologySummary",value:function(){var n=new Zi;return this.isEndPoint()&&n.append(" endpoint"),this._isProper&&n.append(" proper"),this.isCollinear()&&n.append(" collinear"),n.toString()}},{key:"computeIntersection",value:function(n,r,a,f){this._inputLines[0][0]=n,this._inputLines[0][1]=r,this._inputLines[1][0]=a,this._inputLines[1][1]=f,this._result=this.computeIntersect(n,r,a,f)}},{key:"getIntersectionNum",value:function(){return this._result}},{key:"computeIntLineIndex",value:function(){if(arguments.length===0)this._intLineIndex===null&&(this._intLineIndex=Array(2).fill().map((function(){return Array(2)})),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(arguments.length===1){var n=arguments[0];this.getEdgeDistance(n,0)>this.getEdgeDistance(n,1)?(this._intLineIndex[n][0]=0,this._intLineIndex[n][1]=1):(this._intLineIndex[n][0]=1,this._intLineIndex[n][1]=0)}}},{key:"isProper",value:function(){return this.hasIntersection()&&this._isProper}},{key:"setPrecisionModel",value:function(n){this._precisionModel=n}},{key:"isInteriorIntersection",value:function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var n=arguments[0],r=0;r<this._result;r++)if(!this._intPt[r].equals2D(this._inputLines[n][0])&&!this._intPt[r].equals2D(this._inputLines[n][1]))return!0;return!1}}},{key:"getIntersection",value:function(n){return this._intPt[n]}},{key:"isEndPoint",value:function(){return this.hasIntersection()&&!this._isProper}},{key:"hasIntersection",value:function(){return this._result!==u.NO_INTERSECTION}},{key:"getEdgeDistance",value:function(n,r){return u.computeEdgeDistance(this._intPt[r],this._inputLines[n][0],this._inputLines[n][1])}},{key:"isCollinear",value:function(){return this._result===u.COLLINEAR_INTERSECTION}},{key:"toString",value:function(){return So.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+So.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()}},{key:"getEndpoint",value:function(n,r){return this._inputLines[n][r]}},{key:"isIntersection",value:function(n){for(var r=0;r<this._result;r++)if(this._intPt[r].equals2D(n))return!0;return!1}},{key:"getIntersectionAlongSegment",value:function(n,r){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[n][r]]}}],[{key:"constructor_",value: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 W,this._intPt[1]=new W,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0}},{key:"computeEdgeDistance",value:function(n,r,a){var f=Math.abs(a.x-r.x),m=Math.abs(a.y-r.y),p=-1;if(n.equals(r))p=0;else if(n.equals(a))p=f>m?f:m;else{var I=Math.abs(n.x-r.x),O=Math.abs(n.y-r.y);(p=f>m?I:O)!==0||n.equals(r)||(p=Math.max(I,O))}return j.isTrue(!(p===0&&!n.equals(r)),"Bad distance calculation"),p}},{key:"nonRobustComputeEdgeDistance",value:function(n,r,a){var f=n.x-r.x,m=n.y-r.y,p=Math.sqrt(f*f+m*m);return j.isTrue(!(p===0&&!n.equals(r)),"Invalid distance calculation"),p}}])})();Ue.DONT_INTERSECT=0,Ue.DO_INTERSECT=1,Ue.COLLINEAR=2,Ue.NO_INTERSECTION=0,Ue.POINT_INTERSECTION=1,Ue.COLLINEAR_INTERSECTION=2;var kn=(function(u){function n(){return o(this,n),s(this,n)}return v(n,u),c(n,[{key:"isInSegmentEnvelopes",value:function(r){var a=new le(this._inputLines[0][0],this._inputLines[0][1]),f=new le(this._inputLines[1][0],this._inputLines[1][1]);return a.contains(r)&&f.contains(r)}},{key:"computeIntersection",value:function(){if(arguments.length!==3)return M(n,"computeIntersection",this,1).apply(this,arguments);var r=arguments[0],a=arguments[1],f=arguments[2];if(this._isProper=!1,le.intersects(a,f,r)&&Ee.index(a,f,r)===0&&Ee.index(f,a,r)===0)return this._isProper=!0,(r.equals(a)||r.equals(f))&&(this._isProper=!1),this._result=Ue.POINT_INTERSECTION,null;this._result=Ue.NO_INTERSECTION}},{key:"intersection",value:function(r,a,f,m){var p=this.intersectionSafe(r,a,f,m);return this.isInSegmentEnvelopes(p)||(p=new W(n.nearestEndpoint(r,a,f,m))),this._precisionModel!==null&&this._precisionModel.makePrecise(p),p}},{key:"checkDD",value:function(r,a,f,m,p){var I=po.intersection(r,a,f,m),O=this.isInSegmentEnvelopes(I);It.out.println("DD in env = "+O+" --------------------- "+I),p.distance(I)>1e-4&&It.out.println("Distance = "+p.distance(I))}},{key:"intersectionSafe",value:function(r,a,f,m){var p=_o.intersection(r,a,f,m);return p===null&&(p=n.nearestEndpoint(r,a,f,m)),p}},{key:"computeCollinearIntersection",value:function(r,a,f,m){var p=le.intersects(r,a,f),I=le.intersects(r,a,m),O=le.intersects(f,m,r),U=le.intersects(f,m,a);return p&&I?(this._intPt[0]=f,this._intPt[1]=m,Ue.COLLINEAR_INTERSECTION):O&&U?(this._intPt[0]=r,this._intPt[1]=a,Ue.COLLINEAR_INTERSECTION):p&&O?(this._intPt[0]=f,this._intPt[1]=r,!f.equals(r)||I||U?Ue.COLLINEAR_INTERSECTION:Ue.POINT_INTERSECTION):p&&U?(this._intPt[0]=f,this._intPt[1]=a,!f.equals(a)||I||O?Ue.COLLINEAR_INTERSECTION:Ue.POINT_INTERSECTION):I&&O?(this._intPt[0]=m,this._intPt[1]=r,!m.equals(r)||p||U?Ue.COLLINEAR_INTERSECTION:Ue.POINT_INTERSECTION):I&&U?(this._intPt[0]=m,this._intPt[1]=a,!m.equals(a)||p||O?Ue.COLLINEAR_INTERSECTION:Ue.POINT_INTERSECTION):Ue.NO_INTERSECTION}},{key:"computeIntersect",value:function(r,a,f,m){if(this._isProper=!1,!le.intersects(r,a,f,m))return Ue.NO_INTERSECTION;var p=Ee.index(r,a,f),I=Ee.index(r,a,m);if(p>0&&I>0||p<0&&I<0)return Ue.NO_INTERSECTION;var O=Ee.index(f,m,r),U=Ee.index(f,m,a);return O>0&&U>0||O<0&&U<0?Ue.NO_INTERSECTION:p===0&&I===0&&O===0&&U===0?this.computeCollinearIntersection(r,a,f,m):(p===0||I===0||O===0||U===0?(this._isProper=!1,r.equals2D(f)||r.equals2D(m)?this._intPt[0]=r:a.equals2D(f)||a.equals2D(m)?this._intPt[0]=a:p===0?this._intPt[0]=new W(f):I===0?this._intPt[0]=new W(m):O===0?this._intPt[0]=new W(r):U===0&&(this._intPt[0]=new W(a))):(this._isProper=!0,this._intPt[0]=this.intersection(r,a,f,m)),Ue.POINT_INTERSECTION)}}],[{key:"nearestEndpoint",value:function(r,a,f,m){var p=r,I=Gt.pointToSegment(r,f,m),O=Gt.pointToSegment(a,f,m);return O<I&&(I=O,p=a),(O=Gt.pointToSegment(f,r,a))<I&&(I=O,p=f),(O=Gt.pointToSegment(m,r,a))<I&&(I=O,p=m),p}}])})(Ue),ep=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"countSegment",value:function(n,r){if(n.x<this._p.x&&r.x<this._p.x)return null;if(this._p.x===r.x&&this._p.y===r.y)return this._isPointOnSegment=!0,null;if(n.y===this._p.y&&r.y===this._p.y){var a=n.x,f=r.x;return a>f&&(a=r.x,f=n.x),this._p.x>=a&&this._p.x<=f&&(this._isPointOnSegment=!0),null}if(n.y>this._p.y&&r.y<=this._p.y||r.y>this._p.y&&n.y<=this._p.y){var m=Ee.index(n,r,this._p);if(m===Ee.COLLINEAR)return this._isPointOnSegment=!0,null;r.y<n.y&&(m=-m),m===Ee.LEFT&&this._crossingCount++}}},{key:"isPointInPolygon",value:function(){return this.getLocation()!==$.EXTERIOR}},{key:"getLocation",value:function(){return this._isPointOnSegment?$.BOUNDARY:this._crossingCount%2==1?$.INTERIOR:$.EXTERIOR}},{key:"isOnSegment",value:function(){return this._isPointOnSegment}}],[{key:"constructor_",value:function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var n=arguments[0];this._p=n}},{key:"locatePointInRing",value:function(){if(arguments[0]instanceof W&&Ie(arguments[1],Oe)){for(var n=arguments[1],r=new u(arguments[0]),a=new W,f=new W,m=1;m<n.size();m++)if(n.getCoordinate(m,a),n.getCoordinate(m-1,f),r.countSegment(a,f),r.isOnSegment())return r.getLocation();return r.getLocation()}if(arguments[0]instanceof W&&arguments[1]instanceof Array){for(var p=arguments[1],I=new u(arguments[0]),O=1;O<p.length;O++){var U=p[O],J=p[O-1];if(I.countSegment(U,J),I.isOnSegment())return I.getLocation()}return I.getLocation()}}}])})(),Po=(function(){function u(){o(this,u)}return c(u,null,[{key:"isOnLine",value:function(){if(arguments[0]instanceof W&&Ie(arguments[1],Oe)){for(var n=arguments[0],r=arguments[1],a=new kn,f=new W,m=new W,p=r.size(),I=1;I<p;I++)if(r.getCoordinate(I-1,f),r.getCoordinate(I,m),a.computeIntersection(n,f,m),a.hasIntersection())return!0;return!1}if(arguments[0]instanceof W&&arguments[1]instanceof Array){for(var O=arguments[0],U=arguments[1],J=new kn,Q=1;Q<U.length;Q++){var ne=U[Q-1],ce=U[Q];if(J.computeIntersection(O,ne,ce),J.hasIntersection())return!0}return!1}}},{key:"locateInRing",value:function(n,r){return ep.locatePointInRing(n,r)}},{key:"isInRing",value:function(n,r){return u.locateInRing(n,r)!==$.EXTERIOR}}])})(),Nt=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"setAllLocations",value:function(n){for(var r=0;r<this.location.length;r++)this.location[r]=n}},{key:"isNull",value:function(){for(var n=0;n<this.location.length;n++)if(this.location[n]!==$.NONE)return!1;return!0}},{key:"setAllLocationsIfNull",value:function(n){for(var r=0;r<this.location.length;r++)this.location[r]===$.NONE&&(this.location[r]=n)}},{key:"isLine",value:function(){return this.location.length===1}},{key:"merge",value:function(n){if(n.location.length>this.location.length){var r=new Array(3).fill(null);r[ie.ON]=this.location[ie.ON],r[ie.LEFT]=$.NONE,r[ie.RIGHT]=$.NONE,this.location=r}for(var a=0;a<this.location.length;a++)this.location[a]===$.NONE&&a<n.location.length&&(this.location[a]=n.location[a])}},{key:"getLocations",value:function(){return this.location}},{key:"flip",value:function(){if(this.location.length<=1)return null;var n=this.location[ie.LEFT];this.location[ie.LEFT]=this.location[ie.RIGHT],this.location[ie.RIGHT]=n}},{key:"toString",value:function(){var n=new ln;return this.location.length>1&&n.append($.toLocationSymbol(this.location[ie.LEFT])),n.append($.toLocationSymbol(this.location[ie.ON])),this.location.length>1&&n.append($.toLocationSymbol(this.location[ie.RIGHT])),n.toString()}},{key:"setLocations",value:function(n,r,a){this.location[ie.ON]=n,this.location[ie.LEFT]=r,this.location[ie.RIGHT]=a}},{key:"get",value:function(n){return n<this.location.length?this.location[n]:$.NONE}},{key:"isArea",value:function(){return this.location.length>1}},{key:"isAnyNull",value:function(){for(var n=0;n<this.location.length;n++)if(this.location[n]===$.NONE)return!0;return!1}},{key:"setLocation",value:function(){if(arguments.length===1){var n=arguments[0];this.setLocation(ie.ON,n)}else if(arguments.length===2){var r=arguments[0],a=arguments[1];this.location[r]=a}}},{key:"init",value:function(n){this.location=new Array(n).fill(null),this.setAllLocations($.NONE)}},{key:"isEqualOnSide",value:function(n,r){return this.location[r]===n.location[r]}},{key:"allPositionsEqual",value:function(n){for(var r=0;r<this.location.length;r++)if(this.location[r]!==n)return!1;return!0}}],[{key:"constructor_",value:function(){if(this.location=null,arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];this.init(n.length)}else if(Number.isInteger(arguments[0])){var r=arguments[0];this.init(1),this.location[ie.ON]=r}else if(arguments[0]instanceof u){var a=arguments[0];if(this.init(a.location.length),a!==null)for(var f=0;f<this.location.length;f++)this.location[f]=a.location[f]}}else if(arguments.length===3){var m=arguments[0],p=arguments[1],I=arguments[2];this.init(3),this.location[ie.ON]=m,this.location[ie.LEFT]=p,this.location[ie.RIGHT]=I}}}])})(),Mt=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"getGeometryCount",value:function(){var n=0;return this.elt[0].isNull()||n++,this.elt[1].isNull()||n++,n}},{key:"setAllLocations",value:function(n,r){this.elt[n].setAllLocations(r)}},{key:"isNull",value:function(n){return this.elt[n].isNull()}},{key:"setAllLocationsIfNull",value:function(){if(arguments.length===1){var n=arguments[0];this.setAllLocationsIfNull(0,n),this.setAllLocationsIfNull(1,n)}else if(arguments.length===2){var r=arguments[0],a=arguments[1];this.elt[r].setAllLocationsIfNull(a)}}},{key:"isLine",value:function(n){return this.elt[n].isLine()}},{key:"merge",value:function(n){for(var r=0;r<2;r++)this.elt[r]===null&&n.elt[r]!==null?this.elt[r]=new Nt(n.elt[r]):this.elt[r].merge(n.elt[r])}},{key:"flip",value:function(){this.elt[0].flip(),this.elt[1].flip()}},{key:"getLocation",value:function(){if(arguments.length===1){var n=arguments[0];return this.elt[n].get(ie.ON)}if(arguments.length===2){var r=arguments[0],a=arguments[1];return this.elt[r].get(a)}}},{key:"toString",value:function(){var n=new ln;return this.elt[0]!==null&&(n.append("A:"),n.append(this.elt[0].toString())),this.elt[1]!==null&&(n.append(" B:"),n.append(this.elt[1].toString())),n.toString()}},{key:"isArea",value:function(){if(arguments.length===0)return this.elt[0].isArea()||this.elt[1].isArea();if(arguments.length===1){var n=arguments[0];return this.elt[n].isArea()}}},{key:"isAnyNull",value:function(n){return this.elt[n].isAnyNull()}},{key:"setLocation",value:function(){if(arguments.length===2){var n=arguments[0],r=arguments[1];this.elt[n].setLocation(ie.ON,r)}else if(arguments.length===3){var a=arguments[0],f=arguments[1],m=arguments[2];this.elt[a].setLocation(f,m)}}},{key:"isEqualOnSide",value:function(n,r){return this.elt[0].isEqualOnSide(n.elt[0],r)&&this.elt[1].isEqualOnSide(n.elt[1],r)}},{key:"allPositionsEqual",value:function(n,r){return this.elt[n].allPositionsEqual(r)}},{key:"toLine",value:function(n){this.elt[n].isArea()&&(this.elt[n]=new Nt(this.elt[n].location[0]))}}],[{key:"constructor_",value:function(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var n=arguments[0];this.elt[0]=new Nt(n),this.elt[1]=new Nt(n)}else if(arguments[0]instanceof u){var r=arguments[0];this.elt[0]=new Nt(r.elt[0]),this.elt[1]=new Nt(r.elt[1])}}else if(arguments.length===2){var a=arguments[0],f=arguments[1];this.elt[0]=new Nt($.NONE),this.elt[1]=new Nt($.NONE),this.elt[a].setLocation(f)}else if(arguments.length===3){var m=arguments[0],p=arguments[1],I=arguments[2];this.elt[0]=new Nt(m,p,I),this.elt[1]=new Nt(m,p,I)}else if(arguments.length===4){var O=arguments[0],U=arguments[1],J=arguments[2],Q=arguments[3];this.elt[0]=new Nt($.NONE,$.NONE,$.NONE),this.elt[1]=new Nt($.NONE,$.NONE,$.NONE),this.elt[O].setLocations(U,J,Q)}}},{key:"toLineLabel",value:function(n){for(var r=new u($.NONE),a=0;a<2;a++)r.setLocation(a,n.getLocation(a));return r}}])})(),Ki=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"computeRing",value:function(){if(this._ring!==null)return null;for(var u=new Array(this._pts.size()).fill(null),n=0;n<this._pts.size();n++)u[n]=this._pts.get(n);this._ring=this._geometryFactory.createLinearRing(u),this._isHole=Ee.isCCW(this._ring.getCoordinates())}},{key:"isIsolated",value:function(){return this._label.getGeometryCount()===1}},{key:"computePoints",value:function(u){this._startDe=u;var n=u,r=!0;do{if(n===null)throw new Qt("Found null DirectedEdge");if(n.getEdgeRing()===this)throw new Qt("Directed Edge visited twice during ring-building at "+n.getCoordinate());this._edges.add(n);var a=n.getLabel();j.isTrue(a.isArea()),this.mergeLabel(a),this.addPoints(n.getEdge(),n.isForward(),r),r=!1,this.setEdgeRing(n,this),n=this.getNext(n)}while(n!==this._startDe)}},{key:"getLinearRing",value:function(){return this._ring}},{key:"getCoordinate",value:function(u){return this._pts.get(u)}},{key:"computeMaxNodeDegree",value:function(){this._maxNodeDegree=0;var u=this._startDe;do{var n=u.getNode().getEdges().getOutgoingDegree(this);n>this._maxNodeDegree&&(this._maxNodeDegree=n),u=this.getNext(u)}while(u!==this._startDe);this._maxNodeDegree*=2}},{key:"addPoints",value:function(u,n,r){var a=u.getCoordinates();if(n){var f=1;r&&(f=0);for(var m=f;m<a.length;m++)this._pts.add(a[m])}else{var p=a.length-2;r&&(p=a.length-1);for(var I=p;I>=0;I--)this._pts.add(a[I])}}},{key:"isHole",value:function(){return this._isHole}},{key:"setInResult",value:function(){var u=this._startDe;do u.getEdge().setInResult(!0),u=u.getNext();while(u!==this._startDe)}},{key:"containsPoint",value:function(u){var n=this.getLinearRing();if(!n.getEnvelopeInternal().contains(u)||!Po.isInRing(u,n.getCoordinates()))return!1;for(var r=this._holes.iterator();r.hasNext();)if(r.next().containsPoint(u))return!1;return!0}},{key:"addHole",value:function(u){this._holes.add(u)}},{key:"isShell",value:function(){return this._shell===null}},{key:"getLabel",value:function(){return this._label}},{key:"getEdges",value:function(){return this._edges}},{key:"getMaxNodeDegree",value:function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree}},{key:"getShell",value:function(){return this._shell}},{key:"mergeLabel",value:function(){if(arguments.length===1){var u=arguments[0];this.mergeLabel(u,0),this.mergeLabel(u,1)}else if(arguments.length===2){var n=arguments[1],r=arguments[0].getLocation(n,ie.RIGHT);if(r===$.NONE)return null;if(this._label.getLocation(n)===$.NONE)return this._label.setLocation(n,r),null}}},{key:"setShell",value:function(u){this._shell=u,u!==null&&u.addHole(this)}},{key:"toPolygon",value:function(u){for(var n=new Array(this._holes.size()).fill(null),r=0;r<this._holes.size();r++)n[r]=this._holes.get(r).getLinearRing();return u.createPolygon(this.getLinearRing(),n)}}],[{key:"constructor_",value:function(){if(this._startDe=null,this._maxNodeDegree=-1,this._edges=new me,this._pts=new me,this._label=new Mt($.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new me,this._geometryFactory=null,arguments.length!==0){if(arguments.length===2){var u=arguments[0],n=arguments[1];this._geometryFactory=n,this.computePoints(u),this.computeRing()}}}}])})(),tp=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"setEdgeRing",value:function(r,a){r.setMinEdgeRing(a)}},{key:"getNext",value:function(r){return r.getNextMin()}}],[{key:"constructor_",value:function(){var r=arguments[0],a=arguments[1];Ki.constructor_.call(this,r,a)}}])})(Ki),np=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"buildMinimalRings",value:function(){var r=new me,a=this._startDe;do{if(a.getMinEdgeRing()===null){var f=new tp(a,this._geometryFactory);r.add(f)}a=a.getNext()}while(a!==this._startDe);return r}},{key:"setEdgeRing",value:function(r,a){r.setEdgeRing(a)}},{key:"linkDirectedEdgesForMinimalEdgeRings",value:function(){var r=this._startDe;do r.getNode().getEdges().linkMinimalDirectedEdges(this),r=r.getNext();while(r!==this._startDe)}},{key:"getNext",value:function(r){return r.getNext()}}],[{key:"constructor_",value:function(){var r=arguments[0],a=arguments[1];Ki.constructor_.call(this,r,a)}}])})(Ki),Tc=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"setVisited",value:function(u){this._isVisited=u}},{key:"setInResult",value:function(u){this._isInResult=u}},{key:"isCovered",value:function(){return this._isCovered}},{key:"isCoveredSet",value:function(){return this._isCoveredSet}},{key:"setLabel",value:function(u){this._label=u}},{key:"getLabel",value:function(){return this._label}},{key:"setCovered",value:function(u){this._isCovered=u,this._isCoveredSet=!0}},{key:"updateIM",value:function(u){j.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(u)}},{key:"isInResult",value:function(){return this._isInResult}},{key:"isVisited",value:function(){return this._isVisited}}],[{key:"constructor_",value:function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,arguments.length!==0){if(arguments.length===1){var u=arguments[0];this._label=u}}}}])})(),Ji=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"isIncidentEdgeInResult",value:function(){for(var r=this.getEdges().getEdges().iterator();r.hasNext();)if(r.next().getEdge().isInResult())return!0;return!1}},{key:"isIsolated",value:function(){return this._label.getGeometryCount()===1}},{key:"getCoordinate",value:function(){return this._coord}},{key:"print",value:function(r){r.println("node "+this._coord+" lbl: "+this._label)}},{key:"computeIM",value:function(r){}},{key:"computeMergedLocation",value:function(r,a){var f=$.NONE;if(f=this._label.getLocation(a),!r.isNull(a)){var m=r.getLocation(a);f!==$.BOUNDARY&&(f=m)}return f}},{key:"setLabel",value:function(){if(arguments.length!==2||!Number.isInteger(arguments[1])||!Number.isInteger(arguments[0]))return M(n,"setLabel",this,1).apply(this,arguments);var r=arguments[0],a=arguments[1];this._label===null?this._label=new Mt(r,a):this._label.setLocation(r,a)}},{key:"getEdges",value:function(){return this._edges}},{key:"mergeLabel",value:function(){if(arguments[0]instanceof n){var r=arguments[0];this.mergeLabel(r._label)}else if(arguments[0]instanceof Mt)for(var a=arguments[0],f=0;f<2;f++){var m=this.computeMergedLocation(a,f);this._label.getLocation(f)===$.NONE&&this._label.setLocation(f,m)}}},{key:"add",value:function(r){this._edges.insert(r),r.setNode(this)}},{key:"setLabelBoundary",value:function(r){if(this._label===null)return null;var a=$.NONE;this._label!==null&&(a=this._label.getLocation(r));var f=null;switch(a){case $.BOUNDARY:f=$.INTERIOR;break;case $.INTERIOR:default:f=$.BOUNDARY}this._label.setLocation(r,f)}}],[{key:"constructor_",value:function(){this._coord=null,this._edges=null;var r=arguments[0],a=arguments[1];this._coord=r,this._edges=a,this._label=new Mt(0,$.NONE)}}])})(Tc),rp=(function(u){function n(){return o(this,n),s(this,n,arguments)}return v(n,u),c(n)})(Nc);function Oc(u){return u==null?0:u.color}function De(u){return u==null?null:u.parent}function Yt(u,n){u!==null&&(u.color=n)}function Lo(u){return u==null?null:u.left}function Rc(u){return u==null?null:u.right}var Br=(function(u){function n(){var r;return o(this,n),(r=s(this,n)).root_=null,r.size_=0,r}return v(n,u),c(n,[{key:"get",value:function(r){for(var a=this.root_;a!==null;){var f=r.compareTo(a.key);if(f<0)a=a.left;else{if(!(f>0))return a.value;a=a.right}}return null}},{key:"put",value:function(r,a){if(this.root_===null)return this.root_={key:r,value:a,left:null,right:null,parent:null,color:0,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var f,m,p=this.root_;do if(f=p,(m=r.compareTo(p.key))<0)p=p.left;else{if(!(m>0)){var I=p.value;return p.value=a,I}p=p.right}while(p!==null);var O={key:r,left:null,right:null,value:a,parent:f,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return m<0?f.left=O:f.right=O,this.fixAfterInsertion(O),this.size_++,null}},{key:"fixAfterInsertion",value:function(r){var a;for(r.color=1;r!=null&&r!==this.root_&&r.parent.color===1;)De(r)===Lo(De(De(r)))?Oc(a=Rc(De(De(r))))===1?(Yt(De(r),0),Yt(a,0),Yt(De(De(r)),1),r=De(De(r))):(r===Rc(De(r))&&(r=De(r),this.rotateLeft(r)),Yt(De(r),0),Yt(De(De(r)),1),this.rotateRight(De(De(r)))):Oc(a=Lo(De(De(r))))===1?(Yt(De(r),0),Yt(a,0),Yt(De(De(r)),1),r=De(De(r))):(r===Lo(De(r))&&(r=De(r),this.rotateRight(r)),Yt(De(r),0),Yt(De(De(r)),1),this.rotateLeft(De(De(r))));this.root_.color=0}},{key:"values",value:function(){var r=new me,a=this.getFirstEntry();if(a!==null)for(r.add(a.value);(a=n.successor(a))!==null;)r.add(a.value);return r}},{key:"entrySet",value:function(){var r=new ct,a=this.getFirstEntry();if(a!==null)for(r.add(a);(a=n.successor(a))!==null;)r.add(a);return r}},{key:"rotateLeft",value:function(r){if(r!=null){var a=r.right;r.right=a.left,a.left!=null&&(a.left.parent=r),a.parent=r.parent,r.parent==null?this.root_=a:r.parent.left===r?r.parent.left=a:r.parent.right=a,a.left=r,r.parent=a}}},{key:"rotateRight",value:function(r){if(r!=null){var a=r.left;r.left=a.right,a.right!=null&&(a.right.parent=r),a.parent=r.parent,r.parent==null?this.root_=a:r.parent.right===r?r.parent.right=a:r.parent.left=a,a.right=r,r.parent=a}}},{key:"getFirstEntry",value:function(){var r=this.root_;if(r!=null)for(;r.left!=null;)r=r.left;return r}},{key:"size",value:function(){return this.size_}},{key:"containsKey",value:function(r){for(var a=this.root_;a!==null;){var f=r.compareTo(a.key);if(f<0)a=a.left;else{if(!(f>0))return!0;a=a.right}}return!1}}],[{key:"successor",value:function(r){var a;if(r===null)return null;if(r.right!==null){for(a=r.right;a.left!==null;)a=a.left;return a}a=r.parent;for(var f=r;a!==null&&f===a.right;)f=a,a=a.parent;return a}}])})(rp),Ac=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"find",value:function(u){return this.nodeMap.get(u)}},{key:"addNode",value:function(){if(arguments[0]instanceof W){var u=arguments[0],n=this.nodeMap.get(u);return n===null&&(n=this.nodeFact.createNode(u),this.nodeMap.put(u,n)),n}if(arguments[0]instanceof Ji){var r=arguments[0],a=this.nodeMap.get(r.getCoordinate());return a===null?(this.nodeMap.put(r.getCoordinate(),r),r):(a.mergeLabel(r),a)}}},{key:"print",value:function(u){for(var n=this.iterator();n.hasNext();)n.next().print(u)}},{key:"iterator",value:function(){return this.nodeMap.values().iterator()}},{key:"values",value:function(){return this.nodeMap.values()}},{key:"getBoundaryNodes",value:function(u){for(var n=new me,r=this.iterator();r.hasNext();){var a=r.next();a.getLabel().getLocation(u)===$.BOUNDARY&&n.add(a)}return n}},{key:"add",value:function(u){var n=u.getCoordinate();this.addNode(n).add(u)}}],[{key:"constructor_",value:function(){this.nodeMap=new Br,this.nodeFact=null;var u=arguments[0];this.nodeFact=u}}])})(),ht=(function(){function u(){o(this,u)}return c(u,null,[{key:"isNorthern",value:function(n){return n===u.NE||n===u.NW}},{key:"isOpposite",value:function(n,r){return n!==r&&(n-r+4)%4===2}},{key:"commonHalfPlane",value:function(n,r){if(n===r)return n;if((n-r+4)%4===2)return-1;var a=n<r?n:r;return a===0&&(n>r?n:r)===3?3:a}},{key:"isInHalfPlane",value:function(n,r){return r===u.SE?n===u.SE||n===u.SW:n===r||n===r+1}},{key:"quadrant",value:function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],r=arguments[1];if(n===0&&r===0)throw new C("Cannot compute the quadrant for point ( "+n+", "+r+" )");return n>=0?r>=0?u.NE:u.SE:r>=0?u.NW:u.SW}if(arguments[0]instanceof W&&arguments[1]instanceof W){var a=arguments[0],f=arguments[1];if(f.x===a.x&&f.y===a.y)throw new C("Cannot compute the quadrant for two identical points "+a);return f.x>=a.x?f.y>=a.y?u.NE:u.SE:f.y>=a.y?u.NW:u.SW}}}])})();ht.NE=0,ht.NW=1,ht.SW=2,ht.SE=3;var Dc=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"compareDirection",value:function(n){return this._dx===n._dx&&this._dy===n._dy?0:this._quadrant>n._quadrant?1:this._quadrant<n._quadrant?-1:Ee.index(n._p0,n._p1,this._p1)}},{key:"getDy",value:function(){return this._dy}},{key:"getCoordinate",value:function(){return this._p0}},{key:"setNode",value:function(n){this._node=n}},{key:"print",value:function(n){var r=Math.atan2(this._dy,this._dx),a=this.getClass().getName(),f=a.lastIndexOf("."),m=a.substring(f+1);n.print(" "+m+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+r+" "+this._label)}},{key:"compareTo",value:function(n){var r=n;return this.compareDirection(r)}},{key:"getDirectedCoordinate",value:function(){return this._p1}},{key:"getDx",value:function(){return this._dx}},{key:"getLabel",value:function(){return this._label}},{key:"getEdge",value:function(){return this._edge}},{key:"getQuadrant",value:function(){return this._quadrant}},{key:"getNode",value:function(){return this._node}},{key:"toString",value:function(){var n=Math.atan2(this._dy,this._dx),r=this.getClass().getName(),a=r.lastIndexOf(".");return" "+r.substring(a+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+n+" "+this._label}},{key:"computeLabel",value:function(n){}},{key:"init",value:function(n,r){this._p0=n,this._p1=r,this._dx=r.x-n.x,this._dy=r.y-n.y,this._quadrant=ht.quadrant(this._dx,this._dy),j.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")}},{key:"interfaces_",get:function(){return[q]}}],[{key:"constructor_",value: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,arguments.length===1){var n=arguments[0];this._edge=n}else if(arguments.length===3){var r=arguments[0],a=arguments[1],f=arguments[2];u.constructor_.call(this,r,a,f,null)}else if(arguments.length===4){var m=arguments[0],p=arguments[1],I=arguments[2],O=arguments[3];u.constructor_.call(this,m),this.init(p,I),this._label=O}}}])})(),bo=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"getNextMin",value:function(){return this._nextMin}},{key:"getDepth",value:function(r){return this._depth[r]}},{key:"setVisited",value:function(r){this._isVisited=r}},{key:"computeDirectedLabel",value:function(){this._label=new Mt(this._edge.getLabel()),this._isForward||this._label.flip()}},{key:"getNext",value:function(){return this._next}},{key:"setDepth",value:function(r,a){if(this._depth[r]!==-999&&this._depth[r]!==a)throw new Qt("assigned depths do not match",this.getCoordinate());this._depth[r]=a}},{key:"isInteriorAreaEdge",value:function(){for(var r=!0,a=0;a<2;a++)this._label.isArea(a)&&this._label.getLocation(a,ie.LEFT)===$.INTERIOR&&this._label.getLocation(a,ie.RIGHT)===$.INTERIOR||(r=!1);return r}},{key:"setNextMin",value:function(r){this._nextMin=r}},{key:"print",value:function(r){M(n,"print",this,1).call(this,r),r.print(" "+this._depth[ie.LEFT]+"/"+this._depth[ie.RIGHT]),r.print(" ("+this.getDepthDelta()+")"),this._isInResult&&r.print(" inResult")}},{key:"setMinEdgeRing",value:function(r){this._minEdgeRing=r}},{key:"isLineEdge",value:function(){var r=this._label.isLine(0)||this._label.isLine(1),a=!this._label.isArea(0)||this._label.allPositionsEqual(0,$.EXTERIOR),f=!this._label.isArea(1)||this._label.allPositionsEqual(1,$.EXTERIOR);return r&&a&&f}},{key:"setEdgeRing",value:function(r){this._edgeRing=r}},{key:"getMinEdgeRing",value:function(){return this._minEdgeRing}},{key:"getDepthDelta",value:function(){var r=this._edge.getDepthDelta();return this._isForward||(r=-r),r}},{key:"setInResult",value:function(r){this._isInResult=r}},{key:"getSym",value:function(){return this._sym}},{key:"isForward",value:function(){return this._isForward}},{key:"getEdge",value:function(){return this._edge}},{key:"printEdge",value:function(r){this.print(r),r.print(" "),this._isForward?this._edge.print(r):this._edge.printReverse(r)}},{key:"setSym",value:function(r){this._sym=r}},{key:"setVisitedEdge",value:function(r){this.setVisited(r),this._sym.setVisited(r)}},{key:"setEdgeDepths",value:function(r,a){var f=this.getEdge().getDepthDelta();this._isForward||(f=-f);var m=1;r===ie.LEFT&&(m=-1);var p=ie.opposite(r),I=a+f*m;this.setDepth(r,a),this.setDepth(p,I)}},{key:"getEdgeRing",value:function(){return this._edgeRing}},{key:"isInResult",value:function(){return this._isInResult}},{key:"setNext",value:function(r){this._next=r}},{key:"isVisited",value:function(){return this._isVisited}}],[{key:"constructor_",value:function(){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];var r=arguments[0],a=arguments[1];if(Dc.constructor_.call(this,r),this._isForward=a,a)this.init(r.getCoordinate(0),r.getCoordinate(1));else{var f=r.getNumPoints()-1;this.init(r.getCoordinate(f),r.getCoordinate(f-1))}this.computeDirectedLabel()}},{key:"depthFactor",value:function(r,a){return r===$.EXTERIOR&&a===$.INTERIOR?1:r===$.INTERIOR&&a===$.EXTERIOR?-1:0}}])})(Dc),Fc=(function(){return c((function u(){o(this,u)}),[{key:"createNode",value:function(u){return new Ji(u,null)}}])})(),qc=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"printEdges",value:function(u){u.println("Edges:");for(var n=0;n<this._edges.size();n++){u.println("edge "+n+":");var r=this._edges.get(n);r.print(u),r.eiList.print(u)}}},{key:"find",value:function(u){return this._nodes.find(u)}},{key:"addNode",value:function(){if(arguments[0]instanceof Ji){var u=arguments[0];return this._nodes.addNode(u)}if(arguments[0]instanceof W){var n=arguments[0];return this._nodes.addNode(n)}}},{key:"getNodeIterator",value:function(){return this._nodes.iterator()}},{key:"linkResultDirectedEdges",value:function(){for(var u=this._nodes.iterator();u.hasNext();)u.next().getEdges().linkResultDirectedEdges()}},{key:"debugPrintln",value:function(u){It.out.println(u)}},{key:"isBoundaryNode",value:function(u,n){var r=this._nodes.find(n);if(r===null)return!1;var a=r.getLabel();return a!==null&&a.getLocation(u)===$.BOUNDARY}},{key:"linkAllDirectedEdges",value:function(){for(var u=this._nodes.iterator();u.hasNext();)u.next().getEdges().linkAllDirectedEdges()}},{key:"matchInSameDirection",value:function(u,n,r,a){return!!u.equals(r)&&Ee.index(u,n,a)===Ee.COLLINEAR&&ht.quadrant(u,n)===ht.quadrant(r,a)}},{key:"getEdgeEnds",value:function(){return this._edgeEndList}},{key:"debugPrint",value:function(u){It.out.print(u)}},{key:"getEdgeIterator",value:function(){return this._edges.iterator()}},{key:"findEdgeInSameDirection",value:function(u,n){for(var r=0;r<this._edges.size();r++){var a=this._edges.get(r),f=a.getCoordinates();if(this.matchInSameDirection(u,n,f[0],f[1])||this.matchInSameDirection(u,n,f[f.length-1],f[f.length-2]))return a}return null}},{key:"insertEdge",value:function(u){this._edges.add(u)}},{key:"findEdgeEnd",value:function(u){for(var n=this.getEdgeEnds().iterator();n.hasNext();){var r=n.next();if(r.getEdge()===u)return r}return null}},{key:"addEdges",value:function(u){for(var n=u.iterator();n.hasNext();){var r=n.next();this._edges.add(r);var a=new bo(r,!0),f=new bo(r,!1);a.setSym(f),f.setSym(a),this.add(a),this.add(f)}}},{key:"add",value:function(u){this._nodes.add(u),this._edgeEndList.add(u)}},{key:"getNodes",value:function(){return this._nodes.values()}},{key:"findEdge",value:function(u,n){for(var r=0;r<this._edges.size();r++){var a=this._edges.get(r),f=a.getCoordinates();if(u.equals(f[0])&&n.equals(f[1]))return a}return null}}],[{key:"constructor_",value:function(){if(this._edges=new me,this._nodes=null,this._edgeEndList=new me,arguments.length===0)this._nodes=new Ac(new Fc);else if(arguments.length===1){var u=arguments[0];this._nodes=new Ac(u)}}},{key:"linkResultDirectedEdges",value:function(u){for(var n=u.iterator();n.hasNext();)n.next().getEdges().linkResultDirectedEdges()}}])})(),ip=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"sortShellsAndHoles",value:function(n,r,a){for(var f=n.iterator();f.hasNext();){var m=f.next();m.isHole()?a.add(m):r.add(m)}}},{key:"computePolygons",value:function(n){for(var r=new me,a=n.iterator();a.hasNext();){var f=a.next().toPolygon(this._geometryFactory);r.add(f)}return r}},{key:"placeFreeHoles",value:function(n,r){for(var a=r.iterator();a.hasNext();){var f=a.next();if(f.getShell()===null){var m=u.findEdgeRingContaining(f,n);if(m===null)throw new Qt("unable to assign hole to a shell",f.getCoordinate(0));f.setShell(m)}}}},{key:"buildMinimalEdgeRings",value:function(n,r,a){for(var f=new me,m=n.iterator();m.hasNext();){var p=m.next();if(p.getMaxNodeDegree()>2){p.linkDirectedEdgesForMinimalEdgeRings();var I=p.buildMinimalRings(),O=this.findShell(I);O!==null?(this.placePolygonHoles(O,I),r.add(O)):a.addAll(I)}else f.add(p)}return f}},{key:"buildMaximalEdgeRings",value:function(n){for(var r=new me,a=n.iterator();a.hasNext();){var f=a.next();if(f.isInResult()&&f.getLabel().isArea()&&f.getEdgeRing()===null){var m=new np(f,this._geometryFactory);r.add(m),m.setInResult()}}return r}},{key:"placePolygonHoles",value:function(n,r){for(var a=r.iterator();a.hasNext();){var f=a.next();f.isHole()&&f.setShell(n)}}},{key:"getPolygons",value:function(){return this.computePolygons(this._shellList)}},{key:"findShell",value:function(n){for(var r=0,a=null,f=n.iterator();f.hasNext();){var m=f.next();m.isHole()||(a=m,r++)}return j.isTrue(r<=1,"found two shells in MinimalEdgeRing list"),a}},{key:"add",value:function(){if(arguments.length===1){var n=arguments[0];this.add(n.getEdgeEnds(),n.getNodes())}else if(arguments.length===2){var r=arguments[0],a=arguments[1];qc.linkResultDirectedEdges(a);var f=this.buildMaximalEdgeRings(r),m=new me,p=this.buildMinimalEdgeRings(f,this._shellList,m);this.sortShellsAndHoles(p,this._shellList,m),this.placeFreeHoles(this._shellList,m)}}}],[{key:"constructor_",value:function(){this._geometryFactory=null,this._shellList=new me;var n=arguments[0];this._geometryFactory=n}},{key:"findEdgeRingContaining",value:function(n,r){for(var a=n.getLinearRing(),f=a.getEnvelopeInternal(),m=a.getCoordinateN(0),p=null,I=null,O=r.iterator();O.hasNext();){var U=O.next(),J=U.getLinearRing(),Q=J.getEnvelopeInternal();if(!Q.equals(f)&&Q.contains(f)){m=et.ptNotInList(a.getCoordinates(),J.getCoordinates());var ne=!1;Po.isInRing(m,J.getCoordinates())&&(ne=!0),ne&&(p===null||I.contains(Q))&&(I=(p=U).getLinearRing().getEnvelopeInternal())}}return p}}])})(),Bc=(function(){return c((function u(){o(this,u)}),[{key:"getBounds",value:function(){}}])})(),en=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"getItem",value:function(){return this._item}},{key:"getBounds",value:function(){return this._bounds}},{key:"interfaces_",get:function(){return[Bc,N]}}],[{key:"constructor_",value:function(){this._bounds=null,this._item=null;var u=arguments[0],n=arguments[1];this._bounds=u,this._item=n}}])})(),Qi=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"poll",value:function(){if(this.isEmpty())return null;var u=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),u}},{key:"size",value:function(){return this._size}},{key:"reorder",value:function(u){for(var n=null,r=this._items.get(u);2*u<=this._size&&((n=2*u)!==this._size&&this._items.get(n+1).compareTo(this._items.get(n))<0&&n++,this._items.get(n).compareTo(r)<0);u=n)this._items.set(u,this._items.get(n));this._items.set(u,r)}},{key:"clear",value:function(){this._size=0,this._items.clear()}},{key:"peek",value:function(){return this.isEmpty()?null:this._items.get(1)}},{key:"isEmpty",value:function(){return this._size===0}},{key:"add",value:function(u){this._items.add(null),this._size+=1;var n=this._size;for(this._items.set(0,u);u.compareTo(this._items.get(Math.trunc(n/2)))<0;n/=2)this._items.set(n,this._items.get(Math.trunc(n/2)));this._items.set(n,u)}}],[{key:"constructor_",value:function(){this._size=null,this._items=null,this._size=0,this._items=new me,this._items.add(null)}}])})(),sp=(function(){return c((function u(){o(this,u)}),[{key:"insert",value:function(u,n){}},{key:"remove",value:function(u,n){}},{key:"query",value:function(){}}])})(),St=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"getLevel",value:function(){return this._level}},{key:"size",value:function(){return this._childBoundables.size()}},{key:"getChildBoundables",value:function(){return this._childBoundables}},{key:"addChildBoundable",value:function(u){j.isTrue(this._bounds===null),this._childBoundables.add(u)}},{key:"isEmpty",value:function(){return this._childBoundables.isEmpty()}},{key:"getBounds",value:function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds}},{key:"interfaces_",get:function(){return[Bc,N]}}],[{key:"constructor_",value:function(){if(this._childBoundables=new me,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var u=arguments[0];this._level=u}}}}])})(),Zn={reverseOrder:function(){return{compare:function(u,n){return n.compareTo(u)}}},min:function(u){return Zn.sort(u),u.get(0)},sort:function(u,n){var r=u.toArray();n?xn.sort(r,n):xn.sort(r);for(var a=u.iterator(),f=0,m=r.length;f<m;f++)a.next(),a.set(r[f])},singletonList:function(u){var n=new me;return n.add(u),n}},op=(function(){function u(){o(this,u)}return c(u,null,[{key:"maxDistance",value:function(n,r,a,f,m,p,I,O){var U=u.distance(n,r,m,p);return U=Math.max(U,u.distance(n,r,I,O)),U=Math.max(U,u.distance(a,f,m,p)),U=Math.max(U,u.distance(a,f,I,O))}},{key:"distance",value:function(n,r,a,f){var m=a-n,p=f-r;return Math.sqrt(m*m+p*p)}},{key:"maximumDistance",value:function(n,r){var a=Math.min(n.getMinX(),r.getMinX()),f=Math.min(n.getMinY(),r.getMinY()),m=Math.max(n.getMaxX(),r.getMaxX()),p=Math.max(n.getMaxY(),r.getMaxY());return u.distance(a,f,m,p)}},{key:"minMaxDistance",value:function(n,r){var a=n.getMinX(),f=n.getMinY(),m=n.getMaxX(),p=n.getMaxY(),I=r.getMinX(),O=r.getMinY(),U=r.getMaxX(),J=r.getMaxY(),Q=u.maxDistance(a,f,a,p,I,O,I,J);return Q=Math.min(Q,u.maxDistance(a,f,a,p,I,O,U,O)),Q=Math.min(Q,u.maxDistance(a,f,a,p,U,J,I,J)),Q=Math.min(Q,u.maxDistance(a,f,a,p,U,J,U,O)),Q=Math.min(Q,u.maxDistance(a,f,m,f,I,O,I,J)),Q=Math.min(Q,u.maxDistance(a,f,m,f,I,O,U,O)),Q=Math.min(Q,u.maxDistance(a,f,m,f,U,J,I,J)),Q=Math.min(Q,u.maxDistance(a,f,m,f,U,J,U,O)),Q=Math.min(Q,u.maxDistance(m,p,a,p,I,O,I,J)),Q=Math.min(Q,u.maxDistance(m,p,a,p,I,O,U,O)),Q=Math.min(Q,u.maxDistance(m,p,a,p,U,J,I,J)),Q=Math.min(Q,u.maxDistance(m,p,a,p,U,J,U,O)),Q=Math.min(Q,u.maxDistance(m,p,m,f,I,O,I,J)),Q=Math.min(Q,u.maxDistance(m,p,m,f,I,O,U,O)),Q=Math.min(Q,u.maxDistance(m,p,m,f,U,J,I,J)),Q=Math.min(Q,u.maxDistance(m,p,m,f,U,J,U,O))}}])})(),Wn=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"maximumDistance",value:function(){return op.maximumDistance(this._boundable1.getBounds(),this._boundable2.getBounds())}},{key:"expandToQueue",value:function(n,r){var a=u.isComposite(this._boundable1),f=u.isComposite(this._boundable2);if(a&&f)return u.area(this._boundable1)>u.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,!1,n,r),null):(this.expand(this._boundable2,this._boundable1,!0,n,r),null);if(a)return this.expand(this._boundable1,this._boundable2,!1,n,r),null;if(f)return this.expand(this._boundable2,this._boundable1,!0,n,r),null;throw new C("neither boundable is composite")}},{key:"isLeaves",value:function(){return!(u.isComposite(this._boundable1)||u.isComposite(this._boundable2))}},{key:"compareTo",value:function(n){var r=n;return this._distance<r._distance?-1:this._distance>r._distance?1:0}},{key:"expand",value:function(n,r,a,f,m){for(var p=n.getChildBoundables().iterator();p.hasNext();){var I=p.next(),O=null;(O=a?new u(r,I,this._itemDistance):new u(I,r,this._itemDistance)).getDistance()<m&&f.add(O)}}},{key:"getBoundable",value:function(n){return n===0?this._boundable1:this._boundable2}},{key:"getDistance",value:function(){return this._distance}},{key:"distance",value:function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())}},{key:"interfaces_",get:function(){return[q]}}],[{key:"constructor_",value:function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var n=arguments[0],r=arguments[1],a=arguments[2];this._boundable1=n,this._boundable2=r,this._itemDistance=a,this._distance=this.distance()}},{key:"area",value:function(n){return n.getBounds().getArea()}},{key:"isComposite",value:function(n){return n instanceof St}}])})(),Gc=(function(){return c((function u(){o(this,u)}),[{key:"visitItem",value:function(u){}}])})(),Kn=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"queryInternal",value:function(){if(Ie(arguments[2],Gc)&&arguments[0]instanceof Object&&arguments[1]instanceof St)for(var n=arguments[0],r=arguments[2],a=arguments[1].getChildBoundables(),f=0;f<a.size();f++){var m=a.get(f);this.getIntersectsOp().intersects(m.getBounds(),n)&&(m instanceof St?this.queryInternal(n,m,r):m instanceof en?r.visitItem(m.getItem()):j.shouldNeverReachHere())}else if(Ie(arguments[2],Jt)&&arguments[0]instanceof Object&&arguments[1]instanceof St)for(var p=arguments[0],I=arguments[2],O=arguments[1].getChildBoundables(),U=0;U<O.size();U++){var J=O.get(U);this.getIntersectsOp().intersects(J.getBounds(),p)&&(J instanceof St?this.queryInternal(p,J,I):J instanceof en?I.add(J.getItem()):j.shouldNeverReachHere())}}},{key:"getNodeCapacity",value:function(){return this._nodeCapacity}},{key:"lastNode",value:function(n){return n.get(n.size()-1)}},{key:"size",value:function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var n=0,r=arguments[0].getChildBoundables().iterator();r.hasNext();){var a=r.next();a instanceof St?n+=this.size(a):a instanceof en&&(n+=1)}return n}}},{key:"removeItem",value:function(n,r){for(var a=null,f=n.getChildBoundables().iterator();f.hasNext();){var m=f.next();m instanceof en&&m.getItem()===r&&(a=m)}return a!==null&&(n.getChildBoundables().remove(a),!0)}},{key:"itemsTree",value:function(){if(arguments.length===0){this.build();var n=this.itemsTree(this._root);return n===null?new me:n}if(arguments.length===1){for(var r=arguments[0],a=new me,f=r.getChildBoundables().iterator();f.hasNext();){var m=f.next();if(m instanceof St){var p=this.itemsTree(m);p!==null&&a.add(p)}else m instanceof en?a.add(m.getItem()):j.shouldNeverReachHere()}return a.size()<=0?null:a}}},{key:"insert",value:function(n,r){j.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new en(n,r))}},{key:"boundablesAtLevel",value:function(){if(arguments.length===1){var n=arguments[0],r=new me;return this.boundablesAtLevel(n,this._root,r),r}if(arguments.length===3){var a=arguments[0],f=arguments[1],m=arguments[2];if(j.isTrue(a>-2),f.getLevel()===a)return m.add(f),null;for(var p=f.getChildBoundables().iterator();p.hasNext();){var I=p.next();I instanceof St?this.boundablesAtLevel(a,I,m):(j.isTrue(I instanceof en),a===-1&&m.add(I))}return null}}},{key:"query",value:function(){if(arguments.length===1){var n=arguments[0];this.build();var r=new me;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.queryInternal(n,this._root,r),r}if(arguments.length===2){var a=arguments[0],f=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),a)&&this.queryInternal(a,this._root,f)}}},{key:"build",value: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}},{key:"getRoot",value:function(){return this.build(),this._root}},{key:"remove",value:function(){if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.remove(n,this._root,r)}if(arguments.length===3){var a=arguments[0],f=arguments[1],m=arguments[2],p=this.removeItem(f,m);if(p)return!0;for(var I=null,O=f.getChildBoundables().iterator();O.hasNext();){var U=O.next();if(this.getIntersectsOp().intersects(U.getBounds(),a)&&U instanceof St&&(p=this.remove(a,U,m))){I=U;break}}return I!==null&&I.getChildBoundables().isEmpty()&&f.getChildBoundables().remove(I),p}}},{key:"createHigherLevels",value:function(n,r){j.isTrue(!n.isEmpty());var a=this.createParentBoundables(n,r+1);return a.size()===1?a.get(0):this.createHigherLevels(a,r+1)}},{key:"depth",value:function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var n=0,r=arguments[0].getChildBoundables().iterator();r.hasNext();){var a=r.next();if(a instanceof St){var f=this.depth(a);f>n&&(n=f)}}return n+1}}},{key:"createParentBoundables",value:function(n,r){j.isTrue(!n.isEmpty());var a=new me;a.add(this.createNode(r));var f=new me(n);Zn.sort(f,this.getComparator());for(var m=f.iterator();m.hasNext();){var p=m.next();this.lastNode(a).getChildBoundables().size()===this.getNodeCapacity()&&a.add(this.createNode(r)),this.lastNode(a).addChildBoundable(p)}return a}},{key:"isEmpty",value:function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()}},{key:"interfaces_",get:function(){return[N]}}],[{key:"constructor_",value:function(){if(this._root=null,this._built=!1,this._itemBoundables=new me,this._nodeCapacity=null,arguments.length===0)u.constructor_.call(this,u.DEFAULT_NODE_CAPACITY);else if(arguments.length===1){var n=arguments[0];j.isTrue(n>1,"Node capacity must be greater than 1"),this._nodeCapacity=n}}},{key:"compareDoubles",value:function(n,r){return n>r?1:n<r?-1:0}}])})();Kn.IntersectsOp=function(){},Kn.DEFAULT_NODE_CAPACITY=10;var ap=(function(){return c((function u(){o(this,u)}),[{key:"distance",value:function(u,n){}}])})(),zt=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"createParentBoundablesFromVerticalSlices",value:function(r,a){j.isTrue(r.length>0);for(var f=new me,m=0;m<r.length;m++)f.addAll(this.createParentBoundablesFromVerticalSlice(r[m],a));return f}},{key:"nearestNeighbourK",value:function(){if(arguments.length===2){var r=arguments[0],a=arguments[1];return this.nearestNeighbourK(r,B.POSITIVE_INFINITY,a)}if(arguments.length===3){var f=arguments[0],m=arguments[2],p=arguments[1],I=new Qi;I.add(f);for(var O=new Qi;!I.isEmpty()&&p>=0;){var U=I.poll(),J=U.getDistance();if(J>=p)break;U.isLeaves()?O.size()<m?O.add(U):(O.peek().getDistance()>J&&(O.poll(),O.add(U)),p=O.peek().getDistance()):U.expandToQueue(I,p)}return n.getItems(O)}}},{key:"createNode",value:function(r){return new Yc(r)}},{key:"size",value:function(){return arguments.length===0?M(n,"size",this,1).call(this):M(n,"size",this,1).apply(this,arguments)}},{key:"insert",value:function(){if(!(arguments.length===2&&arguments[1]instanceof Object&&arguments[0]instanceof le))return M(n,"insert",this,1).apply(this,arguments);var r=arguments[0],a=arguments[1];if(r.isNull())return null;M(n,"insert",this,1).call(this,r,a)}},{key:"getIntersectsOp",value:function(){return n.intersectsOp}},{key:"verticalSlices",value:function(r,a){for(var f=Math.trunc(Math.ceil(r.size()/a)),m=new Array(a).fill(null),p=r.iterator(),I=0;I<a;I++){m[I]=new me;for(var O=0;p.hasNext()&&O<f;){var U=p.next();m[I].add(U),O++}}return m}},{key:"query",value:function(){if(arguments.length===1){var r=arguments[0];return M(n,"query",this,1).call(this,r)}if(arguments.length===2){var a=arguments[0],f=arguments[1];M(n,"query",this,1).call(this,a,f)}}},{key:"getComparator",value:function(){return n.yComparator}},{key:"createParentBoundablesFromVerticalSlice",value:function(r,a){return M(n,"createParentBoundables",this,1).call(this,r,a)}},{key:"remove",value:function(){if(arguments.length===2&&arguments[1]instanceof Object&&arguments[0]instanceof le){var r=arguments[0],a=arguments[1];return M(n,"remove",this,1).call(this,r,a)}return M(n,"remove",this,1).apply(this,arguments)}},{key:"depth",value:function(){return arguments.length===0?M(n,"depth",this,1).call(this):M(n,"depth",this,1).apply(this,arguments)}},{key:"createParentBoundables",value:function(r,a){j.isTrue(!r.isEmpty());var f=Math.trunc(Math.ceil(r.size()/this.getNodeCapacity())),m=new me(r);Zn.sort(m,n.xComparator);var p=this.verticalSlices(m,Math.trunc(Math.ceil(Math.sqrt(f))));return this.createParentBoundablesFromVerticalSlices(p,a)}},{key:"nearestNeighbour",value:function(){if(arguments.length===1){if(Ie(arguments[0],ap)){var r=arguments[0];if(this.isEmpty())return null;var a=new Wn(this.getRoot(),this.getRoot(),r);return this.nearestNeighbour(a)}if(arguments[0]instanceof Wn){var f=arguments[0],m=B.POSITIVE_INFINITY,p=null,I=new Qi;for(I.add(f);!I.isEmpty()&&m>0;){var O=I.poll(),U=O.getDistance();if(U>=m)break;O.isLeaves()?(m=U,p=O):O.expandToQueue(I,m)}return p===null?null:[p.getBoundable(0).getItem(),p.getBoundable(1).getItem()]}}else{if(arguments.length===2){var J=arguments[0],Q=arguments[1];if(this.isEmpty()||J.isEmpty())return null;var ne=new Wn(this.getRoot(),J.getRoot(),Q);return this.nearestNeighbour(ne)}if(arguments.length===3){var ce=arguments[2],fe=new en(arguments[0],arguments[1]),de=new Wn(this.getRoot(),fe,ce);return this.nearestNeighbour(de)[0]}if(arguments.length===4){var Re=arguments[2],be=arguments[3],Ye=new en(arguments[0],arguments[1]),it=new Wn(this.getRoot(),Ye,Re);return this.nearestNeighbourK(it,be)}}}},{key:"isWithinDistance",value:function(){if(arguments.length===2){var r=arguments[0],a=arguments[1],f=B.POSITIVE_INFINITY,m=new Qi;for(m.add(r);!m.isEmpty();){var p=m.poll(),I=p.getDistance();if(I>a)return!1;if(p.maximumDistance()<=a)return!0;if(p.isLeaves()){if((f=I)<=a)return!0}else p.expandToQueue(m,f)}return!1}if(arguments.length===3){var O=arguments[0],U=arguments[1],J=arguments[2],Q=new Wn(this.getRoot(),O.getRoot(),U);return this.isWithinDistance(Q,J)}}},{key:"interfaces_",get:function(){return[sp,N]}}],[{key:"constructor_",value:function(){if(arguments.length===0)n.constructor_.call(this,n.DEFAULT_NODE_CAPACITY);else if(arguments.length===1){var r=arguments[0];Kn.constructor_.call(this,r)}}},{key:"centreX",value:function(r){return n.avg(r.getMinX(),r.getMaxX())}},{key:"avg",value:function(r,a){return(r+a)/2}},{key:"getItems",value:function(r){for(var a=new Array(r.size()).fill(null),f=0;!r.isEmpty();){var m=r.poll();a[f]=m.getBoundable(0).getItem(),f++}return a}},{key:"centreY",value:function(r){return n.avg(r.getMinY(),r.getMaxY())}}])})(Kn),Yc=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"computeBounds",value:function(){for(var r=null,a=this.getChildBoundables().iterator();a.hasNext();){var f=a.next();r===null?r=new le(f.getBounds()):r.expandToInclude(f.getBounds())}return r}}],[{key:"constructor_",value:function(){var r=arguments[0];St.constructor_.call(this,r)}}])})(St);zt.STRtreeNode=Yc,zt.xComparator=new((function(){return c((function u(){o(this,u)}),[{key:"interfaces_",get:function(){return[Z]}},{key:"compare",value:function(u,n){return Kn.compareDoubles(zt.centreX(u.getBounds()),zt.centreX(n.getBounds()))}}])})()),zt.yComparator=new((function(){return c((function u(){o(this,u)}),[{key:"interfaces_",get:function(){return[Z]}},{key:"compare",value:function(u,n){return Kn.compareDoubles(zt.centreY(u.getBounds()),zt.centreY(n.getBounds()))}}])})()),zt.intersectsOp=new((function(){return c((function u(){o(this,u)}),[{key:"interfaces_",get:function(){return[IntersectsOp]}},{key:"intersects",value:function(u,n){return u.intersects(n)}}])})()),zt.DEFAULT_NODE_CAPACITY=10;var up=(function(){function u(){o(this,u)}return c(u,null,[{key:"relativeSign",value:function(n,r){return n<r?-1:n>r?1:0}},{key:"compare",value:function(n,r,a){if(r.equals2D(a))return 0;var f=u.relativeSign(r.x,a.x),m=u.relativeSign(r.y,a.y);switch(n){case 0:return u.compareValue(f,m);case 1:return u.compareValue(m,f);case 2:return u.compareValue(m,-f);case 3:return u.compareValue(-f,m);case 4:return u.compareValue(-f,-m);case 5:return u.compareValue(-m,-f);case 6:return u.compareValue(-m,f);case 7:return u.compareValue(f,-m)}return j.shouldNeverReachHere("invalid octant value"),0}},{key:"compareValue",value:function(n,r){return n<0?-1:n>0?1:r<0?-1:r>0?1:0}}])})(),lp=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"getCoordinate",value:function(){return this.coord}},{key:"print",value:function(u){u.print(this.coord),u.print(" seg # = "+this.segmentIndex)}},{key:"compareTo",value:function(u){var n=u;return this.segmentIndex<n.segmentIndex?-1:this.segmentIndex>n.segmentIndex?1:this.coord.equals2D(n.coord)?0:this._isInterior?n._isInterior?up.compare(this._segmentOctant,this.coord,n.coord):1:-1}},{key:"isEndPoint",value:function(u){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===u}},{key:"toString",value:function(){return this.segmentIndex+":"+this.coord.toString()}},{key:"isInterior",value:function(){return this._isInterior}},{key:"interfaces_",get:function(){return[q]}}],[{key:"constructor_",value:function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var u=arguments[0],n=arguments[1],r=arguments[2],a=arguments[3];this._segString=u,this.coord=new W(n),this.segmentIndex=r,this._segmentOctant=a,this._isInterior=!n.equals2D(u.getCoordinate(r))}}])})(),cp=(function(){return c((function u(){o(this,u)}),[{key:"hasNext",value:function(){}},{key:"next",value:function(){}},{key:"remove",value:function(){}}])})(),hp=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"getSplitCoordinates",value:function(){var u=new Dr;this.addEndpoints();for(var n=this.iterator(),r=n.next();n.hasNext();){var a=n.next();this.addEdgeCoordinates(r,a,u),r=a}return u.toCoordinateArray()}},{key:"addCollapsedNodes",value:function(){var u=new me;this.findCollapsesFromInsertedNodes(u),this.findCollapsesFromExistingVertices(u);for(var n=u.iterator();n.hasNext();){var r=n.next().intValue();this.add(this._edge.getCoordinate(r),r)}}},{key:"createSplitEdgePts",value:function(u,n){var r=n.segmentIndex-u.segmentIndex+2;if(r===2)return[new W(u.coord),new W(n.coord)];var a=this._edge.getCoordinate(n.segmentIndex),f=n.isInterior()||!n.coord.equals2D(a);f||r--;var m=new Array(r).fill(null),p=0;m[p++]=new W(u.coord);for(var I=u.segmentIndex+1;I<=n.segmentIndex;I++)m[p++]=this._edge.getCoordinate(I);return f&&(m[p]=new W(n.coord)),m}},{key:"print",value:function(u){u.println("Intersections:");for(var n=this.iterator();n.hasNext();)n.next().print(u)}},{key:"findCollapsesFromExistingVertices",value:function(u){for(var n=0;n<this._edge.size()-2;n++){var r=this._edge.getCoordinate(n);this._edge.getCoordinate(n+1);var a=this._edge.getCoordinate(n+2);r.equals2D(a)&&u.add(cn.valueOf(n+1))}}},{key:"addEdgeCoordinates",value:function(u,n,r){var a=this.createSplitEdgePts(u,n);r.add(a,!1)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(u){this.addEndpoints(),this.addCollapsedNodes();for(var n=this.iterator(),r=n.next();n.hasNext();){var a=n.next(),f=this.createSplitEdge(r,a);u.add(f),r=a}}},{key:"findCollapseIndex",value:function(u,n,r){if(!u.coord.equals2D(n.coord))return!1;var a=n.segmentIndex-u.segmentIndex;return n.isInterior()||a--,a===1&&(r[0]=u.segmentIndex+1,!0)}},{key:"findCollapsesFromInsertedNodes",value:function(u){for(var n=new Array(1).fill(null),r=this.iterator(),a=r.next();r.hasNext();){var f=r.next();this.findCollapseIndex(a,f,n)&&u.add(cn.valueOf(n[0])),a=f}}},{key:"getEdge",value:function(){return this._edge}},{key:"addEndpoints",value:function(){var u=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(u),u)}},{key:"createSplitEdge",value:function(u,n){var r=this.createSplitEdgePts(u,n);return new In(r,this._edge.getData())}},{key:"add",value:function(u,n){var r=new lp(this._edge,u,n,this._edge.getSegmentOctant(n)),a=this._nodeMap.get(r);return a!==null?(j.isTrue(a.coord.equals2D(u),"Found equal nodes with different coordinates"),a):(this._nodeMap.put(r,r),r)}},{key:"checkSplitEdgesCorrectness",value:function(u){var n=this._edge.getCoordinates(),r=u.get(0).getCoordinate(0);if(!r.equals2D(n[0]))throw new K("bad split edge start point at "+r);var a=u.get(u.size()-1).getCoordinates(),f=a[a.length-1];if(!f.equals2D(n[n.length-1]))throw new K("bad split edge end point at "+f)}}],[{key:"constructor_",value:function(){this._nodeMap=new Br,this._edge=null;var u=arguments[0];this._edge=u}}])})(),fp=(function(){function u(){o(this,u)}return c(u,null,[{key:"octant",value:function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],r=arguments[1];if(n===0&&r===0)throw new C("Cannot compute the octant for point ( "+n+", "+r+" )");var a=Math.abs(n),f=Math.abs(r);return n>=0?r>=0?a>=f?0:1:a>=f?7:6:r>=0?a>=f?3:2:a>=f?4:5}if(arguments[0]instanceof W&&arguments[1]instanceof W){var m=arguments[0],p=arguments[1],I=p.x-m.x,O=p.y-m.y;if(I===0&&O===0)throw new C("Cannot compute the octant for two identical points "+m);return u.octant(I,O)}}}])})(),gp=(function(){return c((function u(){o(this,u)}),[{key:"getCoordinates",value:function(){}},{key:"size",value:function(){}},{key:"getCoordinate",value:function(u){}},{key:"isClosed",value:function(){}},{key:"setData",value:function(u){}},{key:"getData",value:function(){}}])})(),dp=(function(){return c((function u(){o(this,u)}),[{key:"addIntersection",value:function(u,n){}},{key:"interfaces_",get:function(){return[gp]}}])})(),In=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"getCoordinates",value:function(){return this._pts}},{key:"size",value:function(){return this._pts.length}},{key:"getCoordinate",value:function(n){return this._pts[n]}},{key:"isClosed",value:function(){return this._pts[0].equals(this._pts[this._pts.length-1])}},{key:"getSegmentOctant",value:function(n){return n===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(n),this.getCoordinate(n+1))}},{key:"setData",value:function(n){this._data=n}},{key:"safeOctant",value:function(n,r){return n.equals2D(r)?0:fp.octant(n,r)}},{key:"getData",value:function(){return this._data}},{key:"addIntersection",value:function(){if(arguments.length===2){var n=arguments[0],r=arguments[1];this.addIntersectionNode(n,r)}else if(arguments.length===4){var a=arguments[1],f=arguments[3],m=new W(arguments[0].getIntersection(f));this.addIntersection(m,a)}}},{key:"toString",value:function(){return So.toLineString(new Fr(this._pts))}},{key:"getNodeList",value:function(){return this._nodeList}},{key:"addIntersectionNode",value:function(n,r){var a=r,f=a+1;if(f<this._pts.length){var m=this._pts[f];n.equals2D(m)&&(a=f)}return this._nodeList.add(n,a)}},{key:"addIntersections",value:function(n,r,a){for(var f=0;f<n.getIntersectionNum();f++)this.addIntersection(n,r,a,f)}},{key:"interfaces_",get:function(){return[dp]}}],[{key:"constructor_",value:function(){this._nodeList=new hp(this),this._pts=null,this._data=null;var n=arguments[0],r=arguments[1];this._pts=n,this._data=r}},{key:"getNodedSubstrings",value:function(){if(arguments.length===1){var n=arguments[0],r=new me;return u.getNodedSubstrings(n,r),r}if(arguments.length===2)for(var a=arguments[1],f=arguments[0].iterator();f.hasNext();)f.next().getNodeList().addSplitEdges(a)}}])})(),pt=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"minX",value:function(){return Math.min(this.p0.x,this.p1.x)}},{key:"orientationIndex",value:function(){if(arguments[0]instanceof u){var n=arguments[0],r=Ee.index(this.p0,this.p1,n.p0),a=Ee.index(this.p0,this.p1,n.p1);return r>=0&&a>=0||r<=0&&a<=0?Math.max(r,a):0}if(arguments[0]instanceof W){var f=arguments[0];return Ee.index(this.p0,this.p1,f)}}},{key:"toGeometry",value:function(n){return n.createLineString([this.p0,this.p1])}},{key:"isVertical",value:function(){return this.p0.x===this.p1.x}},{key:"equals",value:function(n){if(!(n instanceof u))return!1;var r=n;return this.p0.equals(r.p0)&&this.p1.equals(r.p1)}},{key:"intersection",value:function(n){var r=new kn;return r.computeIntersection(this.p0,this.p1,n.p0,n.p1),r.hasIntersection()?r.getIntersection(0):null}},{key:"project",value:function(){if(arguments[0]instanceof W){var n=arguments[0];if(n.equals(this.p0)||n.equals(this.p1))return new W(n);var r=this.projectionFactor(n),a=new W;return a.x=this.p0.x+r*(this.p1.x-this.p0.x),a.y=this.p0.y+r*(this.p1.y-this.p0.y),a}if(arguments[0]instanceof u){var f=arguments[0],m=this.projectionFactor(f.p0),p=this.projectionFactor(f.p1);if(m>=1&&p>=1||m<=0&&p<=0)return null;var I=this.project(f.p0);m<0&&(I=this.p0),m>1&&(I=this.p1);var O=this.project(f.p1);return p<0&&(O=this.p0),p>1&&(O=this.p1),new u(I,O)}}},{key:"normalize",value:function(){this.p1.compareTo(this.p0)<0&&this.reverse()}},{key:"angle",value:function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)}},{key:"getCoordinate",value:function(n){return n===0?this.p0:this.p1}},{key:"distancePerpendicular",value:function(n){return Gt.pointToLinePerpendicular(n,this.p0,this.p1)}},{key:"minY",value:function(){return Math.min(this.p0.y,this.p1.y)}},{key:"midPoint",value:function(){return u.midPoint(this.p0,this.p1)}},{key:"projectionFactor",value:function(n){if(n.equals(this.p0))return 0;if(n.equals(this.p1))return 1;var r=this.p1.x-this.p0.x,a=this.p1.y-this.p0.y,f=r*r+a*a;return f<=0?B.NaN:((n.x-this.p0.x)*r+(n.y-this.p0.y)*a)/f}},{key:"closestPoints",value:function(n){var r=this.intersection(n);if(r!==null)return[r,r];var a=new Array(2).fill(null),f=B.MAX_VALUE,m=null,p=this.closestPoint(n.p0);f=p.distance(n.p0),a[0]=p,a[1]=n.p0;var I=this.closestPoint(n.p1);(m=I.distance(n.p1))<f&&(f=m,a[0]=I,a[1]=n.p1);var O=n.closestPoint(this.p0);(m=O.distance(this.p0))<f&&(f=m,a[0]=this.p0,a[1]=O);var U=n.closestPoint(this.p1);return(m=U.distance(this.p1))<f&&(f=m,a[0]=this.p1,a[1]=U),a}},{key:"closestPoint",value:function(n){var r=this.projectionFactor(n);return r>0&&r<1?this.project(n):this.p0.distance(n)<this.p1.distance(n)?this.p0:this.p1}},{key:"maxX",value:function(){return Math.max(this.p0.x,this.p1.x)}},{key:"getLength",value:function(){return this.p0.distance(this.p1)}},{key:"compareTo",value:function(n){var r=n,a=this.p0.compareTo(r.p0);return a!==0?a:this.p1.compareTo(r.p1)}},{key:"reverse",value:function(){var n=this.p0;this.p0=this.p1,this.p1=n}},{key:"equalsTopo",value:function(n){return this.p0.equals(n.p0)&&this.p1.equals(n.p1)||this.p0.equals(n.p1)&&this.p1.equals(n.p0)}},{key:"lineIntersection",value:function(n){return _o.intersection(this.p0,this.p1,n.p0,n.p1)}},{key:"maxY",value:function(){return Math.max(this.p0.y,this.p1.y)}},{key:"pointAlongOffset",value:function(n,r){var a=this.p0.x+n*(this.p1.x-this.p0.x),f=this.p0.y+n*(this.p1.y-this.p0.y),m=this.p1.x-this.p0.x,p=this.p1.y-this.p0.y,I=Math.sqrt(m*m+p*p),O=0,U=0;if(r!==0){if(I<=0)throw new IllegalStateException("Cannot compute offset from zero-length line segment");O=r*m/I,U=r*p/I}return new W(a-U,f+O)}},{key:"setCoordinates",value:function(){if(arguments.length===1){var n=arguments[0];this.setCoordinates(n.p0,n.p1)}else if(arguments.length===2){var r=arguments[0],a=arguments[1];this.p0.x=r.x,this.p0.y=r.y,this.p1.x=a.x,this.p1.y=a.y}}},{key:"segmentFraction",value:function(n){var r=this.projectionFactor(n);return r<0?r=0:(r>1||B.isNaN(r))&&(r=1),r}},{key:"toString",value:function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"}},{key:"isHorizontal",value:function(){return this.p0.y===this.p1.y}},{key:"reflect",value:function(n){var r=this.p1.getY()-this.p0.getY(),a=this.p0.getX()-this.p1.getX(),f=this.p0.getY()*(this.p1.getX()-this.p0.getX())-this.p0.getX()*(this.p1.getY()-this.p0.getY()),m=r*r+a*a,p=r*r-a*a,I=n.getX(),O=n.getY();return new W((-p*I-2*r*a*O-2*r*f)/m,(p*O-2*r*a*I-2*a*f)/m)}},{key:"distance",value:function(){if(arguments[0]instanceof u){var n=arguments[0];return Gt.segmentToSegment(this.p0,this.p1,n.p0,n.p1)}if(arguments[0]instanceof W){var r=arguments[0];return Gt.pointToSegment(r,this.p0,this.p1)}}},{key:"pointAlong",value:function(n){var r=new W;return r.x=this.p0.x+n*(this.p1.x-this.p0.x),r.y=this.p0.y+n*(this.p1.y-this.p0.y),r}},{key:"hashCode",value:function(){var n=B.doubleToLongBits(this.p0.x);n^=31*B.doubleToLongBits(this.p0.y);var r=Math.trunc(n)^Math.trunc(n>>32),a=B.doubleToLongBits(this.p1.x);return a^=31*B.doubleToLongBits(this.p1.y),r^(Math.trunc(a)^Math.trunc(a>>32))}},{key:"interfaces_",get:function(){return[q,N]}}],[{key:"constructor_",value:function(){if(this.p0=null,this.p1=null,arguments.length===0)u.constructor_.call(this,new W,new W);else if(arguments.length===1){var n=arguments[0];u.constructor_.call(this,n.p0,n.p1)}else if(arguments.length===2){var r=arguments[0],a=arguments[1];this.p0=r,this.p1=a}else if(arguments.length===4){var f=arguments[0],m=arguments[1],p=arguments[2],I=arguments[3];u.constructor_.call(this,new W(f,m),new W(p,I))}}},{key:"midPoint",value:function(n,r){return new W((n.x+r.x)/2,(n.y+r.y)/2)}}])})(),vp=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"overlap",value:function(){if(arguments.length!==2){if(arguments.length===4){var u=arguments[1],n=arguments[2],r=arguments[3];arguments[0].getLineSegment(u,this._overlapSeg1),n.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}}}],[{key:"constructor_",value:function(){this._overlapSeg1=new pt,this._overlapSeg2=new pt}}])})(),zc=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"getLineSegment",value:function(u,n){n.p0=this._pts[u],n.p1=this._pts[u+1]}},{key:"computeSelect",value:function(u,n,r,a){var f=this._pts[n],m=this._pts[r];if(r-n==1)return a.select(this,n),null;if(!u.intersects(f,m))return null;var p=Math.trunc((n+r)/2);n<p&&this.computeSelect(u,n,p,a),p<r&&this.computeSelect(u,p,r,a)}},{key:"getCoordinates",value:function(){for(var u=new Array(this._end-this._start+1).fill(null),n=0,r=this._start;r<=this._end;r++)u[n++]=this._pts[r];return u}},{key:"computeOverlaps",value:function(){if(arguments.length===2){var u=arguments[0],n=arguments[1];this.computeOverlaps(this._start,this._end,u,u._start,u._end,n)}else if(arguments.length===6){var r=arguments[0],a=arguments[1],f=arguments[2],m=arguments[3],p=arguments[4],I=arguments[5];if(a-r==1&&p-m==1)return I.overlap(this,r,f,m),null;if(!this.overlaps(r,a,f,m,p))return null;var O=Math.trunc((r+a)/2),U=Math.trunc((m+p)/2);r<O&&(m<U&&this.computeOverlaps(r,O,f,m,U,I),U<p&&this.computeOverlaps(r,O,f,U,p,I)),O<a&&(m<U&&this.computeOverlaps(O,a,f,m,U,I),U<p&&this.computeOverlaps(O,a,f,U,p,I))}}},{key:"setId",value:function(u){this._id=u}},{key:"select",value:function(u,n){this.computeSelect(u,this._start,this._end,n)}},{key:"getEnvelope",value:function(){if(this._env===null){var u=this._pts[this._start],n=this._pts[this._end];this._env=new le(u,n)}return this._env}},{key:"overlaps",value:function(u,n,r,a,f){return le.intersects(this._pts[u],this._pts[n],r._pts[a],r._pts[f])}},{key:"getEndIndex",value:function(){return this._end}},{key:"getStartIndex",value:function(){return this._start}},{key:"getContext",value:function(){return this._context}},{key:"getId",value:function(){return this._id}}],[{key:"constructor_",value:function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var u=arguments[0],n=arguments[1],r=arguments[2],a=arguments[3];this._pts=u,this._start=n,this._end=r,this._context=a}}])})(),yp=(function(){function u(){o(this,u)}return c(u,null,[{key:"findChainEnd",value:function(n,r){for(var a=r;a<n.length-1&&n[a].equals2D(n[a+1]);)a++;if(a>=n.length-1)return n.length-1;for(var f=ht.quadrant(n[a],n[a+1]),m=r+1;m<n.length&&!(!n[m-1].equals2D(n[m])&&ht.quadrant(n[m-1],n[m])!==f);)m++;return m-1}},{key:"getChains",value:function(){if(arguments.length===1){var n=arguments[0];return u.getChains(n,null)}if(arguments.length===2){var r=arguments[0],a=arguments[1],f=new me,m=0;do{var p=u.findChainEnd(r,m),I=new zc(r,m,p,a);f.add(I),m=p}while(m<r.length-1);return f}}}])})(),Co=(function(){return c((function u(){o(this,u)}),[{key:"computeNodes",value:function(u){}},{key:"getNodedSubstrings",value:function(){}}])})(),Xc=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"setSegmentIntersector",value:function(u){this._segInt=u}},{key:"interfaces_",get:function(){return[Co]}}],[{key:"constructor_",value:function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var u=arguments[0];this.setSegmentIntersector(u)}}}}])})(),To=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"getMonotoneChains",value:function(){return this._monoChains}},{key:"getNodedSubstrings",value:function(){return In.getNodedSubstrings(this._nodedSegStrings)}},{key:"getIndex",value:function(){return this._index}},{key:"add",value:function(r){for(var a=yp.getChains(r.getCoordinates(),r).iterator();a.hasNext();){var f=a.next();f.setId(this._idCounter++),this._index.insert(f.getEnvelope(),f),this._monoChains.add(f)}}},{key:"computeNodes",value:function(r){this._nodedSegStrings=r;for(var a=r.iterator();a.hasNext();)this.add(a.next());this.intersectChains()}},{key:"intersectChains",value:function(){for(var r=new Uc(this._segInt),a=this._monoChains.iterator();a.hasNext();)for(var f=a.next(),m=this._index.query(f.getEnvelope()).iterator();m.hasNext();){var p=m.next();if(p.getId()>f.getId()&&(f.computeOverlaps(p,r),this._nOverlaps++),this._segInt.isDone())return null}}}],[{key:"constructor_",value:function(){if(this._monoChains=new me,this._index=new zt,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0,arguments.length!==0){if(arguments.length===1){var r=arguments[0];Xc.constructor_.call(this,r)}}}}])})(Xc),Uc=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"overlap",value:function(){if(arguments.length!==4)return M(n,"overlap",this,1).apply(this,arguments);var r=arguments[1],a=arguments[2],f=arguments[3],m=arguments[0].getContext(),p=a.getContext();this._si.processIntersections(m,r,p,f)}}],[{key:"constructor_",value:function(){this._si=null;var r=arguments[0];this._si=r}}])})(vp);To.SegmentOverlapAction=Uc;var Ct=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"isDeletable",value:function(n,r,a,f){var m=this._inputLine[n],p=this._inputLine[r],I=this._inputLine[a];return!!this.isConcave(m,p,I)&&!!this.isShallow(m,p,I,f)&&this.isShallowSampled(m,p,n,a,f)}},{key:"deleteShallowConcavities",value:function(){for(var n=1,r=this.findNextNonDeletedIndex(n),a=this.findNextNonDeletedIndex(r),f=!1;a<this._inputLine.length;){var m=!1;this.isDeletable(n,r,a,this._distanceTol)&&(this._isDeleted[r]=u.DELETE,m=!0,f=!0),n=m?a:r,r=this.findNextNonDeletedIndex(n),a=this.findNextNonDeletedIndex(r)}return f}},{key:"isShallowConcavity",value:function(n,r,a,f){return Ee.index(n,r,a)===this._angleOrientation&&Gt.pointToSegment(r,n,a)<f}},{key:"isShallowSampled",value:function(n,r,a,f,m){var p=Math.trunc((f-a)/u.NUM_PTS_TO_CHECK);p<=0&&(p=1);for(var I=a;I<f;I+=p)if(!this.isShallow(n,r,this._inputLine[I],m))return!1;return!0}},{key:"isConcave",value:function(n,r,a){var f=Ee.index(n,r,a)===this._angleOrientation;return f}},{key:"simplify",value:function(n){this._distanceTol=Math.abs(n),n<0&&(this._angleOrientation=Ee.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var r=!1;do r=this.deleteShallowConcavities();while(r);return this.collapseLine()}},{key:"findNextNonDeletedIndex",value:function(n){for(var r=n+1;r<this._inputLine.length&&this._isDeleted[r]===u.DELETE;)r++;return r}},{key:"isShallow",value:function(n,r,a,f){return Gt.pointToSegment(r,n,a)<f}},{key:"collapseLine",value:function(){for(var n=new Dr,r=0;r<this._inputLine.length;r++)this._isDeleted[r]!==u.DELETE&&n.add(this._inputLine[r]);return n.toCoordinateArray()}}],[{key:"constructor_",value:function(){this._inputLine=null,this._distanceTol=null,this._isDeleted=null,this._angleOrientation=Ee.COUNTERCLOCKWISE;var n=arguments[0];this._inputLine=n}},{key:"simplify",value:function(n,r){return new u(n).simplify(r)}}])})();Ct.INIT=0,Ct.DELETE=1,Ct.KEEP=1,Ct.NUM_PTS_TO_CHECK=10;var Vc=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"getCoordinates",value:function(){return this._ptList.toArray(u.COORDINATE_ARRAY_TYPE)}},{key:"setPrecisionModel",value:function(n){this._precisionModel=n}},{key:"addPt",value:function(n){var r=new W(n);if(this._precisionModel.makePrecise(r),this.isRedundant(r))return null;this._ptList.add(r)}},{key:"reverse",value:function(){}},{key:"addPts",value:function(n,r){if(r)for(var a=0;a<n.length;a++)this.addPt(n[a]);else for(var f=n.length-1;f>=0;f--)this.addPt(n[f])}},{key:"isRedundant",value:function(n){if(this._ptList.size()<1)return!1;var r=this._ptList.get(this._ptList.size()-1);return n.distance(r)<this._minimimVertexDistance}},{key:"toString",value:function(){return new Hn().createLineString(this.getCoordinates()).toString()}},{key:"closeRing",value:function(){if(this._ptList.size()<1)return null;var n=new W(this._ptList.get(0)),r=this._ptList.get(this._ptList.size()-1);if(n.equals(r))return null;this._ptList.add(n)}},{key:"setMinimumVertexDistance",value:function(n){this._minimimVertexDistance=n}}],[{key:"constructor_",value:function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new me}}])})();Vc.COORDINATE_ARRAY_TYPE=new Array(0).fill(null);var _t=(function(){function u(){o(this,u)}return c(u,null,[{key:"toDegrees",value:function(n){return 180*n/Math.PI}},{key:"normalize",value:function(n){for(;n>Math.PI;)n-=u.PI_TIMES_2;for(;n<=-Math.PI;)n+=u.PI_TIMES_2;return n}},{key:"angle",value:function(){if(arguments.length===1){var n=arguments[0];return Math.atan2(n.y,n.x)}if(arguments.length===2){var r=arguments[0],a=arguments[1],f=a.x-r.x,m=a.y-r.y;return Math.atan2(m,f)}}},{key:"isAcute",value:function(n,r,a){var f=n.x-r.x,m=n.y-r.y;return f*(a.x-r.x)+m*(a.y-r.y)>0}},{key:"isObtuse",value:function(n,r,a){var f=n.x-r.x,m=n.y-r.y;return f*(a.x-r.x)+m*(a.y-r.y)<0}},{key:"interiorAngle",value:function(n,r,a){var f=u.angle(r,n),m=u.angle(r,a);return Math.abs(m-f)}},{key:"normalizePositive",value:function(n){if(n<0){for(;n<0;)n+=u.PI_TIMES_2;n>=u.PI_TIMES_2&&(n=0)}else{for(;n>=u.PI_TIMES_2;)n-=u.PI_TIMES_2;n<0&&(n=0)}return n}},{key:"angleBetween",value:function(n,r,a){var f=u.angle(r,n),m=u.angle(r,a);return u.diff(f,m)}},{key:"diff",value:function(n,r){var a=null;return(a=n<r?r-n:n-r)>Math.PI&&(a=2*Math.PI-a),a}},{key:"toRadians",value:function(n){return n*Math.PI/180}},{key:"getTurn",value:function(n,r){var a=Math.sin(r-n);return a>0?u.COUNTERCLOCKWISE:a<0?u.CLOCKWISE:u.NONE}},{key:"angleBetweenOriented",value:function(n,r,a){var f=u.angle(r,n),m=u.angle(r,a)-f;return m<=-Math.PI?m+u.PI_TIMES_2:m>Math.PI?m-u.PI_TIMES_2:m}}])})();_t.PI_TIMES_2=2*Math.PI,_t.PI_OVER_2=Math.PI/2,_t.PI_OVER_4=Math.PI/4,_t.COUNTERCLOCKWISE=Ee.COUNTERCLOCKWISE,_t.CLOCKWISE=Ee.CLOCKWISE,_t.NONE=Ee.COLLINEAR;var Gr=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"addNextSegment",value:function(n,r){if(this._s0=this._s1,this._s1=this._s2,this._s2=n,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 a=Ee.index(this._s0,this._s1,this._s2),f=a===Ee.CLOCKWISE&&this._side===ie.LEFT||a===Ee.COUNTERCLOCKWISE&&this._side===ie.RIGHT;a===0?this.addCollinear(r):f?this.addOutsideTurn(a,r):this.addInsideTurn(a,r)}},{key:"addLineEndCap",value:function(n,r){var a=new pt(n,r),f=new pt;this.computeOffsetSegment(a,ie.LEFT,this._distance,f);var m=new pt;this.computeOffsetSegment(a,ie.RIGHT,this._distance,m);var p=r.x-n.x,I=r.y-n.y,O=Math.atan2(I,p);switch(this._bufParams.getEndCapStyle()){case S.CAP_ROUND:this._segList.addPt(f.p1),this.addDirectedFillet(r,O+Math.PI/2,O-Math.PI/2,Ee.CLOCKWISE,this._distance),this._segList.addPt(m.p1);break;case S.CAP_FLAT:this._segList.addPt(f.p1),this._segList.addPt(m.p1);break;case S.CAP_SQUARE:var U=new W;U.x=Math.abs(this._distance)*Math.cos(O),U.y=Math.abs(this._distance)*Math.sin(O);var J=new W(f.p1.x+U.x,f.p1.y+U.y),Q=new W(m.p1.x+U.x,m.p1.y+U.y);this._segList.addPt(J),this._segList.addPt(Q)}}},{key:"getCoordinates",value:function(){return this._segList.getCoordinates()}},{key:"addMitreJoin",value:function(n,r,a,f){var m=_o.intersection(r.p0,r.p1,a.p0,a.p1);if(m!==null&&(f<=0?1:m.distance(n)/Math.abs(f))<=this._bufParams.getMitreLimit())return this._segList.addPt(m),null;this.addLimitedMitreJoin(r,a,f,this._bufParams.getMitreLimit())}},{key:"addOutsideTurn",value:function(n,r){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*u.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===S.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===S.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(r&&this._segList.addPt(this._offset0.p1),this.addCornerFillet(this._s1,this._offset0.p1,this._offset1.p0,n,this._distance),this._segList.addPt(this._offset1.p0))}},{key:"createSquare",value:function(n){this._segList.addPt(new W(n.x+this._distance,n.y+this._distance)),this._segList.addPt(new W(n.x+this._distance,n.y-this._distance)),this._segList.addPt(new W(n.x-this._distance,n.y-this._distance)),this._segList.addPt(new W(n.x-this._distance,n.y+this._distance)),this._segList.closeRing()}},{key:"addSegments",value:function(n,r){this._segList.addPts(n,r)}},{key:"addFirstSegment",value:function(){this._segList.addPt(this._offset1.p0)}},{key:"addCornerFillet",value:function(n,r,a,f,m){var p=r.x-n.x,I=r.y-n.y,O=Math.atan2(I,p),U=a.x-n.x,J=a.y-n.y,Q=Math.atan2(J,U);f===Ee.CLOCKWISE?O<=Q&&(O+=2*Math.PI):O>=Q&&(O-=2*Math.PI),this._segList.addPt(r),this.addDirectedFillet(n,O,Q,f,m),this._segList.addPt(a)}},{key:"addLastSegment",value:function(){this._segList.addPt(this._offset1.p1)}},{key:"initSideSegments",value:function(n,r,a){this._s1=n,this._s2=r,this._side=a,this._seg1.setCoordinates(n,r),this.computeOffsetSegment(this._seg1,a,this._distance,this._offset1)}},{key:"addLimitedMitreJoin",value:function(n,r,a,f){var m=this._seg0.p1,p=_t.angle(m,this._seg0.p0),I=_t.angleBetweenOriented(this._seg0.p0,m,this._seg1.p1)/2,O=_t.normalize(p+I),U=_t.normalize(O+Math.PI),J=f*a,Q=a-J*Math.abs(Math.sin(I)),ne=m.x+J*Math.cos(U),ce=m.y+J*Math.sin(U),fe=new W(ne,ce),de=new pt(m,fe),Re=de.pointAlongOffset(1,Q),be=de.pointAlongOffset(1,-Q);this._side===ie.LEFT?(this._segList.addPt(Re),this._segList.addPt(be)):(this._segList.addPt(be),this._segList.addPt(Re))}},{key:"addDirectedFillet",value:function(n,r,a,f,m){var p=f===Ee.CLOCKWISE?-1:1,I=Math.abs(r-a),O=Math.trunc(I/this._filletAngleQuantum+.5);if(O<1)return null;for(var U=I/O,J=new W,Q=0;Q<O;Q++){var ne=r+p*Q*U;J.x=n.x+m*Math.cos(ne),J.y=n.y+m*Math.sin(ne),this._segList.addPt(J)}}},{key:"computeOffsetSegment",value:function(n,r,a,f){var m=r===ie.LEFT?1:-1,p=n.p1.x-n.p0.x,I=n.p1.y-n.p0.y,O=Math.sqrt(p*p+I*I),U=m*a*p/O,J=m*a*I/O;f.p0.x=n.p0.x-J,f.p0.y=n.p0.y+U,f.p1.x=n.p1.x-J,f.p1.y=n.p1.y+U}},{key:"addInsideTurn",value:function(n,r){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*u.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var a=new W((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(a);var f=new W((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(f)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}}},{key:"createCircle",value:function(n){var r=new W(n.x+this._distance,n.y);this._segList.addPt(r),this.addDirectedFillet(n,0,2*Math.PI,-1,this._distance),this._segList.closeRing()}},{key:"addBevelJoin",value:function(n,r){this._segList.addPt(n.p1),this._segList.addPt(r.p0)}},{key:"init",value:function(n){this._distance=n,this._maxCurveSegmentError=n*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Vc,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(n*u.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)}},{key:"addCollinear",value:function(n){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===S.JOIN_BEVEL||this._bufParams.getJoinStyle()===S.JOIN_MITRE?(n&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addCornerFillet(this._s1,this._offset0.p1,this._offset1.p0,Ee.CLOCKWISE,this._distance))}},{key:"closeRing",value:function(){this._segList.closeRing()}},{key:"hasNarrowConcaveAngle",value:function(){return this._hasNarrowConcaveAngle}}],[{key:"constructor_",value:function(){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 pt,this._seg1=new pt,this._offset0=new pt,this._offset1=new pt,this._side=0,this._hasNarrowConcaveAngle=!1;var n=arguments[0],r=arguments[1],a=arguments[2];this._precisionModel=n,this._bufParams=r,this._li=new kn,this._filletAngleQuantum=Math.PI/2/r.getQuadrantSegments(),r.getQuadrantSegments()>=8&&r.getJoinStyle()===S.JOIN_ROUND&&(this._closingSegLengthFactor=u.MAX_CLOSING_SEG_LEN_FACTOR),this.init(a)}}])})();Gr.OFFSET_SEGMENT_SEPARATION_FACTOR=.001,Gr.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR=.001,Gr.CURVE_VERTEX_SNAP_DISTANCE_FACTOR=1e-6,Gr.MAX_CLOSING_SEG_LEN_FACTOR=80;var mp=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"getOffsetCurve",value:function(n,r){if(this._distance=r,r===0)return null;var a=r<0,f=Math.abs(r),m=this.getSegGen(f);n.length<=1?this.computePointCurve(n[0],m):this.computeOffsetCurve(n,a,m);var p=m.getCoordinates();return a&&et.reverse(p),p}},{key:"computeSingleSidedBufferCurve",value:function(n,r,a){var f=this.simplifyTolerance(this._distance);if(r){a.addSegments(n,!0);var m=Ct.simplify(n,-f),p=m.length-1;a.initSideSegments(m[p],m[p-1],ie.LEFT),a.addFirstSegment();for(var I=p-2;I>=0;I--)a.addNextSegment(m[I],!0)}else{a.addSegments(n,!1);var O=Ct.simplify(n,f),U=O.length-1;a.initSideSegments(O[0],O[1],ie.LEFT),a.addFirstSegment();for(var J=2;J<=U;J++)a.addNextSegment(O[J],!0)}a.addLastSegment(),a.closeRing()}},{key:"computeRingBufferCurve",value:function(n,r,a){var f=this.simplifyTolerance(this._distance);r===ie.RIGHT&&(f=-f);var m=Ct.simplify(n,f),p=m.length-1;a.initSideSegments(m[p-1],m[0],r);for(var I=1;I<=p;I++){var O=I!==1;a.addNextSegment(m[I],O)}a.closeRing()}},{key:"computeLineBufferCurve",value:function(n,r){var a=this.simplifyTolerance(this._distance),f=Ct.simplify(n,a),m=f.length-1;r.initSideSegments(f[0],f[1],ie.LEFT);for(var p=2;p<=m;p++)r.addNextSegment(f[p],!0);r.addLastSegment(),r.addLineEndCap(f[m-1],f[m]);var I=Ct.simplify(n,-a),O=I.length-1;r.initSideSegments(I[O],I[O-1],ie.LEFT);for(var U=O-2;U>=0;U--)r.addNextSegment(I[U],!0);r.addLastSegment(),r.addLineEndCap(I[1],I[0]),r.closeRing()}},{key:"computePointCurve",value:function(n,r){switch(this._bufParams.getEndCapStyle()){case S.CAP_ROUND:r.createCircle(n);break;case S.CAP_SQUARE:r.createSquare(n)}}},{key:"getLineCurve",value:function(n,r){if(this._distance=r,this.isLineOffsetEmpty(r))return null;var a=Math.abs(r),f=this.getSegGen(a);if(n.length<=1)this.computePointCurve(n[0],f);else if(this._bufParams.isSingleSided()){var m=r<0;this.computeSingleSidedBufferCurve(n,m,f)}else this.computeLineBufferCurve(n,f);return f.getCoordinates()}},{key:"getBufferParameters",value:function(){return this._bufParams}},{key:"simplifyTolerance",value:function(n){return n*this._bufParams.getSimplifyFactor()}},{key:"getRingCurve",value:function(n,r,a){if(this._distance=a,n.length<=2)return this.getLineCurve(n,a);if(a===0)return u.copyCoordinates(n);var f=this.getSegGen(a);return this.computeRingBufferCurve(n,r,f),f.getCoordinates()}},{key:"computeOffsetCurve",value:function(n,r,a){var f=this.simplifyTolerance(this._distance);if(r){var m=Ct.simplify(n,-f),p=m.length-1;a.initSideSegments(m[p],m[p-1],ie.LEFT),a.addFirstSegment();for(var I=p-2;I>=0;I--)a.addNextSegment(m[I],!0)}else{var O=Ct.simplify(n,f),U=O.length-1;a.initSideSegments(O[0],O[1],ie.LEFT),a.addFirstSegment();for(var J=2;J<=U;J++)a.addNextSegment(O[J],!0)}a.addLastSegment()}},{key:"isLineOffsetEmpty",value:function(n){return n===0||n<0&&!this._bufParams.isSingleSided()}},{key:"getSegGen",value:function(n){return new Gr(this._precisionModel,this._bufParams,n)}}],[{key:"constructor_",value:function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var n=arguments[0],r=arguments[1];this._precisionModel=n,this._bufParams=r}},{key:"copyCoordinates",value:function(n){for(var r=new Array(n.length).fill(null),a=0;a<r.length;a++)r[a]=new W(n[a]);return r}}])})(),Hc=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"findStabbedSegments",value:function(){if(arguments.length===1){for(var u=arguments[0],n=new me,r=this._subgraphs.iterator();r.hasNext();){var a=r.next(),f=a.getEnvelope();u.y<f.getMinY()||u.y>f.getMaxY()||this.findStabbedSegments(u,a.getDirectedEdges(),n)}return n}if(arguments.length===3){if(Ie(arguments[2],Jt)&&arguments[0]instanceof W&&arguments[1]instanceof bo){for(var m=arguments[0],p=arguments[1],I=arguments[2],O=p.getEdge().getCoordinates(),U=0;U<O.length-1;U++)if(this._seg.p0=O[U],this._seg.p1=O[U+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<m.x||this._seg.isHorizontal()||m.y<this._seg.p0.y||m.y>this._seg.p1.y||Ee.index(this._seg.p0,this._seg.p1,m)===Ee.RIGHT)){var J=p.getDepth(ie.LEFT);this._seg.p0.equals(O[U])||(J=p.getDepth(ie.RIGHT));var Q=new $c(this._seg,J);I.add(Q)}}else if(Ie(arguments[2],Jt)&&arguments[0]instanceof W&&Ie(arguments[1],Jt))for(var ne=arguments[0],ce=arguments[2],fe=arguments[1].iterator();fe.hasNext();){var de=fe.next();de.isForward()&&this.findStabbedSegments(ne,de,ce)}}}},{key:"getDepth",value:function(u){var n=this.findStabbedSegments(u);return n.size()===0?0:Zn.min(n)._leftDepth}}],[{key:"constructor_",value:function(){this._subgraphs=null,this._seg=new pt;var u=arguments[0];this._subgraphs=u}}])})(),$c=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"compareTo",value:function(u){var n=u;if(this._upwardSeg.minX()>=n._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=n._upwardSeg.minX())return-1;var r=this._upwardSeg.orientationIndex(n._upwardSeg);return r!==0||(r=-1*n._upwardSeg.orientationIndex(this._upwardSeg))!==0?r:this._upwardSeg.compareTo(n._upwardSeg)}},{key:"compareX",value:function(u,n){var r=u.p0.compareTo(n.p0);return r!==0?r:u.p1.compareTo(n.p1)}},{key:"toString",value:function(){return this._upwardSeg.toString()}},{key:"interfaces_",get:function(){return[q]}}],[{key:"constructor_",value:function(){this._upwardSeg=null,this._leftDepth=null;var u=arguments[0],n=arguments[1];this._upwardSeg=new pt(u),this._leftDepth=n}}])})();Hc.DepthSegment=$c;var Zc=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,null,[{key:"constructor_",value:function(){b.constructor_.call(this,"Projective point not representable on the Cartesian plane.")}}])})(b),Oo=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"getY",value:function(){var n=this.y/this.w;if(B.isNaN(n)||B.isInfinite(n))throw new Zc;return n}},{key:"getX",value:function(){var n=this.x/this.w;if(B.isNaN(n)||B.isInfinite(n))throw new Zc;return n}},{key:"getCoordinate",value:function(){var n=new W;return n.x=this.getX(),n.y=this.getY(),n}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.w=null,arguments.length===0)this.x=0,this.y=0,this.w=1;else if(arguments.length===1){var n=arguments[0];this.x=n.x,this.y=n.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var r=arguments[0],a=arguments[1];this.x=r,this.y=a,this.w=1}else if(arguments[0]instanceof u&&arguments[1]instanceof u){var f=arguments[0],m=arguments[1];this.x=f.y*m.w-m.y*f.w,this.y=m.x*f.w-f.x*m.w,this.w=f.x*m.y-m.x*f.y}else if(arguments[0]instanceof W&&arguments[1]instanceof W){var p=arguments[0],I=arguments[1];this.x=p.y-I.y,this.y=I.x-p.x,this.w=p.x*I.y-I.x*p.y}}else if(arguments.length===3){var O=arguments[0],U=arguments[1],J=arguments[2];this.x=O,this.y=U,this.w=J}else if(arguments.length===4){var Q=arguments[0],ne=arguments[1],ce=arguments[2],fe=arguments[3],de=Q.y-ne.y,Re=ne.x-Q.x,be=Q.x*ne.y-ne.x*Q.y,Ye=ce.y-fe.y,it=fe.x-ce.x,ut=ce.x*fe.y-fe.x*ce.y;this.x=Re*ut-it*be,this.y=Ye*be-de*ut,this.w=de*it-Ye*Re}}}])})(),pp=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"area",value:function(){return u.area(this.p0,this.p1,this.p2)}},{key:"signedArea",value:function(){return u.signedArea(this.p0,this.p1,this.p2)}},{key:"interpolateZ",value:function(n){if(n===null)throw new C("Supplied point is null.");return u.interpolateZ(n,this.p0,this.p1,this.p2)}},{key:"longestSideLength",value:function(){return u.longestSideLength(this.p0,this.p1,this.p2)}},{key:"isAcute",value:function(){return u.isAcute(this.p0,this.p1,this.p2)}},{key:"circumcentre",value:function(){return u.circumcentre(this.p0,this.p1,this.p2)}},{key:"area3D",value:function(){return u.area3D(this.p0,this.p1,this.p2)}},{key:"centroid",value:function(){return u.centroid(this.p0,this.p1,this.p2)}},{key:"inCentre",value:function(){return u.inCentre(this.p0,this.p1,this.p2)}}],[{key:"constructor_",value:function(){this.p0=null,this.p1=null,this.p2=null;var n=arguments[0],r=arguments[1],a=arguments[2];this.p0=n,this.p1=r,this.p2=a}},{key:"area",value:function(n,r,a){return Math.abs(((a.x-n.x)*(r.y-n.y)-(r.x-n.x)*(a.y-n.y))/2)}},{key:"signedArea",value:function(n,r,a){return((a.x-n.x)*(r.y-n.y)-(r.x-n.x)*(a.y-n.y))/2}},{key:"det",value:function(n,r,a,f){return n*f-r*a}},{key:"interpolateZ",value:function(n,r,a,f){var m=r.x,p=r.y,I=a.x-m,O=f.x-m,U=a.y-p,J=f.y-p,Q=I*J-O*U,ne=n.x-m,ce=n.y-p,fe=(J*ne-O*ce)/Q,de=(-U*ne+I*ce)/Q;return r.getZ()+fe*(a.getZ()-r.getZ())+de*(f.getZ()-r.getZ())}},{key:"longestSideLength",value:function(n,r,a){var f=n.distance(r),m=r.distance(a),p=a.distance(n),I=f;return m>I&&(I=m),p>I&&(I=p),I}},{key:"circumcentreDD",value:function(n,r,a){var f=pe.valueOf(n.x).subtract(a.x),m=pe.valueOf(n.y).subtract(a.y),p=pe.valueOf(r.x).subtract(a.x),I=pe.valueOf(r.y).subtract(a.y),O=pe.determinant(f,m,p,I).multiply(2),U=f.sqr().add(m.sqr()),J=p.sqr().add(I.sqr()),Q=pe.determinant(m,U,I,J),ne=pe.determinant(f,U,p,J),ce=pe.valueOf(a.x).subtract(Q.divide(O)).doubleValue(),fe=pe.valueOf(a.y).add(ne.divide(O)).doubleValue();return new W(ce,fe)}},{key:"isAcute",value:function(n,r,a){return!!_t.isAcute(n,r,a)&&!!_t.isAcute(r,a,n)&&!!_t.isAcute(a,n,r)}},{key:"circumcentre",value:function(n,r,a){var f=a.x,m=a.y,p=n.x-f,I=n.y-m,O=r.x-f,U=r.y-m,J=2*u.det(p,I,O,U),Q=u.det(I,p*p+I*I,U,O*O+U*U),ne=u.det(p,p*p+I*I,O,O*O+U*U);return new W(f-Q/J,m+ne/J)}},{key:"perpendicularBisector",value:function(n,r){var a=r.x-n.x,f=r.y-n.y,m=new Oo(n.x+a/2,n.y+f/2,1),p=new Oo(n.x-f+a/2,n.y+a+f/2,1);return new Oo(m,p)}},{key:"angleBisector",value:function(n,r,a){var f=r.distance(n),m=f/(f+r.distance(a)),p=a.x-n.x,I=a.y-n.y;return new W(n.x+m*p,n.y+m*I)}},{key:"area3D",value:function(n,r,a){var f=r.x-n.x,m=r.y-n.y,p=r.getZ()-n.getZ(),I=a.x-n.x,O=a.y-n.y,U=a.getZ()-n.getZ(),J=m*U-p*O,Q=p*I-f*U,ne=f*O-m*I,ce=J*J+Q*Q+ne*ne,fe=Math.sqrt(ce)/2;return fe}},{key:"centroid",value:function(n,r,a){var f=(n.x+r.x+a.x)/3,m=(n.y+r.y+a.y)/3;return new W(f,m)}},{key:"inCentre",value:function(n,r,a){var f=r.distance(a),m=n.distance(a),p=n.distance(r),I=f+m+p,O=(f*n.x+m*r.x+p*a.x)/I,U=(f*n.y+m*r.y+p*a.y)/I;return new W(O,U)}}])})(),_p=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"addRingSide",value:function(u,n,r,a,f){if(n===0&&u.length<Ar.MINIMUM_VALID_SIZE)return null;var m=a,p=f;u.length>=Ar.MINIMUM_VALID_SIZE&&Ee.isCCW(u)&&(m=f,p=a,r=ie.opposite(r));var I=this._curveBuilder.getRingCurve(u,r,n);this.addCurve(I,m,p)}},{key:"addRingBothSides",value:function(u,n){this.addRingSide(u,n,ie.LEFT,$.EXTERIOR,$.INTERIOR),this.addRingSide(u,n,ie.RIGHT,$.INTERIOR,$.EXTERIOR)}},{key:"addPoint",value:function(u){if(this._distance<=0)return null;var n=u.getCoordinates(),r=this._curveBuilder.getLineCurve(n,this._distance);this.addCurve(r,$.EXTERIOR,$.INTERIOR)}},{key:"addPolygon",value:function(u){var n=this._distance,r=ie.LEFT;this._distance<0&&(n=-this._distance,r=ie.RIGHT);var a=u.getExteriorRing(),f=et.removeRepeatedPoints(a.getCoordinates());if(this._distance<0&&this.isErodedCompletely(a,this._distance)||this._distance<=0&&f.length<3)return null;this.addRingSide(f,n,r,$.EXTERIOR,$.INTERIOR);for(var m=0;m<u.getNumInteriorRing();m++){var p=u.getInteriorRingN(m),I=et.removeRepeatedPoints(p.getCoordinates());this._distance>0&&this.isErodedCompletely(p,-this._distance)||this.addRingSide(I,n,ie.opposite(r),$.INTERIOR,$.EXTERIOR)}}},{key:"isTriangleErodedCompletely",value:function(u,n){var r=new pp(u[0],u[1],u[2]),a=r.inCentre();return Gt.pointToSegment(a,r.p0,r.p1)<Math.abs(n)}},{key:"addLineString",value:function(u){if(this._curveBuilder.isLineOffsetEmpty(this._distance))return null;var n=et.removeRepeatedPoints(u.getCoordinates());if(et.isRing(n)&&!this._curveBuilder.getBufferParameters().isSingleSided())this.addRingBothSides(n,this._distance);else{var r=this._curveBuilder.getLineCurve(n,this._distance);this.addCurve(r,$.EXTERIOR,$.INTERIOR)}}},{key:"addCurve",value:function(u,n,r){if(u===null||u.length<2)return null;var a=new In(u,new Mt(0,$.BOUNDARY,n,r));this._curveList.add(a)}},{key:"getCurves",value:function(){return this.add(this._inputGeom),this._curveList}},{key:"add",value:function(u){if(u.isEmpty())return null;if(u instanceof Hi)this.addPolygon(u);else if(u instanceof Rr)this.addLineString(u);else if(u instanceof xo)this.addPoint(u);else if(u instanceof Eo)this.addCollection(u);else if(u instanceof No)this.addCollection(u);else if(u instanceof Io)this.addCollection(u);else{if(!(u instanceof mt))throw new ue(u.getGeometryType());this.addCollection(u)}}},{key:"isErodedCompletely",value:function(u,n){var r=u.getCoordinates();if(r.length<4)return n<0;if(r.length===4)return this.isTriangleErodedCompletely(r,n);var a=u.getEnvelopeInternal(),f=Math.min(a.getHeight(),a.getWidth());return n<0&&2*Math.abs(n)>f}},{key:"addCollection",value:function(u){for(var n=0;n<u.getNumGeometries();n++){var r=u.getGeometryN(n);this.add(r)}}}],[{key:"constructor_",value:function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new me;var u=arguments[0],n=arguments[1],r=arguments[2];this._inputGeom=u,this._distance=n,this._curveBuilder=r}}])})(),xp=(function(){return c((function u(){o(this,u)}),[{key:"locate",value:function(u){}}])})(),Ep=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"next",value:function(){if(this._atStart)return this._atStart=!1,u.isAtomic(this._parent)&&this._index++,this._parent;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new Se;var n=this._parent.getGeometryN(this._index++);return n instanceof mt?(this._subcollectionIterator=new u(n),this._subcollectionIterator.next()):n}},{key:"remove",value:function(){throw new ue(this.getClass().getName())}},{key:"hasNext",value:function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)}},{key:"interfaces_",get:function(){return[cp]}}],[{key:"constructor_",value:function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var n=arguments[0];this._parent=n,this._atStart=!0,this._index=0,this._max=n.getNumGeometries()}},{key:"isAtomic",value:function(n){return!(n instanceof mt)}}])})(),wp=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"locate",value:function(n){return u.locate(n,this._geom)}},{key:"interfaces_",get:function(){return[xp]}}],[{key:"constructor_",value:function(){this._geom=null;var n=arguments[0];this._geom=n}},{key:"locatePointInPolygon",value:function(n,r){if(r.isEmpty())return $.EXTERIOR;var a=r.getExteriorRing(),f=u.locatePointInRing(n,a);if(f!==$.INTERIOR)return f;for(var m=0;m<r.getNumInteriorRing();m++){var p=r.getInteriorRingN(m),I=u.locatePointInRing(n,p);if(I===$.BOUNDARY)return $.BOUNDARY;if(I===$.INTERIOR)return $.EXTERIOR}return $.INTERIOR}},{key:"locatePointInRing",value:function(n,r){return r.getEnvelopeInternal().intersects(n)?Po.locateInRing(n,r.getCoordinates()):$.EXTERIOR}},{key:"containsPointInPolygon",value:function(n,r){return $.EXTERIOR!==u.locatePointInPolygon(n,r)}},{key:"locateInGeometry",value:function(n,r){if(r instanceof Hi)return u.locatePointInPolygon(n,r);if(r instanceof mt)for(var a=new Ep(r);a.hasNext();){var f=a.next();if(f!==r){var m=u.locateInGeometry(n,f);if(m!==$.EXTERIOR)return m}}return $.EXTERIOR}},{key:"isContained",value:function(n,r){return $.EXTERIOR!==u.locate(n,r)}},{key:"locate",value:function(n,r){return r.isEmpty()?$.EXTERIOR:r.getEnvelopeInternal().intersects(n)?u.locateInGeometry(n,r):$.EXTERIOR}}])})(),kp=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"getNextCW",value:function(u){this.getEdges();var n=this._edgeList.indexOf(u),r=n-1;return n===0&&(r=this._edgeList.size()-1),this._edgeList.get(r)}},{key:"propagateSideLabels",value:function(u){for(var n=$.NONE,r=this.iterator();r.hasNext();){var a=r.next().getLabel();a.isArea(u)&&a.getLocation(u,ie.LEFT)!==$.NONE&&(n=a.getLocation(u,ie.LEFT))}if(n===$.NONE)return null;for(var f=n,m=this.iterator();m.hasNext();){var p=m.next(),I=p.getLabel();if(I.getLocation(u,ie.ON)===$.NONE&&I.setLocation(u,ie.ON,f),I.isArea(u)){var O=I.getLocation(u,ie.LEFT),U=I.getLocation(u,ie.RIGHT);if(U!==$.NONE){if(U!==f)throw new Qt("side location conflict",p.getCoordinate());O===$.NONE&&j.shouldNeverReachHere("found single null side (at "+p.getCoordinate()+")"),f=O}else j.isTrue(I.getLocation(u,ie.LEFT)===$.NONE,"found single null side"),I.setLocation(u,ie.RIGHT,f),I.setLocation(u,ie.LEFT,f)}}}},{key:"getCoordinate",value:function(){var u=this.iterator();return u.hasNext()?u.next().getCoordinate():null}},{key:"print",value:function(u){It.out.println("EdgeEndStar: "+this.getCoordinate());for(var n=this.iterator();n.hasNext();)n.next().print(u)}},{key:"isAreaLabelsConsistent",value:function(u){return this.computeEdgeEndLabels(u.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)}},{key:"checkAreaLabelsConsistent",value:function(u){var n=this.getEdges();if(n.size()<=0)return!0;var r=n.size()-1,a=n.get(r).getLabel().getLocation(u,ie.LEFT);j.isTrue(a!==$.NONE,"Found unlabelled area edge");for(var f=a,m=this.iterator();m.hasNext();){var p=m.next().getLabel();j.isTrue(p.isArea(u),"Found non-area edge");var I=p.getLocation(u,ie.LEFT),O=p.getLocation(u,ie.RIGHT);if(I===O||O!==f)return!1;f=I}return!0}},{key:"findIndex",value:function(u){this.iterator();for(var n=0;n<this._edgeList.size();n++)if(this._edgeList.get(n)===u)return n;return-1}},{key:"iterator",value:function(){return this.getEdges().iterator()}},{key:"getEdges",value:function(){return this._edgeList===null&&(this._edgeList=new me(this._edgeMap.values())),this._edgeList}},{key:"getLocation",value:function(u,n,r){return this._ptInAreaLocation[u]===$.NONE&&(this._ptInAreaLocation[u]=wp.locate(n,r[u].getGeometry())),this._ptInAreaLocation[u]}},{key:"toString",value:function(){var u=new ln;u.append("EdgeEndStar: "+this.getCoordinate()),u.append(`
1
+ (function(Ot,Qn){typeof exports=="object"&&typeof module<"u"?Qn(exports,require("cesium")):typeof define=="function"&&define.amd?define(["exports","cesium"],Qn):(Ot=typeof globalThis<"u"?globalThis:Ot||self,Qn(Ot.Gauss={},Ot.Cesium))})(this,(function(Ot,Qn){"use strict";function dh(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>t[i]})}}return e.default=t,Object.freeze(e)}const qo=dh(Qn);var Ke=63710088e-1,Xr={centimeters:Ke*100,centimetres:Ke*100,degrees:360/(2*Math.PI),feet:Ke*3.28084,inches:Ke*39.37,kilometers:Ke/1e3,kilometres:Ke/1e3,meters:Ke,metres:Ke,miles:Ke/1609.344,millimeters:Ke*1e3,millimetres:Ke*1e3,nauticalmiles:Ke/1852,radians:1,yards:Ke*1.0936},Ur={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,nauticalmiles:29155334959812285e-23,millimeters:1e6,millimetres:1e6,yards:1.195990046};function We(t,e,i={}){const s={type:"Feature"};return(i.id===0||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function Bo(t,e,i={}){switch(t){case"Point":return _e(e).geometry;case"LineString":return Pe(e).geometry;case"Polygon":return ye(e).geometry;case"MultiPoint":return jn(e).geometry;case"MultiLineString":return tn(e).geometry;case"MultiPolygon":return ft(e).geometry;default:throw new Error(t+" is invalid")}}function _e(t,e,i={}){if(!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Je(t[0])||!Je(t[1]))throw new Error("coordinates must contain numbers");return We({type:"Point",coordinates:t},e,i)}function Go(t,e,i={}){return he(t.map(s=>_e(s,e)),i)}function ye(t,e,i={}){for(const o of t){if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(o[o.length-1].length!==o[0].length)throw new Error("First and last Position are not equivalent.");for(let l=0;l<o[o.length-1].length;l++)if(o[o.length-1][l]!==o[0][l])throw new Error("First and last Position are not equivalent.")}return We({type:"Polygon",coordinates:t},e,i)}function Yo(t,e,i={}){return he(t.map(s=>ye(s,e)),i)}function Pe(t,e,i={}){if(t.length<2)throw new Error("coordinates must be an array of two or more positions");return We({type:"LineString",coordinates:t},e,i)}function zo(t,e,i={}){return he(t.map(s=>Pe(s,e)),i)}function he(t,e={}){const i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function tn(t,e,i={}){return We({type:"MultiLineString",coordinates:t},e,i)}function jn(t,e,i={}){return We({type:"MultiPoint",coordinates:t},e,i)}function ft(t,e,i={}){return We({type:"MultiPolygon",coordinates:t},e,i)}function es(t,e,i={}){return We({type:"GeometryCollection",geometries:t},e,i)}function Xo(t,e=0){if(e&&!(e>=0))throw new Error("precision must be a positive number");const i=Math.pow(10,e||0);return Math.round(t*i)/i}function er(t,e="kilometers"){const i=Xr[e];if(!i)throw new Error(e+" units is invalid");return t*i}function Mn(t,e="kilometers"){const i=Xr[e];if(!i)throw new Error(e+" units is invalid");return t/i}function Vr(t,e){return Tt(Mn(t,e))}function Sn(t){let e=t%360;return e<0&&(e+=360),e}function Uo(t){return t=t%360,t>180?t-360:t<-180?t+360:t}function Tt(t){return t%(2*Math.PI)*180/Math.PI}function Ze(t){return t%360*Math.PI/180}function fn(t,e="kilometers",i="kilometers"){if(!(t>=0))throw new Error("length must be a positive number");return er(Mn(t,e),i)}function ts(t,e="meters",i="kilometers"){if(!(t>=0))throw new Error("area must be a positive number");const s=Ur[e];if(!s)throw new Error("invalid original units");const o=Ur[i];if(!o)throw new Error("invalid final units");return t/s*o}function Je(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}function Ce(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function tr(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(t.length!==4&&t.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach(e=>{if(!Je(e))throw new Error("bbox must only contain numbers")})}function Vo(t){if(!t)throw new Error("id is required");if(["string","number"].indexOf(typeof t)===-1)throw new Error("id must be a number or a string")}const vh=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:Ur,azimuthToBearing:Uo,bearingToAzimuth:Sn,convertArea:ts,convertLength:fn,degreesToRadians:Ze,earthRadius:Ke,factors:Xr,feature:We,featureCollection:he,geometry:Bo,geometryCollection:es,isNumber:Je,isObject:Ce,lengthToDegrees:Vr,lengthToRadians:Mn,lineString:Pe,lineStrings:zo,multiLineString:tn,multiPoint:jn,multiPolygon:ft,point:_e,points:Go,polygon:ye,polygons:Yo,radiansToDegrees:Tt,radiansToLength:er,round:Xo,validateBBox:tr,validateId:Vo},Symbol.toStringTag,{value:"Module"}));function Oe(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if(t.type==="Feature"&&t.geometry!==null&&t.geometry.type==="Point")return[...t.geometry.coordinates];if(t.type==="Point")return[...t.coordinates]}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return[...t];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function ve(t){if(Array.isArray(t))return t;if(t.type==="Feature"){if(t.geometry!==null)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function ns(t){if(t.length>1&&Je(t[0])&&Je(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return ns(t[0]);throw new Error("coordinates must only contain numbers")}function Ho(t,e,i){if(!e||!i)throw new Error("type and name required");if(!t||t.type!==e)throw new Error("Invalid input to "+i+": must be a "+e+", given "+t.type)}function nr(t,e,i){if(!t)throw new Error("No feature passed");if(!i)throw new Error(".featureOf() requires a name");if(!t||t.type!=="Feature"||!t.geometry)throw new Error("Invalid input to "+i+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+i+": must be a "+e+", given "+t.geometry.type)}function Ut(t,e,i){if(!t)throw new Error("No featureCollection passed");if(!i)throw new Error(".collectionOf() requires a name");if(!t||t.type!=="FeatureCollection")throw new Error("Invalid input to "+i+", FeatureCollection required");for(const s of t.features){if(!s||s.type!=="Feature"||!s.geometry)throw new Error("Invalid input to "+i+", Feature with geometry required");if(!s.geometry||s.geometry.type!==e)throw new Error("Invalid input to "+i+": must be a "+e+", given "+s.geometry.type)}}function qe(t){return t.type==="Feature"?t.geometry:t}function gt(t,e){return t.type==="FeatureCollection"?"FeatureCollection":t.type==="GeometryCollection"?"GeometryCollection":t.type==="Feature"&&t.geometry!==null?t.geometry.type:t.type}const yh=Object.freeze(Object.defineProperty({__proto__:null,collectionOf:Ut,containsNumber:ns,featureOf:nr,geojsonType:Ho,getCoord:Oe,getCoords:ve,getGeom:qe,getType:gt},Symbol.toStringTag,{value:"Module"}));function nn(t,e,i={}){if(i.final===!0)return mh(t,e);const s=Oe(t),o=Oe(e),l=Ze(s[0]),h=Ze(o[0]),c=Ze(s[1]),g=Ze(o[1]),d=Math.sin(h-l)*Math.cos(g),y=Math.cos(c)*Math.sin(g)-Math.sin(c)*Math.cos(g)*Math.cos(h-l);return Tt(Math.atan2(d,y))}function mh(t,e){let i=nn(e,t);return i=(i+180)%360,i}function rn(t,e,i,s={}){const o=Oe(t),l=Ze(o[0]),h=Ze(o[1]),c=Ze(i),g=Mn(e,s.units),d=Math.asin(Math.sin(h)*Math.cos(g)+Math.cos(h)*Math.sin(g)*Math.cos(c)),y=l+Math.atan2(Math.sin(c)*Math.sin(g)*Math.cos(h),Math.cos(g)-Math.sin(h)*Math.sin(d)),v=Tt(y),_=Tt(d);return o[2]!==void 0?_e([v,_,o[2]],s.properties):_e([v,_],s.properties)}function Be(t,e,i={}){var s=Oe(t),o=Oe(e),l=Ze(o[1]-s[1]),h=Ze(o[0]-s[0]),c=Ze(s[1]),g=Ze(o[1]),d=Math.pow(Math.sin(l/2),2)+Math.pow(Math.sin(h/2),2)*Math.cos(c)*Math.cos(g);return er(2*Math.atan2(Math.sqrt(d),Math.sqrt(1-d)),i.units)}function ph(t,e,i={}){const o=qe(t).coordinates;let l=0;for(let h=0;h<o.length&&!(e>=l&&h===o.length-1);h++)if(l>=e){const c=e-l;if(c){const g=nn(o[h],o[h-1])-180;return rn(o[h],c,g,i)}else return _e(o[h])}else l+=Be(o[h],o[h+1],i);return _e(o[o.length-1])}function gn(t,e,i={}){let s;return i.final?s=$o(Oe(e),Oe(t)):s=$o(Oe(t),Oe(e)),s>180?-(360-s):s}function $o(t,e){const i=Ze(t[1]),s=Ze(e[1]);let o=Ze(e[0]-t[0]);o>Math.PI&&(o-=2*Math.PI),o<-Math.PI&&(o+=2*Math.PI);const l=Math.log(Math.tan(s/2+Math.PI/4)/Math.tan(i/2+Math.PI/4)),h=Math.atan2(o,l);return(Tt(h)+360)%360}function _h(t,e,i,s={}){if(!Ce(s))throw new Error("options is invalid");if(!t)throw new Error("startPoint is required");if(!e)throw new Error("midPoint is required");if(!i)throw new Error("endPoint is required");const o=t,l=e,h=i,c=Sn(s.mercator!==!0?nn(l,o):gn(l,o));let g=Sn(s.mercator!==!0?nn(l,h):gn(l,h));g<c&&(g=g+360);const d=g-c;return s.explementary===!0?360-d:d}function Xe(t,e,i){if(t!==null)for(var s,o,l,h,c,g,d,y=0,v=0,_,E=t.type,M=E==="FeatureCollection",R=E==="Feature",Y=M?t.features.length:1,H=0;H<Y;H++){d=M?t.features[H].geometry:R?t.geometry:t,_=d?d.type==="GeometryCollection":!1,c=_?d.geometries.length:1;for(var x=0;x<c;x++){var S=0,b=0;if(h=_?d.geometries[x]:d,h!==null){g=h.coordinates;var C=h.type;switch(y=i&&(C==="Polygon"||C==="MultiPolygon")?1:0,C){case null:break;case"Point":if(e(g,v,H,S,b)===!1)return!1;v++,S++;break;case"LineString":case"MultiPoint":for(s=0;s<g.length;s++){if(e(g[s],v,H,S,b)===!1)return!1;v++,C==="MultiPoint"&&S++}C==="LineString"&&S++;break;case"Polygon":case"MultiLineString":for(s=0;s<g.length;s++){for(o=0;o<g[s].length-y;o++){if(e(g[s][o],v,H,S,b)===!1)return!1;v++}C==="MultiLineString"&&S++,C==="Polygon"&&b++}C==="Polygon"&&S++;break;case"MultiPolygon":for(s=0;s<g.length;s++){for(b=0,o=0;o<g[s].length;o++){for(l=0;l<g[s][o].length-y;l++){if(e(g[s][o][l],v,H,S,b)===!1)return!1;v++}b++}S++}break;case"GeometryCollection":for(s=0;s<h.geometries.length;s++)if(Xe(h.geometries[s],e,i)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function rs(t,e,i,s){var o=i;return Xe(t,function(l,h,c,g,d){h===0&&i===void 0?o=l:o=e(o,l,h,c,g,d)},s),o}function is(t,e){var i;switch(t.type){case"FeatureCollection":for(i=0;i<t.features.length&&e(t.features[i].properties,i)!==!1;i++);break;case"Feature":e(t.properties,0);break}}function Zo(t,e,i){var s=i;return is(t,function(o,l){l===0&&i===void 0?s=o:s=e(s,o,l)}),s}function Le(t,e){if(t.type==="Feature")e(t,0);else if(t.type==="FeatureCollection")for(var i=0;i<t.features.length&&e(t.features[i],i)!==!1;i++);}function ss(t,e,i){var s=i;return Le(t,function(o,l){l===0&&i===void 0?s=o:s=e(s,o,l)}),s}function rr(t){var e=[];return Xe(t,function(i){e.push(i)}),e}function rt(t,e){var i,s,o,l,h,c,g,d,y,v,_=0,E=t.type==="FeatureCollection",M=t.type==="Feature",R=E?t.features.length:1;for(i=0;i<R;i++){for(c=E?t.features[i].geometry:M?t.geometry:t,d=E?t.features[i].properties:M?t.properties:{},y=E?t.features[i].bbox:M?t.bbox:void 0,v=E?t.features[i].id:M?t.id:void 0,g=c?c.type==="GeometryCollection":!1,h=g?c.geometries.length:1,o=0;o<h;o++){if(l=g?c.geometries[o]:c,l===null){if(e(null,_,d,y,v)===!1)return!1;continue}switch(l.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(e(l,_,d,y,v)===!1)return!1;break}case"GeometryCollection":{for(s=0;s<l.geometries.length;s++)if(e(l.geometries[s],_,d,y,v)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}_++}}function os(t,e,i){var s=i;return rt(t,function(o,l,h,c,g){l===0&&i===void 0?s=o:s=e(s,o,l,h,c,g)}),s}function Qe(t,e){rt(t,function(i,s,o,l,h){var c=i===null?null:i.type;switch(c){case null:case"Point":case"LineString":case"Polygon":return e(We(i,o,{bbox:l,id:h}),s,0)===!1?!1:void 0}var g;switch(c){case"MultiPoint":g="Point";break;case"MultiLineString":g="LineString";break;case"MultiPolygon":g="Polygon";break}for(var d=0;d<i.coordinates.length;d++){var y=i.coordinates[d],v={type:g,coordinates:y};if(e(We(v,o),s,d)===!1)return!1}})}function Wo(t,e,i){var s=i;return Qe(t,function(o,l,h){l===0&&h===0&&i===void 0?s=o:s=e(s,o,l,h)}),s}function Vt(t,e){Qe(t,function(i,s,o){var l=0;if(i.geometry){var h=i.geometry.type;if(!(h==="Point"||h==="MultiPoint")){var c,g=0,d=0,y=0;if(Xe(i,function(v,_,E,M,R){if(c===void 0||s>g||M>d||R>y){c=v,g=s,d=M,y=R,l=0;return}var Y=Pe([c,v],i.properties);if(e(Y,s,o,R,l)===!1)return!1;l++,c=v})===!1)return!1}}})}function as(t,e,i){var s=i,o=!1;return Vt(t,function(l,h,c,g,d){o===!1&&i===void 0?s=l:s=e(s,l,h,c,g,d),o=!0}),s}function us(t,e){if(!t)throw new Error("geojson is required");Qe(t,function(i,s,o){if(i.geometry!==null){var l=i.geometry.type,h=i.geometry.coordinates;switch(l){case"LineString":if(e(i,s,o,0,0)===!1)return!1;break;case"Polygon":for(var c=0;c<h.length;c++)if(e(Pe(h[c],i.properties),s,o,c)===!1)return!1;break}}})}function ls(t,e,i){var s=i;return us(t,function(o,l,h,c){l===0&&i===void 0?s=o:s=e(s,o,l,h,c)}),s}function Ko(t,e){if(e=e||{},!Ce(e))throw new Error("options is invalid");var i=e.featureIndex||0,s=e.multiFeatureIndex||0,o=e.geometryIndex||0,l=e.segmentIndex||0,h=e.properties,c;switch(t.type){case"FeatureCollection":i<0&&(i=t.features.length+i),h=h||t.features[i].properties,c=t.features[i].geometry;break;case"Feature":h=h||t.properties,c=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":c=t;break;default:throw new Error("geojson is invalid")}if(c===null)return null;var g=c.coordinates;switch(c.type){case"Point":case"MultiPoint":return null;case"LineString":return l<0&&(l=g.length+l-1),Pe([g[l],g[l+1]],h,e);case"Polygon":return o<0&&(o=g.length+o),l<0&&(l=g[o].length+l-1),Pe([g[o][l],g[o][l+1]],h,e);case"MultiLineString":return s<0&&(s=g.length+s),l<0&&(l=g[s].length+l-1),Pe([g[s][l],g[s][l+1]],h,e);case"MultiPolygon":return s<0&&(s=g.length+s),o<0&&(o=g[s].length+o),l<0&&(l=g[s][o].length-l-1),Pe([g[s][o][l],g[s][o][l+1]],h,e)}throw new Error("geojson is invalid")}function Jo(t,e){if(e=e||{},!Ce(e))throw new Error("options is invalid");var i=e.featureIndex||0,s=e.multiFeatureIndex||0,o=e.geometryIndex||0,l=e.coordIndex||0,h=e.properties,c;switch(t.type){case"FeatureCollection":i<0&&(i=t.features.length+i),h=h||t.features[i].properties,c=t.features[i].geometry;break;case"Feature":h=h||t.properties,c=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":c=t;break;default:throw new Error("geojson is invalid")}if(c===null)return null;var g=c.coordinates;switch(c.type){case"Point":return _e(g,h,e);case"MultiPoint":return s<0&&(s=g.length+s),_e(g[s],h,e);case"LineString":return l<0&&(l=g.length+l),_e(g[l],h,e);case"Polygon":return o<0&&(o=g.length+o),l<0&&(l=g[o].length+l),_e(g[o][l],h,e);case"MultiLineString":return s<0&&(s=g.length+s),l<0&&(l=g[s].length+l),_e(g[s][l],h,e);case"MultiPolygon":return s<0&&(s=g.length+s),o<0&&(o=g[s].length+o),l<0&&(l=g[s][o].length-l),_e(g[s][o][l],h,e)}throw new Error("geojson is invalid")}const xh=Object.freeze(Object.defineProperty({__proto__:null,coordAll:rr,coordEach:Xe,coordReduce:rs,featureEach:Le,featureReduce:ss,findPoint:Jo,findSegment:Ko,flattenEach:Qe,flattenReduce:Wo,geomEach:rt,geomReduce:os,lineEach:us,lineReduce:ls,propEach:is,propReduce:Zo,segmentEach:Vt,segmentReduce:as},Symbol.toStringTag,{value:"Module"}));function ir(t){return os(t,(e,i)=>e+Eh(i),0)}function Eh(t){let e=0,i;switch(t.type){case"Polygon":return Qo(t.coordinates);case"MultiPolygon":for(i=0;i<t.coordinates.length;i++)e+=Qo(t.coordinates[i]);return e;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}function Qo(t){let e=0;if(t&&t.length>0){e+=Math.abs(jo(t[0]));for(let i=1;i<t.length;i++)e-=Math.abs(jo(t[i]))}return e}var wh=Ke*Ke/2,cs=Math.PI/180;function jo(t){const e=t.length-1;if(e<=2)return 0;let i=0,s=0;for(;s<e;){const o=t[s],l=t[s+1===e?0:s+1],h=t[s+2>=e?(s+2)%e:s+2],c=o[0]*cs,g=l[1]*cs,d=h[0]*cs;i+=(d-c)*Math.sin(g),s++}return i*wh}function Fe(t,e={}){if(t.bbox!=null&&e.recompute!==!0)return t.bbox;const i=[1/0,1/0,-1/0,-1/0];return Xe(t,s=>{i[0]>s[0]&&(i[0]=s[0]),i[1]>s[1]&&(i[1]=s[1]),i[2]<s[0]&&(i[2]=s[0]),i[3]<s[1]&&(i[3]=s[1])}),i}function kh(t,e,i){var s=t.length,o=Pn(t[0],e),l=[],h,c,g;let d,y;for(i||(i=[]),h=1;h<s;h++){for(d=t[h-1],y=t[h],c=g=Pn(y,e);;)if(o|c){if(o&c)break;o?(d=hs(d,y,o,e),o=Pn(d,e)):(y=hs(d,y,c,e),c=Pn(y,e))}else{l.push(d),c!==g?(l.push(y),h<s-1&&(i.push(l),l=[])):h===s-1&&l.push(y);break}o=g}return l.length&&i.push(l),i}function Ih(t,e){var i,s,o,l,h,c,g;for(s=1;s<=8;s*=2){for(i=[],o=t[t.length-1],l=!(Pn(o,e)&s),h=0;h<t.length;h++)c=t[h],g=!(Pn(c,e)&s),g!==l&&i.push(hs(o,c,s,e)),g&&i.push(c),o=c,l=g;if(t=i,!t.length)break}return i}function hs(t,e,i,s){return i&8?[t[0]+(e[0]-t[0])*(s[3]-t[1])/(e[1]-t[1]),s[3]]:i&4?[t[0]+(e[0]-t[0])*(s[1]-t[1])/(e[1]-t[1]),s[1]]:i&2?[s[2],t[1]+(e[1]-t[1])*(s[2]-t[0])/(e[0]-t[0])]:i&1?[s[0],t[1]+(e[1]-t[1])*(s[0]-t[0])/(e[0]-t[0])]:null}function Pn(t,e){var i=0;return t[0]<e[0]?i|=1:t[0]>e[2]&&(i|=2),t[1]<e[1]?i|=4:t[1]>e[3]&&(i|=8),i}function Nh(t,e){const i=qe(t),s=i.type,o=t.type==="Feature"?t.properties:{};let l=i.coordinates;switch(s){case"LineString":case"MultiLineString":{const h=[];return s==="LineString"&&(l=[l]),l.forEach(c=>{kh(c,e,h)}),h.length===1?Pe(h[0],o):tn(h,o)}case"Polygon":return ye(ea(l,e),o);case"MultiPolygon":return ft(l.map(h=>ea(h,e)),o);default:throw new Error("geometry "+s+" not supported")}}function ea(t,e){const i=[];for(const s of t){const o=Ih(s,e);o.length>0&&((o[0][0]!==o[o.length-1][0]||o[0][1]!==o[o.length-1][1])&&o.push(o[0]),o.length>=4&&i.push(o))}return i}function sr(t,e={}){const i=Number(t[0]),s=Number(t[1]),o=Number(t[2]),l=Number(t[3]);if(t.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");const h=[i,s];return ye([[h,[o,s],[o,l],[i,l],h]],e.properties,{bbox:t,id:e.id})}var Mh=class{constructor(t){this.points=t.points||[],this.duration=t.duration||1e4,this.sharpness=t.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=t.stepLength||60,this.length=this.points.length,this.delay=0;for(let e=0;e<this.length;e++)this.points[e].z=this.points[e].z||0;for(let e=0;e<this.length-1;e++){const i=this.points[e],s=this.points[e+1];this.centers.push({x:(i.x+s.x)/2,y:(i.y+s.y)/2,z:(i.z+s.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(let e=0;e<this.centers.length-1;e++){const i=this.points[e+1].x-(this.centers[e].x+this.centers[e+1].x)/2,s=this.points[e+1].y-(this.centers[e].y+this.centers[e+1].y)/2,o=this.points[e+1].z-(this.centers[e].y+this.centers[e+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e].x+i),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e].y+s),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e].z+o)},{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e+1].x+i),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e+1].y+s),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e+1].z+o)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}cacheSteps(t){const e=[];let i=this.pos(0);e.push(0);for(let s=0;s<this.duration;s+=10){const o=this.pos(s);Math.sqrt((o.x-i.x)*(o.x-i.x)+(o.y-i.y)*(o.y-i.y)+(o.z-i.z)*(o.z-i.z))>t&&(e.push(s),i=o)}return e}vector(t){const e=this.pos(t+10),i=this.pos(t-10);return{angle:180*Math.atan2(e.y-i.y,e.x-i.x)/3.14,speed:Math.sqrt((i.x-e.x)*(i.x-e.x)+(i.y-e.y)*(i.y-e.y)+(i.z-e.z)*(i.z-e.z))}}pos(t){let e=t-this.delay;e<0&&(e=0),e>this.duration&&(e=this.duration-1);const i=e/this.duration;if(i>=1)return this.points[this.length-1];const s=Math.floor((this.points.length-1)*i),o=(this.length-1)*i-s;return Sh(o,this.points[s],this.controls[s][1],this.controls[s+1][0],this.points[s+1])}};function Sh(t,e,i,s,o){const l=Ph(t);return{x:o.x*l[0]+s.x*l[1]+i.x*l[2]+e.x*l[3],y:o.y*l[0]+s.y*l[1]+i.y*l[2]+e.y*l[3],z:o.z*l[0]+s.z*l[1]+i.z*l[2]+e.z*l[3]}}function Ph(t){const e=t*t;return[e*t,3*e*(1-t),3*t*(1-t)*(1-t),(1-t)*(1-t)*(1-t)]}function Lh(t,e={}){const i=e.resolution||1e4,s=e.sharpness||.85,o=[],l=qe(t).coordinates.map(d=>({x:d[0],y:d[1]})),h=new Mh({duration:i,points:l,sharpness:s}),c=d=>{var y=h.pos(d);Math.floor(d/100)%2===0&&o.push([y.x,y.y])};for(var g=0;g<h.duration;g+=10)c(g);return c(h.duration),Pe(o,e.properties)}function Hr(t){const e=ve(t);let i=0,s=1,o,l;for(;s<e.length;)o=l||e[0],l=e[s],i+=(l[0]-o[0])*(l[1]+o[1]),s++;return i>0}function bh(t){const e=qe(t).coordinates;if(e[0].length<=4)return!1;let i=!1;const s=e[0].length-1;for(let o=0;o<s;o++){const l=e[0][(o+2)%s][0]-e[0][(o+1)%s][0],h=e[0][(o+2)%s][1]-e[0][(o+1)%s][1],c=e[0][o][0]-e[0][(o+1)%s][0],g=e[0][o][1]-e[0][(o+1)%s][1],d=l*g-h*c;if(o===0)i=d>0;else if(i!==d>0)return!0}return!1}const Ht=11102230246251565e-32,st=134217729,Ch=(3+8*Ht)*Ht;function fs(t,e,i,s,o){let l,h,c,g,d=e[0],y=s[0],v=0,_=0;y>d==y>-d?(l=d,d=e[++v]):(l=y,y=s[++_]);let E=0;if(v<t&&_<i)for(y>d==y>-d?(h=d+l,c=l-(h-d),d=e[++v]):(h=y+l,c=l-(h-y),y=s[++_]),l=h,c!==0&&(o[E++]=c);v<t&&_<i;)y>d==y>-d?(h=l+d,g=h-l,c=l-(h-g)+(d-g),d=e[++v]):(h=l+y,g=h-l,c=l-(h-g)+(y-g),y=s[++_]),l=h,c!==0&&(o[E++]=c);for(;v<t;)h=l+d,g=h-l,c=l-(h-g)+(d-g),d=e[++v],l=h,c!==0&&(o[E++]=c);for(;_<i;)h=l+y,g=h-l,c=l-(h-g)+(y-g),y=s[++_],l=h,c!==0&&(o[E++]=c);return(l!==0||E===0)&&(o[E++]=l),E}function Oh(t,e){let i=e[0];for(let s=1;s<t;s++)i+=e[s];return i}function or(t){return new Float64Array(t)}const Th=(3+16*Ht)*Ht,Rh=(2+12*Ht)*Ht,Ah=(9+64*Ht)*Ht*Ht,Ln=or(4),ta=or(8),na=or(12),ra=or(16),lt=or(4);function Dh(t,e,i,s,o,l,h){let c,g,d,y,v,_,E,M,R,Y,H,x,S,b,C,A,q,w;const N=t-o,L=i-o,D=e-l,F=s-l;b=N*F,_=st*N,E=_-(_-N),M=N-E,_=st*F,R=_-(_-F),Y=F-R,C=M*Y-(b-E*R-M*R-E*Y),A=D*L,_=st*D,E=_-(_-D),M=D-E,_=st*L,R=_-(_-L),Y=L-R,q=M*Y-(A-E*R-M*R-E*Y),H=C-q,v=C-H,Ln[0]=C-(H+v)+(v-q),x=b+H,v=x-b,S=b-(x-v)+(H-v),H=S-A,v=S-H,Ln[1]=S-(H+v)+(v-A),w=x+H,v=w-x,Ln[2]=x-(w-v)+(H-v),Ln[3]=w;let X=Oh(4,Ln),z=Rh*h;if(X>=z||-X>=z||(v=t-N,c=t-(N+v)+(v-o),v=i-L,d=i-(L+v)+(v-o),v=e-D,g=e-(D+v)+(v-l),v=s-F,y=s-(F+v)+(v-l),c===0&&g===0&&d===0&&y===0)||(z=Ah*h+Ch*Math.abs(X),X+=N*y+F*c-(D*d+L*g),X>=z||-X>=z))return X;b=c*F,_=st*c,E=_-(_-c),M=c-E,_=st*F,R=_-(_-F),Y=F-R,C=M*Y-(b-E*R-M*R-E*Y),A=g*L,_=st*g,E=_-(_-g),M=g-E,_=st*L,R=_-(_-L),Y=L-R,q=M*Y-(A-E*R-M*R-E*Y),H=C-q,v=C-H,lt[0]=C-(H+v)+(v-q),x=b+H,v=x-b,S=b-(x-v)+(H-v),H=S-A,v=S-H,lt[1]=S-(H+v)+(v-A),w=x+H,v=w-x,lt[2]=x-(w-v)+(H-v),lt[3]=w;const V=fs(4,Ln,4,lt,ta);b=N*y,_=st*N,E=_-(_-N),M=N-E,_=st*y,R=_-(_-y),Y=y-R,C=M*Y-(b-E*R-M*R-E*Y),A=D*d,_=st*D,E=_-(_-D),M=D-E,_=st*d,R=_-(_-d),Y=d-R,q=M*Y-(A-E*R-M*R-E*Y),H=C-q,v=C-H,lt[0]=C-(H+v)+(v-q),x=b+H,v=x-b,S=b-(x-v)+(H-v),H=S-A,v=S-H,lt[1]=S-(H+v)+(v-A),w=x+H,v=w-x,lt[2]=x-(w-v)+(H-v),lt[3]=w;const k=fs(V,ta,4,lt,na);b=c*y,_=st*c,E=_-(_-c),M=c-E,_=st*y,R=_-(_-y),Y=y-R,C=M*Y-(b-E*R-M*R-E*Y),A=g*d,_=st*g,E=_-(_-g),M=g-E,_=st*d,R=_-(_-d),Y=d-R,q=M*Y-(A-E*R-M*R-E*Y),H=C-q,v=C-H,lt[0]=C-(H+v)+(v-q),x=b+H,v=x-b,S=b-(x-v)+(H-v),H=S-A,v=S-H,lt[1]=S-(H+v)+(v-A),w=x+H,v=w-x,lt[2]=x-(w-v)+(H-v),lt[3]=w;const O=fs(k,na,4,lt,ra);return ra[O-1]}function Fh(t,e,i,s,o,l){const h=(e-l)*(i-o),c=(t-o)*(s-l),g=h-c,d=Math.abs(h+c);return Math.abs(g)>=Th*d?g:-Dh(t,e,i,s,o,l,d)}function qh(t,e){var i,s,o=0,l,h,c,g,d,y,v,_=t[0],E=t[1],M=e.length;for(i=0;i<M;i++){s=0;var R=e[i],Y=R.length-1;if(y=R[0],y[0]!==R[Y][0]&&y[1]!==R[Y][1])throw new Error("First and last coordinates in a ring must be the same");for(h=y[0]-_,c=y[1]-E,s;s<Y;s++){if(v=R[s+1],g=v[0]-_,d=v[1]-E,c===0&&d===0){if(g<=0&&h>=0||h<=0&&g>=0)return 0}else if(d>=0&&c<=0||d<=0&&c>=0){if(l=Fh(h,g,c,d,0,0),l===0)return 0;(l>0&&d>0&&c<=0||l<0&&d<=0&&c>0)&&o++}y=v,c=d,h=g}}return o%2!==0}function xe(t,e,i={}){if(!t)throw new Error("point is required");if(!e)throw new Error("polygon is required");const s=Oe(t),o=qe(e),l=o.type,h=e.bbox;let c=o.coordinates;if(h&&Bh(s,h)===!1)return!1;l==="Polygon"&&(c=[c]);let g=!1;for(var d=0;d<c.length;++d){const y=qh(s,c[d]);if(y===0)return!i.ignoreBoundary;y&&(g=!0)}return g}function Bh(t,e){return e[0]<=t[0]&&e[1]<=t[1]&&e[2]>=t[0]&&e[3]>=t[1]}function we(t,e,i={}){const s=Oe(t),o=ve(e);for(let l=0;l<o.length-1;l++){let h=!1;if(i.ignoreEndVertices&&(l===0&&(h="start"),l===o.length-2&&(h="end"),l===0&&l+1===o.length-1&&(h="both")),Gh(o[l],o[l+1],s,h,typeof i.epsilon>"u"?null:i.epsilon))return!0}return!1}function Gh(t,e,i,s,o){const l=i[0],h=i[1],c=t[0],g=t[1],d=e[0],y=e[1],v=i[0]-c,_=i[1]-g,E=d-c,M=y-g,R=v*M-_*E;if(o!==null){if(Math.abs(R)>o)return!1}else if(R!==0)return!1;if(Math.abs(E)===Math.abs(M)&&Math.abs(E)===0)return s?!1:i[0]===t[0]&&i[1]===t[1];if(s){if(s==="start")return Math.abs(E)>=Math.abs(M)?E>0?c<l&&l<=d:d<=l&&l<c:M>0?g<h&&h<=y:y<=h&&h<g;if(s==="end")return Math.abs(E)>=Math.abs(M)?E>0?c<=l&&l<d:d<l&&l<=c:M>0?g<=h&&h<y:y<h&&h<=g;if(s==="both")return Math.abs(E)>=Math.abs(M)?E>0?c<l&&l<d:d<l&&l<c:M>0?g<h&&h<y:y<h&&h<g}else return Math.abs(E)>=Math.abs(M)?E>0?c<=l&&l<=d:d<=l&&l<=c:M>0?g<=h&&h<=y:y<=h&&h<=g;return!1}function Yh(t,e){const i=qe(t),s=qe(e),o=i.type,l=s.type,h=i.coordinates,c=s.coordinates;switch(o){case"Point":if(l==="Point")return gs(h,c);throw new Error("feature2 "+l+" geometry not supported");case"MultiPoint":switch(l){case"Point":return Xh(i,s);case"MultiPoint":return Uh(i,s);default:throw new Error("feature2 "+l+" geometry not supported")}case"LineString":switch(l){case"Point":return we(s,i,{ignoreEndVertices:!0});case"LineString":return $h(i,s);case"MultiPoint":return Vh(i,s);default:throw new Error("feature2 "+l+" geometry not supported")}case"Polygon":switch(l){case"Point":return xe(s,i,{ignoreBoundary:!0});case"LineString":return Zh(i,s);case"Polygon":return ia(i,s);case"MultiPoint":return Hh(i,s);default:throw new Error("feature2 "+l+" geometry not supported")}case"MultiPolygon":if(l==="Polygon")return zh(i,s);throw new Error("feature2 "+l+" geometry not supported");default:throw new Error("feature1 "+o+" geometry not supported")}}function zh(t,e){return t.coordinates.some(i=>ia({type:"Polygon",coordinates:i},e))}function Xh(t,e){let i,s=!1;for(i=0;i<t.coordinates.length;i++)if(gs(t.coordinates[i],e.coordinates)){s=!0;break}return s}function Uh(t,e){for(const i of e.coordinates){let s=!1;for(const o of t.coordinates)if(gs(i,o)){s=!0;break}if(!s)return!1}return!0}function Vh(t,e){let i=!1;for(const s of e.coordinates)if(we(s,t,{ignoreEndVertices:!0})&&(i=!0),!we(s,t))return!1;return!!i}function Hh(t,e){for(const i of e.coordinates)if(!xe(i,t,{ignoreBoundary:!0}))return!1;return!0}function $h(t,e){let i=!1;for(const s of e.coordinates)if(we({type:"Point",coordinates:s},t,{ignoreEndVertices:!0})&&(i=!0),!we({type:"Point",coordinates:s},t,{ignoreEndVertices:!1}))return!1;return i}function Zh(t,e){let i=!1,s=0;const o=Fe(t),l=Fe(e);if(!sa(o,l))return!1;for(s;s<e.coordinates.length-1;s++){const h=Wh(e.coordinates[s],e.coordinates[s+1]);if(xe({type:"Point",coordinates:h},t,{ignoreBoundary:!0})){i=!0;break}}return i}function ia(t,e){if(t.type==="Feature"&&t.geometry===null||e.type==="Feature"&&e.geometry===null)return!1;const i=Fe(t),s=Fe(e);if(!sa(i,s))return!1;const o=qe(e).coordinates;for(const l of o)for(const h of l)if(!xe(h,t))return!1;return!0}function sa(t,e){return!(t[0]>e[0]||t[2]<e[2]||t[1]>e[1]||t[3]<e[3])}function gs(t,e){return t[0]===e[0]&&t[1]===e[1]}function Wh(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2]}let oa=class{constructor(e=[],i=Kh){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],i=this.data.pop();return this.length--,this.length>0&&(this.data[0]=i,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:i,compare:s}=this,o=i[e];for(;e>0;){const l=e-1>>1,h=i[l];if(s(o,h)>=0)break;i[e]=h,e=l}i[e]=o}_down(e){const{data:i,compare:s}=this,o=this.length>>1,l=i[e];for(;e<o;){let h=(e<<1)+1,c=i[h];const g=h+1;if(g<this.length&&s(i[g],c)<0&&(h=g,c=i[g]),s(c,l)>=0)break;i[e]=c,e=h}i[e]=l}};function Kh(t,e){return t<e?-1:t>e?1:0}function aa(t,e){return t.p.x>e.p.x?1:t.p.x<e.p.x?-1:t.p.y!==e.p.y?t.p.y>e.p.y?1:-1:1}function Jh(t,e){return t.rightSweepEvent.p.x>e.rightSweepEvent.p.x?1:t.rightSweepEvent.p.x<e.rightSweepEvent.p.x?-1:t.rightSweepEvent.p.y!==e.rightSweepEvent.p.y?t.rightSweepEvent.p.y<e.rightSweepEvent.p.y?1:-1:1}class ua{constructor(e,i,s,o){this.p={x:e[0],y:e[1]},this.featureId=i,this.ringId=s,this.eventId=o,this.otherEvent=null,this.isLeftEndpoint=null}isSamePoint(e){return this.p.x===e.p.x&&this.p.y===e.p.y}}function Qh(t,e){if(t.type==="FeatureCollection"){const i=t.features;for(let s=0;s<i.length;s++)la(i[s],e)}else la(t,e)}let $r=0,Zr=0,Wr=0;function la(t,e){const i=t.type==="Feature"?t.geometry:t;let s=i.coordinates;(i.type==="Polygon"||i.type==="MultiLineString")&&(s=[s]),i.type==="LineString"&&(s=[[s]]);for(let o=0;o<s.length;o++)for(let l=0;l<s[o].length;l++){let h=s[o][l][0],c=null;Zr=Zr+1;for(let g=0;g<s[o][l].length-1;g++){c=s[o][l][g+1];const d=new ua(h,$r,Zr,Wr),y=new ua(c,$r,Zr,Wr+1);d.otherEvent=y,y.otherEvent=d,aa(d,y)>0?(y.isLeftEndpoint=!0,d.isLeftEndpoint=!1):(d.isLeftEndpoint=!0,y.isLeftEndpoint=!1),e.push(d),e.push(y),h=c,Wr=Wr+1}}$r=$r+1}let jh=class{constructor(e){this.leftSweepEvent=e,this.rightSweepEvent=e.otherEvent}};function ef(t,e){if(t===null||e===null||t.leftSweepEvent.ringId===e.leftSweepEvent.ringId&&(t.rightSweepEvent.isSamePoint(e.leftSweepEvent)||t.rightSweepEvent.isSamePoint(e.leftSweepEvent)||t.rightSweepEvent.isSamePoint(e.rightSweepEvent)||t.leftSweepEvent.isSamePoint(e.leftSweepEvent)||t.leftSweepEvent.isSamePoint(e.rightSweepEvent)))return!1;const i=t.leftSweepEvent.p.x,s=t.leftSweepEvent.p.y,o=t.rightSweepEvent.p.x,l=t.rightSweepEvent.p.y,h=e.leftSweepEvent.p.x,c=e.leftSweepEvent.p.y,g=e.rightSweepEvent.p.x,d=e.rightSweepEvent.p.y,y=(d-c)*(o-i)-(g-h)*(l-s),v=(g-h)*(s-c)-(d-c)*(i-h),_=(o-i)*(s-c)-(l-s)*(i-h);if(y===0)return!1;const E=v/y,M=_/y;if(E>=0&&E<=1&&M>=0&&M<=1){const R=i+E*(o-i),Y=s+E*(l-s);return[R,Y]}return!1}function tf(t,e){e=e||!1;const i=[],s=new oa([],Jh);for(;t.length;){const o=t.pop();if(o.isLeftEndpoint){const l=new jh(o);for(let h=0;h<s.data.length;h++){const c=s.data[h];if(e&&c.leftSweepEvent.featureId===o.featureId)continue;const g=ef(l,c);g!==!1&&i.push(g)}s.push(l)}else o.isLeftEndpoint===!1&&s.pop()}return i}function nf(t,e){const i=new oa([],aa);return Qh(t,i),tf(i,e)}var rf=nf;function Rt(t,e,i={}){const{removeDuplicates:s=!0,ignoreSelfIntersections:o=!0}=i;let l=[];t.type==="FeatureCollection"?l=l.concat(t.features):t.type==="Feature"?l.push(t):(t.type==="LineString"||t.type==="Polygon"||t.type==="MultiLineString"||t.type==="MultiPolygon")&&l.push(We(t)),e.type==="FeatureCollection"?l=l.concat(e.features):e.type==="Feature"?l.push(e):(e.type==="LineString"||e.type==="Polygon"||e.type==="MultiLineString"||e.type==="MultiPolygon")&&l.push(We(e));const h=rf(he(l),o);let c=[];if(s){const g={};h.forEach(d=>{const y=d.join(",");g[y]||(g[y]=!0,c.push(d))})}else c=h;return he(c.map(g=>_e(g)))}function bn(t,e={}){const i=qe(t);switch(!e.properties&&t.type==="Feature"&&(e.properties=t.properties),i.type){case"Polygon":return sf(i,e);case"MultiPolygon":return of(i,e);default:throw new Error("invalid poly")}}function sf(t,e={}){const s=qe(t).coordinates,o=e.properties?e.properties:t.type==="Feature"?t.properties:{};return ca(s,o)}function of(t,e={}){const s=qe(t).coordinates,o=e.properties?e.properties:t.type==="Feature"?t.properties:{},l=[];return s.forEach(h=>{l.push(ca(h,o))}),he(l)}function ca(t,e){return t.length>1?tn(t,e):Pe(t[0],e)}function ha(t,e){var i=qe(t),s=qe(e),o=i.type,l=s.type;switch(o){case"MultiPoint":switch(l){case"LineString":return fa(i,s);case"Polygon":return da(i,s);default:throw new Error("feature2 "+l+" geometry not supported")}case"LineString":switch(l){case"MultiPoint":return fa(s,i);case"LineString":return af(i,s);case"Polygon":return ga(i,s);default:throw new Error("feature2 "+l+" geometry not supported")}case"Polygon":switch(l){case"MultiPoint":return da(s,i);case"LineString":return ga(s,i);default:throw new Error("feature2 "+l+" geometry not supported")}default:throw new Error("feature1 "+o+" geometry not supported")}}function fa(t,e){for(var i=!1,s=!1,o=t.coordinates.length,l=0;l<o&&!i&&!s;){for(var h=0;h<e.coordinates.length-1;h++){var c=!0;(h===0||h===e.coordinates.length-2)&&(c=!1),va(e.coordinates[h],e.coordinates[h+1],t.coordinates[l],c)?i=!0:s=!0}l++}return i&&s}function af(t,e){var i=Rt(t,e);if(i.features.length>0)for(var s=0;s<t.coordinates.length-1;s++)for(var o=0;o<e.coordinates.length-1;o++){var l=!0;if((o===0||o===e.coordinates.length-2)&&(l=!1),va(t.coordinates[s],t.coordinates[s+1],e.coordinates[o],l))return!0}return!1}function ga(t,e){const i=bn(e);return Rt(t,i).features.length>0}function da(t,e){var i=!1,s=!1,o=t.coordinates.length;for(let l=0;l<o&&(!i||!s);l++)xe(_e(t.coordinates[l]),e)?i=!0:s=!0;return s&&i}function va(t,e,i,s){var o=i[0]-t[0],l=i[1]-t[1],h=e[0]-t[0],c=e[1]-t[1],g=o*c-l*h;return g!==0?!1:s?Math.abs(h)>=Math.abs(c)?h>0?t[0]<=i[0]&&i[0]<=e[0]:e[0]<=i[0]&&i[0]<=t[0]:c>0?t[1]<=i[1]&&i[1]<=e[1]:e[1]<=i[1]&&i[1]<=t[1]:Math.abs(h)>=Math.abs(c)?h>0?t[0]<i[0]&&i[0]<e[0]:e[0]<i[0]&&i[0]<t[0]:c>0?t[1]<i[1]&&i[1]<e[1]:e[1]<i[1]&&i[1]<t[1]}function ds(t,e,{ignoreSelfIntersections:i=!0}={ignoreSelfIntersections:!0}){let s=!0;return Qe(t,o=>{Qe(e,l=>{if(s===!1)return!1;s=uf(o.geometry,l.geometry,i)})}),s}function uf(t,e,i){switch(t.type){case"Point":switch(e.type){case"Point":return!ff(t.coordinates,e.coordinates);case"LineString":return!ya(e,t);case"Polygon":return!xe(t,e)}break;case"LineString":switch(e.type){case"Point":return!ya(t,e);case"LineString":return!lf(t,e,i);case"Polygon":return!ma(e,t,i)}break;case"Polygon":switch(e.type){case"Point":return!xe(e,t);case"LineString":return!ma(t,e,i);case"Polygon":return!cf(e,t,i)}}return!1}function ya(t,e){for(let i=0;i<t.coordinates.length-1;i++)if(hf(t.coordinates[i],t.coordinates[i+1],e.coordinates))return!0;return!1}function lf(t,e,i){return Rt(t,e,{ignoreSelfIntersections:i}).features.length>0}function ma(t,e,i){for(const o of e.coordinates)if(xe(o,t))return!0;return Rt(e,bn(t),{ignoreSelfIntersections:i}).features.length>0}function cf(t,e,i){for(const o of t.coordinates[0])if(xe(o,e))return!0;for(const o of e.coordinates[0])if(xe(o,t))return!0;return Rt(bn(t),bn(e),{ignoreSelfIntersections:i}).features.length>0}function hf(t,e,i){const s=i[0]-t[0],o=i[1]-t[1],l=e[0]-t[0],h=e[1]-t[1];return s*h-o*l!==0?!1:Math.abs(l)>=Math.abs(h)?l>0?t[0]<=i[0]&&i[0]<=e[0]:e[0]<=i[0]&&i[0]<=t[0]:h>0?t[1]<=i[1]&&i[1]<=e[1]:e[1]<=i[1]&&i[1]<=t[1]}function ff(t,e){return t[0]===e[0]&&t[1]===e[1]}var gf=Object.defineProperty,Cn=(t,e)=>gf(t,"name",{value:e,configurable:!0}),pa=class{constructor(e){this.direction=!1,this.compareProperties=!0;var i,s,o;this.precision=10**-((i=e?.precision)!=null?i:17),this.direction=(s=e?.direction)!=null?s:!1,this.compareProperties=(o=e?.compareProperties)!=null?o:!0}compare(e,i){if(e.type!==i.type||!ar(e,i))return!1;switch(e.type){case"Point":return this.compareCoord(e.coordinates,i.coordinates);case"LineString":return this.compareLine(e.coordinates,i.coordinates);case"Polygon":return this.comparePolygon(e,i);case"GeometryCollection":return this.compareGeometryCollection(e,i);case"Feature":return this.compareFeature(e,i);case"FeatureCollection":return this.compareFeatureCollection(e,i);default:if(e.type.startsWith("Multi")){const s=vs(e),o=vs(i);return s.every(l=>o.some(h=>this.compare(l,h)))}}return!1}compareCoord(e,i){return e.length===i.length&&e.every((s,o)=>Math.abs(s-i[o])<this.precision)}compareLine(e,i,s=0,o=!1){if(!ar(e,i))return!1;const l=e;let h=i;if(o&&!this.compareCoord(l[0],h[0])){const g=this.fixStartIndex(h,l);if(g)h=g;else return!1}const c=this.compareCoord(l[s],h[s]);return this.direction||c?this.comparePath(l,h):this.compareCoord(l[s],h[h.length-(1+s)])?this.comparePath(l.slice().reverse(),h):!1}fixStartIndex(e,i){let s,o=-1;for(let l=0;l<e.length;l++)if(this.compareCoord(e[l],i[0])){o=l;break}return o>=0&&(s=[].concat(e.slice(o,e.length),e.slice(1,o+1))),s}comparePath(e,i){return e.every((s,o)=>this.compareCoord(s,i[o]))}comparePolygon(e,i){if(this.compareLine(e.coordinates[0],i.coordinates[0],1,!0)){const s=e.coordinates.slice(1,e.coordinates.length),o=i.coordinates.slice(1,i.coordinates.length);return s.every(l=>o.some(h=>this.compareLine(l,h,1,!0)))}return!1}compareGeometryCollection(e,i){return ar(e.geometries,i.geometries)&&this.compareBBox(e,i)&&e.geometries.every((s,o)=>this.compare(s,i.geometries[o]))}compareFeature(e,i){return e.id===i.id&&(this.compareProperties?ms(e.properties,i.properties):!0)&&this.compareBBox(e,i)&&this.compare(e.geometry,i.geometry)}compareFeatureCollection(e,i){return ar(e.features,i.features)&&this.compareBBox(e,i)&&e.features.every((s,o)=>this.compare(s,i.features[o]))}compareBBox(e,i){return!e.bbox&&!i.bbox||(e.bbox&&i.bbox?this.compareCoord(e.bbox,i.bbox):!1)}};Cn(pa,"GeojsonEquality");var df=pa;function ar(t,e){return t.coordinates?t.coordinates.length===e.coordinates.length:t.length===e.length}Cn(ar,"sameLength");function vs(t){return t.coordinates.map(e=>({type:t.type.replace("Multi",""),coordinates:e}))}Cn(vs,"explode");function ys(t,e,i){return new df(i).compare(t,e)}Cn(ys,"geojsonEquality");function ms(t,e){if(t===null&&e===null)return!0;if(t===null||e===null)return!1;const i=Object.keys(t),s=Object.keys(e);if(i.length!==s.length)return!1;for(var o of i){const l=t[o],h=e[o],c=_a(l)&&_a(h);if(c&&!ms(l,h)||!c&&l!==h)return!1}return!0}Cn(ms,"equal");var _a=Cn(t=>t!=null&&typeof t=="object","isObject");function dn(t,e={}){var i=typeof e=="object"?e.mutate:e;if(!t)throw new Error("geojson is required");var s=gt(t),o=[];switch(s){case"LineString":o=ps(t,s);break;case"MultiLineString":case"Polygon":ve(t).forEach(function(h){o.push(ps(h,s))});break;case"MultiPolygon":ve(t).forEach(function(h){var c=[];h.forEach(function(g){c.push(ps(g,s))}),o.push(c)});break;case"Point":return t;case"MultiPoint":var l={};ve(t).forEach(function(h){var c=h.join("-");Object.prototype.hasOwnProperty.call(l,c)||(o.push(h),l[c]=!0)});break;default:throw new Error(s+" geometry not supported")}return t.coordinates?i===!0?(t.coordinates=o,t):{type:s,coordinates:o}:i===!0?(t.geometry.coordinates=o,t):We({type:s,coordinates:o},t.properties,{bbox:t.bbox,id:t.id})}function ps(t,e){const i=ve(t);if(i.length===2&&!xa(i[0],i[1]))return i;const s=[];let o=0,l=1,h=2;for(s.push(i[o]);h<i.length;)we(i[l],Pe([i[o],i[h]]))?l=h:(s.push(i[l]),o=l,l++,h=l),h++;if(s.push(i[l]),e==="Polygon"||e==="MultiPolygon"){if(we(s[0],Pe([s[1],s[s.length-2]]))&&(s.shift(),s.pop(),s.push(s[0])),s.length<4)throw new Error("invalid polygon, fewer than 4 points");if(!xa(s[0],s[s.length-1]))throw new Error("invalid polygon, first and last points not equal")}return s}function xa(t,e){return t[0]===e[0]&&t[1]===e[1]}function vf(t,e,i={}){let s=i.precision;if(s=s==null||isNaN(s)?6:s,typeof s!="number"||!(s>=0))throw new Error("precision must be a positive number");const o=qe(t).type,l=qe(e).type;return o!==l?!1:ys(dn(t),dn(e),{precision:s})}function Ea(t,e,{ignoreSelfIntersections:i=!0}={}){let s=!1;return Qe(t,o=>{Qe(e,l=>{if(s===!0)return!0;s=!ds(o.geometry,l.geometry,{ignoreSelfIntersections:i})})}),s}function yf(t,e,i,s,o){wa(t,e,i||0,s||t.length-1,o||mf)}function wa(t,e,i,s,o){for(;s>i;){if(s-i>600){var l=s-i+1,h=e-i+1,c=Math.log(l),g=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*g*(l-g)/l)*(h-l/2<0?-1:1),y=Math.max(i,Math.floor(e-h*g/l+d)),v=Math.min(s,Math.floor(e+(l-h)*g/l+d));wa(t,e,y,v,o)}var _=t[e],E=i,M=s;for(ur(t,i,e),o(t[s],_)>0&&ur(t,i,s);E<M;){for(ur(t,E,M),E++,M--;o(t[E],_)<0;)E++;for(;o(t[M],_)>0;)M--}o(t[i],_)===0?ur(t,i,M):(M++,ur(t,M,s)),M<=e&&(i=M+1),e<=M&&(s=M-1)}}function ur(t,e,i){var s=t[e];t[e]=t[i],t[i]=s}function mf(t,e){return t<e?-1:t>e?1:0}class dt{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let i=this.data;const s=[];if(!Jr(e,i))return s;const o=this.toBBox,l=[];for(;i;){for(let h=0;h<i.children.length;h++){const c=i.children[h],g=i.leaf?o(c):c;Jr(e,g)&&(i.leaf?s.push(c):xs(e,g)?this._all(c,s):l.push(c))}i=l.pop()}return s}collides(e){let i=this.data;if(!Jr(e,i))return!1;const s=[];for(;i;){for(let o=0;o<i.children.length;o++){const l=i.children[o],h=i.leaf?this.toBBox(l):l;if(Jr(e,h)){if(i.leaf||xs(e,h))return!0;s.push(l)}}i=s.pop()}return!1}load(e){if(!(e&&e.length))return this;if(e.length<this._minEntries){for(let s=0;s<e.length;s++)this.insert(e[s]);return this}let i=this._build(e.slice(),0,e.length-1,0);if(!this.data.children.length)this.data=i;else if(this.data.height===i.height)this._splitRoot(this.data,i);else{if(this.data.height<i.height){const s=this.data;this.data=i,i=s}this._insert(i,this.data.height-i.height-1,!0)}return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=Tn([]),this}remove(e,i){if(!e)return this;let s=this.data;const o=this.toBBox(e),l=[],h=[];let c,g,d;for(;s||l.length;){if(s||(s=l.pop(),g=l[l.length-1],c=h.pop(),d=!0),s.leaf){const y=pf(e,s.children,i);if(y!==-1)return s.children.splice(y,1),l.push(s),this._condense(l),this}!d&&!s.leaf&&xs(s,o)?(l.push(s),h.push(c),c=0,g=s,s=s.children[0]):g?(c++,s=g.children[c],d=!1):s=null}return this}toBBox(e){return e}compareMinX(e,i){return e.minX-i.minX}compareMinY(e,i){return e.minY-i.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,i){const s=[];for(;e;)e.leaf?i.push(...e.children):s.push(...e.children),e=s.pop();return i}_build(e,i,s,o){const l=s-i+1;let h=this._maxEntries,c;if(l<=h)return c=Tn(e.slice(i,s+1)),On(c,this.toBBox),c;o||(o=Math.ceil(Math.log(l)/Math.log(h)),h=Math.ceil(l/Math.pow(h,o-1))),c=Tn([]),c.leaf=!1,c.height=o;const g=Math.ceil(l/h),d=g*Math.ceil(Math.sqrt(h));ka(e,i,s,d,this.compareMinX);for(let y=i;y<=s;y+=d){const v=Math.min(y+d-1,s);ka(e,y,v,g,this.compareMinY);for(let _=y;_<=v;_+=g){const E=Math.min(_+g-1,v);c.children.push(this._build(e,_,E,o-1))}}return On(c,this.toBBox),c}_chooseSubtree(e,i,s,o){for(;o.push(i),!(i.leaf||o.length-1===s);){let l=1/0,h=1/0,c;for(let g=0;g<i.children.length;g++){const d=i.children[g],y=_s(d),v=Ef(e,d)-y;v<h?(h=v,l=y<l?y:l,c=d):v===h&&y<l&&(l=y,c=d)}i=c||i.children[0]}return i}_insert(e,i,s){const o=s?e:this.toBBox(e),l=[],h=this._chooseSubtree(o,this.data,i,l);for(h.children.push(e),cr(h,o);i>=0&&l[i].children.length>this._maxEntries;)this._split(l,i),i--;this._adjustParentBBoxes(o,l,i)}_split(e,i){const s=e[i],o=s.children.length,l=this._minEntries;this._chooseSplitAxis(s,l,o);const h=this._chooseSplitIndex(s,l,o),c=Tn(s.children.splice(h,s.children.length-h));c.height=s.height,c.leaf=s.leaf,On(s,this.toBBox),On(c,this.toBBox),i?e[i-1].children.push(c):this._splitRoot(s,c)}_splitRoot(e,i){this.data=Tn([e,i]),this.data.height=e.height+1,this.data.leaf=!1,On(this.data,this.toBBox)}_chooseSplitIndex(e,i,s){let o,l=1/0,h=1/0;for(let c=i;c<=s-i;c++){const g=lr(e,0,c,this.toBBox),d=lr(e,c,s,this.toBBox),y=wf(g,d),v=_s(g)+_s(d);y<l?(l=y,o=c,h=v<h?v:h):y===l&&v<h&&(h=v,o=c)}return o||s-i}_chooseSplitAxis(e,i,s){const o=e.leaf?this.compareMinX:_f,l=e.leaf?this.compareMinY:xf,h=this._allDistMargin(e,i,s,o),c=this._allDistMargin(e,i,s,l);h<c&&e.children.sort(o)}_allDistMargin(e,i,s,o){e.children.sort(o);const l=this.toBBox,h=lr(e,0,i,l),c=lr(e,s-i,s,l);let g=Kr(h)+Kr(c);for(let d=i;d<s-i;d++){const y=e.children[d];cr(h,e.leaf?l(y):y),g+=Kr(h)}for(let d=s-i-1;d>=i;d--){const y=e.children[d];cr(c,e.leaf?l(y):y),g+=Kr(c)}return g}_adjustParentBBoxes(e,i,s){for(let o=s;o>=0;o--)cr(i[o],e)}_condense(e){for(let i=e.length-1,s;i>=0;i--)e[i].children.length===0?i>0?(s=e[i-1].children,s.splice(s.indexOf(e[i]),1)):this.clear():On(e[i],this.toBBox)}}function pf(t,e,i){if(!i)return e.indexOf(t);for(let s=0;s<e.length;s++)if(i(t,e[s]))return s;return-1}function On(t,e){lr(t,0,t.children.length,e,t)}function lr(t,e,i,s,o){o||(o=Tn(null)),o.minX=1/0,o.minY=1/0,o.maxX=-1/0,o.maxY=-1/0;for(let l=e;l<i;l++){const h=t.children[l];cr(o,t.leaf?s(h):h)}return o}function cr(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function _f(t,e){return t.minX-e.minX}function xf(t,e){return t.minY-e.minY}function _s(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Kr(t){return t.maxX-t.minX+(t.maxY-t.minY)}function Ef(t,e){return(Math.max(e.maxX,t.maxX)-Math.min(e.minX,t.minX))*(Math.max(e.maxY,t.maxY)-Math.min(e.minY,t.minY))}function wf(t,e){const i=Math.max(t.minX,e.minX),s=Math.max(t.minY,e.minY),o=Math.min(t.maxX,e.maxX),l=Math.min(t.maxY,e.maxY);return Math.max(0,o-i)*Math.max(0,l-s)}function xs(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function Jr(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function Tn(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function ka(t,e,i,s,o){const l=[e,i];for(;l.length;){if(i=l.pop(),e=l.pop(),i-e<=s)continue;const h=e+Math.ceil((i-e)/s/2)*s;yf(t,h,e,i,o),l.push(e,h,h,i)}}function Qr(t){var e=new dt(t);return e.insert=function(i){if(i.type!=="Feature")throw new Error("invalid feature");return i.bbox=i.bbox?i.bbox:Fe(i),dt.prototype.insert.call(this,i)},e.load=function(i){var s=[];return Array.isArray(i)?i.forEach(function(o){if(o.type!=="Feature")throw new Error("invalid features");o.bbox=o.bbox?o.bbox:Fe(o),s.push(o)}):Le(i,function(o){if(o.type!=="Feature")throw new Error("invalid features");o.bbox=o.bbox?o.bbox:Fe(o),s.push(o)}),dt.prototype.load.call(this,s)},e.remove=function(i,s){if(i.type!=="Feature")throw new Error("invalid feature");return i.bbox=i.bbox?i.bbox:Fe(i),dt.prototype.remove.call(this,i,s)},e.clear=function(){return dt.prototype.clear.call(this)},e.search=function(i){var s=dt.prototype.search.call(this,this.toBBox(i));return he(s)},e.collides=function(i){return dt.prototype.collides.call(this,this.toBBox(i))},e.all=function(){var i=dt.prototype.all.call(this);return he(i)},e.toJSON=function(){return dt.prototype.toJSON.call(this)},e.fromJSON=function(i){return dt.prototype.fromJSON.call(this,i)},e.toBBox=function(i){var s;if(i.bbox)s=i.bbox;else if(Array.isArray(i)&&i.length===4)s=i;else if(Array.isArray(i)&&i.length===6)s=[i[0],i[1],i[3],i[4]];else if(i.type==="Feature")s=Fe(i);else if(i.type==="FeatureCollection")s=Fe(i);else throw new Error("invalid geojson");return{minX:s[0],minY:s[1],maxX:s[2],maxY:s[3]}},e}function hr(t){if(!t)throw new Error("geojson is required");const e=[];return Qe(t,i=>{kf(i,e)}),he(e)}function kf(t,e){let i=[];const s=t.geometry;if(s!==null){switch(s.type){case"Polygon":i=ve(s);break;case"LineString":i=[ve(s)]}i.forEach(o=>{If(o,t.properties).forEach(h=>{h.id=e.length,e.push(h)})})}}function If(t,e){const i=[];return t.reduce((s,o)=>{const l=Pe([s,o],e);return l.bbox=Nf(s,o),i.push(l),o}),i}function Nf(t,e){const i=t[0],s=t[1],o=e[0],l=e[1],h=i<o?i:o,c=s<l?s:l,g=i>o?i:o,d=s>l?s:l;return[h,c,g,d]}var Mf=Object.defineProperty,Sf=Object.defineProperties,Pf=Object.getOwnPropertyDescriptors,Ia=Object.getOwnPropertySymbols,Lf=Object.prototype.hasOwnProperty,bf=Object.prototype.propertyIsEnumerable,Na=(t,e,i)=>e in t?Mf(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Ma=(t,e)=>{for(var i in e||(e={}))Lf.call(e,i)&&Na(t,i,e[i]);if(Ia)for(var i of Ia(e))bf.call(e,i)&&Na(t,i,e[i]);return t},Sa=(t,e)=>Sf(t,Pf(e));function $t(t,e,i={}){if(!t||!e)throw new Error("lines and pt are required arguments");const s=Oe(e);let o=_e([1/0,1/0],{dist:1/0,index:-1,multiFeatureIndex:-1,location:-1}),l=0;return Qe(t,function(h,c,g){const d=ve(h);for(let y=0;y<d.length-1;y++){const v=_e(d[y]),_=Oe(v),E=_e(d[y+1]),M=Oe(E),R=Be(v,E,i);let Y,H;M[0]===s[0]&&M[1]===s[1]?[Y,H]=[M,!0]:_[0]===s[0]&&_[1]===s[1]?[Y,H]=[_,!1]:[Y,H]=Tf(_,M,s);const x=_e(Y,{dist:Be(e,Y,i),multiFeatureIndex:g,location:l+Be(v,Y,i)});x.properties.dist<o.properties.dist&&(o=Sa(Ma({},x),{properties:Sa(Ma({},x.properties),{index:H?y+1:y})})),l+=R}}),o}function vn(t,e){const[i,s,o]=t,[l,h,c]=e;return i*l+s*h+o*c}function fr(t,e){const[i,s,o]=t,[l,h,c]=e;return[s*c-o*h,o*l-i*c,i*h-s*l]}function Cf(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2))}function Pa(t){const e=Cf(t);return[t[0]/e,t[1]/e,t[2]/e]}function Es(t){const e=Ze(t[1]),i=Ze(t[0]);return[Math.cos(e)*Math.cos(i),Math.cos(e)*Math.sin(i),Math.sin(e)]}function Of(t){const[e,i,s]=t,o=Math.min(Math.max(s,-1),1),l=Tt(Math.asin(o));return[Tt(Math.atan2(i,e)),l]}function Tf(t,e,i){const s=Es(t),o=Es(e),l=Es(i),h=fr(s,o);if(h[0]===0&&h[1]===0&&h[2]===0)return vn(s,o)>0?[[...e],!0]:[[...i],!1];const c=fr(h,l);if(c[0]===0&&c[1]===0&&c[2]===0)return[[...e],!0];const g=fr(c,h),d=Pa(g),y=[-d[0],-d[1],-d[2]],v=vn(l,d)>vn(l,y)?d:y,_=Pa(h),E=vn(fr(s,v),_),M=vn(fr(v,o),_);return E>=0&&M>=0?[Of(v),!1]:vn(s,l)>vn(o,l)?[[...t],!1]:[[...e],!0]}function gr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Rf(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var i=function s(){var o=!1;try{o=this instanceof s}catch{}return o?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};i.prototype=e.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(t).forEach(function(s){var o=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(i,s,o.get?o:{enumerable:!0,get:function(){return t[s]}})}),i}var ws,La;function Af(){return La||(La=1,ws=function t(e,i){if(e===i)return!0;if(e&&i&&typeof e=="object"&&typeof i=="object"){if(e.constructor!==i.constructor)return!1;var s,o,l;if(Array.isArray(e)){if(s=e.length,s!=i.length)return!1;for(o=s;o--!==0;)if(!t(e[o],i[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===i.source&&e.flags===i.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===i.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===i.toString();if(l=Object.keys(e),s=l.length,s!==Object.keys(i).length)return!1;for(o=s;o--!==0;)if(!Object.prototype.hasOwnProperty.call(i,l[o]))return!1;for(o=s;o--!==0;){var h=l[o];if(!t(e[h],i[h]))return!1}return!0}return e!==e&&i!==i}),ws}var Df=Af();const dr=gr(Df);function ba(t,e,i={}){if(i=i||{},!Ce(i))throw new Error("options is invalid");var s=i.tolerance||0,o=[],l=Qr();const h=hr(t);l.load(h);var c;let g=[];return Vt(e,function(d){var y=!1;d&&(Le(l.search(d),function(v){if(y===!1){var _=ve(d).sort(),E=ve(v).sort();if(dr(_,E))y=!0,c?c=ks(c,d)||c:c=d;else if(s===0?we(_[0],v)&&we(_[1],v):$t(v,_[0]).properties.dist<=s&&$t(v,_[1]).properties.dist<=s)y=!0,c?c=ks(c,d)||c:c=d;else if(s===0?we(E[0],d)&&we(E[1],d):$t(d,E[0]).properties.dist<=s&&$t(d,E[1]).properties.dist<=s)if(c){const M=ks(c,v);M?c=M:g.push(v)}else c=v}}),y===!1&&c&&(o.push(c),g.length&&(o=o.concat(g),g=[]),c=void 0))}),c&&o.push(c),he(o)}function ks(t,e){var i=ve(e),s=ve(t),o=s[0],l=s[s.length-1],h=t.geometry.coordinates;if(dr(i[0],o))h.unshift(i[1]);else if(dr(i[0],l))h.push(i[1]);else if(dr(i[1],o))h.unshift(i[0]);else if(dr(i[1],l))h.push(i[0]);else return;return t}function Ff(t,e){const i=qe(t),s=qe(e),o=i.type,l=s.type;if(o==="MultiPoint"&&l!=="MultiPoint"||(o==="LineString"||o==="MultiLineString")&&l!=="LineString"&&l!=="MultiLineString"||(o==="Polygon"||o==="MultiPolygon")&&l!=="Polygon"&&l!=="MultiPolygon")throw new Error("features must be of the same type");if(o==="Point")throw new Error("Point geometry not supported");if(ys(t,e,{precision:6}))return!1;let h=0;switch(o){case"MultiPoint":for(var c=0;c<i.coordinates.length;c++)for(var g=0;g<s.coordinates.length;g++){var d=i.coordinates[c],y=s.coordinates[g];if(d[0]===y[0]&&d[1]===y[1])return!0}return!1;case"LineString":case"MultiLineString":Vt(t,v=>{Vt(e,_=>{ba(v,_).features.length&&h++})});break;case"Polygon":case"MultiPolygon":Vt(t,v=>{Vt(e,_=>{Rt(v,_).features.length&&h++})});break}return h>0}function qf(t,e){if(!t)throw new Error("line1 is required");if(!e)throw new Error("line2 is required");var i=Ca(t,"line1");if(i!=="LineString")throw new Error("line1 must be a LineString");var s=Ca(e,"line2");if(s!=="LineString")throw new Error("line2 must be a LineString");for(var o=hr(dn(t)).features,l=hr(dn(e)).features,h=0;h<o.length;h++){var c=o[h].geometry.coordinates;if(!l[h])break;var g=l[h].geometry.coordinates;if(!Bf(c,g))return!1}return!0}function Bf(t,e){var i=Sn(gn(t[0],t[1])),s=Sn(gn(e[0],e[1]));return i===s||(s-i)%180===0}function Ca(t,e){if(t.geometry&&t.geometry.type)return t.geometry.type;if(t.type)return t.type;throw new Error("Invalid GeoJSON object for "+e)}function Gf(t,e){var i=qe(t),s=qe(e),o=i.type,l=s.type;switch(o){case"Point":switch(l){case"LineString":return ot(i,s);case"MultiLineString":for(var h=!1,c=0;c<s.coordinates.length;c++)ot(i,{coordinates:s.coordinates[c]})&&(h=!0);return h;case"Polygon":for(var g=0;g<s.coordinates.length;g++)if(we(i,{type:"LineString",coordinates:s.coordinates[g]}))return!0;return!1;case"MultiPolygon":for(var g=0;g<s.coordinates.length;g++)for(var c=0;c<s.coordinates[g].length;c++)if(we(i,{type:"LineString",coordinates:s.coordinates[g][c]}))return!0;return!1;default:throw new Error("feature2 "+l+" geometry not supported")}case"MultiPoint":switch(l){case"LineString":for(var h=!1,g=0;g<i.coordinates.length;g++)if(h||ot({coordinates:i.coordinates[g]},s)&&(h=!0),we({type:"Point",coordinates:i.coordinates[g]},s,{ignoreEndVertices:!0}))return!1;return h;case"MultiLineString":for(var h=!1,g=0;g<i.coordinates.length;g++)for(var c=0;c<s.coordinates.length;c++)if(h||ot({coordinates:i.coordinates[g]},{coordinates:s.coordinates[c]})&&(h=!0),we({type:"Point",coordinates:i.coordinates[g]},{type:"LineString",coordinates:s.coordinates[c]},{ignoreEndVertices:!0}))return!1;return h;case"Polygon":for(var h=!1,g=0;g<i.coordinates.length;g++)if(h||we({type:"Point",coordinates:i.coordinates[g]},{type:"LineString",coordinates:s.coordinates[0]})&&(h=!0),xe({type:"Point",coordinates:i.coordinates[g]},s,{ignoreBoundary:!0}))return!1;return h;case"MultiPolygon":for(var h=!1,g=0;g<i.coordinates.length;g++)for(var c=0;c<s.coordinates.length;c++)if(h||we({type:"Point",coordinates:i.coordinates[g]},{type:"LineString",coordinates:s.coordinates[c][0]})&&(h=!0),xe({type:"Point",coordinates:i.coordinates[g]},{type:"Polygon",coordinates:s.coordinates[c]},{ignoreBoundary:!0}))return!1;return h;default:throw new Error("feature2 "+l+" geometry not supported")}case"LineString":switch(l){case"Point":return ot(s,i);case"MultiPoint":for(var h=!1,g=0;g<s.coordinates.length;g++)if(h||ot({coordinates:s.coordinates[g]},i)&&(h=!0),we({type:"Point",coordinates:s.coordinates[g]},i,{ignoreEndVertices:!0}))return!1;return h;case"LineString":var d=!1;if(ot({coordinates:i.coordinates[0]},s)&&(d=!0),ot({coordinates:i.coordinates[i.coordinates.length-1]},s)&&(d=!0),d===!1)return!1;for(var g=0;g<i.coordinates.length;g++)if(we({type:"Point",coordinates:i.coordinates[g]},s,{ignoreEndVertices:!0}))return!1;return d;case"MultiLineString":for(var d=!1,g=0;g<s.coordinates.length;g++){ot({coordinates:i.coordinates[0]},{coordinates:s.coordinates[g]})&&(d=!0),ot({coordinates:i.coordinates[i.coordinates.length-1]},{coordinates:s.coordinates[g]})&&(d=!0);for(var c=0;c<i.coordinates[g].length;c++)if(we({type:"Point",coordinates:i.coordinates[c]},{type:"LineString",coordinates:s.coordinates[g]},{ignoreEndVertices:!0}))return!1}return d;case"Polygon":for(var h=!1,g=0;g<i.coordinates.length;g++)if(h||we({type:"Point",coordinates:i.coordinates[g]},{type:"LineString",coordinates:s.coordinates[0]})&&(h=!0),xe({type:"Point",coordinates:i.coordinates[g]},s,{ignoreBoundary:!0}))return!1;return h;case"MultiPolygon":for(var h=!1,g=0;g<i.coordinates.length;g++){for(var c=0;c<s.coordinates.length;c++)h||we({type:"Point",coordinates:i.coordinates[g]},{type:"LineString",coordinates:s.coordinates[c][0]})&&(h=!0);if(xe({type:"Point",coordinates:i.coordinates[g]},s,{ignoreBoundary:!0}))return!1}return h;default:throw new Error("feature2 "+l+" geometry not supported")}case"MultiLineString":switch(l){case"Point":for(var g=0;g<i.coordinates.length;g++)if(ot(s,{coordinates:i.coordinates[g]}))return!0;return!1;case"MultiPoint":for(var h=!1,g=0;g<i.coordinates.length;g++)for(var c=0;c<s.coordinates.length;c++)if(h||ot({coordinates:s.coordinates[c]},{coordinates:i.coordinates[c]})&&(h=!0),we({type:"Point",coordinates:s.coordinates[c]},{type:"LineString",coordinates:i.coordinates[c]},{ignoreEndVertices:!0}))return!1;return h;case"LineString":for(var d=!1,g=0;g<i.coordinates.length;g++){ot({coordinates:i.coordinates[g][0]},s)&&(d=!0),ot({coordinates:i.coordinates[g][i.coordinates[g].length-1]},s)&&(d=!0);for(var c=0;c<s.coordinates.length;c++)if(we({type:"Point",coordinates:s.coordinates[c]},{type:"LineString",coordinates:i.coordinates[g]},{ignoreEndVertices:!0}))return!1}return d;case"MultiLineString":for(var d=!1,g=0;g<i.coordinates.length;g++)for(var c=0;c<s.coordinates.length;c++){ot({coordinates:i.coordinates[g][0]},{coordinates:s.coordinates[c]})&&(d=!0),ot({coordinates:i.coordinates[g][i.coordinates[g].length-1]},{coordinates:s.coordinates[c]})&&(d=!0);for(var y=0;y<i.coordinates[g].length;y++)if(we({type:"Point",coordinates:i.coordinates[g][y]},{type:"LineString",coordinates:s.coordinates[c]},{ignoreEndVertices:!0}))return!1}return d;case"Polygon":for(var h=!1,g=0;g<i.coordinates.length;g++)for(var c=0;c<i.coordinates.length;c++)if(h||we({type:"Point",coordinates:i.coordinates[g][c]},{type:"LineString",coordinates:s.coordinates[0]})&&(h=!0),xe({type:"Point",coordinates:i.coordinates[g][c]},s,{ignoreBoundary:!0}))return!1;return h;case"MultiPolygon":for(var h=!1,g=0;g<s.coordinates[0].length;g++)for(var c=0;c<i.coordinates.length;c++)for(var y=0;y<i.coordinates[c].length;y++)if(h||we({type:"Point",coordinates:i.coordinates[c][y]},{type:"LineString",coordinates:s.coordinates[0][g]})&&(h=!0),xe({type:"Point",coordinates:i.coordinates[c][y]},{type:"Polygon",coordinates:[s.coordinates[0][g]]},{ignoreBoundary:!0}))return!1;return h;default:throw new Error("feature2 "+l+" geometry not supported")}case"Polygon":switch(l){case"Point":for(var g=0;g<i.coordinates.length;g++)if(we(s,{type:"LineString",coordinates:i.coordinates[g]}))return!0;return!1;case"MultiPoint":for(var h=!1,g=0;g<s.coordinates.length;g++)if(h||we({type:"Point",coordinates:s.coordinates[g]},{type:"LineString",coordinates:i.coordinates[0]})&&(h=!0),xe({type:"Point",coordinates:s.coordinates[g]},i,{ignoreBoundary:!0}))return!1;return h;case"LineString":for(var h=!1,g=0;g<s.coordinates.length;g++)if(h||we({type:"Point",coordinates:s.coordinates[g]},{type:"LineString",coordinates:i.coordinates[0]})&&(h=!0),xe({type:"Point",coordinates:s.coordinates[g]},i,{ignoreBoundary:!0}))return!1;return h;case"MultiLineString":for(var h=!1,g=0;g<s.coordinates.length;g++)for(var c=0;c<s.coordinates[g].length;c++)if(h||we({type:"Point",coordinates:s.coordinates[g][c]},{type:"LineString",coordinates:i.coordinates[0]})&&(h=!0),xe({type:"Point",coordinates:s.coordinates[g][c]},i,{ignoreBoundary:!0}))return!1;return h;case"Polygon":for(var h=!1,g=0;g<i.coordinates[0].length;g++)if(h||we({type:"Point",coordinates:i.coordinates[0][g]},{type:"LineString",coordinates:s.coordinates[0]})&&(h=!0),xe({type:"Point",coordinates:i.coordinates[0][g]},s,{ignoreBoundary:!0}))return!1;return h;case"MultiPolygon":for(var h=!1,g=0;g<s.coordinates[0].length;g++)for(var c=0;c<i.coordinates[0].length;c++)if(h||we({type:"Point",coordinates:i.coordinates[0][c]},{type:"LineString",coordinates:s.coordinates[0][g]})&&(h=!0),xe({type:"Point",coordinates:i.coordinates[0][c]},{type:"Polygon",coordinates:s.coordinates[0][g]},{ignoreBoundary:!0}))return!1;return h;default:throw new Error("feature2 "+l+" geometry not supported")}case"MultiPolygon":switch(l){case"Point":for(var g=0;g<i.coordinates[0].length;g++)if(we(s,{type:"LineString",coordinates:i.coordinates[0][g]}))return!0;return!1;case"MultiPoint":for(var h=!1,g=0;g<i.coordinates[0].length;g++)for(var c=0;c<s.coordinates.length;c++)if(h||we({type:"Point",coordinates:s.coordinates[c]},{type:"LineString",coordinates:i.coordinates[0][g]})&&(h=!0),xe({type:"Point",coordinates:s.coordinates[c]},{type:"Polygon",coordinates:i.coordinates[0][g]},{ignoreBoundary:!0}))return!1;return h;case"LineString":for(var h=!1,g=0;g<i.coordinates[0].length;g++)for(var c=0;c<s.coordinates.length;c++)if(h||we({type:"Point",coordinates:s.coordinates[c]},{type:"LineString",coordinates:i.coordinates[0][g]})&&(h=!0),xe({type:"Point",coordinates:s.coordinates[c]},{type:"Polygon",coordinates:i.coordinates[0][g]},{ignoreBoundary:!0}))return!1;return h;case"MultiLineString":for(var h=!1,g=0;g<i.coordinates.length;g++)for(var c=0;c<s.coordinates.length;c++)for(var y=0;y<s.coordinates[c].length;y++)if(h||we({type:"Point",coordinates:s.coordinates[c][y]},{type:"LineString",coordinates:i.coordinates[g][0]})&&(h=!0),xe({type:"Point",coordinates:s.coordinates[c][y]},{type:"Polygon",coordinates:[i.coordinates[g][0]]},{ignoreBoundary:!0}))return!1;return h;case"Polygon":for(var h=!1,g=0;g<i.coordinates[0].length;g++)for(var c=0;c<i.coordinates[0][g].length;c++)if(h||we({type:"Point",coordinates:i.coordinates[0][g][c]},{type:"LineString",coordinates:s.coordinates[0]})&&(h=!0),xe({type:"Point",coordinates:i.coordinates[0][g][c]},s,{ignoreBoundary:!0}))return!1;return h;case"MultiPolygon":for(var h=!1,g=0;g<i.coordinates[0].length;g++)for(var c=0;c<s.coordinates[0].length;c++)for(var y=0;y<i.coordinates[0].length;y++)if(h||we({type:"Point",coordinates:i.coordinates[0][g][y]},{type:"LineString",coordinates:s.coordinates[0][c]})&&(h=!0),xe({type:"Point",coordinates:i.coordinates[0][g][y]},{type:"Polygon",coordinates:s.coordinates[0][c]},{ignoreBoundary:!0}))return!1;return h;default:throw new Error("feature2 "+l+" geometry not supported")}default:throw new Error("feature1 "+o+" geometry not supported")}}function ot(t,e){return!!(Oa(e.coordinates[0],t.coordinates)||Oa(e.coordinates[e.coordinates.length-1],t.coordinates))}function Oa(t,e){return t[0]===e[0]&&t[1]===e[1]}function Yf(t){if(!t.type)return!1;const e=qe(t),i=e.type,s=e.coordinates;switch(i){case"Point":return s.length>1;case"MultiPoint":for(var o=0;o<s.length;o++)if(s[o].length<2)return!1;return!0;case"LineString":if(s.length<2)return!1;for(var o=0;o<s.length;o++)if(s[o].length<2)return!1;return!0;case"MultiLineString":if(s.length<2)return!1;for(var o=0;o<s.length;o++)if(s[o].length<2)return!1;return!0;case"Polygon":for(var o=0;o<e.coordinates.length;o++)if(s[o].length<4||!Ta(s[o])||Ra(s[o])||o>0&&Rt(ye([s[0]]),ye([s[o]])).features.length>1)return!1;return!0;case"MultiPolygon":for(var o=0;o<e.coordinates.length;o++)for(var l=e.coordinates[o],h=0;h<l.length;h++)if(l[h].length<4||!Ta(l[h])||Ra(l[h])||h===0&&!zf(l,e.coordinates,o)||h>0&&Rt(ye([l[0]]),ye([l[h]])).features.length>1)return!1;return!0;default:return!1}}function Ta(t){return t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]}function Ra(t){for(var e=0;e<t.length-1;e++)for(var i=t[e],s=e+1;s<t.length-2;s++){var o=[t[s],t[s+1]];if(we(i,Pe(o)))return!0}return!1}function zf(t,e,i){for(var s=ye(t),o=i+1;o<e.length;o++)if(!ds(s,ye(e[o]))&&ha(s,Pe(e[o][0])))return!1;return!0}function Aa(t,e){var i=qe(t),s=qe(e),o=i.type,l=s.type;switch(o){case"Point":switch(l){case"MultiPoint":return Xf(i,s);case"LineString":return we(i,s,{ignoreEndVertices:!0});case"Polygon":case"MultiPolygon":return xe(i,s,{ignoreBoundary:!0});default:throw new Error("feature2 "+l+" geometry not supported")}case"MultiPoint":switch(l){case"MultiPoint":return Uf(i,s);case"LineString":return Vf(i,s);case"Polygon":case"MultiPolygon":return Hf(i,s);default:throw new Error("feature2 "+l+" geometry not supported")}case"LineString":switch(l){case"LineString":return $f(i,s);case"Polygon":case"MultiPolygon":return Zf(i,s);default:throw new Error("feature2 "+l+" geometry not supported")}case"Polygon":switch(l){case"Polygon":case"MultiPolygon":return Wf(i,s);default:throw new Error("feature2 "+l+" geometry not supported")}default:throw new Error("feature1 "+o+" geometry not supported")}}function Xf(t,e){var i,s=!1;for(i=0;i<e.coordinates.length;i++)if(Fa(e.coordinates[i],t.coordinates)){s=!0;break}return s}function Uf(t,e){for(var i=0;i<t.coordinates.length;i++){for(var s=!1,o=0;o<e.coordinates.length;o++)Fa(t.coordinates[i],e.coordinates[o])&&(s=!0);if(!s)return!1}return!0}function Vf(t,e){for(var i=!1,s=0;s<t.coordinates.length;s++){if(!we(t.coordinates[s],e))return!1;i||(i=we(t.coordinates[s],e,{ignoreEndVertices:!0}))}return i}function Hf(t,e){for(var i=!0,s=!1,o=0;o<t.coordinates.length;o++){if(s=xe(t.coordinates[o],e),!s){i=!1;break}s=xe(t.coordinates[o],e,{ignoreBoundary:!0})}return i&&s}function $f(t,e){for(var i=0;i<t.coordinates.length;i++)if(!we(t.coordinates[i],e))return!1;return!0}function Zf(t,e){var i=Fe(e),s=Fe(t);if(!Da(i,s))return!1;for(var o=!1,l=0;l<t.coordinates.length;l++){if(!xe(t.coordinates[l],e))return!1;if(o||(o=xe(t.coordinates[l],e,{ignoreBoundary:!0})),!o&&l<t.coordinates.length-1){var h=Kf(t.coordinates[l],t.coordinates[l+1]);o=xe(h,e,{ignoreBoundary:!0})}}return o}function Wf(t,e){var i=Fe(t),s=Fe(e);if(!Da(s,i))return!1;for(var o=0;o<t.coordinates[0].length;o++)if(!xe(t.coordinates[0][o],e))return!1;return!0}function Da(t,e){return!(t[0]>e[0]||t[2]<e[2]||t[1]>e[1]||t[3]<e[3])}function Fa(t,e){return t[0]===e[0]&&t[1]===e[1]}function Kf(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2]}function jr(t,e={}){const i=Fe(t),s=(i[0]+i[2])/2,o=(i[1]+i[3])/2;return _e([s,o],e.properties,e)}var ei={exports:{}},Jf=ei.exports,qa;function Qf(){return qa||(qa=1,(function(t,e){(function(i,s){t.exports=s()})(Jf,(function(){function i(u,n){(n==null||n>u.length)&&(n=u.length);for(var r=0,a=Array(n);r<n;r++)a[r]=u[r];return a}function s(u,n,r){return n=y(n),(function(a,f){if(f&&(typeof f=="object"||typeof f=="function"))return f;if(f!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return(function(m){if(m===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m})(a)})(u,_()?Reflect.construct(n,r||[],y(u).constructor):n.apply(u,r))}function o(u,n){if(!(u instanceof n))throw new TypeError("Cannot call a class as a function")}function l(u,n,r){if(_())return Reflect.construct.apply(null,arguments);var a=[null];a.push.apply(a,n);var f=new(u.bind.apply(u,a));return r&&E(f,r.prototype),f}function h(u,n){for(var r=0;r<n.length;r++){var a=n[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(u,Y(a.key),a)}}function c(u,n,r){return n&&h(u.prototype,n),r&&h(u,r),Object.defineProperty(u,"prototype",{writable:!1}),u}function g(u,n){var r=typeof Symbol<"u"&&u[Symbol.iterator]||u["@@iterator"];if(!r){if(Array.isArray(u)||(r=H(u))||n){r&&(u=r);var a=0,f=function(){};return{s:f,n:function(){return a>=u.length?{done:!0}:{done:!1,value:u[a++]}},e:function(T){throw T},f}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var m,p=!0,I=!1;return{s:function(){r=r.call(u)},n:function(){var T=r.next();return p=T.done,T},e:function(T){I=!0,m=T},f:function(){try{p||r.return==null||r.return()}finally{if(I)throw m}}}}function d(){return d=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(u,n,r){var a=(function(m,p){for(;!{}.hasOwnProperty.call(m,p)&&(m=y(m))!==null;);return m})(u,n);if(a){var f=Object.getOwnPropertyDescriptor(a,n);return f.get?f.get.call(arguments.length<3?u:r):f.value}},d.apply(null,arguments)}function y(u){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},y(u)}function v(u,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");u.prototype=Object.create(n&&n.prototype,{constructor:{value:u,writable:!0,configurable:!0}}),Object.defineProperty(u,"prototype",{writable:!1}),n&&E(u,n)}function _(){try{var u=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch{}return(_=function(){return!!u})()}function E(u,n){return E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},E(u,n)}function M(u,n,r,a){var f=d(y(1&a?u.prototype:u),n,r);return 2&a&&typeof f=="function"?function(m){return f.apply(r,m)}:f}function R(u){return(function(n){if(Array.isArray(n))return i(n)})(u)||(function(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)})(u)||H(u)||(function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
3
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function Y(u){var n=(function(r,a){if(typeof r!="object"||!r)return r;var f=r[Symbol.toPrimitive];if(f!==void 0){var m=f.call(r,a);if(typeof m!="object")return m;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)})(u,"string");return typeof n=="symbol"?n:n+""}function H(u,n){if(u){if(typeof u=="string")return i(u,n);var r={}.toString.call(u).slice(8,-1);return r==="Object"&&u.constructor&&(r=u.constructor.name),r==="Map"||r==="Set"?Array.from(u):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(u,n):void 0}}function x(u){var n=typeof Map=="function"?new Map:void 0;return x=function(r){if(r===null||!(function(f){try{return Function.toString.call(f).indexOf("[native code]")!==-1}catch{return typeof f=="function"}})(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(n!==void 0){if(n.has(r))return n.get(r);n.set(r,a)}function a(){return l(r,arguments,y(this).constructor)}return a.prototype=Object.create(r.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),E(a,r)},x(u)}var S=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"getEndCapStyle",value:function(){return this._endCapStyle}},{key:"isSingleSided",value:function(){return this._isSingleSided}},{key:"setQuadrantSegments",value:function(n){this._quadrantSegments=n,this._quadrantSegments===0&&(this._joinStyle=u.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=u.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),n<=0&&(this._quadrantSegments=1),this._joinStyle!==u.JOIN_ROUND&&(this._quadrantSegments=u.DEFAULT_QUADRANT_SEGMENTS)}},{key:"getJoinStyle",value:function(){return this._joinStyle}},{key:"setJoinStyle",value:function(n){this._joinStyle=n}},{key:"setSimplifyFactor",value:function(n){this._simplifyFactor=n<0?0:n}},{key:"getSimplifyFactor",value:function(){return this._simplifyFactor}},{key:"getQuadrantSegments",value:function(){return this._quadrantSegments}},{key:"setEndCapStyle",value:function(n){this._endCapStyle=n}},{key:"getMitreLimit",value:function(){return this._mitreLimit}},{key:"setMitreLimit",value:function(n){this._mitreLimit=n}},{key:"setSingleSided",value:function(n){this._isSingleSided=n}}],[{key:"constructor_",value:function(){if(this._quadrantSegments=u.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=u.CAP_ROUND,this._joinStyle=u.JOIN_ROUND,this._mitreLimit=u.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=u.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this.setQuadrantSegments(n)}else if(arguments.length===2){var r=arguments[0],a=arguments[1];this.setQuadrantSegments(r),this.setEndCapStyle(a)}else if(arguments.length===4){var f=arguments[0],m=arguments[1],p=arguments[2],I=arguments[3];this.setQuadrantSegments(f),this.setEndCapStyle(m),this.setJoinStyle(p),this.setMitreLimit(I)}}}},{key:"bufferDistanceError",value:function(n){var r=Math.PI/2/n;return 1-Math.cos(r/2)}}])})();S.CAP_ROUND=1,S.CAP_FLAT=2,S.CAP_SQUARE=3,S.JOIN_ROUND=1,S.JOIN_MITRE=2,S.JOIN_BEVEL=3,S.DEFAULT_QUADRANT_SEGMENTS=8,S.DEFAULT_MITRE_LIMIT=5,S.DEFAULT_SIMPLIFY_FACTOR=.01;var b=(function(u){function n(r){var a;return o(this,n),(a=s(this,n,[r])).name=Object.keys({Exception:n})[0],a}return v(n,u),c(n,[{key:"toString",value:function(){return this.message}}])})(x(Error)),C=(function(u){function n(r){var a;return o(this,n),(a=s(this,n,[r])).name=Object.keys({IllegalArgumentException:n})[0],a}return v(n,u),c(n)})(b),A=(function(){return c((function u(){o(this,u)}),[{key:"filter",value:function(u){}}])})();function q(){}function w(){}function N(){}var L,D,F,X,z,V,k,O,P=(function(){return c((function u(){o(this,u)}),null,[{key:"equalsWithTolerance",value:function(u,n,r){return Math.abs(u-n)<=r}}])})(),G=(function(){return c((function u(n,r){o(this,u),this.low=r||0,this.high=n||0}),null,[{key:"toBinaryString",value:function(u){var n,r="";for(n=2147483648;n>0;n>>>=1)r+=(u.high&n)===n?"1":"0";for(n=2147483648;n>0;n>>>=1)r+=(u.low&n)===n?"1":"0";return r}}])})();function B(){}function Z(){}B.NaN=NaN,B.isNaN=function(u){return Number.isNaN(u)},B.isInfinite=function(u){return!Number.isFinite(u)},B.MAX_VALUE=Number.MAX_VALUE,B.POSITIVE_INFINITY=Number.POSITIVE_INFINITY,B.NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY,typeof Float64Array=="function"&&typeof Int32Array=="function"?(V=2146435072,k=new Float64Array(1),O=new Int32Array(k.buffer),B.doubleToLongBits=function(u){k[0]=u;var n=0|O[0],r=0|O[1];return(r&V)===V&&1048575&r&&n!==0&&(n=0,r=2146959360),new G(r,n)},B.longBitsToDouble=function(u){return O[0]=u.low,O[1]=u.high,k[0]}):(L=1023,D=Math.log2,F=Math.floor,X=Math.pow,z=(function(){for(var u=53;u>0;u--){var n=X(2,u)-1;if(F(D(n))+1===u)return n}return 0})(),B.doubleToLongBits=function(u){var n,r,a,f,m,p,I,T,U;if(u<0||1/u===Number.NEGATIVE_INFINITY?(p=1<<31,u=-u):p=0,u===0)return new G(T=p,U=0);if(u===1/0)return new G(T=2146435072|p,U=0);if(u!=u)return new G(T=2146959360,U=0);if(f=0,U=0,(n=F(u))>1)if(n<=z)(f=F(D(n)))<=20?(U=0,T=n<<20-f&1048575):(U=n%(r=X(2,a=f-20))<<32-a,T=n/r&1048575);else for(a=n,U=0;(a=F(r=a/2))!==0;)f++,U>>>=1,U|=(1&T)<<31,T>>>=1,r!==a&&(T|=524288);if(I=f+L,m=n===0,n=u-n,f<52&&n!==0)for(a=0;;){if((r=2*n)>=1?(n=r-1,m?(I--,m=!1):(a<<=1,a|=1,f++)):(n=r,m?--I==0&&(f++,m=!1):(a<<=1,f++)),f===20)T|=a,a=0;else if(f===52){U|=a;break}if(r===1){f<20?T|=a<<20-f:f<52&&(U|=a<<52-f);break}}return T|=I<<20,new G(T|=p,U)},B.longBitsToDouble=function(u){var n,r,a,f,m=u.high,p=u.low,I=m&1<<31?-1:1;for(a=((2146435072&m)>>20)-L,f=0,r=1<<19,n=1;n<=20;n++)m&r&&(f+=X(2,-n)),r>>>=1;for(r=1<<31,n=21;n<=52;n++)p&r&&(f+=X(2,-n)),r>>>=1;if(a===-1023){if(f===0)return 0*I;a=-1022}else{if(a===1024)return f===0?I/0:NaN;f+=1}return I*f*X(2,a)});var K=(function(u){function n(r){var a;return o(this,n),(a=s(this,n,[r])).name=Object.keys({RuntimeException:n})[0],a}return v(n,u),c(n)})(b),ee=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,null,[{key:"constructor_",value:function(){if(arguments.length===0)K.constructor_.call(this);else if(arguments.length===1){var r=arguments[0];K.constructor_.call(this,r)}}}])})(K),j=(function(){function u(){o(this,u)}return c(u,null,[{key:"shouldNeverReachHere",value:function(){if(arguments.length===0)u.shouldNeverReachHere(null);else if(arguments.length===1){var n=arguments[0];throw new ee("Should never reach here"+(n!==null?": "+n:""))}}},{key:"isTrue",value:function(){if(arguments.length===1){var n=arguments[0];u.isTrue(n,null)}else if(arguments.length===2){var r=arguments[1];if(!arguments[0])throw r===null?new ee:new ee(r)}}},{key:"equals",value:function(){if(arguments.length===2){var n=arguments[0],r=arguments[1];u.equals(n,r,null)}else if(arguments.length===3){var a=arguments[0],f=arguments[1],m=arguments[2];if(!f.equals(a))throw new ee("Expected "+a+" but encountered "+f+(m!==null?": "+m:""))}}}])})(),te=new ArrayBuffer(8),re=new Float64Array(te),se=new Int32Array(te),W=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"getM",value:function(){return B.NaN}},{key:"setOrdinate",value:function(n,r){switch(n){case u.X:this.x=r;break;case u.Y:this.y=r;break;case u.Z:this.setZ(r);break;default:throw new C("Invalid ordinate index: "+n)}}},{key:"equals2D",value:function(){if(arguments.length===1){var n=arguments[0];return this.x===n.x&&this.y===n.y}if(arguments.length===2){var r=arguments[0],a=arguments[1];return!!P.equalsWithTolerance(this.x,r.x,a)&&!!P.equalsWithTolerance(this.y,r.y,a)}}},{key:"setM",value:function(n){throw new C("Invalid ordinate index: "+u.M)}},{key:"getZ",value:function(){return this.z}},{key:"getOrdinate",value:function(n){switch(n){case u.X:return this.x;case u.Y:return this.y;case u.Z:return this.getZ()}throw new C("Invalid ordinate index: "+n)}},{key:"equals3D",value:function(n){return this.x===n.x&&this.y===n.y&&(this.getZ()===n.getZ()||B.isNaN(this.getZ())&&B.isNaN(n.getZ()))}},{key:"equals",value:function(n){return n instanceof u&&this.equals2D(n)}},{key:"equalInZ",value:function(n,r){return P.equalsWithTolerance(this.getZ(),n.getZ(),r)}},{key:"setX",value:function(n){this.x=n}},{key:"compareTo",value:function(n){var r=n;return this.x<r.x?-1:this.x>r.x?1:this.y<r.y?-1:this.y>r.y?1:0}},{key:"getX",value:function(){return this.x}},{key:"setZ",value:function(n){this.z=n}},{key:"clone",value:function(){try{return null}catch(n){if(n instanceof CloneNotSupportedException)return j.shouldNeverReachHere("this shouldn't happen because this class is Cloneable"),null;throw n}}},{key:"copy",value:function(){return new u(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+")"}},{key:"distance3D",value:function(n){var r=this.x-n.x,a=this.y-n.y,f=this.getZ()-n.getZ();return Math.sqrt(r*r+a*a+f*f)}},{key:"getY",value:function(){return this.y}},{key:"setY",value:function(n){this.y=n}},{key:"distance",value:function(n){var r=this.x-n.x,a=this.y-n.y;return Math.sqrt(r*r+a*a)}},{key:"hashCode",value:function(){var n=17;return n=37*(n=37*n+u.hashCode(this.x))+u.hashCode(this.y)}},{key:"setCoordinate",value:function(n){this.x=n.x,this.y=n.y,this.z=n.getZ()}},{key:"interfaces_",get:function(){return[q,w,N]}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)u.constructor_.call(this,0,0);else if(arguments.length===1){var n=arguments[0];u.constructor_.call(this,n.x,n.y,n.getZ())}else if(arguments.length===2){var r=arguments[0],a=arguments[1];u.constructor_.call(this,r,a,u.NULL_ORDINATE)}else if(arguments.length===3){var f=arguments[0],m=arguments[1],p=arguments[2];this.x=f,this.y=m,this.z=p}}},{key:"hashCode",value:function(n){return re[0]=n,se[0]^se[1]}}])})(),ge=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"compare",value:function(n,r){var a=u.compare(n.x,r.x);if(a!==0)return a;var f=u.compare(n.y,r.y);return f!==0?f:this._dimensionsToTest<=2?0:u.compare(n.getZ(),r.getZ())}},{key:"interfaces_",get:function(){return[Z]}}],[{key:"constructor_",value:function(){if(this._dimensionsToTest=2,arguments.length===0)u.constructor_.call(this,2);else if(arguments.length===1){var n=arguments[0];if(n!==2&&n!==3)throw new C("only 2 or 3 dimensions may be specified");this._dimensionsToTest=n}}},{key:"compare",value:function(n,r){return n<r?-1:n>r?1:B.isNaN(n)?B.isNaN(r)?0:-1:B.isNaN(r)?1:0}}])})();W.DimensionalComparator=ge,W.NULL_ORDINATE=B.NaN,W.X=0,W.Y=1,W.Z=2,W.M=3;var le=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"getArea",value:function(){return this.getWidth()*this.getHeight()}},{key:"equals",value:function(n){if(!(n instanceof u))return!1;var r=n;return this.isNull()?r.isNull():this._maxx===r.getMaxX()&&this._maxy===r.getMaxY()&&this._minx===r.getMinX()&&this._miny===r.getMinY()}},{key:"intersection",value:function(n){if(this.isNull()||n.isNull()||!this.intersects(n))return new u;var r=this._minx>n._minx?this._minx:n._minx,a=this._miny>n._miny?this._miny:n._miny;return new u(r,this._maxx<n._maxx?this._maxx:n._maxx,a,this._maxy<n._maxy?this._maxy:n._maxy)}},{key:"isNull",value:function(){return this._maxx<this._minx}},{key:"getMaxX",value:function(){return this._maxx}},{key:"covers",value:function(){if(arguments.length===1){if(arguments[0]instanceof W){var n=arguments[0];return this.covers(n.x,n.y)}if(arguments[0]instanceof u){var r=arguments[0];return!this.isNull()&&!r.isNull()&&r.getMinX()>=this._minx&&r.getMaxX()<=this._maxx&&r.getMinY()>=this._miny&&r.getMaxY()<=this._maxy}}else if(arguments.length===2){var a=arguments[0],f=arguments[1];return!this.isNull()&&a>=this._minx&&a<=this._maxx&&f>=this._miny&&f<=this._maxy}}},{key:"intersects",value:function(){if(arguments.length===1){if(arguments[0]instanceof u){var n=arguments[0];return!this.isNull()&&!n.isNull()&&!(n._minx>this._maxx||n._maxx<this._minx||n._miny>this._maxy||n._maxy<this._miny)}if(arguments[0]instanceof W){var r=arguments[0];return this.intersects(r.x,r.y)}}else if(arguments.length===2){if(arguments[0]instanceof W&&arguments[1]instanceof W){var a=arguments[0],f=arguments[1];return!this.isNull()&&!((a.x<f.x?a.x:f.x)>this._maxx)&&!((a.x>f.x?a.x:f.x)<this._minx)&&!((a.y<f.y?a.y:f.y)>this._maxy)&&!((a.y>f.y?a.y:f.y)<this._miny)}if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var m=arguments[0],p=arguments[1];return!this.isNull()&&!(m>this._maxx||m<this._minx||p>this._maxy||p<this._miny)}}}},{key:"getMinY",value:function(){return this._miny}},{key:"getDiameter",value:function(){if(this.isNull())return 0;var n=this.getWidth(),r=this.getHeight();return Math.sqrt(n*n+r*r)}},{key:"getMinX",value:function(){return this._minx}},{key:"expandToInclude",value:function(){if(arguments.length===1){if(arguments[0]instanceof W){var n=arguments[0];this.expandToInclude(n.x,n.y)}else if(arguments[0]instanceof u){var r=arguments[0];if(r.isNull())return null;this.isNull()?(this._minx=r.getMinX(),this._maxx=r.getMaxX(),this._miny=r.getMinY(),this._maxy=r.getMaxY()):(r._minx<this._minx&&(this._minx=r._minx),r._maxx>this._maxx&&(this._maxx=r._maxx),r._miny<this._miny&&(this._miny=r._miny),r._maxy>this._maxy&&(this._maxy=r._maxy))}}else if(arguments.length===2){var a=arguments[0],f=arguments[1];this.isNull()?(this._minx=a,this._maxx=a,this._miny=f,this._maxy=f):(a<this._minx&&(this._minx=a),a>this._maxx&&(this._maxx=a),f<this._miny&&(this._miny=f),f>this._maxy&&(this._maxy=f))}}},{key:"minExtent",value:function(){if(this.isNull())return 0;var n=this.getWidth(),r=this.getHeight();return n<r?n:r}},{key:"getWidth",value:function(){return this.isNull()?0:this._maxx-this._minx}},{key:"compareTo",value:function(n){var r=n;return this.isNull()?r.isNull()?0:-1:r.isNull()?1:this._minx<r._minx?-1:this._minx>r._minx?1:this._miny<r._miny?-1:this._miny>r._miny?1:this._maxx<r._maxx?-1:this._maxx>r._maxx?1:this._maxy<r._maxy?-1:this._maxy>r._maxy?1:0}},{key:"translate",value:function(n,r){if(this.isNull())return null;this.init(this.getMinX()+n,this.getMaxX()+n,this.getMinY()+r,this.getMaxY()+r)}},{key:"copy",value:function(){return new u(this)}},{key:"toString",value:function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"}},{key:"setToNull",value:function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1}},{key:"disjoint",value:function(n){return!(!this.isNull()&&!n.isNull())||n._minx>this._maxx||n._maxx<this._minx||n._miny>this._maxy||n._maxy<this._miny}},{key:"getHeight",value:function(){return this.isNull()?0:this._maxy-this._miny}},{key:"maxExtent",value:function(){if(this.isNull())return 0;var n=this.getWidth(),r=this.getHeight();return n>r?n:r}},{key:"expandBy",value:function(){if(arguments.length===1){var n=arguments[0];this.expandBy(n,n)}else if(arguments.length===2){var r=arguments[0],a=arguments[1];if(this.isNull())return null;this._minx-=r,this._maxx+=r,this._miny-=a,this._maxy+=a,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}}},{key:"contains",value:function(){if(arguments.length===1){if(arguments[0]instanceof u){var n=arguments[0];return this.covers(n)}if(arguments[0]instanceof W){var r=arguments[0];return this.covers(r)}}else if(arguments.length===2){var a=arguments[0],f=arguments[1];return this.covers(a,f)}}},{key:"centre",value:function(){return this.isNull()?null:new W((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)}},{key:"init",value:function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof W){var n=arguments[0];this.init(n.x,n.x,n.y,n.y)}else if(arguments[0]instanceof u){var r=arguments[0];this._minx=r._minx,this._maxx=r._maxx,this._miny=r._miny,this._maxy=r._maxy}}else if(arguments.length===2){var a=arguments[0],f=arguments[1];this.init(a.x,f.x,a.y,f.y)}else if(arguments.length===4){var m=arguments[0],p=arguments[1],I=arguments[2],T=arguments[3];m<p?(this._minx=m,this._maxx=p):(this._minx=p,this._maxx=m),I<T?(this._miny=I,this._maxy=T):(this._miny=T,this._maxy=I)}}},{key:"getMaxY",value:function(){return this._maxy}},{key:"distance",value:function(n){if(this.intersects(n))return 0;var r=0;this._maxx<n._minx?r=n._minx-this._maxx:this._minx>n._maxx&&(r=this._minx-n._maxx);var a=0;return this._maxy<n._miny?a=n._miny-this._maxy:this._miny>n._maxy&&(a=this._miny-n._maxy),r===0?a:a===0?r:Math.sqrt(r*r+a*a)}},{key:"hashCode",value:function(){var n=17;return n=37*(n=37*(n=37*(n=37*n+W.hashCode(this._minx))+W.hashCode(this._maxx))+W.hashCode(this._miny))+W.hashCode(this._maxy)}},{key:"interfaces_",get:function(){return[q,N]}}],[{key:"constructor_",value:function(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,arguments.length===0)this.init();else if(arguments.length===1){if(arguments[0]instanceof W){var n=arguments[0];this.init(n.x,n.x,n.y,n.y)}else if(arguments[0]instanceof u){var r=arguments[0];this.init(r)}}else if(arguments.length===2){var a=arguments[0],f=arguments[1];this.init(a.x,f.x,a.y,f.y)}else if(arguments.length===4){var m=arguments[0],p=arguments[1],I=arguments[2],T=arguments[3];this.init(m,p,I,T)}}},{key:"intersects",value:function(){if(arguments.length===3){var n=arguments[0],r=arguments[1],a=arguments[2];return a.x>=(n.x<r.x?n.x:r.x)&&a.x<=(n.x>r.x?n.x:r.x)&&a.y>=(n.y<r.y?n.y:r.y)&&a.y<=(n.y>r.y?n.y:r.y)}if(arguments.length===4){var f=arguments[0],m=arguments[1],p=arguments[2],I=arguments[3],T=Math.min(p.x,I.x),U=Math.max(p.x,I.x),J=Math.min(f.x,m.x),Q=Math.max(f.x,m.x);return!(J>U)&&!(Q<T)&&(T=Math.min(p.y,I.y),U=Math.max(p.y,I.y),J=Math.min(f.y,m.y),Q=Math.max(f.y,m.y),!(J>U)&&!(Q<T))}}}])})(),oe=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"isGeometryCollection",value:function(){return this.getTypeCode()===u.TYPECODE_GEOMETRYCOLLECTION}},{key:"getFactory",value:function(){return this._factory}},{key:"getGeometryN",value:function(n){return this}},{key:"getArea",value:function(){return 0}},{key:"isRectangle",value:function(){return!1}},{key:"equalsExact",value:function(n){return this===n||this.equalsExact(n,0)}},{key:"geometryChanged",value:function(){this.apply(u.geometryChangedFilter)}},{key:"geometryChangedAction",value:function(){this._envelope=null}},{key:"equalsNorm",value:function(n){return n!==null&&this.norm().equalsExact(n.norm())}},{key:"getLength",value:function(){return 0}},{key:"getNumGeometries",value:function(){return 1}},{key:"compareTo",value:function(){var n;if(arguments.length===1){var r=arguments[0];return n=r,this.getTypeCode()!==n.getTypeCode()?this.getTypeCode()-n.getTypeCode():this.isEmpty()&&n.isEmpty()?0:this.isEmpty()?-1:n.isEmpty()?1:this.compareToSameClass(r)}if(arguments.length===2){var a=arguments[0],f=arguments[1];return n=a,this.getTypeCode()!==n.getTypeCode()?this.getTypeCode()-n.getTypeCode():this.isEmpty()&&n.isEmpty()?0:this.isEmpty()?-1:n.isEmpty()?1:this.compareToSameClass(a,f)}}},{key:"getUserData",value:function(){return this._userData}},{key:"getSRID",value:function(){return this._SRID}},{key:"getEnvelope",value:function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())}},{key:"checkNotGeometryCollection",value:function(n){if(n.getTypeCode()===u.TYPECODE_GEOMETRYCOLLECTION)throw new C("This method does not support GeometryCollection arguments")}},{key:"equal",value:function(n,r,a){return a===0?n.equals(r):n.distance(r)<=a}},{key:"norm",value:function(){var n=this.copy();return n.normalize(),n}},{key:"reverse",value:function(){var n=this.reverseInternal();return this.envelope!=null&&(n.envelope=this.envelope.copy()),n.setSRID(this.getSRID()),n}},{key:"copy",value:function(){var n=this.copyInternal();return n.envelope=this._envelope==null?null:this._envelope.copy(),n._SRID=this._SRID,n._userData=this._userData,n}},{key:"getPrecisionModel",value:function(){return this._factory.getPrecisionModel()}},{key:"getEnvelopeInternal",value:function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new le(this._envelope)}},{key:"setSRID",value:function(n){this._SRID=n}},{key:"setUserData",value:function(n){this._userData=n}},{key:"compare",value:function(n,r){for(var a=n.iterator(),f=r.iterator();a.hasNext()&&f.hasNext();){var m=a.next(),p=f.next(),I=m.compareTo(p);if(I!==0)return I}return a.hasNext()?1:f.hasNext()?-1:0}},{key:"hashCode",value:function(){return this.getEnvelopeInternal().hashCode()}},{key:"isEquivalentClass",value:function(n){return this.getClass()===n.getClass()}},{key:"isGeometryCollectionOrDerived",value:function(){return this.getTypeCode()===u.TYPECODE_GEOMETRYCOLLECTION||this.getTypeCode()===u.TYPECODE_MULTIPOINT||this.getTypeCode()===u.TYPECODE_MULTILINESTRING||this.getTypeCode()===u.TYPECODE_MULTIPOLYGON}},{key:"interfaces_",get:function(){return[w,q,N]}},{key:"getClass",value:function(){return u}}],[{key:"hasNonEmptyElements",value:function(n){for(var r=0;r<n.length;r++)if(!n[r].isEmpty())return!0;return!1}},{key:"hasNullElements",value:function(n){for(var r=0;r<n.length;r++)if(n[r]===null)return!0;return!1}}])})();oe.constructor_=function(u){u&&(this._envelope=null,this._userData=null,this._factory=u,this._SRID=u.getSRID())},oe.TYPECODE_POINT=0,oe.TYPECODE_MULTIPOINT=1,oe.TYPECODE_LINESTRING=2,oe.TYPECODE_LINEARRING=3,oe.TYPECODE_MULTILINESTRING=4,oe.TYPECODE_POLYGON=5,oe.TYPECODE_MULTIPOLYGON=6,oe.TYPECODE_GEOMETRYCOLLECTION=7,oe.TYPENAME_POINT="Point",oe.TYPENAME_MULTIPOINT="MultiPoint",oe.TYPENAME_LINESTRING="LineString",oe.TYPENAME_LINEARRING="LinearRing",oe.TYPENAME_MULTILINESTRING="MultiLineString",oe.TYPENAME_POLYGON="Polygon",oe.TYPENAME_MULTIPOLYGON="MultiPolygon",oe.TYPENAME_GEOMETRYCOLLECTION="GeometryCollection",oe.geometryChangedFilter={get interfaces_(){return[A]},filter:function(u){u.geometryChangedAction()}};var $=(function(){function u(){o(this,u)}return c(u,null,[{key:"toLocationSymbol",value:function(n){switch(n){case u.EXTERIOR:return"e";case u.BOUNDARY:return"b";case u.INTERIOR:return"i";case u.NONE:return"-"}throw new C("Unknown location value: "+n)}}])})();$.INTERIOR=0,$.BOUNDARY=1,$.EXTERIOR=2,$.NONE=-1;var Me=(function(){return c((function u(){o(this,u)}),[{key:"add",value:function(){}},{key:"addAll",value:function(){}},{key:"isEmpty",value:function(){}},{key:"iterator",value:function(){}},{key:"size",value:function(){}},{key:"toArray",value:function(){}},{key:"remove",value:function(){}}])})(),Se=(function(u){function n(r){var a;return o(this,n),(a=s(this,n,[r])).name=Object.keys({NoSuchElementException:n})[0],a}return v(n,u),c(n)})(b),ue=(function(u){function n(r){var a;return o(this,n),(a=s(this,n,[r])).name=Object.keys({UnsupportedOperationException:n})[0],a}return v(n,u),c(n)})(b),ke=(function(u){function n(){return o(this,n),s(this,n,arguments)}return v(n,u),c(n,[{key:"contains",value:function(){}}])})(Me),ct=(function(u){function n(r){var a;return o(this,n),(a=s(this,n)).map=new Map,r instanceof Me&&a.addAll(r),a}return v(n,u),c(n,[{key:"contains",value:function(r){var a=r.hashCode?r.hashCode():r;return!!this.map.has(a)}},{key:"add",value:function(r){var a=r.hashCode?r.hashCode():r;return!this.map.has(a)&&!!this.map.set(a,r)}},{key:"addAll",value:function(r){var a,f=g(r);try{for(f.s();!(a=f.n()).done;){var m=a.value;this.add(m)}}catch(p){f.e(p)}finally{f.f()}return!0}},{key:"remove",value:function(){throw new ue}},{key:"size",value:function(){return this.map.size}},{key:"isEmpty",value:function(){return this.map.size===0}},{key:"toArray",value:function(){return Array.from(this.map.values())}},{key:"iterator",value:function(){return new Bt(this.map)}},{key:Symbol.iterator,value:function(){return this.map}}])})(ke),Bt=(function(){return c((function u(n){o(this,u),this.iterator=n.values();var r=this.iterator.next(),a=r.done,f=r.value;this.done=a,this.value=f}),[{key:"next",value:function(){if(this.done)throw new Se;var u=this.value,n=this.iterator.next(),r=n.done,a=n.value;return this.done=r,this.value=a,u}},{key:"hasNext",value:function(){return!this.done}},{key:"remove",value:function(){throw new ue}}])})(),ie=(function(){function u(){o(this,u)}return c(u,null,[{key:"opposite",value:function(n){return n===u.LEFT?u.RIGHT:n===u.RIGHT?u.LEFT:n}}])})();ie.ON=0,ie.LEFT=1,ie.RIGHT=2;var Yi=(function(u){function n(r){var a;return o(this,n),(a=s(this,n,[r])).name=Object.keys({EmptyStackException:n})[0],a}return v(n,u),c(n)})(b),zi=(function(u){function n(r){var a;return o(this,n),(a=s(this,n,[r])).name=Object.keys({IndexOutOfBoundsException:n})[0],a}return v(n,u),c(n)})(b),Jt=(function(u){function n(){return o(this,n),s(this,n,arguments)}return v(n,u),c(n,[{key:"get",value:function(){}},{key:"set",value:function(){}},{key:"isEmpty",value:function(){}}])})(Me),yo=(function(u){function n(){var r;return o(this,n),(r=s(this,n)).array=[],r}return v(n,u),c(n,[{key:"add",value:function(r){return this.array.push(r),!0}},{key:"get",value:function(r){if(r<0||r>=this.size())throw new zi;return this.array[r]}},{key:"push",value:function(r){return this.array.push(r),r}},{key:"pop",value:function(){if(this.array.length===0)throw new Yi;return this.array.pop()}},{key:"peek",value:function(){if(this.array.length===0)throw new Yi;return this.array[this.array.length-1]}},{key:"empty",value:function(){return this.array.length===0}},{key:"isEmpty",value:function(){return this.empty()}},{key:"search",value:function(r){return this.array.indexOf(r)}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}}])})(Jt);function Ie(u,n){return u.interfaces_&&u.interfaces_.indexOf(n)>-1}var ln=(function(){return c((function u(n){o(this,u),this.str=n}),[{key:"append",value:function(u){this.str+=u}},{key:"setCharAt",value:function(u,n){this.str=this.str.substr(0,u)+n+this.str.substr(u+1)}},{key:"toString",value:function(){return this.str}}])})(),cn=(function(){function u(n){o(this,u),this.value=n}return c(u,[{key:"intValue",value:function(){return this.value}},{key:"compareTo",value:function(n){return this.value<n?-1:this.value>n?1:0}}],[{key:"compare",value:function(n,r){return n<r?-1:n>r?1:0}},{key:"isNan",value:function(n){return Number.isNaN(n)}},{key:"valueOf",value:function(n){return new u(n)}}])})(),mo=(function(){return c((function u(){o(this,u)}),null,[{key:"isWhitespace",value:function(u){return u<=32&&u>=0||u===127}},{key:"toUpperCase",value:function(u){return u.toUpperCase()}}])})(),pe=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"le",value:function(n){return this._hi<n._hi||this._hi===n._hi&&this._lo<=n._lo}},{key:"extractSignificantDigits",value:function(n,r){var a=this.abs(),f=u.magnitude(a._hi),m=u.TEN.pow(f);(a=a.divide(m)).gt(u.TEN)?(a=a.divide(u.TEN),f+=1):a.lt(u.ONE)&&(a=a.multiply(u.TEN),f-=1);for(var p=f+1,I=new ln,T=u.MAX_PRINT_DIGITS-1,U=0;U<=T;U++){n&&U===p&&I.append(".");var J=Math.trunc(a._hi);if(J<0)break;var Q=!1,ne=0;J>9?(Q=!0,ne="9"):ne="0"+J,I.append(ne),a=a.subtract(u.valueOf(J)).multiply(u.TEN),Q&&a.selfAdd(u.TEN);var ce=!0,fe=u.magnitude(a._hi);if(fe<0&&Math.abs(fe)>=T-U&&(ce=!1),!ce)break}return r[0]=f,I.toString()}},{key:"sqr",value:function(){return this.multiply(this)}},{key:"doubleValue",value:function(){return this._hi+this._lo}},{key:"subtract",value:function(){if(arguments[0]instanceof u){var n=arguments[0];return this.add(n.negate())}if(typeof arguments[0]=="number"){var r=arguments[0];return this.add(-r)}}},{key:"equals",value:function(){if(arguments.length===1&&arguments[0]instanceof u){var n=arguments[0];return this._hi===n._hi&&this._lo===n._lo}}},{key:"isZero",value:function(){return this._hi===0&&this._lo===0}},{key:"selfSubtract",value:function(){if(arguments[0]instanceof u){var n=arguments[0];return this.isNaN()?this:this.selfAdd(-n._hi,-n._lo)}if(typeof arguments[0]=="number"){var r=arguments[0];return this.isNaN()?this:this.selfAdd(-r,0)}}},{key:"getSpecialNumberString",value:function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null}},{key:"min",value:function(n){return this.le(n)?this:n}},{key:"selfDivide",value:function(){if(arguments.length===1){if(arguments[0]instanceof u){var n=arguments[0];return this.selfDivide(n._hi,n._lo)}if(typeof arguments[0]=="number"){var r=arguments[0];return this.selfDivide(r,0)}}else if(arguments.length===2){var a,f,m,p,I=arguments[0],T=arguments[1],U=null,J=null,Q=null,ne=null;return m=this._hi/I,ne=(U=(Q=u.SPLIT*m)-(U=Q-m))*(J=(ne=u.SPLIT*I)-(J=ne-I))-(p=m*I)+U*(f=I-J)+(a=m-U)*J+a*f,ne=m+(Q=(this._hi-p-ne+this._lo-m*T)/I),this._hi=ne,this._lo=m-ne+Q,this}}},{key:"dump",value:function(){return"DD<"+this._hi+", "+this._lo+">"}},{key:"divide",value:function(){if(arguments[0]instanceof u){var n,r,a,f,m=arguments[0],p=null,I=null,T=null,U=null;return n=(a=this._hi/m._hi)-(p=(T=u.SPLIT*a)-(p=T-a)),U=p*(I=(U=u.SPLIT*m._hi)-(I=U-m._hi))-(f=a*m._hi)+p*(r=m._hi-I)+n*I+n*r,new u(U=a+(T=(this._hi-f-U+this._lo-a*m._lo)/m._hi),a-U+T)}if(typeof arguments[0]=="number"){var J=arguments[0];return B.isNaN(J)?u.createNaN():u.copy(this).selfDivide(J,0)}}},{key:"ge",value:function(n){return this._hi>n._hi||this._hi===n._hi&&this._lo>=n._lo}},{key:"pow",value:function(n){if(n===0)return u.valueOf(1);var r=new u(this),a=u.valueOf(1),f=Math.abs(n);if(f>1)for(;f>0;)f%2==1&&a.selfMultiply(r),(f/=2)>0&&(r=r.sqr());else a=r;return n<0?a.reciprocal():a}},{key:"ceil",value:function(){if(this.isNaN())return u.NaN;var n=Math.ceil(this._hi),r=0;return n===this._hi&&(r=Math.ceil(this._lo)),new u(n,r)}},{key:"compareTo",value:function(n){var r=n;return this._hi<r._hi?-1:this._hi>r._hi?1:this._lo<r._lo?-1:this._lo>r._lo?1:0}},{key:"rint",value:function(){return this.isNaN()?this:this.add(.5).floor()}},{key:"setValue",value:function(){if(arguments[0]instanceof u){var n=arguments[0];return this.init(n),this}if(typeof arguments[0]=="number"){var r=arguments[0];return this.init(r),this}}},{key:"max",value:function(n){return this.ge(n)?this:n}},{key:"sqrt",value:function(){if(this.isZero())return u.valueOf(0);if(this.isNegative())return u.NaN;var n=1/Math.sqrt(this._hi),r=this._hi*n,a=u.valueOf(r),f=this.subtract(a.sqr())._hi*(.5*n);return a.add(f)}},{key:"selfAdd",value:function(){if(arguments.length===1){if(arguments[0]instanceof u){var n=arguments[0];return this.selfAdd(n._hi,n._lo)}if(typeof arguments[0]=="number"){var r,a,f,m,p,I=arguments[0],T=null;return T=(f=this._hi+I)-(m=f-this._hi),a=(p=(T=I-m+(this._hi-T))+this._lo)+(f-(r=f+p)),this._hi=r+a,this._lo=a+(r-this._hi),this}}else if(arguments.length===2){var U,J,Q,ne,ce=arguments[0],fe=arguments[1],de=null,Re=null,be=null;Q=this._hi+ce,J=this._lo+fe,Re=Q-(be=Q-this._hi),de=J-(ne=J-this._lo);var Ye=(U=Q+(be=(Re=ce-be+(this._hi-Re))+J))+(be=(de=fe-ne+(this._lo-de))+(be+(Q-U))),it=be+(U-Ye);return this._hi=Ye,this._lo=it,this}}},{key:"selfMultiply",value:function(){if(arguments.length===1){if(arguments[0]instanceof u){var n=arguments[0];return this.selfMultiply(n._hi,n._lo)}if(typeof arguments[0]=="number"){var r=arguments[0];return this.selfMultiply(r,0)}}else if(arguments.length===2){var a,f,m=arguments[0],p=arguments[1],I=null,T=null,U=null,J=null;I=(U=u.SPLIT*this._hi)-this._hi,J=u.SPLIT*m,I=U-I,a=this._hi-I,T=J-m;var Q=(U=this._hi*m)+(J=I*(T=J-T)-U+I*(f=m-T)+a*T+a*f+(this._hi*p+this._lo*m)),ne=J+(I=U-Q);return this._hi=Q,this._lo=ne,this}}},{key:"selfSqr",value:function(){return this.selfMultiply(this)}},{key:"floor",value:function(){if(this.isNaN())return u.NaN;var n=Math.floor(this._hi),r=0;return n===this._hi&&(r=Math.floor(this._lo)),new u(n,r)}},{key:"negate",value:function(){return this.isNaN()?this:new u(-this._hi,-this._lo)}},{key:"clone",value:function(){try{return null}catch(n){if(n instanceof CloneNotSupportedException)return null;throw n}}},{key:"multiply",value:function(){if(arguments[0]instanceof u){var n=arguments[0];return n.isNaN()?u.createNaN():u.copy(this).selfMultiply(n)}if(typeof arguments[0]=="number"){var r=arguments[0];return B.isNaN(r)?u.createNaN():u.copy(this).selfMultiply(r,0)}}},{key:"isNaN",value:function(){return B.isNaN(this._hi)}},{key:"intValue",value:function(){return Math.trunc(this._hi)}},{key:"toString",value:function(){var n=u.magnitude(this._hi);return n>=-3&&n<=20?this.toStandardNotation():this.toSciNotation()}},{key:"toStandardNotation",value:function(){var n=this.getSpecialNumberString();if(n!==null)return n;var r=new Array(1).fill(null),a=this.extractSignificantDigits(!0,r),f=r[0]+1,m=a;if(a.charAt(0)===".")m="0"+a;else if(f<0)m="0."+u.stringOfChar("0",-f)+a;else if(a.indexOf(".")===-1){var p=f-a.length;m=a+u.stringOfChar("0",p)+".0"}return this.isNegative()?"-"+m:m}},{key:"reciprocal",value:function(){var n,r,a,f,m=null,p=null,I=null,T=null;n=(a=1/this._hi)-(m=(I=u.SPLIT*a)-(m=I-a)),p=(T=u.SPLIT*this._hi)-this._hi;var U=a+(I=(1-(f=a*this._hi)-(T=m*(p=T-p)-f+m*(r=this._hi-p)+n*p+n*r)-a*this._lo)/this._hi);return new u(U,a-U+I)}},{key:"toSciNotation",value:function(){if(this.isZero())return u.SCI_NOT_ZERO;var n=this.getSpecialNumberString();if(n!==null)return n;var r=new Array(1).fill(null),a=this.extractSignificantDigits(!1,r),f=u.SCI_NOT_EXPONENT_CHAR+r[0];if(a.charAt(0)==="0")throw new IllegalStateException("Found leading zero: "+a);var m="";a.length>1&&(m=a.substring(1));var p=a.charAt(0)+"."+m;return this.isNegative()?"-"+p+f:p+f}},{key:"abs",value:function(){return this.isNaN()?u.NaN:this.isNegative()?this.negate():new u(this)}},{key:"isPositive",value:function(){return this._hi>0||this._hi===0&&this._lo>0}},{key:"lt",value:function(n){return this._hi<n._hi||this._hi===n._hi&&this._lo<n._lo}},{key:"add",value:function(){if(arguments[0]instanceof u){var n=arguments[0];return u.copy(this).selfAdd(n)}if(typeof arguments[0]=="number"){var r=arguments[0];return u.copy(this).selfAdd(r)}}},{key:"init",value:function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var n=arguments[0];this._hi=n,this._lo=0}else if(arguments[0]instanceof u){var r=arguments[0];this._hi=r._hi,this._lo=r._lo}}else if(arguments.length===2){var a=arguments[0],f=arguments[1];this._hi=a,this._lo=f}}},{key:"gt",value:function(n){return this._hi>n._hi||this._hi===n._hi&&this._lo>n._lo}},{key:"isNegative",value:function(){return this._hi<0||this._hi===0&&this._lo<0}},{key:"trunc",value:function(){return this.isNaN()?u.NaN:this.isPositive()?this.floor():this.ceil()}},{key:"signum",value:function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0}},{key:"interfaces_",get:function(){return[N,q,w]}}],[{key:"constructor_",value:function(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var n=arguments[0];this.init(n)}else if(arguments[0]instanceof u){var r=arguments[0];this.init(r)}else if(typeof arguments[0]=="string"){var a=arguments[0];u.constructor_.call(this,u.parse(a))}}else if(arguments.length===2){var f=arguments[0],m=arguments[1];this.init(f,m)}}},{key:"determinant",value:function(){if(typeof arguments[3]=="number"&&typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],r=arguments[1],a=arguments[2],f=arguments[3];return u.determinant(u.valueOf(n),u.valueOf(r),u.valueOf(a),u.valueOf(f))}if(arguments[3]instanceof u&&arguments[2]instanceof u&&arguments[0]instanceof u&&arguments[1]instanceof u){var m=arguments[1],p=arguments[2],I=arguments[3];return arguments[0].multiply(I).selfSubtract(m.multiply(p))}}},{key:"sqr",value:function(n){return u.valueOf(n).selfMultiply(n)}},{key:"valueOf",value:function(){if(typeof arguments[0]=="string"){var n=arguments[0];return u.parse(n)}if(typeof arguments[0]=="number")return new u(arguments[0])}},{key:"sqrt",value:function(n){return u.valueOf(n).sqrt()}},{key:"parse",value:function(n){for(var r=0,a=n.length;mo.isWhitespace(n.charAt(r));)r++;var f=!1;if(r<a){var m=n.charAt(r);m!=="-"&&m!=="+"||(r++,m==="-"&&(f=!0))}for(var p=new u,I=0,T=0,U=0,J=!1;!(r>=a);){var Q=n.charAt(r);if(r++,mo.isDigit(Q)){var ne=Q-"0";p.selfMultiply(u.TEN),p.selfAdd(ne),I++}else{if(Q!=="."){if(Q==="e"||Q==="E"){var ce=n.substring(r);try{U=cn.parseInt(ce)}catch(Ye){throw Ye instanceof NumberFormatException?new NumberFormatException("Invalid exponent "+ce+" in string "+n):Ye}break}throw new NumberFormatException("Unexpected character '"+Q+"' at position "+r+" in string "+n)}T=I,J=!0}}var fe=p;J||(T=I);var de=I-T-U;if(de===0)fe=p;else if(de>0){var Re=u.TEN.pow(de);fe=p.divide(Re)}else if(de<0){var be=u.TEN.pow(-de);fe=p.multiply(be)}return f?fe.negate():fe}},{key:"createNaN",value:function(){return new u(B.NaN,B.NaN)}},{key:"copy",value:function(n){return new u(n)}},{key:"magnitude",value:function(n){var r=Math.abs(n),a=Math.log(r)/Math.log(10),f=Math.trunc(Math.floor(a));return 10*Math.pow(10,f)<=r&&(f+=1),f}},{key:"stringOfChar",value:function(n,r){for(var a=new ln,f=0;f<r;f++)a.append(n);return a.toString()}}])})();pe.PI=new pe(3.141592653589793,12246467991473532e-32),pe.TWO_PI=new pe(6.283185307179586,24492935982947064e-32),pe.PI_2=new pe(1.5707963267948966,6123233995736766e-32),pe.E=new pe(2.718281828459045,14456468917292502e-32),pe.NaN=new pe(B.NaN,B.NaN),pe.EPS=123259516440783e-46,pe.SPLIT=134217729,pe.MAX_PRINT_DIGITS=32,pe.TEN=pe.valueOf(10),pe.ONE=pe.valueOf(1),pe.SCI_NOT_EXPONENT_CHAR="E",pe.SCI_NOT_ZERO="0.0E0";var po=(function(){function u(){o(this,u)}return c(u,null,[{key:"orientationIndex",value:function(n,r,a){var f=u.orientationIndexFilter(n,r,a);if(f<=1)return f;var m=pe.valueOf(r.x).selfAdd(-n.x),p=pe.valueOf(r.y).selfAdd(-n.y),I=pe.valueOf(a.x).selfAdd(-r.x),T=pe.valueOf(a.y).selfAdd(-r.y);return m.selfMultiply(T).selfSubtract(p.selfMultiply(I)).signum()}},{key:"signOfDet2x2",value:function(){if(arguments[3]instanceof pe&&arguments[2]instanceof pe&&arguments[0]instanceof pe&&arguments[1]instanceof pe){var n=arguments[1],r=arguments[2],a=arguments[3];return arguments[0].multiply(a).selfSubtract(n.multiply(r)).signum()}if(typeof arguments[3]=="number"&&typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var f=arguments[0],m=arguments[1],p=arguments[2],I=arguments[3],T=pe.valueOf(f),U=pe.valueOf(m),J=pe.valueOf(p),Q=pe.valueOf(I);return T.multiply(Q).selfSubtract(U.multiply(J)).signum()}}},{key:"intersection",value:function(n,r,a,f){var m=new pe(n.y).selfSubtract(r.y),p=new pe(r.x).selfSubtract(n.x),I=new pe(n.x).selfMultiply(r.y).selfSubtract(new pe(r.x).selfMultiply(n.y)),T=new pe(a.y).selfSubtract(f.y),U=new pe(f.x).selfSubtract(a.x),J=new pe(a.x).selfMultiply(f.y).selfSubtract(new pe(f.x).selfMultiply(a.y)),Q=p.multiply(J).selfSubtract(U.multiply(I)),ne=T.multiply(I).selfSubtract(m.multiply(J)),ce=m.multiply(U).selfSubtract(T.multiply(p)),fe=Q.selfDivide(ce).doubleValue(),de=ne.selfDivide(ce).doubleValue();return B.isNaN(fe)||B.isInfinite(fe)||B.isNaN(de)||B.isInfinite(de)?null:new W(fe,de)}},{key:"orientationIndexFilter",value:function(n,r,a){var f=null,m=(n.x-a.x)*(r.y-a.y),p=(n.y-a.y)*(r.x-a.x),I=m-p;if(m>0){if(p<=0)return u.signum(I);f=m+p}else{if(!(m<0)||p>=0)return u.signum(I);f=-m-p}var T=u.DP_SAFE_EPSILON*f;return I>=T||-I>=T?u.signum(I):2}},{key:"signum",value:function(n){return n>0?1:n<0?-1:0}}])})();po.DP_SAFE_EPSILON=1e-15;var Te=(function(){return c((function u(){o(this,u)}),[{key:"getM",value:function(u){if(this.hasM()){var n=this.getDimension()-this.getMeasures();return this.getOrdinate(u,n)}return B.NaN}},{key:"setOrdinate",value:function(u,n,r){}},{key:"getZ",value:function(u){return this.hasZ()?this.getOrdinate(u,2):B.NaN}},{key:"size",value:function(){}},{key:"getOrdinate",value:function(u,n){}},{key:"getCoordinate",value:function(){}},{key:"getCoordinateCopy",value:function(u){}},{key:"createCoordinate",value:function(){}},{key:"getDimension",value:function(){}},{key:"hasM",value:function(){return this.getMeasures()>0}},{key:"getX",value:function(u){}},{key:"hasZ",value:function(){return this.getDimension()-this.getMeasures()>2}},{key:"getMeasures",value:function(){return 0}},{key:"expandEnvelope",value:function(u){}},{key:"copy",value:function(){}},{key:"getY",value:function(u){}},{key:"toCoordinateArray",value:function(){}},{key:"interfaces_",get:function(){return[w]}}])})();Te.X=0,Te.Y=1,Te.Z=2,Te.M=3;var Ee=(function(){function u(){o(this,u)}return c(u,null,[{key:"index",value:function(n,r,a){return po.orientationIndex(n,r,a)}},{key:"isCCW",value:function(){if(arguments[0]instanceof Array){var n=arguments[0],r=n.length-1;if(r<3)throw new C("Ring has fewer than 4 points, so orientation cannot be determined");for(var a=n[0],f=0,m=1;m<=r;m++){var p=n[m];p.y>a.y&&(a=p,f=m)}var I=f;do(I-=1)<0&&(I=r);while(n[I].equals2D(a)&&I!==f);var T=f;do T=(T+1)%r;while(n[T].equals2D(a)&&T!==f);var U=n[I],J=n[T];if(U.equals2D(a)||J.equals2D(a)||U.equals2D(J))return!1;var Q=u.index(U,a,J);return Q===0?U.x>J.x:Q>0}if(Ie(arguments[0],Te)){var ne=arguments[0],ce=ne.size()-1;if(ce<3)throw new C("Ring has fewer than 4 points, so orientation cannot be determined");for(var fe=ne.getCoordinate(0),de=0,Re=1;Re<=ce;Re++){var be=ne.getCoordinate(Re);be.y>fe.y&&(fe=be,de=Re)}var Ye=null,it=de;do(it-=1)<0&&(it=ce),Ye=ne.getCoordinate(it);while(Ye.equals2D(fe)&&it!==de);var ut=null,Nn=de;do Nn=(Nn+1)%ce,ut=ne.getCoordinate(Nn);while(ut.equals2D(fe)&&Nn!==de);if(Ye.equals2D(fe)||ut.equals2D(fe)||Ye.equals2D(ut))return!1;var Yr=u.index(Ye,fe,ut);return Yr===0?Ye.x>ut.x:Yr>0}}}])})();Ee.CLOCKWISE=-1,Ee.RIGHT=Ee.CLOCKWISE,Ee.COUNTERCLOCKWISE=1,Ee.LEFT=Ee.COUNTERCLOCKWISE,Ee.COLLINEAR=0,Ee.STRAIGHT=Ee.COLLINEAR;var Dm=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"getCoordinate",value:function(){return this._minCoord}},{key:"getRightmostSide",value:function(u,n){var r=this.getRightmostSideOfSegment(u,n);return r<0&&(r=this.getRightmostSideOfSegment(u,n-1)),r<0&&(this._minCoord=null,this.checkForRightmostCoordinate(u)),r}},{key:"findRightmostEdgeAtVertex",value:function(){var u=this._minDe.getEdge().getCoordinates();j.isTrue(this._minIndex>0&&this._minIndex<u.length,"rightmost point expected to be interior vertex of edge");var n=u[this._minIndex-1],r=u[this._minIndex+1],a=Ee.index(this._minCoord,r,n),f=!1;(n.y<this._minCoord.y&&r.y<this._minCoord.y&&a===Ee.COUNTERCLOCKWISE||n.y>this._minCoord.y&&r.y>this._minCoord.y&&a===Ee.CLOCKWISE)&&(f=!0),f&&(this._minIndex=this._minIndex-1)}},{key:"getRightmostSideOfSegment",value:function(u,n){var r=u.getEdge().getCoordinates();if(n<0||n+1>=r.length||r[n].y===r[n+1].y)return-1;var a=ie.LEFT;return r[n].y<r[n+1].y&&(a=ie.RIGHT),a}},{key:"getEdge",value:function(){return this._orientedDe}},{key:"checkForRightmostCoordinate",value:function(u){for(var n=u.getEdge().getCoordinates(),r=0;r<n.length-1;r++)(this._minCoord===null||n[r].x>this._minCoord.x)&&(this._minDe=u,this._minIndex=r,this._minCoord=n[r])}},{key:"findRightmostEdgeAtNode",value:function(){var u=this._minDe.getNode().getEdges();this._minDe=u.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)}},{key:"findEdge",value:function(u){for(var n=u.iterator();n.hasNext();){var r=n.next();r.isForward()&&this.checkForRightmostCoordinate(r)}j.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===ie.LEFT&&(this._orientedDe=this._minDe.getSym())}}],[{key:"constructor_",value:function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null}}])})(),Qt=(function(u){function n(r,a){var f;return o(this,n),(f=s(this,n,[a?r+" [ "+a+" ]":r])).pt=a?new W(a):void 0,f.name=Object.keys({TopologyException:n})[0],f}return v(n,u),c(n,[{key:"getCoordinate",value:function(){return this.pt}}])})(K),Fm=(function(){return c((function u(){o(this,u),this.array=[]}),[{key:"addLast",value:function(u){this.array.push(u)}},{key:"removeFirst",value:function(){return this.array.shift()}},{key:"isEmpty",value:function(){return this.array.length===0}}])})(),me=(function(u){function n(r){var a;return o(this,n),(a=s(this,n)).array=[],r instanceof Me&&a.addAll(r),a}return v(n,u),c(n,[{key:"interfaces_",get:function(){return[Jt,Me]}},{key:"ensureCapacity",value:function(){}},{key:"add",value:function(r){return arguments.length===1?this.array.push(r):this.array.splice(arguments[0],0,arguments[1]),!0}},{key:"clear",value:function(){this.array=[]}},{key:"addAll",value:function(r){var a,f=g(r);try{for(f.s();!(a=f.n()).done;){var m=a.value;this.array.push(m)}}catch(p){f.e(p)}finally{f.f()}}},{key:"set",value:function(r,a){var f=this.array[r];return this.array[r]=a,f}},{key:"iterator",value:function(){return new qm(this)}},{key:"get",value:function(r){if(r<0||r>=this.size())throw new zi;return this.array[r]}},{key:"isEmpty",value:function(){return this.array.length===0}},{key:"sort",value:function(r){r?this.array.sort((function(a,f){return r.compare(a,f)})):this.array.sort()}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}},{key:"remove",value:function(r){for(var a=0,f=this.array.length;a<f;a++)if(this.array[a]===r)return!!this.array.splice(a,1);return!1}},{key:Symbol.iterator,value:function(){return this.array.values()}}])})(Jt),qm=(function(){return c((function u(n){o(this,u),this.arrayList=n,this.position=0}),[{key:"next",value:function(){if(this.position===this.arrayList.size())throw new Se;return this.arrayList.get(this.position++)}},{key:"hasNext",value:function(){return this.position<this.arrayList.size()}},{key:"set",value:function(u){return this.arrayList.set(this.position-1,u)}},{key:"remove",value:function(){this.arrayList.remove(this.arrayList.get(this.position))}}])})(),Bm=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"clearVisitedEdges",value:function(){for(var u=this._dirEdgeList.iterator();u.hasNext();)u.next().setVisited(!1)}},{key:"getRightmostCoordinate",value:function(){return this._rightMostCoord}},{key:"computeNodeDepth",value:function(u){for(var n=null,r=u.getEdges().iterator();r.hasNext();){var a=r.next();if(a.isVisited()||a.getSym().isVisited()){n=a;break}}if(n===null)throw new Qt("unable to find edge to compute depths at "+u.getCoordinate());u.getEdges().computeDepths(n);for(var f=u.getEdges().iterator();f.hasNext();){var m=f.next();m.setVisited(!0),this.copySymDepths(m)}}},{key:"computeDepth",value:function(u){this.clearVisitedEdges();var n=this._finder.getEdge();n.getNode(),n.getLabel(),n.setEdgeDepths(ie.RIGHT,u),this.copySymDepths(n),this.computeDepths(n)}},{key:"create",value:function(u){this.addReachable(u),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()}},{key:"findResultEdges",value:function(){for(var u=this._dirEdgeList.iterator();u.hasNext();){var n=u.next();n.getDepth(ie.RIGHT)>=1&&n.getDepth(ie.LEFT)<=0&&!n.isInteriorAreaEdge()&&n.setInResult(!0)}}},{key:"computeDepths",value:function(u){var n=new ct,r=new Fm,a=u.getNode();for(r.addLast(a),n.add(a),u.setVisited(!0);!r.isEmpty();){var f=r.removeFirst();n.add(f),this.computeNodeDepth(f);for(var m=f.getEdges().iterator();m.hasNext();){var p=m.next().getSym();if(!p.isVisited()){var I=p.getNode();n.contains(I)||(r.addLast(I),n.add(I))}}}}},{key:"compareTo",value:function(u){var n=u;return this._rightMostCoord.x<n._rightMostCoord.x?-1:this._rightMostCoord.x>n._rightMostCoord.x?1:0}},{key:"getEnvelope",value:function(){if(this._env===null){for(var u=new le,n=this._dirEdgeList.iterator();n.hasNext();)for(var r=n.next().getEdge().getCoordinates(),a=0;a<r.length-1;a++)u.expandToInclude(r[a]);this._env=u}return this._env}},{key:"addReachable",value:function(u){var n=new yo;for(n.add(u);!n.empty();){var r=n.pop();this.add(r,n)}}},{key:"copySymDepths",value:function(u){var n=u.getSym();n.setDepth(ie.LEFT,u.getDepth(ie.RIGHT)),n.setDepth(ie.RIGHT,u.getDepth(ie.LEFT))}},{key:"add",value:function(u,n){u.setVisited(!0),this._nodes.add(u);for(var r=u.getEdges().iterator();r.hasNext();){var a=r.next();this._dirEdgeList.add(a);var f=a.getSym().getNode();f.isVisited()||n.push(f)}}},{key:"getNodes",value:function(){return this._nodes}},{key:"getDirectedEdges",value:function(){return this._dirEdgeList}},{key:"interfaces_",get:function(){return[q]}}],[{key:"constructor_",value:function(){this._finder=null,this._dirEdgeList=new me,this._nodes=new me,this._rightMostCoord=null,this._env=null,this._finder=new Dm}}])})(),_o=(function(){return c((function u(){o(this,u)}),null,[{key:"intersection",value:function(u,n,r,a){var f=u.x<n.x?u.x:n.x,m=u.y<n.y?u.y:n.y,p=u.x>n.x?u.x:n.x,I=u.y>n.y?u.y:n.y,T=r.x<a.x?r.x:a.x,U=r.y<a.y?r.y:a.y,J=r.x>a.x?r.x:a.x,Q=r.y>a.y?r.y:a.y,ne=((f>T?f:T)+(p<J?p:J))/2,ce=((m>U?m:U)+(I<Q?I:Q))/2,fe=u.x-ne,de=u.y-ce,Re=n.x-ne,be=n.y-ce,Ye=r.x-ne,it=r.y-ce,ut=a.x-ne,Nn=a.y-ce,Yr=de-be,ih=Re-fe,sh=fe*be-Re*de,oh=it-Nn,ah=ut-Ye,uh=Ye*Nn-ut*it,lh=Yr*ah-oh*ih,Ao=(ih*uh-ah*sh)/lh,Do=(oh*sh-Yr*uh)/lh;return B.isNaN(Ao)||B.isInfinite(Ao)||B.isNaN(Do)||B.isInfinite(Do)?null:new W(Ao+ne,Do+ce)}}])})(),It=(function(){return c((function u(){o(this,u)}),null,[{key:"arraycopy",value:function(u,n,r,a,f){for(var m=0,p=n;p<n+f;p++)r[a+m]=u[p],m++}},{key:"getProperty",value:function(u){return{"line.separator":`
4
+ `}[u]}}])})(),Tr=(function(){function u(){o(this,u)}return c(u,null,[{key:"log10",value:function(n){var r=Math.log(n);return B.isInfinite(r)||B.isNaN(r)?r:r/u.LOG_10}},{key:"min",value:function(n,r,a,f){var m=n;return r<m&&(m=r),a<m&&(m=a),f<m&&(m=f),m}},{key:"clamp",value:function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],r=arguments[1],a=arguments[2];return n<r?r:n>a?a:n}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var f=arguments[0],m=arguments[1],p=arguments[2];return f<m?m:f>p?p:f}}},{key:"wrap",value:function(n,r){return n<0?r- -n%r:n%r}},{key:"max",value:function(){if(arguments.length===3){var n=arguments[1],r=arguments[2],a=arguments[0];return n>a&&(a=n),r>a&&(a=r),a}if(arguments.length===4){var f=arguments[1],m=arguments[2],p=arguments[3],I=arguments[0];return f>I&&(I=f),m>I&&(I=m),p>I&&(I=p),I}}},{key:"average",value:function(n,r){return(n+r)/2}}])})();Tr.LOG_10=Math.log(10);var Gt=(function(){function u(){o(this,u)}return c(u,null,[{key:"segmentToSegment",value:function(n,r,a,f){if(n.equals(r))return u.pointToSegment(n,a,f);if(a.equals(f))return u.pointToSegment(f,n,r);var m=!1;if(le.intersects(n,r,a,f)){var p=(r.x-n.x)*(f.y-a.y)-(r.y-n.y)*(f.x-a.x);if(p===0)m=!0;else{var I=(n.y-a.y)*(f.x-a.x)-(n.x-a.x)*(f.y-a.y),T=((n.y-a.y)*(r.x-n.x)-(n.x-a.x)*(r.y-n.y))/p,U=I/p;(U<0||U>1||T<0||T>1)&&(m=!0)}}else m=!0;return m?Tr.min(u.pointToSegment(n,a,f),u.pointToSegment(r,a,f),u.pointToSegment(a,n,r),u.pointToSegment(f,n,r)):0}},{key:"pointToSegment",value:function(n,r,a){if(r.x===a.x&&r.y===a.y)return n.distance(r);var f=(a.x-r.x)*(a.x-r.x)+(a.y-r.y)*(a.y-r.y),m=((n.x-r.x)*(a.x-r.x)+(n.y-r.y)*(a.y-r.y))/f;if(m<=0)return n.distance(r);if(m>=1)return n.distance(a);var p=((r.y-n.y)*(a.x-r.x)-(r.x-n.x)*(a.y-r.y))/f;return Math.abs(p)*Math.sqrt(f)}},{key:"pointToLinePerpendicular",value:function(n,r,a){var f=(a.x-r.x)*(a.x-r.x)+(a.y-r.y)*(a.y-r.y),m=((r.y-n.y)*(a.x-r.x)-(r.x-n.x)*(a.y-r.y))/f;return Math.abs(m)*Math.sqrt(f)}},{key:"pointToSegmentString",value:function(n,r){if(r.length===0)throw new C("Line array must contain at least one vertex");for(var a=n.distance(r[0]),f=0;f<r.length-1;f++){var m=u.pointToSegment(n,r[f],r[f+1]);m<a&&(a=m)}return a}}])})(),_c=(function(){return c((function u(){o(this,u)}),[{key:"create",value:function(){if(arguments.length===1)arguments[0]instanceof Array||Ie(arguments[0],Te);else if(arguments.length!==2){if(arguments.length===3){var u=arguments[0],n=arguments[1];return this.create(u,n)}}}}])})(),Xi=(function(){return c((function u(){o(this,u)}),[{key:"filter",value:function(u){}}])})(),Gm=(function(){return c((function u(){o(this,u)}),null,[{key:"ofLine",value:function(u){var n=u.size();if(n<=1)return 0;var r=0,a=new W;u.getCoordinate(0,a);for(var f=a.x,m=a.y,p=1;p<n;p++){u.getCoordinate(p,a);var I=a.x,T=a.y,U=I-f,J=T-m;r+=Math.sqrt(U*U+J*J),f=I,m=T}return r}}])})(),xc=c((function u(){o(this,u)})),_n=(function(){function u(){o(this,u)}return c(u,null,[{key:"copyCoord",value:function(n,r,a,f){for(var m=Math.min(n.getDimension(),a.getDimension()),p=0;p<m;p++)a.setOrdinate(f,p,n.getOrdinate(r,p))}},{key:"isRing",value:function(n){var r=n.size();return r===0||!(r<=3)&&n.getOrdinate(0,Te.X)===n.getOrdinate(r-1,Te.X)&&n.getOrdinate(0,Te.Y)===n.getOrdinate(r-1,Te.Y)}},{key:"scroll",value:function(){if(arguments.length===2){if(Ie(arguments[0],Te)&&Number.isInteger(arguments[1])){var n=arguments[0],r=arguments[1];u.scroll(n,r,u.isRing(n))}else if(Ie(arguments[0],Te)&&arguments[1]instanceof W){var a=arguments[0],f=arguments[1],m=u.indexOf(f,a);if(m<=0)return null;u.scroll(a,m)}}else if(arguments.length===3){var p=arguments[0],I=arguments[1],T=arguments[2];if(I<=0)return null;for(var U=p.copy(),J=T?p.size()-1:p.size(),Q=0;Q<J;Q++)for(var ne=0;ne<p.getDimension();ne++)p.setOrdinate(Q,ne,U.getOrdinate((I+Q)%J,ne));if(T)for(var ce=0;ce<p.getDimension();ce++)p.setOrdinate(J,ce,p.getOrdinate(0,ce))}}},{key:"isEqual",value:function(n,r){var a=n.size();if(a!==r.size())return!1;for(var f=Math.min(n.getDimension(),r.getDimension()),m=0;m<a;m++)for(var p=0;p<f;p++){var I=n.getOrdinate(m,p),T=r.getOrdinate(m,p);if(n.getOrdinate(m,p)!==r.getOrdinate(m,p)&&(!B.isNaN(I)||!B.isNaN(T)))return!1}return!0}},{key:"minCoordinateIndex",value:function(){if(arguments.length===1){var n=arguments[0];return u.minCoordinateIndex(n,0,n.size()-1)}if(arguments.length===3){for(var r=arguments[0],a=arguments[2],f=-1,m=null,p=arguments[1];p<=a;p++){var I=r.getCoordinate(p);(m===null||m.compareTo(I)>0)&&(m=I,f=p)}return f}}},{key:"extend",value:function(n,r,a){var f=n.create(a,r.getDimension()),m=r.size();if(u.copy(r,0,f,0,m),m>0)for(var p=m;p<a;p++)u.copy(r,m-1,f,p,1);return f}},{key:"reverse",value:function(n){for(var r=n.size()-1,a=Math.trunc(r/2),f=0;f<=a;f++)u.swap(n,f,r-f)}},{key:"swap",value:function(n,r,a){if(r===a)return null;for(var f=0;f<n.getDimension();f++){var m=n.getOrdinate(r,f);n.setOrdinate(r,f,n.getOrdinate(a,f)),n.setOrdinate(a,f,m)}}},{key:"copy",value:function(n,r,a,f,m){for(var p=0;p<m;p++)u.copyCoord(n,r+p,a,f+p)}},{key:"ensureValidRing",value:function(n,r){var a=r.size();return a===0?r:a<=3?u.createClosedRing(n,r,4):r.getOrdinate(0,Te.X)===r.getOrdinate(a-1,Te.X)&&r.getOrdinate(0,Te.Y)===r.getOrdinate(a-1,Te.Y)?r:u.createClosedRing(n,r,a+1)}},{key:"indexOf",value:function(n,r){for(var a=0;a<r.size();a++)if(n.x===r.getOrdinate(a,Te.X)&&n.y===r.getOrdinate(a,Te.Y))return a;return-1}},{key:"createClosedRing",value:function(n,r,a){var f=n.create(a,r.getDimension()),m=r.size();u.copy(r,0,f,0,m);for(var p=m;p<a;p++)u.copy(r,0,f,p,1);return f}},{key:"minCoordinate",value:function(n){for(var r=null,a=0;a<n.size();a++){var f=n.getCoordinate(a);(r===null||r.compareTo(f)>0)&&(r=f)}return r}}])})(),ae=(function(){function u(){o(this,u)}return c(u,null,[{key:"toDimensionSymbol",value:function(n){switch(n){case u.FALSE:return u.SYM_FALSE;case u.TRUE:return u.SYM_TRUE;case u.DONTCARE:return u.SYM_DONTCARE;case u.P:return u.SYM_P;case u.L:return u.SYM_L;case u.A:return u.SYM_A}throw new C("Unknown dimension value: "+n)}},{key:"toDimensionValue",value:function(n){switch(mo.toUpperCase(n)){case u.SYM_FALSE:return u.FALSE;case u.SYM_TRUE:return u.TRUE;case u.SYM_DONTCARE:return u.DONTCARE;case u.SYM_P:return u.P;case u.SYM_L:return u.L;case u.SYM_A:return u.A}throw new C("Unknown dimension symbol: "+n)}}])})();ae.P=0,ae.L=1,ae.A=2,ae.FALSE=-1,ae.TRUE=-2,ae.DONTCARE=-3,ae.SYM_FALSE="F",ae.SYM_TRUE="T",ae.SYM_DONTCARE="*",ae.SYM_P="0",ae.SYM_L="1",ae.SYM_A="2";var Ui=(function(){return c((function u(){o(this,u)}),[{key:"filter",value:function(u){}}])})(),Vi=(function(){return c((function u(){o(this,u)}),[{key:"filter",value:function(u,n){}},{key:"isDone",value:function(){}},{key:"isGeometryChanged",value:function(){}}])})(),Rr=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"computeEnvelopeInternal",value:function(){return this.isEmpty()?new le:this._points.expandEnvelope(new le)}},{key:"isRing",value:function(){return this.isClosed()&&this.isSimple()}},{key:"getCoordinates",value:function(){return this._points.toCoordinateArray()}},{key:"copyInternal",value:function(){return new n(this._points.copy(),this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof oe){var r=arguments[0],a=arguments[1];if(!this.isEquivalentClass(r))return!1;var f=r;if(this._points.size()!==f._points.size())return!1;for(var m=0;m<this._points.size();m++)if(!this.equal(this._points.getCoordinate(m),f._points.getCoordinate(m),a))return!1;return!0}return M(n,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){for(var r=0;r<Math.trunc(this._points.size()/2);r++){var a=this._points.size()-1-r;if(!this._points.getCoordinate(r).equals(this._points.getCoordinate(a))){if(this._points.getCoordinate(r).compareTo(this._points.getCoordinate(a))>0){var f=this._points.copy();_n.reverse(f),this._points=f}return null}}}},{key:"getCoordinate",value:function(){return this.isEmpty()?null:this._points.getCoordinate(0)}},{key:"getBoundaryDimension",value:function(){return this.isClosed()?ae.FALSE:0}},{key:"isClosed",value:function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))}},{key:"reverseInternal",value:function(){var r=this._points.copy();return _n.reverse(r),this.getFactory().createLineString(r)}},{key:"getEndPoint",value:function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)}},{key:"getTypeCode",value:function(){return oe.TYPECODE_LINESTRING}},{key:"getDimension",value:function(){return 1}},{key:"getLength",value:function(){return Gm.ofLine(this._points)}},{key:"getNumPoints",value:function(){return this._points.size()}},{key:"compareToSameClass",value:function(){if(arguments.length===1){for(var r=arguments[0],a=0,f=0;a<this._points.size()&&f<r._points.size();){var m=this._points.getCoordinate(a).compareTo(r._points.getCoordinate(f));if(m!==0)return m;a++,f++}return a<this._points.size()?1:f<r._points.size()?-1:0}if(arguments.length===2){var p=arguments[0];return arguments[1].compare(this._points,p._points)}}},{key:"apply",value:function(){if(Ie(arguments[0],Xi))for(var r=arguments[0],a=0;a<this._points.size();a++)r.filter(this._points.getCoordinate(a));else if(Ie(arguments[0],Vi)){var f=arguments[0];if(this._points.size()===0)return null;for(var m=0;m<this._points.size()&&(f.filter(this._points,m),!f.isDone());m++);f.isGeometryChanged()&&this.geometryChanged()}else Ie(arguments[0],Ui)?arguments[0].filter(this):Ie(arguments[0],A)&&arguments[0].filter(this)}},{key:"getBoundary",value:function(){throw new ue}},{key:"isEquivalentClass",value:function(r){return r instanceof n}},{key:"getCoordinateN",value:function(r){return this._points.getCoordinate(r)}},{key:"getGeometryType",value:function(){return oe.TYPENAME_LINESTRING}},{key:"getCoordinateSequence",value:function(){return this._points}},{key:"isEmpty",value:function(){return this._points.size()===0}},{key:"init",value:function(r){if(r===null&&(r=this.getFactory().getCoordinateSequenceFactory().create([])),r.size()===1)throw new C("Invalid number of points in LineString (found "+r.size()+" - must be 0 or >= 2)");this._points=r}},{key:"isCoordinate",value:function(r){for(var a=0;a<this._points.size();a++)if(this._points.getCoordinate(a).equals(r))return!0;return!1}},{key:"getStartPoint",value:function(){return this.isEmpty()?null:this.getPointN(0)}},{key:"getPointN",value:function(r){return this.getFactory().createPoint(this._points.getCoordinate(r))}},{key:"interfaces_",get:function(){return[xc]}}],[{key:"constructor_",value:function(){if(this._points=null,arguments.length!==0){if(arguments.length===2){var r=arguments[0],a=arguments[1];oe.constructor_.call(this,a),this.init(r)}}}}])})(oe),Ec=c((function u(){o(this,u)})),xo=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"computeEnvelopeInternal",value:function(){if(this.isEmpty())return new le;var r=new le;return r.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),r}},{key:"getCoordinates",value:function(){return this.isEmpty()?[]:[this.getCoordinate()]}},{key:"copyInternal",value:function(){return new n(this._coordinates.copy(),this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof oe){var r=arguments[0],a=arguments[1];return!!this.isEquivalentClass(r)&&(!(!this.isEmpty()||!r.isEmpty())||this.isEmpty()===r.isEmpty()&&this.equal(r.getCoordinate(),this.getCoordinate(),a))}return M(n,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){}},{key:"getCoordinate",value:function(){return this._coordinates.size()!==0?this._coordinates.getCoordinate(0):null}},{key:"getBoundaryDimension",value:function(){return ae.FALSE}},{key:"reverseInternal",value:function(){return this.getFactory().createPoint(this._coordinates.copy())}},{key:"getTypeCode",value:function(){return oe.TYPECODE_POINT}},{key:"getDimension",value:function(){return 0}},{key:"getNumPoints",value:function(){return this.isEmpty()?0:1}},{key:"getX",value:function(){if(this.getCoordinate()===null)throw new IllegalStateException("getX called on empty Point");return this.getCoordinate().x}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var r=arguments[0];return this.getCoordinate().compareTo(r.getCoordinate())}if(arguments.length===2){var a=arguments[0];return arguments[1].compare(this._coordinates,a._coordinates)}}},{key:"apply",value:function(){if(Ie(arguments[0],Xi)){var r=arguments[0];if(this.isEmpty())return null;r.filter(this.getCoordinate())}else if(Ie(arguments[0],Vi)){var a=arguments[0];if(this.isEmpty())return null;a.filter(this._coordinates,0),a.isGeometryChanged()&&this.geometryChanged()}else Ie(arguments[0],Ui)?arguments[0].filter(this):Ie(arguments[0],A)&&arguments[0].filter(this)}},{key:"getBoundary",value:function(){return this.getFactory().createGeometryCollection()}},{key:"getGeometryType",value:function(){return oe.TYPENAME_POINT}},{key:"getCoordinateSequence",value:function(){return this._coordinates}},{key:"getY",value:function(){if(this.getCoordinate()===null)throw new IllegalStateException("getY called on empty Point");return this.getCoordinate().y}},{key:"isEmpty",value:function(){return this._coordinates.size()===0}},{key:"init",value:function(r){r===null&&(r=this.getFactory().getCoordinateSequenceFactory().create([])),j.isTrue(r.size()<=1),this._coordinates=r}},{key:"isSimple",value:function(){return!0}},{key:"interfaces_",get:function(){return[Ec]}}],[{key:"constructor_",value:function(){this._coordinates=null;var r=arguments[0],a=arguments[1];oe.constructor_.call(this,a),this.init(r)}}])})(oe),wc=(function(){function u(){o(this,u)}return c(u,null,[{key:"ofRing",value:function(){if(arguments[0]instanceof Array){var n=arguments[0];return Math.abs(u.ofRingSigned(n))}if(Ie(arguments[0],Te)){var r=arguments[0];return Math.abs(u.ofRingSigned(r))}}},{key:"ofRingSigned",value:function(){if(arguments[0]instanceof Array){var n=arguments[0];if(n.length<3)return 0;for(var r=0,a=n[0].x,f=1;f<n.length-1;f++){var m=n[f].x-a,p=n[f+1].y;r+=m*(n[f-1].y-p)}return r/2}if(Ie(arguments[0],Te)){var I=arguments[0],T=I.size();if(T<3)return 0;var U=new W,J=new W,Q=new W;I.getCoordinate(0,J),I.getCoordinate(1,Q);var ne=J.x;Q.x-=ne;for(var ce=0,fe=1;fe<T-1;fe++)U.y=J.y,J.x=Q.x,J.y=Q.y,I.getCoordinate(fe+1,Q),Q.x-=ne,ce+=J.x*(U.y-Q.y);return ce/2}}}])})(),xn=(function(){return c((function u(){o(this,u)}),null,[{key:"sort",value:function(){var u=arguments,n=arguments[0];if(arguments.length===1)n.sort((function(ne,ce){return ne.compareTo(ce)}));else if(arguments.length===2)n.sort((function(ne,ce){return u[1].compare(ne,ce)}));else if(arguments.length===3){var r=n.slice(arguments[1],arguments[2]);r.sort();var a=n.slice(0,arguments[1]).concat(r,n.slice(arguments[2],n.length));n.splice(0,n.length);var f,m=g(a);try{for(m.s();!(f=m.n()).done;){var p=f.value;n.push(p)}}catch(ne){m.e(ne)}finally{m.f()}}else if(arguments.length===4){var I=n.slice(arguments[1],arguments[2]);I.sort((function(ne,ce){return u[3].compare(ne,ce)}));var T=n.slice(0,arguments[1]).concat(I,n.slice(arguments[2],n.length));n.splice(0,n.length);var U,J=g(T);try{for(J.s();!(U=J.n()).done;){var Q=U.value;n.push(Q)}}catch(ne){J.e(ne)}finally{J.f()}}}},{key:"asList",value:function(u){var n,r=new me,a=g(u);try{for(a.s();!(n=a.n()).done;){var f=n.value;r.add(f)}}catch(m){a.e(m)}finally{a.f()}return r}},{key:"copyOf",value:function(u,n){return u.slice(0,n)}}])})(),kc=c((function u(){o(this,u)})),Hi=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"computeEnvelopeInternal",value:function(){return this._shell.getEnvelopeInternal()}},{key:"getCoordinates",value:function(){if(this.isEmpty())return[];for(var r=new Array(this.getNumPoints()).fill(null),a=-1,f=this._shell.getCoordinates(),m=0;m<f.length;m++)r[++a]=f[m];for(var p=0;p<this._holes.length;p++)for(var I=this._holes[p].getCoordinates(),T=0;T<I.length;T++)r[++a]=I[T];return r}},{key:"getArea",value:function(){var r=0;r+=wc.ofRing(this._shell.getCoordinateSequence());for(var a=0;a<this._holes.length;a++)r-=wc.ofRing(this._holes[a].getCoordinateSequence());return r}},{key:"copyInternal",value:function(){for(var r=this._shell.copy(),a=new Array(this._holes.length).fill(null),f=0;f<this._holes.length;f++)a[f]=this._holes[f].copy();return new n(r,a,this._factory)}},{key:"isRectangle",value:function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var r=this._shell.getCoordinateSequence(),a=this.getEnvelopeInternal(),f=0;f<5;f++){var m=r.getX(f);if(m!==a.getMinX()&&m!==a.getMaxX())return!1;var p=r.getY(f);if(p!==a.getMinY()&&p!==a.getMaxY())return!1}for(var I=r.getX(0),T=r.getY(0),U=1;U<=4;U++){var J=r.getX(U),Q=r.getY(U);if(J!==I==(Q!==T))return!1;I=J,T=Q}return!0}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof oe){var r=arguments[0],a=arguments[1];if(!this.isEquivalentClass(r))return!1;var f=r,m=this._shell,p=f._shell;if(!m.equalsExact(p,a)||this._holes.length!==f._holes.length)return!1;for(var I=0;I<this._holes.length;I++)if(!this._holes[I].equalsExact(f._holes[I],a))return!1;return!0}return M(n,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){if(arguments.length===0){this._shell=this.normalized(this._shell,!0);for(var r=0;r<this._holes.length;r++)this._holes[r]=this.normalized(this._holes[r],!1);xn.sort(this._holes)}else if(arguments.length===2){var a=arguments[0],f=arguments[1];if(a.isEmpty())return null;var m=a.getCoordinateSequence(),p=_n.minCoordinateIndex(m,0,m.size()-2);_n.scroll(m,p,!0),Ee.isCCW(m)===f&&_n.reverse(m)}}},{key:"getCoordinate",value:function(){return this._shell.getCoordinate()}},{key:"getNumInteriorRing",value:function(){return this._holes.length}},{key:"getBoundaryDimension",value:function(){return 1}},{key:"reverseInternal",value:function(){for(var r=this.getExteriorRing().reverse(),a=new Array(this.getNumInteriorRing()).fill(null),f=0;f<a.length;f++)a[f]=this.getInteriorRingN(f).reverse();return this.getFactory().createPolygon(r,a)}},{key:"getTypeCode",value:function(){return oe.TYPECODE_POLYGON}},{key:"getDimension",value:function(){return 2}},{key:"getLength",value:function(){var r=0;r+=this._shell.getLength();for(var a=0;a<this._holes.length;a++)r+=this._holes[a].getLength();return r}},{key:"getNumPoints",value:function(){for(var r=this._shell.getNumPoints(),a=0;a<this._holes.length;a++)r+=this._holes[a].getNumPoints();return r}},{key:"convexHull",value:function(){return this.getExteriorRing().convexHull()}},{key:"normalized",value:function(r,a){var f=r.copy();return this.normalize(f,a),f}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var r=arguments[0],a=this._shell,f=r._shell;return a.compareToSameClass(f)}if(arguments.length===2){var m=arguments[1],p=arguments[0],I=this._shell,T=p._shell,U=I.compareToSameClass(T,m);if(U!==0)return U;for(var J=this.getNumInteriorRing(),Q=p.getNumInteriorRing(),ne=0;ne<J&&ne<Q;){var ce=this.getInteriorRingN(ne),fe=p.getInteriorRingN(ne),de=ce.compareToSameClass(fe,m);if(de!==0)return de;ne++}return ne<J?1:ne<Q?-1:0}}},{key:"apply",value:function(){if(Ie(arguments[0],Xi)){var r=arguments[0];this._shell.apply(r);for(var a=0;a<this._holes.length;a++)this._holes[a].apply(r)}else if(Ie(arguments[0],Vi)){var f=arguments[0];if(this._shell.apply(f),!f.isDone())for(var m=0;m<this._holes.length&&(this._holes[m].apply(f),!f.isDone());m++);f.isGeometryChanged()&&this.geometryChanged()}else if(Ie(arguments[0],Ui))arguments[0].filter(this);else if(Ie(arguments[0],A)){var p=arguments[0];p.filter(this),this._shell.apply(p);for(var I=0;I<this._holes.length;I++)this._holes[I].apply(p)}}},{key:"getBoundary",value:function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var r=new Array(this._holes.length+1).fill(null);r[0]=this._shell;for(var a=0;a<this._holes.length;a++)r[a+1]=this._holes[a];return r.length<=1?this.getFactory().createLinearRing(r[0].getCoordinateSequence()):this.getFactory().createMultiLineString(r)}},{key:"getGeometryType",value:function(){return oe.TYPENAME_POLYGON}},{key:"getExteriorRing",value:function(){return this._shell}},{key:"isEmpty",value:function(){return this._shell.isEmpty()}},{key:"getInteriorRingN",value:function(r){return this._holes[r]}},{key:"interfaces_",get:function(){return[kc]}}],[{key:"constructor_",value:function(){this._shell=null,this._holes=null;var r=arguments[0],a=arguments[1],f=arguments[2];if(oe.constructor_.call(this,f),r===null&&(r=this.getFactory().createLinearRing()),a===null&&(a=[]),oe.hasNullElements(a))throw new C("holes must not contain null elements");if(r.isEmpty()&&oe.hasNonEmptyElements(a))throw new C("shell is empty but holes are not");this._shell=r,this._holes=a}}])})(oe),Ym=(function(u){function n(){return o(this,n),s(this,n,arguments)}return v(n,u),c(n)})(ke),Ic=(function(u){function n(r){var a;return o(this,n),(a=s(this,n)).array=[],r instanceof Me&&a.addAll(r),a}return v(n,u),c(n,[{key:"contains",value:function(r){var a,f=g(this.array);try{for(f.s();!(a=f.n()).done;)if(a.value.compareTo(r)===0)return!0}catch(m){f.e(m)}finally{f.f()}return!1}},{key:"add",value:function(r){if(this.contains(r))return!1;for(var a=0,f=this.array.length;a<f;a++)if(this.array[a].compareTo(r)===1)return!!this.array.splice(a,0,r);return this.array.push(r),!0}},{key:"addAll",value:function(r){var a,f=g(r);try{for(f.s();!(a=f.n()).done;){var m=a.value;this.add(m)}}catch(p){f.e(p)}finally{f.f()}return!0}},{key:"remove",value:function(){throw new ue}},{key:"size",value:function(){return this.array.length}},{key:"isEmpty",value:function(){return this.array.length===0}},{key:"toArray",value:function(){return this.array.slice()}},{key:"iterator",value:function(){return new zm(this.array)}}])})(Ym),zm=(function(){return c((function u(n){o(this,u),this.array=n,this.position=0}),[{key:"next",value:function(){if(this.position===this.array.length)throw new Se;return this.array[this.position++]}},{key:"hasNext",value:function(){return this.position<this.array.length}},{key:"remove",value:function(){throw new ue}}])})(),mt=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"computeEnvelopeInternal",value:function(){for(var r=new le,a=0;a<this._geometries.length;a++)r.expandToInclude(this._geometries[a].getEnvelopeInternal());return r}},{key:"getGeometryN",value:function(r){return this._geometries[r]}},{key:"getCoordinates",value:function(){for(var r=new Array(this.getNumPoints()).fill(null),a=-1,f=0;f<this._geometries.length;f++)for(var m=this._geometries[f].getCoordinates(),p=0;p<m.length;p++)r[++a]=m[p];return r}},{key:"getArea",value:function(){for(var r=0,a=0;a<this._geometries.length;a++)r+=this._geometries[a].getArea();return r}},{key:"copyInternal",value:function(){for(var r=new Array(this._geometries.length).fill(null),a=0;a<r.length;a++)r[a]=this._geometries[a].copy();return new n(r,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof oe){var r=arguments[0],a=arguments[1];if(!this.isEquivalentClass(r))return!1;var f=r;if(this._geometries.length!==f._geometries.length)return!1;for(var m=0;m<this._geometries.length;m++)if(!this._geometries[m].equalsExact(f._geometries[m],a))return!1;return!0}return M(n,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){for(var r=0;r<this._geometries.length;r++)this._geometries[r].normalize();xn.sort(this._geometries)}},{key:"getCoordinate",value:function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()}},{key:"getBoundaryDimension",value:function(){for(var r=ae.FALSE,a=0;a<this._geometries.length;a++)r=Math.max(r,this._geometries[a].getBoundaryDimension());return r}},{key:"reverseInternal",value:function(){for(var r=this._geometries.length,a=new me(r),f=0;f<r;f++)a.add(this._geometries[f].reverse());return this.getFactory().buildGeometry(a)}},{key:"getTypeCode",value:function(){return oe.TYPECODE_GEOMETRYCOLLECTION}},{key:"getDimension",value:function(){for(var r=ae.FALSE,a=0;a<this._geometries.length;a++)r=Math.max(r,this._geometries[a].getDimension());return r}},{key:"getLength",value:function(){for(var r=0,a=0;a<this._geometries.length;a++)r+=this._geometries[a].getLength();return r}},{key:"getNumPoints",value:function(){for(var r=0,a=0;a<this._geometries.length;a++)r+=this._geometries[a].getNumPoints();return r}},{key:"getNumGeometries",value:function(){return this._geometries.length}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var r=arguments[0],a=new Ic(xn.asList(this._geometries)),f=new Ic(xn.asList(r._geometries));return this.compare(a,f)}if(arguments.length===2){for(var m=arguments[1],p=arguments[0],I=this.getNumGeometries(),T=p.getNumGeometries(),U=0;U<I&&U<T;){var J=this.getGeometryN(U),Q=p.getGeometryN(U),ne=J.compareToSameClass(Q,m);if(ne!==0)return ne;U++}return U<I?1:U<T?-1:0}}},{key:"apply",value:function(){if(Ie(arguments[0],Xi))for(var r=arguments[0],a=0;a<this._geometries.length;a++)this._geometries[a].apply(r);else if(Ie(arguments[0],Vi)){var f=arguments[0];if(this._geometries.length===0)return null;for(var m=0;m<this._geometries.length&&(this._geometries[m].apply(f),!f.isDone());m++);f.isGeometryChanged()&&this.geometryChanged()}else if(Ie(arguments[0],Ui)){var p=arguments[0];p.filter(this);for(var I=0;I<this._geometries.length;I++)this._geometries[I].apply(p)}else if(Ie(arguments[0],A)){var T=arguments[0];T.filter(this);for(var U=0;U<this._geometries.length;U++)this._geometries[U].apply(T)}}},{key:"getBoundary",value:function(){return oe.checkNotGeometryCollection(this),j.shouldNeverReachHere(),null}},{key:"getGeometryType",value:function(){return oe.TYPENAME_GEOMETRYCOLLECTION}},{key:"isEmpty",value:function(){for(var r=0;r<this._geometries.length;r++)if(!this._geometries[r].isEmpty())return!1;return!0}}],[{key:"constructor_",value:function(){if(this._geometries=null,arguments.length!==0){if(arguments.length===2){var r=arguments[0],a=arguments[1];if(oe.constructor_.call(this,a),r===null&&(r=[]),oe.hasNullElements(r))throw new C("geometries must not contain null elements");this._geometries=r}}}}])})(oe),Eo=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"copyInternal",value:function(){for(var r=new Array(this._geometries.length).fill(null),a=0;a<r.length;a++)r[a]=this._geometries[a].copy();return new n(r,this._factory)}},{key:"isValid",value:function(){return!0}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof oe){var r=arguments[0],a=arguments[1];return!!this.isEquivalentClass(r)&&M(n,"equalsExact",this,1).call(this,r,a)}return M(n,"equalsExact",this,1).apply(this,arguments)}},{key:"getCoordinate",value:function(){if(arguments.length===1&&Number.isInteger(arguments[0])){var r=arguments[0];return this._geometries[r].getCoordinate()}return M(n,"getCoordinate",this,1).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return ae.FALSE}},{key:"getTypeCode",value:function(){return oe.TYPECODE_MULTIPOINT}},{key:"getDimension",value:function(){return 0}},{key:"getBoundary",value:function(){return this.getFactory().createGeometryCollection()}},{key:"getGeometryType",value:function(){return oe.TYPENAME_MULTIPOINT}},{key:"interfaces_",get:function(){return[Ec]}}],[{key:"constructor_",value:function(){var r=arguments[0],a=arguments[1];mt.constructor_.call(this,r,a)}}])})(mt),Ar=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"copyInternal",value:function(){return new n(this._points.copy(),this._factory)}},{key:"getBoundaryDimension",value:function(){return ae.FALSE}},{key:"isClosed",value:function(){return!!this.isEmpty()||M(n,"isClosed",this,1).call(this)}},{key:"reverseInternal",value:function(){var r=this._points.copy();return _n.reverse(r),this.getFactory().createLinearRing(r)}},{key:"getTypeCode",value:function(){return oe.TYPECODE_LINEARRING}},{key:"validateConstruction",value:function(){if(!this.isEmpty()&&!M(n,"isClosed",this,1).call(this))throw new C("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<n.MINIMUM_VALID_SIZE)throw new C("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")}},{key:"getGeometryType",value:function(){return oe.TYPENAME_LINEARRING}}],[{key:"constructor_",value:function(){var r=arguments[0],a=arguments[1];Rr.constructor_.call(this,r,a),this.validateConstruction()}}])})(Rr);Ar.MINIMUM_VALID_SIZE=4;var En=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"setOrdinate",value:function(r,a){switch(r){case n.X:this.x=a;break;case n.Y:this.y=a;break;default:throw new C("Invalid ordinate index: "+r)}}},{key:"getZ",value:function(){return W.NULL_ORDINATE}},{key:"getOrdinate",value:function(r){switch(r){case n.X:return this.x;case n.Y:return this.y}throw new C("Invalid ordinate index: "+r)}},{key:"setZ",value:function(r){throw new C("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new n(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+")"}},{key:"setCoordinate",value:function(r){this.x=r.x,this.y=r.y,this.z=r.getZ()}}],[{key:"constructor_",value:function(){if(arguments.length===0)W.constructor_.call(this);else if(arguments.length===1){if(arguments[0]instanceof n){var r=arguments[0];W.constructor_.call(this,r.x,r.y)}else if(arguments[0]instanceof W){var a=arguments[0];W.constructor_.call(this,a.x,a.y)}}else if(arguments.length===2){var f=arguments[0],m=arguments[1];W.constructor_.call(this,f,m,W.NULL_ORDINATE)}}}])})(W);En.X=0,En.Y=1,En.Z=-1,En.M=-1;var wn=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(r,a){switch(r){case n.X:this.x=a;break;case n.Y:this.y=a;break;case n.M:this._m=a;break;default:throw new C("Invalid ordinate index: "+r)}}},{key:"setM",value:function(r){this._m=r}},{key:"getZ",value:function(){return W.NULL_ORDINATE}},{key:"getOrdinate",value:function(r){switch(r){case n.X:return this.x;case n.Y:return this.y;case n.M:return this._m}throw new C("Invalid ordinate index: "+r)}},{key:"setZ",value:function(r){throw new C("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new n(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(r){this.x=r.x,this.y=r.y,this.z=r.getZ(),this._m=r.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,arguments.length===0)W.constructor_.call(this),this._m=0;else if(arguments.length===1){if(arguments[0]instanceof n){var r=arguments[0];W.constructor_.call(this,r.x,r.y),this._m=r._m}else if(arguments[0]instanceof W){var a=arguments[0];W.constructor_.call(this,a.x,a.y),this._m=this.getM()}}else if(arguments.length===3){var f=arguments[0],m=arguments[1],p=arguments[2];W.constructor_.call(this,f,m,W.NULL_ORDINATE),this._m=p}}}])})(W);wn.X=0,wn.Y=1,wn.Z=-1,wn.M=2;var wo=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(r,a){switch(r){case W.X:this.x=a;break;case W.Y:this.y=a;break;case W.Z:this.z=a;break;case W.M:this._m=a;break;default:throw new C("Invalid ordinate index: "+r)}}},{key:"setM",value:function(r){this._m=r}},{key:"getOrdinate",value:function(r){switch(r){case W.X:return this.x;case W.Y:return this.y;case W.Z:return this.getZ();case W.M:return this.getM()}throw new C("Invalid ordinate index: "+r)}},{key:"copy",value:function(){return new n(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(r){this.x=r.x,this.y=r.y,this.z=r.getZ(),this._m=r.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,arguments.length===0)W.constructor_.call(this),this._m=0;else if(arguments.length===1){if(arguments[0]instanceof n){var r=arguments[0];W.constructor_.call(this,r),this._m=r._m}else if(arguments[0]instanceof W){var a=arguments[0];W.constructor_.call(this,a),this._m=this.getM()}}else if(arguments.length===4){var f=arguments[0],m=arguments[1],p=arguments[2],I=arguments[3];W.constructor_.call(this,f,m,p),this._m=I}}}])})(W),$i=(function(){function u(){o(this,u)}return c(u,null,[{key:"measures",value:function(n){return n instanceof En?0:n instanceof wn||n instanceof wo?1:0}},{key:"dimension",value:function(n){return n instanceof En?2:n instanceof wn?3:n instanceof wo?4:3}},{key:"create",value:function(){if(arguments.length===1){var n=arguments[0];return u.create(n,0)}if(arguments.length===2){var r=arguments[0],a=arguments[1];return r===2?new En:r===3&&a===0?new W:r===3&&a===1?new wn:r===4&&a===1?new wo:new W}}}])})(),Dr=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"getCoordinate",value:function(r){return this.get(r)}},{key:"addAll",value:function(){if(arguments.length===2&&typeof arguments[1]=="boolean"&&Ie(arguments[0],Me)){for(var r=arguments[1],a=!1,f=arguments[0].iterator();f.hasNext();)this.add(f.next(),r),a=!0;return a}return M(n,"addAll",this,1).apply(this,arguments)}},{key:"clone",value:function(){for(var r=M(n,"clone",this,1).call(this),a=0;a<this.size();a++)r.add(a,this.get(a).clone());return r}},{key:"toCoordinateArray",value:function(){if(arguments.length===0)return this.toArray(n.coordArrayType);if(arguments.length===1){if(arguments[0])return this.toArray(n.coordArrayType);for(var r=this.size(),a=new Array(r).fill(null),f=0;f<r;f++)a[f]=this.get(r-f-1);return a}}},{key:"add",value:function(){if(arguments.length===1){var r=arguments[0];return M(n,"add",this,1).call(this,r)}if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var a=arguments[0],f=arguments[1];return this.add(a,f,!0),!0}if(arguments[0]instanceof W&&typeof arguments[1]=="boolean"){var m=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(m))return null;M(n,"add",this,1).call(this,m)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var p=arguments[0],I=arguments[1];return this.add(p,I),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var T=arguments[0],U=arguments[1];if(arguments[2])for(var J=0;J<T.length;J++)this.add(T[J],U);else for(var Q=T.length-1;Q>=0;Q--)this.add(T[Q],U);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof W){var ne=arguments[0],ce=arguments[1];if(!arguments[2]){var fe=this.size();if(fe>0&&(ne>0&&this.get(ne-1).equals2D(ce)||ne<fe&&this.get(ne).equals2D(ce)))return null}M(n,"add",this,1).call(this,ne,ce)}}else if(arguments.length===4){var de=arguments[0],Re=arguments[1],be=arguments[2],Ye=arguments[3],it=1;be>Ye&&(it=-1);for(var ut=be;ut!==Ye;ut+=it)this.add(de[ut],Re);return!0}}},{key:"closeRing",value:function(){if(this.size()>0){var r=this.get(0).copy();this.add(r,!1)}}}],[{key:"constructor_",value:function(){if(arguments.length!==0){if(arguments.length===1){var r=arguments[0];this.ensureCapacity(r.length),this.add(r,!0)}else if(arguments.length===2){var a=arguments[0],f=arguments[1];this.ensureCapacity(a.length),this.add(a,f)}}}}])})(me);Dr.coordArrayType=new Array(0).fill(null);var et=(function(){function u(){o(this,u)}return c(u,null,[{key:"isRing",value:function(n){return!(n.length<4)&&!!n[0].equals2D(n[n.length-1])}},{key:"ptNotInList",value:function(n,r){for(var a=0;a<n.length;a++){var f=n[a];if(u.indexOf(f,r)<0)return f}return null}},{key:"scroll",value:function(n,r){var a=u.indexOf(r,n);if(a<0)return null;var f=new Array(n.length).fill(null);It.arraycopy(n,a,f,0,n.length-a),It.arraycopy(n,0,f,n.length-a,a),It.arraycopy(f,0,n,0,n.length)}},{key:"equals",value:function(){if(arguments.length===2){var n=arguments[0],r=arguments[1];if(n===r)return!0;if(n===null||r===null||n.length!==r.length)return!1;for(var a=0;a<n.length;a++)if(!n[a].equals(r[a]))return!1;return!0}if(arguments.length===3){var f=arguments[0],m=arguments[1],p=arguments[2];if(f===m)return!0;if(f===null||m===null||f.length!==m.length)return!1;for(var I=0;I<f.length;I++)if(p.compare(f[I],m[I])!==0)return!1;return!0}}},{key:"intersection",value:function(n,r){for(var a=new Dr,f=0;f<n.length;f++)r.intersects(n[f])&&a.add(n[f],!0);return a.toCoordinateArray()}},{key:"measures",value:function(n){if(n===null||n.length===0)return 0;var r,a=0,f=g(n);try{for(f.s();!(r=f.n()).done;){var m=r.value;a=Math.max(a,$i.measures(m))}}catch(p){f.e(p)}finally{f.f()}return a}},{key:"hasRepeatedPoints",value:function(n){for(var r=1;r<n.length;r++)if(n[r-1].equals(n[r]))return!0;return!1}},{key:"removeRepeatedPoints",value:function(n){return u.hasRepeatedPoints(n)?new Dr(n,!1).toCoordinateArray():n}},{key:"reverse",value:function(n){for(var r=n.length-1,a=Math.trunc(r/2),f=0;f<=a;f++){var m=n[f];n[f]=n[r-f],n[r-f]=m}}},{key:"removeNull",value:function(n){for(var r=0,a=0;a<n.length;a++)n[a]!==null&&r++;var f=new Array(r).fill(null);if(r===0)return f;for(var m=0,p=0;p<n.length;p++)n[p]!==null&&(f[m++]=n[p]);return f}},{key:"copyDeep",value:function(){if(arguments.length===1){for(var n=arguments[0],r=new Array(n.length).fill(null),a=0;a<n.length;a++)r[a]=n[a].copy();return r}if(arguments.length===5)for(var f=arguments[0],m=arguments[1],p=arguments[2],I=arguments[3],T=arguments[4],U=0;U<T;U++)p[I+U]=f[m+U].copy()}},{key:"isEqualReversed",value:function(n,r){for(var a=0;a<n.length;a++){var f=n[a],m=r[n.length-a-1];if(f.compareTo(m)!==0)return!1}return!0}},{key:"envelope",value:function(n){for(var r=new le,a=0;a<n.length;a++)r.expandToInclude(n[a]);return r}},{key:"toCoordinateArray",value:function(n){return n.toArray(u.coordArrayType)}},{key:"dimension",value:function(n){if(n===null||n.length===0)return 3;var r,a=0,f=g(n);try{for(f.s();!(r=f.n()).done;){var m=r.value;a=Math.max(a,$i.dimension(m))}}catch(p){f.e(p)}finally{f.f()}return a}},{key:"atLeastNCoordinatesOrNothing",value:function(n,r){return r.length>=n?r:[]}},{key:"indexOf",value:function(n,r){for(var a=0;a<r.length;a++)if(n.equals(r[a]))return a;return-1}},{key:"increasingDirection",value:function(n){for(var r=0;r<Math.trunc(n.length/2);r++){var a=n.length-1-r,f=n[r].compareTo(n[a]);if(f!==0)return f}return 1}},{key:"compare",value:function(n,r){for(var a=0;a<n.length&&a<r.length;){var f=n[a].compareTo(r[a]);if(f!==0)return f;a++}return a<r.length?-1:a<n.length?1:0}},{key:"minCoordinate",value:function(n){for(var r=null,a=0;a<n.length;a++)(r===null||r.compareTo(n[a])>0)&&(r=n[a]);return r}},{key:"extract",value:function(n,r,a){r=Tr.clamp(r,0,n.length);var f=(a=Tr.clamp(a,-1,n.length))-r+1;a<0&&(f=0),r>=n.length&&(f=0),a<r&&(f=0);var m=new Array(f).fill(null);if(f===0)return m;for(var p=0,I=r;I<=a;I++)m[p++]=n[I];return m}}])})(),Xm=(function(){return c((function u(){o(this,u)}),[{key:"compare",value:function(u,n){var r=u,a=n;return et.compare(r,a)}},{key:"interfaces_",get:function(){return[Z]}}])})(),Um=(function(){return c((function u(){o(this,u)}),[{key:"compare",value:function(u,n){var r=u,a=n;if(r.length<a.length)return-1;if(r.length>a.length)return 1;if(r.length===0)return 0;var f=et.compare(r,a);return et.isEqualReversed(r,a)?0:f}},{key:"OLDcompare",value:function(u,n){var r=u,a=n;if(r.length<a.length)return-1;if(r.length>a.length)return 1;if(r.length===0)return 0;for(var f=et.increasingDirection(r),m=et.increasingDirection(a),p=f>0?0:r.length-1,I=m>0?0:r.length-1,T=0;T<r.length;T++){var U=r[p].compareTo(a[I]);if(U!==0)return U;p+=f,I+=m}return 0}},{key:"interfaces_",get:function(){return[Z]}}])})();et.ForwardComparator=Xm,et.BidirectionalComparator=Um,et.coordArrayType=new Array(0).fill(null);var Zi=(function(){return c((function u(n){o(this,u),this.str=n}),[{key:"append",value:function(u){this.str+=u}},{key:"setCharAt",value:function(u,n){this.str=this.str.substr(0,u)+n+this.str.substr(u+1)}},{key:"toString",value:function(){return this.str}}])})(),Fr=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"getM",value:function(n){return this.hasM()?this._coordinates[n].getM():B.NaN}},{key:"setOrdinate",value:function(n,r,a){switch(r){case Te.X:this._coordinates[n].x=a;break;case Te.Y:this._coordinates[n].y=a;break;default:this._coordinates[n].setOrdinate(r,a)}}},{key:"getZ",value:function(n){return this.hasZ()?this._coordinates[n].getZ():B.NaN}},{key:"size",value:function(){return this._coordinates.length}},{key:"getOrdinate",value:function(n,r){switch(r){case Te.X:return this._coordinates[n].x;case Te.Y:return this._coordinates[n].y;default:return this._coordinates[n].getOrdinate(r)}}},{key:"getCoordinate",value:function(){if(arguments.length===1){var n=arguments[0];return this._coordinates[n]}if(arguments.length===2){var r=arguments[0];arguments[1].setCoordinate(this._coordinates[r])}}},{key:"getCoordinateCopy",value:function(n){var r=this.createCoordinate();return r.setCoordinate(this._coordinates[n]),r}},{key:"createCoordinate",value:function(){return $i.create(this.getDimension(),this.getMeasures())}},{key:"getDimension",value:function(){return this._dimension}},{key:"getX",value:function(n){return this._coordinates[n].x}},{key:"getMeasures",value:function(){return this._measures}},{key:"expandEnvelope",value:function(n){for(var r=0;r<this._coordinates.length;r++)n.expandToInclude(this._coordinates[r]);return n}},{key:"copy",value:function(){for(var n=new Array(this.size()).fill(null),r=0;r<this._coordinates.length;r++){var a=this.createCoordinate();a.setCoordinate(this._coordinates[r]),n[r]=a}return new u(n,this._dimension,this._measures)}},{key:"toString",value:function(){if(this._coordinates.length>0){var n=new Zi(17*this._coordinates.length);n.append("("),n.append(this._coordinates[0]);for(var r=1;r<this._coordinates.length;r++)n.append(", "),n.append(this._coordinates[r]);return n.append(")"),n.toString()}return"()"}},{key:"getY",value:function(n){return this._coordinates[n].y}},{key:"toCoordinateArray",value:function(){return this._coordinates}},{key:"interfaces_",get:function(){return[Te,N]}}],[{key:"constructor_",value:function(){if(this._dimension=3,this._measures=0,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];u.constructor_.call(this,n,et.dimension(n),et.measures(n))}else if(Number.isInteger(arguments[0])){var r=arguments[0];this._coordinates=new Array(r).fill(null);for(var a=0;a<r;a++)this._coordinates[a]=new W}else if(Ie(arguments[0],Te)){var f=arguments[0];if(f===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=f.getDimension(),this._measures=f.getMeasures(),this._coordinates=new Array(f.size()).fill(null);for(var m=0;m<this._coordinates.length;m++)this._coordinates[m]=f.getCoordinateCopy(m)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var p=arguments[0],I=arguments[1];u.constructor_.call(this,p,I,et.measures(p))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var T=arguments[0],U=arguments[1];this._coordinates=new Array(T).fill(null),this._dimension=U;for(var J=0;J<T;J++)this._coordinates[J]=$i.create(U)}}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var Q=arguments[0],ne=arguments[1],ce=arguments[2];this._dimension=ne,this._measures=ce,this._coordinates=Q===null?new Array(0).fill(null):Q}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var fe=arguments[0],de=arguments[1],Re=arguments[2];this._coordinates=new Array(fe).fill(null),this._dimension=de,this._measures=Re;for(var be=0;be<fe;be++)this._coordinates[be]=this.createCoordinate()}}}}])})(),ko=(function(){function u(){o(this,u)}return c(u,[{key:"readResolve",value:function(){return u.instance()}},{key:"create",value:function(){if(arguments.length===1){if(arguments[0]instanceof Array)return new Fr(arguments[0]);if(Ie(arguments[0],Te))return new Fr(arguments[0])}else{if(arguments.length===2){var n=arguments[1];return n>3&&(n=3),n<2&&(n=2),new Fr(arguments[0],n)}if(arguments.length===3){var r=arguments[2],a=arguments[1]-r;return r>1&&(r=1),a>3&&(a=3),a<2&&(a=2),new Fr(arguments[0],a+r,r)}}}},{key:"interfaces_",get:function(){return[_c,N]}}],[{key:"instance",value:function(){return u.instanceObject}}])})();ko.instanceObject=new ko;var Io=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"copyInternal",value:function(){for(var r=new Array(this._geometries.length).fill(null),a=0;a<r.length;a++)r[a]=this._geometries[a].copy();return new n(r,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof oe){var r=arguments[0],a=arguments[1];return!!this.isEquivalentClass(r)&&M(n,"equalsExact",this,1).call(this,r,a)}return M(n,"equalsExact",this,1).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return 1}},{key:"getTypeCode",value:function(){return oe.TYPECODE_MULTIPOLYGON}},{key:"getDimension",value:function(){return 2}},{key:"getBoundary",value:function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var r=new me,a=0;a<this._geometries.length;a++)for(var f=this._geometries[a].getBoundary(),m=0;m<f.getNumGeometries();m++)r.add(f.getGeometryN(m));var p=new Array(r.size()).fill(null);return this.getFactory().createMultiLineString(r.toArray(p))}},{key:"getGeometryType",value:function(){return oe.TYPENAME_MULTIPOLYGON}},{key:"interfaces_",get:function(){return[kc]}}],[{key:"constructor_",value:function(){var r=arguments[0],a=arguments[1];mt.constructor_.call(this,r,a)}}])})(mt),Nc=(function(){return c((function u(){o(this,u)}),[{key:"get",value:function(){}},{key:"put",value:function(){}},{key:"size",value:function(){}},{key:"values",value:function(){}},{key:"entrySet",value:function(){}}])})(),Vm=(function(u){function n(){var r;return o(this,n),(r=s(this,n)).map=new Map,r}return v(n,u),c(n,[{key:"get",value:function(r){return this.map.get(r)||null}},{key:"put",value:function(r,a){return this.map.set(r,a),a}},{key:"values",value:function(){for(var r=new me,a=this.map.values(),f=a.next();!f.done;)r.add(f.value),f=a.next();return r}},{key:"entrySet",value:function(){var r=new ct;return this.map.entries().forEach((function(a){return r.add(a)})),r}},{key:"size",value:function(){return this.map.size()}}])})(Nc),bt=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"equals",value:function(n){if(!(n instanceof u))return!1;var r=n;return this._modelType===r._modelType&&this._scale===r._scale}},{key:"compareTo",value:function(n){var r=n,a=this.getMaximumSignificantDigits(),f=r.getMaximumSignificantDigits();return cn.compare(a,f)}},{key:"getScale",value:function(){return this._scale}},{key:"isFloating",value:function(){return this._modelType===u.FLOATING||this._modelType===u.FLOATING_SINGLE}},{key:"getType",value:function(){return this._modelType}},{key:"toString",value:function(){var n="UNKNOWN";return this._modelType===u.FLOATING?n="Floating":this._modelType===u.FLOATING_SINGLE?n="Floating-Single":this._modelType===u.FIXED&&(n="Fixed (Scale="+this.getScale()+")"),n}},{key:"makePrecise",value:function(){if(typeof arguments[0]=="number"){var n=arguments[0];return B.isNaN(n)||this._modelType===u.FLOATING_SINGLE?n:this._modelType===u.FIXED?Math.round(n*this._scale)/this._scale:n}if(arguments[0]instanceof W){var r=arguments[0];if(this._modelType===u.FLOATING)return null;r.x=this.makePrecise(r.x),r.y=this.makePrecise(r.y)}}},{key:"getMaximumSignificantDigits",value:function(){var n=16;return this._modelType===u.FLOATING?n=16:this._modelType===u.FLOATING_SINGLE?n=6:this._modelType===u.FIXED&&(n=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),n}},{key:"setScale",value:function(n){this._scale=Math.abs(n)}},{key:"interfaces_",get:function(){return[N,q]}}],[{key:"constructor_",value:function(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=u.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof Vn){var n=arguments[0];this._modelType=n,n===u.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var r=arguments[0];this._modelType=u.FIXED,this.setScale(r)}else if(arguments[0]instanceof u){var a=arguments[0];this._modelType=a._modelType,this._scale=a._scale}}}},{key:"mostPrecise",value:function(n,r){return n.compareTo(r)>=0?n:r}}])})(),Vn=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"readResolve",value:function(){return u.nameToTypeMap.get(this._name)}},{key:"toString",value:function(){return this._name}},{key:"interfaces_",get:function(){return[N]}}],[{key:"constructor_",value:function(){this._name=null;var n=arguments[0];this._name=n,u.nameToTypeMap.put(n,this)}}])})();Vn.nameToTypeMap=new Vm,bt.Type=Vn,bt.FIXED=new Vn("FIXED"),bt.FLOATING=new Vn("FLOATING"),bt.FLOATING_SINGLE=new Vn("FLOATING SINGLE"),bt.maximumPreciseValue=9007199254740992;var No=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"copyInternal",value:function(){for(var r=new Array(this._geometries.length).fill(null),a=0;a<r.length;a++)r[a]=this._geometries[a].copy();return new n(r,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof oe){var r=arguments[0],a=arguments[1];return!!this.isEquivalentClass(r)&&M(n,"equalsExact",this,1).call(this,r,a)}return M(n,"equalsExact",this,1).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return this.isClosed()?ae.FALSE:0}},{key:"isClosed",value:function(){if(this.isEmpty())return!1;for(var r=0;r<this._geometries.length;r++)if(!this._geometries[r].isClosed())return!1;return!0}},{key:"getTypeCode",value:function(){return oe.TYPECODE_MULTILINESTRING}},{key:"getDimension",value:function(){return 1}},{key:"getBoundary",value:function(){throw new ue}},{key:"getGeometryType",value:function(){return oe.TYPENAME_MULTILINESTRING}},{key:"interfaces_",get:function(){return[xc]}}],[{key:"constructor_",value:function(){var r=arguments[0],a=arguments[1];mt.constructor_.call(this,r,a)}}])})(mt),Hn=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"createEmpty",value:function(n){switch(n){case-1:return this.createGeometryCollection();case 0:return this.createPoint();case 1:return this.createLineString();case 2:return this.createPolygon();default:throw new C("Invalid dimension: "+n)}}},{key:"toGeometry",value:function(n){return n.isNull()?this.createPoint():n.getMinX()===n.getMaxX()&&n.getMinY()===n.getMaxY()?this.createPoint(new W(n.getMinX(),n.getMinY())):n.getMinX()===n.getMaxX()||n.getMinY()===n.getMaxY()?this.createLineString([new W(n.getMinX(),n.getMinY()),new W(n.getMaxX(),n.getMaxY())]):this.createPolygon(this.createLinearRing([new W(n.getMinX(),n.getMinY()),new W(n.getMinX(),n.getMaxY()),new W(n.getMaxX(),n.getMaxY()),new W(n.getMaxX(),n.getMinY()),new W(n.getMinX(),n.getMinY())]),null)}},{key:"createLineString",value:function(){if(arguments.length===0)return this.createLineString(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return this.createLineString(n!==null?this.getCoordinateSequenceFactory().create(n):null)}if(Ie(arguments[0],Te))return new Rr(arguments[0],this)}}},{key:"createMultiLineString",value:function(){return arguments.length===0?new No(null,this):arguments.length===1?new No(arguments[0],this):void 0}},{key:"buildGeometry",value:function(n){for(var r=null,a=!1,f=!1,m=n.iterator();m.hasNext();){var p=m.next(),I=p.getTypeCode();r===null&&(r=I),I!==r&&(a=!0),p instanceof mt&&(f=!0)}if(r===null)return this.createGeometryCollection();if(a||f)return this.createGeometryCollection(u.toGeometryArray(n));var T=n.iterator().next();if(n.size()>1){if(T instanceof Hi)return this.createMultiPolygon(u.toPolygonArray(n));if(T instanceof Rr)return this.createMultiLineString(u.toLineStringArray(n));if(T instanceof xo)return this.createMultiPoint(u.toPointArray(n));j.shouldNeverReachHere("Unhandled geometry type: "+T.getGeometryType())}return T}},{key:"createMultiPointFromCoords",value:function(n){return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}},{key:"createPoint",value:function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof W){var n=arguments[0];return this.createPoint(n!==null?this.getCoordinateSequenceFactory().create([n]):null)}if(Ie(arguments[0],Te))return new xo(arguments[0],this)}}},{key:"getCoordinateSequenceFactory",value:function(){return this._coordinateSequenceFactory}},{key:"createPolygon",value:function(){if(arguments.length===0)return this.createPolygon(null,null);if(arguments.length===1){if(Ie(arguments[0],Te)){var n=arguments[0];return this.createPolygon(this.createLinearRing(n))}if(arguments[0]instanceof Array){var r=arguments[0];return this.createPolygon(this.createLinearRing(r))}if(arguments[0]instanceof Ar){var a=arguments[0];return this.createPolygon(a,null)}}else if(arguments.length===2)return new Hi(arguments[0],arguments[1],this)}},{key:"getSRID",value:function(){return this._SRID}},{key:"createGeometryCollection",value:function(){return arguments.length===0?new mt(null,this):arguments.length===1?new mt(arguments[0],this):void 0}},{key:"getPrecisionModel",value:function(){return this._precisionModel}},{key:"createLinearRing",value:function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return this.createLinearRing(n!==null?this.getCoordinateSequenceFactory().create(n):null)}if(Ie(arguments[0],Te))return new Ar(arguments[0],this)}}},{key:"createMultiPolygon",value:function(){return arguments.length===0?new Io(null,this):arguments.length===1?new Io(arguments[0],this):void 0}},{key:"createMultiPoint",value:function(){if(arguments.length===0)return new Eo(null,this);if(arguments.length===1){if(arguments[0]instanceof Array)return new Eo(arguments[0],this);if(Ie(arguments[0],Te)){var n=arguments[0];if(n===null)return this.createMultiPoint(new Array(0).fill(null));for(var r=new Array(n.size()).fill(null),a=0;a<n.size();a++){var f=this.getCoordinateSequenceFactory().create(1,n.getDimension(),n.getMeasures());_n.copy(n,a,f,0,1),r[a]=this.createPoint(f)}return this.createMultiPoint(r)}}}},{key:"interfaces_",get:function(){return[N]}}],[{key:"constructor_",value:function(){if(this._precisionModel=null,this._coordinateSequenceFactory=null,this._SRID=null,arguments.length===0)u.constructor_.call(this,new bt,0);else if(arguments.length===1){if(Ie(arguments[0],_c)){var n=arguments[0];u.constructor_.call(this,new bt,0,n)}else if(arguments[0]instanceof bt){var r=arguments[0];u.constructor_.call(this,r,0,u.getDefaultCoordinateSequenceFactory())}}else if(arguments.length===2){var a=arguments[0],f=arguments[1];u.constructor_.call(this,a,f,u.getDefaultCoordinateSequenceFactory())}else if(arguments.length===3){var m=arguments[0],p=arguments[1],I=arguments[2];this._precisionModel=m,this._coordinateSequenceFactory=I,this._SRID=p}}},{key:"toMultiPolygonArray",value:function(n){var r=new Array(n.size()).fill(null);return n.toArray(r)}},{key:"toGeometryArray",value:function(n){if(n===null)return null;var r=new Array(n.size()).fill(null);return n.toArray(r)}},{key:"getDefaultCoordinateSequenceFactory",value:function(){return ko.instance()}},{key:"toMultiLineStringArray",value:function(n){var r=new Array(n.size()).fill(null);return n.toArray(r)}},{key:"toLineStringArray",value:function(n){var r=new Array(n.size()).fill(null);return n.toArray(r)}},{key:"toMultiPointArray",value:function(n){var r=new Array(n.size()).fill(null);return n.toArray(r)}},{key:"toLinearRingArray",value:function(n){var r=new Array(n.size()).fill(null);return n.toArray(r)}},{key:"toPointArray",value:function(n){var r=new Array(n.size()).fill(null);return n.toArray(r)}},{key:"toPolygonArray",value:function(n){var r=new Array(n.size()).fill(null);return n.toArray(r)}},{key:"createPointFromInternalCoord",value:function(n,r){return r.getPrecisionModel().makePrecise(n),r.getFactory().createPoint(n)}}])})(),Mo="XY",Hm="XYZ",$m="XYM",Zm="XYZM",Mc={POINT:"Point",LINE_STRING:"LineString",LINEAR_RING:"LinearRing",POLYGON:"Polygon",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon",GEOMETRY_COLLECTION:"GeometryCollection",CIRCLE:"Circle"},Sc="EMPTY",Wi=1,jt=2,hn=3,Pc=4,$n=5,Wm=6;for(var Km in Mc)Mc[Km].toUpperCase();var Jm=(function(){return c((function u(n){o(this,u),this.wkt=n,this.index_=-1}),[{key:"isAlpha_",value:function(u){return u>="a"&&u<="z"||u>="A"&&u<="Z"}},{key:"isNumeric_",value:function(u,n){return u>="0"&&u<="9"||u=="."&&!(n!==void 0&&n)}},{key:"isWhiteSpace_",value:function(u){return u==" "||u==" "||u=="\r"||u==`
5
+ `}},{key:"nextChar_",value:function(){return this.wkt.charAt(++this.index_)}},{key:"nextToken",value:function(){var u,n=this.nextChar_(),r=this.index_,a=n;if(n=="(")u=jt;else if(n==",")u=$n;else if(n==")")u=hn;else if(this.isNumeric_(n)||n=="-")u=Pc,a=this.readNumber_();else if(this.isAlpha_(n))u=Wi,a=this.readText_();else{if(this.isWhiteSpace_(n))return this.nextToken();if(n!=="")throw new Error("Unexpected character: "+n);u=Wm}return{position:r,value:a,type:u}}},{key:"readNumber_",value:function(){var u,n=this.index_,r=!1,a=!1;do u=="."?r=!0:u!="e"&&u!="E"||(a=!0),u=this.nextChar_();while(this.isNumeric_(u,r)||!a&&(u=="e"||u=="E")||a&&(u=="-"||u=="+"));return parseFloat(this.wkt.substring(n,this.index_--))}},{key:"readText_",value:function(){var u,n=this.index_;do u=this.nextChar_();while(this.isAlpha_(u));return this.wkt.substring(n,this.index_--).toUpperCase()}}])})(),Qm=(function(){return c((function u(n,r){o(this,u),this.lexer_=n,this.token_,this.layout_=Mo,this.factory=r}),[{key:"consume_",value:function(){this.token_=this.lexer_.nextToken()}},{key:"isTokenType",value:function(u){return this.token_.type==u}},{key:"match",value:function(u){var n=this.isTokenType(u);return n&&this.consume_(),n}},{key:"parse",value:function(){return this.consume_(),this.parseGeometry_()}},{key:"parseGeometryLayout_",value:function(){var u=Mo,n=this.token_;if(this.isTokenType(Wi)){var r=n.value;r==="Z"?u=Hm:r==="M"?u=$m:r==="ZM"&&(u=Zm),u!==Mo&&this.consume_()}return u}},{key:"parseGeometryCollectionText_",value:function(){if(this.match(jt)){var u=[];do u.push(this.parseGeometry_());while(this.match($n));if(this.match(hn))return u}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePointText_",value:function(){if(this.match(jt)){var u=this.parsePoint_();if(this.match(hn))return u}else if(this.isEmptyGeometry_())return null;throw new Error(this.formatErrorMessage_())}},{key:"parseLineStringText_",value:function(){if(this.match(jt)){var u=this.parsePointList_();if(this.match(hn))return u}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePolygonText_",value:function(){if(this.match(jt)){var u=this.parseLineStringTextList_();if(this.match(hn))return u}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPointText_",value:function(){var u;if(this.match(jt)){if(u=this.token_.type==jt?this.parsePointTextList_():this.parsePointList_(),this.match(hn))return u}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiLineStringText_",value:function(){if(this.match(jt)){var u=this.parseLineStringTextList_();if(this.match(hn))return u}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPolygonText_",value:function(){if(this.match(jt)){var u=this.parsePolygonTextList_();if(this.match(hn))return u}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePoint_",value:function(){for(var u=[],n=this.layout_.length,r=0;r<n;++r){var a=this.token_;if(!this.match(Pc))break;u.push(a.value)}if(u.length==n)return u;throw new Error(this.formatErrorMessage_())}},{key:"parsePointList_",value:function(){for(var u=[this.parsePoint_()];this.match($n);)u.push(this.parsePoint_());return u}},{key:"parsePointTextList_",value:function(){for(var u=[this.parsePointText_()];this.match($n);)u.push(this.parsePointText_());return u}},{key:"parseLineStringTextList_",value:function(){for(var u=[this.parseLineStringText_()];this.match($n);)u.push(this.parseLineStringText_());return u}},{key:"parsePolygonTextList_",value:function(){for(var u=[this.parsePolygonText_()];this.match($n);)u.push(this.parsePolygonText_());return u}},{key:"isEmptyGeometry_",value:function(){var u=this.isTokenType(Wi)&&this.token_.value==Sc;return u&&this.consume_(),u}},{key:"formatErrorMessage_",value:function(){return"Unexpected `"+this.token_.value+"` at position "+this.token_.position+" in `"+this.lexer_.wkt+"`"}},{key:"parseGeometry_",value:function(){var u=this.factory,n=function(de){return l(W,R(de))},r=function(de){var Re=de.map((function(be){return u.createLinearRing(be.map(n))}));return Re.length>1?u.createPolygon(Re[0],Re.slice(1)):u.createPolygon(Re[0])},a=this.token_;if(this.match(Wi)){var f=a.value;if(this.layout_=this.parseGeometryLayout_(),f=="GEOMETRYCOLLECTION"){var m=this.parseGeometryCollectionText_();return u.createGeometryCollection(m)}switch(f){case"POINT":var p=this.parsePointText_();return p?u.createPoint(l(W,R(p))):u.createPoint();case"LINESTRING":var I=this.parseLineStringText_().map(n);return u.createLineString(I);case"LINEARRING":var T=this.parseLineStringText_().map(n);return u.createLinearRing(T);case"POLYGON":var U=this.parsePolygonText_();return U&&U.length!==0?r(U):u.createPolygon();case"MULTIPOINT":var J=this.parseMultiPointText_();if(!J||J.length===0)return u.createMultiPoint();var Q=J.map(n).map((function(de){return u.createPoint(de)}));return u.createMultiPoint(Q);case"MULTILINESTRING":var ne=this.parseMultiLineStringText_().map((function(de){return u.createLineString(de.map(n))}));return u.createMultiLineString(ne);case"MULTIPOLYGON":var ce=this.parseMultiPolygonText_();if(!ce||ce.length===0)return u.createMultiPolygon();var fe=ce.map(r);return u.createMultiPolygon(fe);default:throw new Error("Invalid geometry type: "+f)}}throw new Error(this.formatErrorMessage_())}}])})();function Lc(u){if(u.isEmpty())return"";var n=u.getCoordinate(),r=[n.x,n.y];return n.z===void 0||Number.isNaN(n.z)||r.push(n.z),n.m===void 0||Number.isNaN(n.m)||r.push(n.m),r.join(" ")}function qr(u){for(var n=u.getCoordinates().map((function(m){var p=[m.x,m.y];return m.z===void 0||Number.isNaN(m.z)||p.push(m.z),m.m===void 0||Number.isNaN(m.m)||p.push(m.m),p})),r=[],a=0,f=n.length;a<f;++a)r.push(n[a].join(" "));return r.join(", ")}function bc(u){var n=[];n.push("("+qr(u.getExteriorRing())+")");for(var r=0,a=u.getNumInteriorRing();r<a;++r)n.push("("+qr(u.getInteriorRingN(r))+")");return n.join(", ")}var jm={Point:Lc,LineString:qr,LinearRing:qr,Polygon:bc,MultiPoint:function(u){for(var n=[],r=0,a=u.getNumGeometries();r<a;++r)n.push("("+Lc(u.getGeometryN(r))+")");return n.join(", ")},MultiLineString:function(u){for(var n=[],r=0,a=u.getNumGeometries();r<a;++r)n.push("("+qr(u.getGeometryN(r))+")");return n.join(", ")},MultiPolygon:function(u){for(var n=[],r=0,a=u.getNumGeometries();r<a;++r)n.push("("+bc(u.getGeometryN(r))+")");return n.join(", ")},GeometryCollection:function(u){for(var n=[],r=0,a=u.getNumGeometries();r<a;++r)n.push(Cc(u.getGeometryN(r)));return n.join(", ")}};function Cc(u){var n=u.getGeometryType(),r=jm[n];n=n.toUpperCase();var a=(function(f){var m="";if(f.isEmpty())return m;var p=f.getCoordinate();return p.z===void 0||Number.isNaN(p.z)||(m+="Z"),p.m===void 0||Number.isNaN(p.m)||(m+="M"),m})(u);return a.length>0&&(n+=" "+a),u.isEmpty()?n+" "+Sc:n+" ("+r(u)+")"}var ep=(function(){return c((function u(n){o(this,u),this.geometryFactory=n||new Hn,this.precisionModel=this.geometryFactory.getPrecisionModel()}),[{key:"read",value:function(u){var n=new Jm(u);return new Qm(n,this.geometryFactory).parse()}},{key:"write",value:function(u){return Cc(u)}}])})(),So=(function(){return c((function u(n){o(this,u),this.parser=new ep(n)}),[{key:"write",value:function(u){return this.parser.write(u)}}],[{key:"toLineString",value:function(u,n){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+u.x+" "+u.y+", "+n.x+" "+n.y+" )"}}])})(),Ue=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"getIndexAlongSegment",value:function(n,r){return this.computeIntLineIndex(),this._intLineIndex[n][r]}},{key:"getTopologySummary",value:function(){var n=new Zi;return this.isEndPoint()&&n.append(" endpoint"),this._isProper&&n.append(" proper"),this.isCollinear()&&n.append(" collinear"),n.toString()}},{key:"computeIntersection",value:function(n,r,a,f){this._inputLines[0][0]=n,this._inputLines[0][1]=r,this._inputLines[1][0]=a,this._inputLines[1][1]=f,this._result=this.computeIntersect(n,r,a,f)}},{key:"getIntersectionNum",value:function(){return this._result}},{key:"computeIntLineIndex",value:function(){if(arguments.length===0)this._intLineIndex===null&&(this._intLineIndex=Array(2).fill().map((function(){return Array(2)})),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(arguments.length===1){var n=arguments[0];this.getEdgeDistance(n,0)>this.getEdgeDistance(n,1)?(this._intLineIndex[n][0]=0,this._intLineIndex[n][1]=1):(this._intLineIndex[n][0]=1,this._intLineIndex[n][1]=0)}}},{key:"isProper",value:function(){return this.hasIntersection()&&this._isProper}},{key:"setPrecisionModel",value:function(n){this._precisionModel=n}},{key:"isInteriorIntersection",value:function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var n=arguments[0],r=0;r<this._result;r++)if(!this._intPt[r].equals2D(this._inputLines[n][0])&&!this._intPt[r].equals2D(this._inputLines[n][1]))return!0;return!1}}},{key:"getIntersection",value:function(n){return this._intPt[n]}},{key:"isEndPoint",value:function(){return this.hasIntersection()&&!this._isProper}},{key:"hasIntersection",value:function(){return this._result!==u.NO_INTERSECTION}},{key:"getEdgeDistance",value:function(n,r){return u.computeEdgeDistance(this._intPt[r],this._inputLines[n][0],this._inputLines[n][1])}},{key:"isCollinear",value:function(){return this._result===u.COLLINEAR_INTERSECTION}},{key:"toString",value:function(){return So.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+So.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()}},{key:"getEndpoint",value:function(n,r){return this._inputLines[n][r]}},{key:"isIntersection",value:function(n){for(var r=0;r<this._result;r++)if(this._intPt[r].equals2D(n))return!0;return!1}},{key:"getIntersectionAlongSegment",value:function(n,r){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[n][r]]}}],[{key:"constructor_",value: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 W,this._intPt[1]=new W,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0}},{key:"computeEdgeDistance",value:function(n,r,a){var f=Math.abs(a.x-r.x),m=Math.abs(a.y-r.y),p=-1;if(n.equals(r))p=0;else if(n.equals(a))p=f>m?f:m;else{var I=Math.abs(n.x-r.x),T=Math.abs(n.y-r.y);(p=f>m?I:T)!==0||n.equals(r)||(p=Math.max(I,T))}return j.isTrue(!(p===0&&!n.equals(r)),"Bad distance calculation"),p}},{key:"nonRobustComputeEdgeDistance",value:function(n,r,a){var f=n.x-r.x,m=n.y-r.y,p=Math.sqrt(f*f+m*m);return j.isTrue(!(p===0&&!n.equals(r)),"Invalid distance calculation"),p}}])})();Ue.DONT_INTERSECT=0,Ue.DO_INTERSECT=1,Ue.COLLINEAR=2,Ue.NO_INTERSECTION=0,Ue.POINT_INTERSECTION=1,Ue.COLLINEAR_INTERSECTION=2;var kn=(function(u){function n(){return o(this,n),s(this,n)}return v(n,u),c(n,[{key:"isInSegmentEnvelopes",value:function(r){var a=new le(this._inputLines[0][0],this._inputLines[0][1]),f=new le(this._inputLines[1][0],this._inputLines[1][1]);return a.contains(r)&&f.contains(r)}},{key:"computeIntersection",value:function(){if(arguments.length!==3)return M(n,"computeIntersection",this,1).apply(this,arguments);var r=arguments[0],a=arguments[1],f=arguments[2];if(this._isProper=!1,le.intersects(a,f,r)&&Ee.index(a,f,r)===0&&Ee.index(f,a,r)===0)return this._isProper=!0,(r.equals(a)||r.equals(f))&&(this._isProper=!1),this._result=Ue.POINT_INTERSECTION,null;this._result=Ue.NO_INTERSECTION}},{key:"intersection",value:function(r,a,f,m){var p=this.intersectionSafe(r,a,f,m);return this.isInSegmentEnvelopes(p)||(p=new W(n.nearestEndpoint(r,a,f,m))),this._precisionModel!==null&&this._precisionModel.makePrecise(p),p}},{key:"checkDD",value:function(r,a,f,m,p){var I=po.intersection(r,a,f,m),T=this.isInSegmentEnvelopes(I);It.out.println("DD in env = "+T+" --------------------- "+I),p.distance(I)>1e-4&&It.out.println("Distance = "+p.distance(I))}},{key:"intersectionSafe",value:function(r,a,f,m){var p=_o.intersection(r,a,f,m);return p===null&&(p=n.nearestEndpoint(r,a,f,m)),p}},{key:"computeCollinearIntersection",value:function(r,a,f,m){var p=le.intersects(r,a,f),I=le.intersects(r,a,m),T=le.intersects(f,m,r),U=le.intersects(f,m,a);return p&&I?(this._intPt[0]=f,this._intPt[1]=m,Ue.COLLINEAR_INTERSECTION):T&&U?(this._intPt[0]=r,this._intPt[1]=a,Ue.COLLINEAR_INTERSECTION):p&&T?(this._intPt[0]=f,this._intPt[1]=r,!f.equals(r)||I||U?Ue.COLLINEAR_INTERSECTION:Ue.POINT_INTERSECTION):p&&U?(this._intPt[0]=f,this._intPt[1]=a,!f.equals(a)||I||T?Ue.COLLINEAR_INTERSECTION:Ue.POINT_INTERSECTION):I&&T?(this._intPt[0]=m,this._intPt[1]=r,!m.equals(r)||p||U?Ue.COLLINEAR_INTERSECTION:Ue.POINT_INTERSECTION):I&&U?(this._intPt[0]=m,this._intPt[1]=a,!m.equals(a)||p||T?Ue.COLLINEAR_INTERSECTION:Ue.POINT_INTERSECTION):Ue.NO_INTERSECTION}},{key:"computeIntersect",value:function(r,a,f,m){if(this._isProper=!1,!le.intersects(r,a,f,m))return Ue.NO_INTERSECTION;var p=Ee.index(r,a,f),I=Ee.index(r,a,m);if(p>0&&I>0||p<0&&I<0)return Ue.NO_INTERSECTION;var T=Ee.index(f,m,r),U=Ee.index(f,m,a);return T>0&&U>0||T<0&&U<0?Ue.NO_INTERSECTION:p===0&&I===0&&T===0&&U===0?this.computeCollinearIntersection(r,a,f,m):(p===0||I===0||T===0||U===0?(this._isProper=!1,r.equals2D(f)||r.equals2D(m)?this._intPt[0]=r:a.equals2D(f)||a.equals2D(m)?this._intPt[0]=a:p===0?this._intPt[0]=new W(f):I===0?this._intPt[0]=new W(m):T===0?this._intPt[0]=new W(r):U===0&&(this._intPt[0]=new W(a))):(this._isProper=!0,this._intPt[0]=this.intersection(r,a,f,m)),Ue.POINT_INTERSECTION)}}],[{key:"nearestEndpoint",value:function(r,a,f,m){var p=r,I=Gt.pointToSegment(r,f,m),T=Gt.pointToSegment(a,f,m);return T<I&&(I=T,p=a),(T=Gt.pointToSegment(f,r,a))<I&&(I=T,p=f),(T=Gt.pointToSegment(m,r,a))<I&&(I=T,p=m),p}}])})(Ue),tp=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"countSegment",value:function(n,r){if(n.x<this._p.x&&r.x<this._p.x)return null;if(this._p.x===r.x&&this._p.y===r.y)return this._isPointOnSegment=!0,null;if(n.y===this._p.y&&r.y===this._p.y){var a=n.x,f=r.x;return a>f&&(a=r.x,f=n.x),this._p.x>=a&&this._p.x<=f&&(this._isPointOnSegment=!0),null}if(n.y>this._p.y&&r.y<=this._p.y||r.y>this._p.y&&n.y<=this._p.y){var m=Ee.index(n,r,this._p);if(m===Ee.COLLINEAR)return this._isPointOnSegment=!0,null;r.y<n.y&&(m=-m),m===Ee.LEFT&&this._crossingCount++}}},{key:"isPointInPolygon",value:function(){return this.getLocation()!==$.EXTERIOR}},{key:"getLocation",value:function(){return this._isPointOnSegment?$.BOUNDARY:this._crossingCount%2==1?$.INTERIOR:$.EXTERIOR}},{key:"isOnSegment",value:function(){return this._isPointOnSegment}}],[{key:"constructor_",value:function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var n=arguments[0];this._p=n}},{key:"locatePointInRing",value:function(){if(arguments[0]instanceof W&&Ie(arguments[1],Te)){for(var n=arguments[1],r=new u(arguments[0]),a=new W,f=new W,m=1;m<n.size();m++)if(n.getCoordinate(m,a),n.getCoordinate(m-1,f),r.countSegment(a,f),r.isOnSegment())return r.getLocation();return r.getLocation()}if(arguments[0]instanceof W&&arguments[1]instanceof Array){for(var p=arguments[1],I=new u(arguments[0]),T=1;T<p.length;T++){var U=p[T],J=p[T-1];if(I.countSegment(U,J),I.isOnSegment())return I.getLocation()}return I.getLocation()}}}])})(),Po=(function(){function u(){o(this,u)}return c(u,null,[{key:"isOnLine",value:function(){if(arguments[0]instanceof W&&Ie(arguments[1],Te)){for(var n=arguments[0],r=arguments[1],a=new kn,f=new W,m=new W,p=r.size(),I=1;I<p;I++)if(r.getCoordinate(I-1,f),r.getCoordinate(I,m),a.computeIntersection(n,f,m),a.hasIntersection())return!0;return!1}if(arguments[0]instanceof W&&arguments[1]instanceof Array){for(var T=arguments[0],U=arguments[1],J=new kn,Q=1;Q<U.length;Q++){var ne=U[Q-1],ce=U[Q];if(J.computeIntersection(T,ne,ce),J.hasIntersection())return!0}return!1}}},{key:"locateInRing",value:function(n,r){return tp.locatePointInRing(n,r)}},{key:"isInRing",value:function(n,r){return u.locateInRing(n,r)!==$.EXTERIOR}}])})(),Nt=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"setAllLocations",value:function(n){for(var r=0;r<this.location.length;r++)this.location[r]=n}},{key:"isNull",value:function(){for(var n=0;n<this.location.length;n++)if(this.location[n]!==$.NONE)return!1;return!0}},{key:"setAllLocationsIfNull",value:function(n){for(var r=0;r<this.location.length;r++)this.location[r]===$.NONE&&(this.location[r]=n)}},{key:"isLine",value:function(){return this.location.length===1}},{key:"merge",value:function(n){if(n.location.length>this.location.length){var r=new Array(3).fill(null);r[ie.ON]=this.location[ie.ON],r[ie.LEFT]=$.NONE,r[ie.RIGHT]=$.NONE,this.location=r}for(var a=0;a<this.location.length;a++)this.location[a]===$.NONE&&a<n.location.length&&(this.location[a]=n.location[a])}},{key:"getLocations",value:function(){return this.location}},{key:"flip",value:function(){if(this.location.length<=1)return null;var n=this.location[ie.LEFT];this.location[ie.LEFT]=this.location[ie.RIGHT],this.location[ie.RIGHT]=n}},{key:"toString",value:function(){var n=new ln;return this.location.length>1&&n.append($.toLocationSymbol(this.location[ie.LEFT])),n.append($.toLocationSymbol(this.location[ie.ON])),this.location.length>1&&n.append($.toLocationSymbol(this.location[ie.RIGHT])),n.toString()}},{key:"setLocations",value:function(n,r,a){this.location[ie.ON]=n,this.location[ie.LEFT]=r,this.location[ie.RIGHT]=a}},{key:"get",value:function(n){return n<this.location.length?this.location[n]:$.NONE}},{key:"isArea",value:function(){return this.location.length>1}},{key:"isAnyNull",value:function(){for(var n=0;n<this.location.length;n++)if(this.location[n]===$.NONE)return!0;return!1}},{key:"setLocation",value:function(){if(arguments.length===1){var n=arguments[0];this.setLocation(ie.ON,n)}else if(arguments.length===2){var r=arguments[0],a=arguments[1];this.location[r]=a}}},{key:"init",value:function(n){this.location=new Array(n).fill(null),this.setAllLocations($.NONE)}},{key:"isEqualOnSide",value:function(n,r){return this.location[r]===n.location[r]}},{key:"allPositionsEqual",value:function(n){for(var r=0;r<this.location.length;r++)if(this.location[r]!==n)return!1;return!0}}],[{key:"constructor_",value:function(){if(this.location=null,arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];this.init(n.length)}else if(Number.isInteger(arguments[0])){var r=arguments[0];this.init(1),this.location[ie.ON]=r}else if(arguments[0]instanceof u){var a=arguments[0];if(this.init(a.location.length),a!==null)for(var f=0;f<this.location.length;f++)this.location[f]=a.location[f]}}else if(arguments.length===3){var m=arguments[0],p=arguments[1],I=arguments[2];this.init(3),this.location[ie.ON]=m,this.location[ie.LEFT]=p,this.location[ie.RIGHT]=I}}}])})(),Mt=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"getGeometryCount",value:function(){var n=0;return this.elt[0].isNull()||n++,this.elt[1].isNull()||n++,n}},{key:"setAllLocations",value:function(n,r){this.elt[n].setAllLocations(r)}},{key:"isNull",value:function(n){return this.elt[n].isNull()}},{key:"setAllLocationsIfNull",value:function(){if(arguments.length===1){var n=arguments[0];this.setAllLocationsIfNull(0,n),this.setAllLocationsIfNull(1,n)}else if(arguments.length===2){var r=arguments[0],a=arguments[1];this.elt[r].setAllLocationsIfNull(a)}}},{key:"isLine",value:function(n){return this.elt[n].isLine()}},{key:"merge",value:function(n){for(var r=0;r<2;r++)this.elt[r]===null&&n.elt[r]!==null?this.elt[r]=new Nt(n.elt[r]):this.elt[r].merge(n.elt[r])}},{key:"flip",value:function(){this.elt[0].flip(),this.elt[1].flip()}},{key:"getLocation",value:function(){if(arguments.length===1){var n=arguments[0];return this.elt[n].get(ie.ON)}if(arguments.length===2){var r=arguments[0],a=arguments[1];return this.elt[r].get(a)}}},{key:"toString",value:function(){var n=new ln;return this.elt[0]!==null&&(n.append("A:"),n.append(this.elt[0].toString())),this.elt[1]!==null&&(n.append(" B:"),n.append(this.elt[1].toString())),n.toString()}},{key:"isArea",value:function(){if(arguments.length===0)return this.elt[0].isArea()||this.elt[1].isArea();if(arguments.length===1){var n=arguments[0];return this.elt[n].isArea()}}},{key:"isAnyNull",value:function(n){return this.elt[n].isAnyNull()}},{key:"setLocation",value:function(){if(arguments.length===2){var n=arguments[0],r=arguments[1];this.elt[n].setLocation(ie.ON,r)}else if(arguments.length===3){var a=arguments[0],f=arguments[1],m=arguments[2];this.elt[a].setLocation(f,m)}}},{key:"isEqualOnSide",value:function(n,r){return this.elt[0].isEqualOnSide(n.elt[0],r)&&this.elt[1].isEqualOnSide(n.elt[1],r)}},{key:"allPositionsEqual",value:function(n,r){return this.elt[n].allPositionsEqual(r)}},{key:"toLine",value:function(n){this.elt[n].isArea()&&(this.elt[n]=new Nt(this.elt[n].location[0]))}}],[{key:"constructor_",value:function(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var n=arguments[0];this.elt[0]=new Nt(n),this.elt[1]=new Nt(n)}else if(arguments[0]instanceof u){var r=arguments[0];this.elt[0]=new Nt(r.elt[0]),this.elt[1]=new Nt(r.elt[1])}}else if(arguments.length===2){var a=arguments[0],f=arguments[1];this.elt[0]=new Nt($.NONE),this.elt[1]=new Nt($.NONE),this.elt[a].setLocation(f)}else if(arguments.length===3){var m=arguments[0],p=arguments[1],I=arguments[2];this.elt[0]=new Nt(m,p,I),this.elt[1]=new Nt(m,p,I)}else if(arguments.length===4){var T=arguments[0],U=arguments[1],J=arguments[2],Q=arguments[3];this.elt[0]=new Nt($.NONE,$.NONE,$.NONE),this.elt[1]=new Nt($.NONE,$.NONE,$.NONE),this.elt[T].setLocations(U,J,Q)}}},{key:"toLineLabel",value:function(n){for(var r=new u($.NONE),a=0;a<2;a++)r.setLocation(a,n.getLocation(a));return r}}])})(),Ki=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"computeRing",value:function(){if(this._ring!==null)return null;for(var u=new Array(this._pts.size()).fill(null),n=0;n<this._pts.size();n++)u[n]=this._pts.get(n);this._ring=this._geometryFactory.createLinearRing(u),this._isHole=Ee.isCCW(this._ring.getCoordinates())}},{key:"isIsolated",value:function(){return this._label.getGeometryCount()===1}},{key:"computePoints",value:function(u){this._startDe=u;var n=u,r=!0;do{if(n===null)throw new Qt("Found null DirectedEdge");if(n.getEdgeRing()===this)throw new Qt("Directed Edge visited twice during ring-building at "+n.getCoordinate());this._edges.add(n);var a=n.getLabel();j.isTrue(a.isArea()),this.mergeLabel(a),this.addPoints(n.getEdge(),n.isForward(),r),r=!1,this.setEdgeRing(n,this),n=this.getNext(n)}while(n!==this._startDe)}},{key:"getLinearRing",value:function(){return this._ring}},{key:"getCoordinate",value:function(u){return this._pts.get(u)}},{key:"computeMaxNodeDegree",value:function(){this._maxNodeDegree=0;var u=this._startDe;do{var n=u.getNode().getEdges().getOutgoingDegree(this);n>this._maxNodeDegree&&(this._maxNodeDegree=n),u=this.getNext(u)}while(u!==this._startDe);this._maxNodeDegree*=2}},{key:"addPoints",value:function(u,n,r){var a=u.getCoordinates();if(n){var f=1;r&&(f=0);for(var m=f;m<a.length;m++)this._pts.add(a[m])}else{var p=a.length-2;r&&(p=a.length-1);for(var I=p;I>=0;I--)this._pts.add(a[I])}}},{key:"isHole",value:function(){return this._isHole}},{key:"setInResult",value:function(){var u=this._startDe;do u.getEdge().setInResult(!0),u=u.getNext();while(u!==this._startDe)}},{key:"containsPoint",value:function(u){var n=this.getLinearRing();if(!n.getEnvelopeInternal().contains(u)||!Po.isInRing(u,n.getCoordinates()))return!1;for(var r=this._holes.iterator();r.hasNext();)if(r.next().containsPoint(u))return!1;return!0}},{key:"addHole",value:function(u){this._holes.add(u)}},{key:"isShell",value:function(){return this._shell===null}},{key:"getLabel",value:function(){return this._label}},{key:"getEdges",value:function(){return this._edges}},{key:"getMaxNodeDegree",value:function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree}},{key:"getShell",value:function(){return this._shell}},{key:"mergeLabel",value:function(){if(arguments.length===1){var u=arguments[0];this.mergeLabel(u,0),this.mergeLabel(u,1)}else if(arguments.length===2){var n=arguments[1],r=arguments[0].getLocation(n,ie.RIGHT);if(r===$.NONE)return null;if(this._label.getLocation(n)===$.NONE)return this._label.setLocation(n,r),null}}},{key:"setShell",value:function(u){this._shell=u,u!==null&&u.addHole(this)}},{key:"toPolygon",value:function(u){for(var n=new Array(this._holes.size()).fill(null),r=0;r<this._holes.size();r++)n[r]=this._holes.get(r).getLinearRing();return u.createPolygon(this.getLinearRing(),n)}}],[{key:"constructor_",value:function(){if(this._startDe=null,this._maxNodeDegree=-1,this._edges=new me,this._pts=new me,this._label=new Mt($.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new me,this._geometryFactory=null,arguments.length!==0){if(arguments.length===2){var u=arguments[0],n=arguments[1];this._geometryFactory=n,this.computePoints(u),this.computeRing()}}}}])})(),np=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"setEdgeRing",value:function(r,a){r.setMinEdgeRing(a)}},{key:"getNext",value:function(r){return r.getNextMin()}}],[{key:"constructor_",value:function(){var r=arguments[0],a=arguments[1];Ki.constructor_.call(this,r,a)}}])})(Ki),rp=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"buildMinimalRings",value:function(){var r=new me,a=this._startDe;do{if(a.getMinEdgeRing()===null){var f=new np(a,this._geometryFactory);r.add(f)}a=a.getNext()}while(a!==this._startDe);return r}},{key:"setEdgeRing",value:function(r,a){r.setEdgeRing(a)}},{key:"linkDirectedEdgesForMinimalEdgeRings",value:function(){var r=this._startDe;do r.getNode().getEdges().linkMinimalDirectedEdges(this),r=r.getNext();while(r!==this._startDe)}},{key:"getNext",value:function(r){return r.getNext()}}],[{key:"constructor_",value:function(){var r=arguments[0],a=arguments[1];Ki.constructor_.call(this,r,a)}}])})(Ki),Oc=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"setVisited",value:function(u){this._isVisited=u}},{key:"setInResult",value:function(u){this._isInResult=u}},{key:"isCovered",value:function(){return this._isCovered}},{key:"isCoveredSet",value:function(){return this._isCoveredSet}},{key:"setLabel",value:function(u){this._label=u}},{key:"getLabel",value:function(){return this._label}},{key:"setCovered",value:function(u){this._isCovered=u,this._isCoveredSet=!0}},{key:"updateIM",value:function(u){j.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(u)}},{key:"isInResult",value:function(){return this._isInResult}},{key:"isVisited",value:function(){return this._isVisited}}],[{key:"constructor_",value:function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,arguments.length!==0){if(arguments.length===1){var u=arguments[0];this._label=u}}}}])})(),Ji=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"isIncidentEdgeInResult",value:function(){for(var r=this.getEdges().getEdges().iterator();r.hasNext();)if(r.next().getEdge().isInResult())return!0;return!1}},{key:"isIsolated",value:function(){return this._label.getGeometryCount()===1}},{key:"getCoordinate",value:function(){return this._coord}},{key:"print",value:function(r){r.println("node "+this._coord+" lbl: "+this._label)}},{key:"computeIM",value:function(r){}},{key:"computeMergedLocation",value:function(r,a){var f=$.NONE;if(f=this._label.getLocation(a),!r.isNull(a)){var m=r.getLocation(a);f!==$.BOUNDARY&&(f=m)}return f}},{key:"setLabel",value:function(){if(arguments.length!==2||!Number.isInteger(arguments[1])||!Number.isInteger(arguments[0]))return M(n,"setLabel",this,1).apply(this,arguments);var r=arguments[0],a=arguments[1];this._label===null?this._label=new Mt(r,a):this._label.setLocation(r,a)}},{key:"getEdges",value:function(){return this._edges}},{key:"mergeLabel",value:function(){if(arguments[0]instanceof n){var r=arguments[0];this.mergeLabel(r._label)}else if(arguments[0]instanceof Mt)for(var a=arguments[0],f=0;f<2;f++){var m=this.computeMergedLocation(a,f);this._label.getLocation(f)===$.NONE&&this._label.setLocation(f,m)}}},{key:"add",value:function(r){this._edges.insert(r),r.setNode(this)}},{key:"setLabelBoundary",value:function(r){if(this._label===null)return null;var a=$.NONE;this._label!==null&&(a=this._label.getLocation(r));var f=null;switch(a){case $.BOUNDARY:f=$.INTERIOR;break;case $.INTERIOR:default:f=$.BOUNDARY}this._label.setLocation(r,f)}}],[{key:"constructor_",value:function(){this._coord=null,this._edges=null;var r=arguments[0],a=arguments[1];this._coord=r,this._edges=a,this._label=new Mt(0,$.NONE)}}])})(Oc),ip=(function(u){function n(){return o(this,n),s(this,n,arguments)}return v(n,u),c(n)})(Nc);function Tc(u){return u==null?0:u.color}function De(u){return u==null?null:u.parent}function Yt(u,n){u!==null&&(u.color=n)}function Lo(u){return u==null?null:u.left}function Rc(u){return u==null?null:u.right}var Br=(function(u){function n(){var r;return o(this,n),(r=s(this,n)).root_=null,r.size_=0,r}return v(n,u),c(n,[{key:"get",value:function(r){for(var a=this.root_;a!==null;){var f=r.compareTo(a.key);if(f<0)a=a.left;else{if(!(f>0))return a.value;a=a.right}}return null}},{key:"put",value:function(r,a){if(this.root_===null)return this.root_={key:r,value:a,left:null,right:null,parent:null,color:0,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var f,m,p=this.root_;do if(f=p,(m=r.compareTo(p.key))<0)p=p.left;else{if(!(m>0)){var I=p.value;return p.value=a,I}p=p.right}while(p!==null);var T={key:r,left:null,right:null,value:a,parent:f,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return m<0?f.left=T:f.right=T,this.fixAfterInsertion(T),this.size_++,null}},{key:"fixAfterInsertion",value:function(r){var a;for(r.color=1;r!=null&&r!==this.root_&&r.parent.color===1;)De(r)===Lo(De(De(r)))?Tc(a=Rc(De(De(r))))===1?(Yt(De(r),0),Yt(a,0),Yt(De(De(r)),1),r=De(De(r))):(r===Rc(De(r))&&(r=De(r),this.rotateLeft(r)),Yt(De(r),0),Yt(De(De(r)),1),this.rotateRight(De(De(r)))):Tc(a=Lo(De(De(r))))===1?(Yt(De(r),0),Yt(a,0),Yt(De(De(r)),1),r=De(De(r))):(r===Lo(De(r))&&(r=De(r),this.rotateRight(r)),Yt(De(r),0),Yt(De(De(r)),1),this.rotateLeft(De(De(r))));this.root_.color=0}},{key:"values",value:function(){var r=new me,a=this.getFirstEntry();if(a!==null)for(r.add(a.value);(a=n.successor(a))!==null;)r.add(a.value);return r}},{key:"entrySet",value:function(){var r=new ct,a=this.getFirstEntry();if(a!==null)for(r.add(a);(a=n.successor(a))!==null;)r.add(a);return r}},{key:"rotateLeft",value:function(r){if(r!=null){var a=r.right;r.right=a.left,a.left!=null&&(a.left.parent=r),a.parent=r.parent,r.parent==null?this.root_=a:r.parent.left===r?r.parent.left=a:r.parent.right=a,a.left=r,r.parent=a}}},{key:"rotateRight",value:function(r){if(r!=null){var a=r.left;r.left=a.right,a.right!=null&&(a.right.parent=r),a.parent=r.parent,r.parent==null?this.root_=a:r.parent.right===r?r.parent.right=a:r.parent.left=a,a.right=r,r.parent=a}}},{key:"getFirstEntry",value:function(){var r=this.root_;if(r!=null)for(;r.left!=null;)r=r.left;return r}},{key:"size",value:function(){return this.size_}},{key:"containsKey",value:function(r){for(var a=this.root_;a!==null;){var f=r.compareTo(a.key);if(f<0)a=a.left;else{if(!(f>0))return!0;a=a.right}}return!1}}],[{key:"successor",value:function(r){var a;if(r===null)return null;if(r.right!==null){for(a=r.right;a.left!==null;)a=a.left;return a}a=r.parent;for(var f=r;a!==null&&f===a.right;)f=a,a=a.parent;return a}}])})(ip),Ac=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"find",value:function(u){return this.nodeMap.get(u)}},{key:"addNode",value:function(){if(arguments[0]instanceof W){var u=arguments[0],n=this.nodeMap.get(u);return n===null&&(n=this.nodeFact.createNode(u),this.nodeMap.put(u,n)),n}if(arguments[0]instanceof Ji){var r=arguments[0],a=this.nodeMap.get(r.getCoordinate());return a===null?(this.nodeMap.put(r.getCoordinate(),r),r):(a.mergeLabel(r),a)}}},{key:"print",value:function(u){for(var n=this.iterator();n.hasNext();)n.next().print(u)}},{key:"iterator",value:function(){return this.nodeMap.values().iterator()}},{key:"values",value:function(){return this.nodeMap.values()}},{key:"getBoundaryNodes",value:function(u){for(var n=new me,r=this.iterator();r.hasNext();){var a=r.next();a.getLabel().getLocation(u)===$.BOUNDARY&&n.add(a)}return n}},{key:"add",value:function(u){var n=u.getCoordinate();this.addNode(n).add(u)}}],[{key:"constructor_",value:function(){this.nodeMap=new Br,this.nodeFact=null;var u=arguments[0];this.nodeFact=u}}])})(),ht=(function(){function u(){o(this,u)}return c(u,null,[{key:"isNorthern",value:function(n){return n===u.NE||n===u.NW}},{key:"isOpposite",value:function(n,r){return n!==r&&(n-r+4)%4===2}},{key:"commonHalfPlane",value:function(n,r){if(n===r)return n;if((n-r+4)%4===2)return-1;var a=n<r?n:r;return a===0&&(n>r?n:r)===3?3:a}},{key:"isInHalfPlane",value:function(n,r){return r===u.SE?n===u.SE||n===u.SW:n===r||n===r+1}},{key:"quadrant",value:function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],r=arguments[1];if(n===0&&r===0)throw new C("Cannot compute the quadrant for point ( "+n+", "+r+" )");return n>=0?r>=0?u.NE:u.SE:r>=0?u.NW:u.SW}if(arguments[0]instanceof W&&arguments[1]instanceof W){var a=arguments[0],f=arguments[1];if(f.x===a.x&&f.y===a.y)throw new C("Cannot compute the quadrant for two identical points "+a);return f.x>=a.x?f.y>=a.y?u.NE:u.SE:f.y>=a.y?u.NW:u.SW}}}])})();ht.NE=0,ht.NW=1,ht.SW=2,ht.SE=3;var Dc=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"compareDirection",value:function(n){return this._dx===n._dx&&this._dy===n._dy?0:this._quadrant>n._quadrant?1:this._quadrant<n._quadrant?-1:Ee.index(n._p0,n._p1,this._p1)}},{key:"getDy",value:function(){return this._dy}},{key:"getCoordinate",value:function(){return this._p0}},{key:"setNode",value:function(n){this._node=n}},{key:"print",value:function(n){var r=Math.atan2(this._dy,this._dx),a=this.getClass().getName(),f=a.lastIndexOf("."),m=a.substring(f+1);n.print(" "+m+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+r+" "+this._label)}},{key:"compareTo",value:function(n){var r=n;return this.compareDirection(r)}},{key:"getDirectedCoordinate",value:function(){return this._p1}},{key:"getDx",value:function(){return this._dx}},{key:"getLabel",value:function(){return this._label}},{key:"getEdge",value:function(){return this._edge}},{key:"getQuadrant",value:function(){return this._quadrant}},{key:"getNode",value:function(){return this._node}},{key:"toString",value:function(){var n=Math.atan2(this._dy,this._dx),r=this.getClass().getName(),a=r.lastIndexOf(".");return" "+r.substring(a+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+n+" "+this._label}},{key:"computeLabel",value:function(n){}},{key:"init",value:function(n,r){this._p0=n,this._p1=r,this._dx=r.x-n.x,this._dy=r.y-n.y,this._quadrant=ht.quadrant(this._dx,this._dy),j.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")}},{key:"interfaces_",get:function(){return[q]}}],[{key:"constructor_",value: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,arguments.length===1){var n=arguments[0];this._edge=n}else if(arguments.length===3){var r=arguments[0],a=arguments[1],f=arguments[2];u.constructor_.call(this,r,a,f,null)}else if(arguments.length===4){var m=arguments[0],p=arguments[1],I=arguments[2],T=arguments[3];u.constructor_.call(this,m),this.init(p,I),this._label=T}}}])})(),bo=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"getNextMin",value:function(){return this._nextMin}},{key:"getDepth",value:function(r){return this._depth[r]}},{key:"setVisited",value:function(r){this._isVisited=r}},{key:"computeDirectedLabel",value:function(){this._label=new Mt(this._edge.getLabel()),this._isForward||this._label.flip()}},{key:"getNext",value:function(){return this._next}},{key:"setDepth",value:function(r,a){if(this._depth[r]!==-999&&this._depth[r]!==a)throw new Qt("assigned depths do not match",this.getCoordinate());this._depth[r]=a}},{key:"isInteriorAreaEdge",value:function(){for(var r=!0,a=0;a<2;a++)this._label.isArea(a)&&this._label.getLocation(a,ie.LEFT)===$.INTERIOR&&this._label.getLocation(a,ie.RIGHT)===$.INTERIOR||(r=!1);return r}},{key:"setNextMin",value:function(r){this._nextMin=r}},{key:"print",value:function(r){M(n,"print",this,1).call(this,r),r.print(" "+this._depth[ie.LEFT]+"/"+this._depth[ie.RIGHT]),r.print(" ("+this.getDepthDelta()+")"),this._isInResult&&r.print(" inResult")}},{key:"setMinEdgeRing",value:function(r){this._minEdgeRing=r}},{key:"isLineEdge",value:function(){var r=this._label.isLine(0)||this._label.isLine(1),a=!this._label.isArea(0)||this._label.allPositionsEqual(0,$.EXTERIOR),f=!this._label.isArea(1)||this._label.allPositionsEqual(1,$.EXTERIOR);return r&&a&&f}},{key:"setEdgeRing",value:function(r){this._edgeRing=r}},{key:"getMinEdgeRing",value:function(){return this._minEdgeRing}},{key:"getDepthDelta",value:function(){var r=this._edge.getDepthDelta();return this._isForward||(r=-r),r}},{key:"setInResult",value:function(r){this._isInResult=r}},{key:"getSym",value:function(){return this._sym}},{key:"isForward",value:function(){return this._isForward}},{key:"getEdge",value:function(){return this._edge}},{key:"printEdge",value:function(r){this.print(r),r.print(" "),this._isForward?this._edge.print(r):this._edge.printReverse(r)}},{key:"setSym",value:function(r){this._sym=r}},{key:"setVisitedEdge",value:function(r){this.setVisited(r),this._sym.setVisited(r)}},{key:"setEdgeDepths",value:function(r,a){var f=this.getEdge().getDepthDelta();this._isForward||(f=-f);var m=1;r===ie.LEFT&&(m=-1);var p=ie.opposite(r),I=a+f*m;this.setDepth(r,a),this.setDepth(p,I)}},{key:"getEdgeRing",value:function(){return this._edgeRing}},{key:"isInResult",value:function(){return this._isInResult}},{key:"setNext",value:function(r){this._next=r}},{key:"isVisited",value:function(){return this._isVisited}}],[{key:"constructor_",value:function(){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];var r=arguments[0],a=arguments[1];if(Dc.constructor_.call(this,r),this._isForward=a,a)this.init(r.getCoordinate(0),r.getCoordinate(1));else{var f=r.getNumPoints()-1;this.init(r.getCoordinate(f),r.getCoordinate(f-1))}this.computeDirectedLabel()}},{key:"depthFactor",value:function(r,a){return r===$.EXTERIOR&&a===$.INTERIOR?1:r===$.INTERIOR&&a===$.EXTERIOR?-1:0}}])})(Dc),Fc=(function(){return c((function u(){o(this,u)}),[{key:"createNode",value:function(u){return new Ji(u,null)}}])})(),qc=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"printEdges",value:function(u){u.println("Edges:");for(var n=0;n<this._edges.size();n++){u.println("edge "+n+":");var r=this._edges.get(n);r.print(u),r.eiList.print(u)}}},{key:"find",value:function(u){return this._nodes.find(u)}},{key:"addNode",value:function(){if(arguments[0]instanceof Ji){var u=arguments[0];return this._nodes.addNode(u)}if(arguments[0]instanceof W){var n=arguments[0];return this._nodes.addNode(n)}}},{key:"getNodeIterator",value:function(){return this._nodes.iterator()}},{key:"linkResultDirectedEdges",value:function(){for(var u=this._nodes.iterator();u.hasNext();)u.next().getEdges().linkResultDirectedEdges()}},{key:"debugPrintln",value:function(u){It.out.println(u)}},{key:"isBoundaryNode",value:function(u,n){var r=this._nodes.find(n);if(r===null)return!1;var a=r.getLabel();return a!==null&&a.getLocation(u)===$.BOUNDARY}},{key:"linkAllDirectedEdges",value:function(){for(var u=this._nodes.iterator();u.hasNext();)u.next().getEdges().linkAllDirectedEdges()}},{key:"matchInSameDirection",value:function(u,n,r,a){return!!u.equals(r)&&Ee.index(u,n,a)===Ee.COLLINEAR&&ht.quadrant(u,n)===ht.quadrant(r,a)}},{key:"getEdgeEnds",value:function(){return this._edgeEndList}},{key:"debugPrint",value:function(u){It.out.print(u)}},{key:"getEdgeIterator",value:function(){return this._edges.iterator()}},{key:"findEdgeInSameDirection",value:function(u,n){for(var r=0;r<this._edges.size();r++){var a=this._edges.get(r),f=a.getCoordinates();if(this.matchInSameDirection(u,n,f[0],f[1])||this.matchInSameDirection(u,n,f[f.length-1],f[f.length-2]))return a}return null}},{key:"insertEdge",value:function(u){this._edges.add(u)}},{key:"findEdgeEnd",value:function(u){for(var n=this.getEdgeEnds().iterator();n.hasNext();){var r=n.next();if(r.getEdge()===u)return r}return null}},{key:"addEdges",value:function(u){for(var n=u.iterator();n.hasNext();){var r=n.next();this._edges.add(r);var a=new bo(r,!0),f=new bo(r,!1);a.setSym(f),f.setSym(a),this.add(a),this.add(f)}}},{key:"add",value:function(u){this._nodes.add(u),this._edgeEndList.add(u)}},{key:"getNodes",value:function(){return this._nodes.values()}},{key:"findEdge",value:function(u,n){for(var r=0;r<this._edges.size();r++){var a=this._edges.get(r),f=a.getCoordinates();if(u.equals(f[0])&&n.equals(f[1]))return a}return null}}],[{key:"constructor_",value:function(){if(this._edges=new me,this._nodes=null,this._edgeEndList=new me,arguments.length===0)this._nodes=new Ac(new Fc);else if(arguments.length===1){var u=arguments[0];this._nodes=new Ac(u)}}},{key:"linkResultDirectedEdges",value:function(u){for(var n=u.iterator();n.hasNext();)n.next().getEdges().linkResultDirectedEdges()}}])})(),sp=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"sortShellsAndHoles",value:function(n,r,a){for(var f=n.iterator();f.hasNext();){var m=f.next();m.isHole()?a.add(m):r.add(m)}}},{key:"computePolygons",value:function(n){for(var r=new me,a=n.iterator();a.hasNext();){var f=a.next().toPolygon(this._geometryFactory);r.add(f)}return r}},{key:"placeFreeHoles",value:function(n,r){for(var a=r.iterator();a.hasNext();){var f=a.next();if(f.getShell()===null){var m=u.findEdgeRingContaining(f,n);if(m===null)throw new Qt("unable to assign hole to a shell",f.getCoordinate(0));f.setShell(m)}}}},{key:"buildMinimalEdgeRings",value:function(n,r,a){for(var f=new me,m=n.iterator();m.hasNext();){var p=m.next();if(p.getMaxNodeDegree()>2){p.linkDirectedEdgesForMinimalEdgeRings();var I=p.buildMinimalRings(),T=this.findShell(I);T!==null?(this.placePolygonHoles(T,I),r.add(T)):a.addAll(I)}else f.add(p)}return f}},{key:"buildMaximalEdgeRings",value:function(n){for(var r=new me,a=n.iterator();a.hasNext();){var f=a.next();if(f.isInResult()&&f.getLabel().isArea()&&f.getEdgeRing()===null){var m=new rp(f,this._geometryFactory);r.add(m),m.setInResult()}}return r}},{key:"placePolygonHoles",value:function(n,r){for(var a=r.iterator();a.hasNext();){var f=a.next();f.isHole()&&f.setShell(n)}}},{key:"getPolygons",value:function(){return this.computePolygons(this._shellList)}},{key:"findShell",value:function(n){for(var r=0,a=null,f=n.iterator();f.hasNext();){var m=f.next();m.isHole()||(a=m,r++)}return j.isTrue(r<=1,"found two shells in MinimalEdgeRing list"),a}},{key:"add",value:function(){if(arguments.length===1){var n=arguments[0];this.add(n.getEdgeEnds(),n.getNodes())}else if(arguments.length===2){var r=arguments[0],a=arguments[1];qc.linkResultDirectedEdges(a);var f=this.buildMaximalEdgeRings(r),m=new me,p=this.buildMinimalEdgeRings(f,this._shellList,m);this.sortShellsAndHoles(p,this._shellList,m),this.placeFreeHoles(this._shellList,m)}}}],[{key:"constructor_",value:function(){this._geometryFactory=null,this._shellList=new me;var n=arguments[0];this._geometryFactory=n}},{key:"findEdgeRingContaining",value:function(n,r){for(var a=n.getLinearRing(),f=a.getEnvelopeInternal(),m=a.getCoordinateN(0),p=null,I=null,T=r.iterator();T.hasNext();){var U=T.next(),J=U.getLinearRing(),Q=J.getEnvelopeInternal();if(!Q.equals(f)&&Q.contains(f)){m=et.ptNotInList(a.getCoordinates(),J.getCoordinates());var ne=!1;Po.isInRing(m,J.getCoordinates())&&(ne=!0),ne&&(p===null||I.contains(Q))&&(I=(p=U).getLinearRing().getEnvelopeInternal())}}return p}}])})(),Bc=(function(){return c((function u(){o(this,u)}),[{key:"getBounds",value:function(){}}])})(),en=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"getItem",value:function(){return this._item}},{key:"getBounds",value:function(){return this._bounds}},{key:"interfaces_",get:function(){return[Bc,N]}}],[{key:"constructor_",value:function(){this._bounds=null,this._item=null;var u=arguments[0],n=arguments[1];this._bounds=u,this._item=n}}])})(),Qi=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"poll",value:function(){if(this.isEmpty())return null;var u=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),u}},{key:"size",value:function(){return this._size}},{key:"reorder",value:function(u){for(var n=null,r=this._items.get(u);2*u<=this._size&&((n=2*u)!==this._size&&this._items.get(n+1).compareTo(this._items.get(n))<0&&n++,this._items.get(n).compareTo(r)<0);u=n)this._items.set(u,this._items.get(n));this._items.set(u,r)}},{key:"clear",value:function(){this._size=0,this._items.clear()}},{key:"peek",value:function(){return this.isEmpty()?null:this._items.get(1)}},{key:"isEmpty",value:function(){return this._size===0}},{key:"add",value:function(u){this._items.add(null),this._size+=1;var n=this._size;for(this._items.set(0,u);u.compareTo(this._items.get(Math.trunc(n/2)))<0;n/=2)this._items.set(n,this._items.get(Math.trunc(n/2)));this._items.set(n,u)}}],[{key:"constructor_",value:function(){this._size=null,this._items=null,this._size=0,this._items=new me,this._items.add(null)}}])})(),op=(function(){return c((function u(){o(this,u)}),[{key:"insert",value:function(u,n){}},{key:"remove",value:function(u,n){}},{key:"query",value:function(){}}])})(),St=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"getLevel",value:function(){return this._level}},{key:"size",value:function(){return this._childBoundables.size()}},{key:"getChildBoundables",value:function(){return this._childBoundables}},{key:"addChildBoundable",value:function(u){j.isTrue(this._bounds===null),this._childBoundables.add(u)}},{key:"isEmpty",value:function(){return this._childBoundables.isEmpty()}},{key:"getBounds",value:function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds}},{key:"interfaces_",get:function(){return[Bc,N]}}],[{key:"constructor_",value:function(){if(this._childBoundables=new me,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var u=arguments[0];this._level=u}}}}])})(),Zn={reverseOrder:function(){return{compare:function(u,n){return n.compareTo(u)}}},min:function(u){return Zn.sort(u),u.get(0)},sort:function(u,n){var r=u.toArray();n?xn.sort(r,n):xn.sort(r);for(var a=u.iterator(),f=0,m=r.length;f<m;f++)a.next(),a.set(r[f])},singletonList:function(u){var n=new me;return n.add(u),n}},ap=(function(){function u(){o(this,u)}return c(u,null,[{key:"maxDistance",value:function(n,r,a,f,m,p,I,T){var U=u.distance(n,r,m,p);return U=Math.max(U,u.distance(n,r,I,T)),U=Math.max(U,u.distance(a,f,m,p)),U=Math.max(U,u.distance(a,f,I,T))}},{key:"distance",value:function(n,r,a,f){var m=a-n,p=f-r;return Math.sqrt(m*m+p*p)}},{key:"maximumDistance",value:function(n,r){var a=Math.min(n.getMinX(),r.getMinX()),f=Math.min(n.getMinY(),r.getMinY()),m=Math.max(n.getMaxX(),r.getMaxX()),p=Math.max(n.getMaxY(),r.getMaxY());return u.distance(a,f,m,p)}},{key:"minMaxDistance",value:function(n,r){var a=n.getMinX(),f=n.getMinY(),m=n.getMaxX(),p=n.getMaxY(),I=r.getMinX(),T=r.getMinY(),U=r.getMaxX(),J=r.getMaxY(),Q=u.maxDistance(a,f,a,p,I,T,I,J);return Q=Math.min(Q,u.maxDistance(a,f,a,p,I,T,U,T)),Q=Math.min(Q,u.maxDistance(a,f,a,p,U,J,I,J)),Q=Math.min(Q,u.maxDistance(a,f,a,p,U,J,U,T)),Q=Math.min(Q,u.maxDistance(a,f,m,f,I,T,I,J)),Q=Math.min(Q,u.maxDistance(a,f,m,f,I,T,U,T)),Q=Math.min(Q,u.maxDistance(a,f,m,f,U,J,I,J)),Q=Math.min(Q,u.maxDistance(a,f,m,f,U,J,U,T)),Q=Math.min(Q,u.maxDistance(m,p,a,p,I,T,I,J)),Q=Math.min(Q,u.maxDistance(m,p,a,p,I,T,U,T)),Q=Math.min(Q,u.maxDistance(m,p,a,p,U,J,I,J)),Q=Math.min(Q,u.maxDistance(m,p,a,p,U,J,U,T)),Q=Math.min(Q,u.maxDistance(m,p,m,f,I,T,I,J)),Q=Math.min(Q,u.maxDistance(m,p,m,f,I,T,U,T)),Q=Math.min(Q,u.maxDistance(m,p,m,f,U,J,I,J)),Q=Math.min(Q,u.maxDistance(m,p,m,f,U,J,U,T))}}])})(),Wn=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"maximumDistance",value:function(){return ap.maximumDistance(this._boundable1.getBounds(),this._boundable2.getBounds())}},{key:"expandToQueue",value:function(n,r){var a=u.isComposite(this._boundable1),f=u.isComposite(this._boundable2);if(a&&f)return u.area(this._boundable1)>u.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,!1,n,r),null):(this.expand(this._boundable2,this._boundable1,!0,n,r),null);if(a)return this.expand(this._boundable1,this._boundable2,!1,n,r),null;if(f)return this.expand(this._boundable2,this._boundable1,!0,n,r),null;throw new C("neither boundable is composite")}},{key:"isLeaves",value:function(){return!(u.isComposite(this._boundable1)||u.isComposite(this._boundable2))}},{key:"compareTo",value:function(n){var r=n;return this._distance<r._distance?-1:this._distance>r._distance?1:0}},{key:"expand",value:function(n,r,a,f,m){for(var p=n.getChildBoundables().iterator();p.hasNext();){var I=p.next(),T=null;(T=a?new u(r,I,this._itemDistance):new u(I,r,this._itemDistance)).getDistance()<m&&f.add(T)}}},{key:"getBoundable",value:function(n){return n===0?this._boundable1:this._boundable2}},{key:"getDistance",value:function(){return this._distance}},{key:"distance",value:function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())}},{key:"interfaces_",get:function(){return[q]}}],[{key:"constructor_",value:function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var n=arguments[0],r=arguments[1],a=arguments[2];this._boundable1=n,this._boundable2=r,this._itemDistance=a,this._distance=this.distance()}},{key:"area",value:function(n){return n.getBounds().getArea()}},{key:"isComposite",value:function(n){return n instanceof St}}])})(),Gc=(function(){return c((function u(){o(this,u)}),[{key:"visitItem",value:function(u){}}])})(),Kn=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"queryInternal",value:function(){if(Ie(arguments[2],Gc)&&arguments[0]instanceof Object&&arguments[1]instanceof St)for(var n=arguments[0],r=arguments[2],a=arguments[1].getChildBoundables(),f=0;f<a.size();f++){var m=a.get(f);this.getIntersectsOp().intersects(m.getBounds(),n)&&(m instanceof St?this.queryInternal(n,m,r):m instanceof en?r.visitItem(m.getItem()):j.shouldNeverReachHere())}else if(Ie(arguments[2],Jt)&&arguments[0]instanceof Object&&arguments[1]instanceof St)for(var p=arguments[0],I=arguments[2],T=arguments[1].getChildBoundables(),U=0;U<T.size();U++){var J=T.get(U);this.getIntersectsOp().intersects(J.getBounds(),p)&&(J instanceof St?this.queryInternal(p,J,I):J instanceof en?I.add(J.getItem()):j.shouldNeverReachHere())}}},{key:"getNodeCapacity",value:function(){return this._nodeCapacity}},{key:"lastNode",value:function(n){return n.get(n.size()-1)}},{key:"size",value:function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var n=0,r=arguments[0].getChildBoundables().iterator();r.hasNext();){var a=r.next();a instanceof St?n+=this.size(a):a instanceof en&&(n+=1)}return n}}},{key:"removeItem",value:function(n,r){for(var a=null,f=n.getChildBoundables().iterator();f.hasNext();){var m=f.next();m instanceof en&&m.getItem()===r&&(a=m)}return a!==null&&(n.getChildBoundables().remove(a),!0)}},{key:"itemsTree",value:function(){if(arguments.length===0){this.build();var n=this.itemsTree(this._root);return n===null?new me:n}if(arguments.length===1){for(var r=arguments[0],a=new me,f=r.getChildBoundables().iterator();f.hasNext();){var m=f.next();if(m instanceof St){var p=this.itemsTree(m);p!==null&&a.add(p)}else m instanceof en?a.add(m.getItem()):j.shouldNeverReachHere()}return a.size()<=0?null:a}}},{key:"insert",value:function(n,r){j.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new en(n,r))}},{key:"boundablesAtLevel",value:function(){if(arguments.length===1){var n=arguments[0],r=new me;return this.boundablesAtLevel(n,this._root,r),r}if(arguments.length===3){var a=arguments[0],f=arguments[1],m=arguments[2];if(j.isTrue(a>-2),f.getLevel()===a)return m.add(f),null;for(var p=f.getChildBoundables().iterator();p.hasNext();){var I=p.next();I instanceof St?this.boundablesAtLevel(a,I,m):(j.isTrue(I instanceof en),a===-1&&m.add(I))}return null}}},{key:"query",value:function(){if(arguments.length===1){var n=arguments[0];this.build();var r=new me;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.queryInternal(n,this._root,r),r}if(arguments.length===2){var a=arguments[0],f=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),a)&&this.queryInternal(a,this._root,f)}}},{key:"build",value: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}},{key:"getRoot",value:function(){return this.build(),this._root}},{key:"remove",value:function(){if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.remove(n,this._root,r)}if(arguments.length===3){var a=arguments[0],f=arguments[1],m=arguments[2],p=this.removeItem(f,m);if(p)return!0;for(var I=null,T=f.getChildBoundables().iterator();T.hasNext();){var U=T.next();if(this.getIntersectsOp().intersects(U.getBounds(),a)&&U instanceof St&&(p=this.remove(a,U,m))){I=U;break}}return I!==null&&I.getChildBoundables().isEmpty()&&f.getChildBoundables().remove(I),p}}},{key:"createHigherLevels",value:function(n,r){j.isTrue(!n.isEmpty());var a=this.createParentBoundables(n,r+1);return a.size()===1?a.get(0):this.createHigherLevels(a,r+1)}},{key:"depth",value:function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var n=0,r=arguments[0].getChildBoundables().iterator();r.hasNext();){var a=r.next();if(a instanceof St){var f=this.depth(a);f>n&&(n=f)}}return n+1}}},{key:"createParentBoundables",value:function(n,r){j.isTrue(!n.isEmpty());var a=new me;a.add(this.createNode(r));var f=new me(n);Zn.sort(f,this.getComparator());for(var m=f.iterator();m.hasNext();){var p=m.next();this.lastNode(a).getChildBoundables().size()===this.getNodeCapacity()&&a.add(this.createNode(r)),this.lastNode(a).addChildBoundable(p)}return a}},{key:"isEmpty",value:function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()}},{key:"interfaces_",get:function(){return[N]}}],[{key:"constructor_",value:function(){if(this._root=null,this._built=!1,this._itemBoundables=new me,this._nodeCapacity=null,arguments.length===0)u.constructor_.call(this,u.DEFAULT_NODE_CAPACITY);else if(arguments.length===1){var n=arguments[0];j.isTrue(n>1,"Node capacity must be greater than 1"),this._nodeCapacity=n}}},{key:"compareDoubles",value:function(n,r){return n>r?1:n<r?-1:0}}])})();Kn.IntersectsOp=function(){},Kn.DEFAULT_NODE_CAPACITY=10;var up=(function(){return c((function u(){o(this,u)}),[{key:"distance",value:function(u,n){}}])})(),zt=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"createParentBoundablesFromVerticalSlices",value:function(r,a){j.isTrue(r.length>0);for(var f=new me,m=0;m<r.length;m++)f.addAll(this.createParentBoundablesFromVerticalSlice(r[m],a));return f}},{key:"nearestNeighbourK",value:function(){if(arguments.length===2){var r=arguments[0],a=arguments[1];return this.nearestNeighbourK(r,B.POSITIVE_INFINITY,a)}if(arguments.length===3){var f=arguments[0],m=arguments[2],p=arguments[1],I=new Qi;I.add(f);for(var T=new Qi;!I.isEmpty()&&p>=0;){var U=I.poll(),J=U.getDistance();if(J>=p)break;U.isLeaves()?T.size()<m?T.add(U):(T.peek().getDistance()>J&&(T.poll(),T.add(U)),p=T.peek().getDistance()):U.expandToQueue(I,p)}return n.getItems(T)}}},{key:"createNode",value:function(r){return new Yc(r)}},{key:"size",value:function(){return arguments.length===0?M(n,"size",this,1).call(this):M(n,"size",this,1).apply(this,arguments)}},{key:"insert",value:function(){if(!(arguments.length===2&&arguments[1]instanceof Object&&arguments[0]instanceof le))return M(n,"insert",this,1).apply(this,arguments);var r=arguments[0],a=arguments[1];if(r.isNull())return null;M(n,"insert",this,1).call(this,r,a)}},{key:"getIntersectsOp",value:function(){return n.intersectsOp}},{key:"verticalSlices",value:function(r,a){for(var f=Math.trunc(Math.ceil(r.size()/a)),m=new Array(a).fill(null),p=r.iterator(),I=0;I<a;I++){m[I]=new me;for(var T=0;p.hasNext()&&T<f;){var U=p.next();m[I].add(U),T++}}return m}},{key:"query",value:function(){if(arguments.length===1){var r=arguments[0];return M(n,"query",this,1).call(this,r)}if(arguments.length===2){var a=arguments[0],f=arguments[1];M(n,"query",this,1).call(this,a,f)}}},{key:"getComparator",value:function(){return n.yComparator}},{key:"createParentBoundablesFromVerticalSlice",value:function(r,a){return M(n,"createParentBoundables",this,1).call(this,r,a)}},{key:"remove",value:function(){if(arguments.length===2&&arguments[1]instanceof Object&&arguments[0]instanceof le){var r=arguments[0],a=arguments[1];return M(n,"remove",this,1).call(this,r,a)}return M(n,"remove",this,1).apply(this,arguments)}},{key:"depth",value:function(){return arguments.length===0?M(n,"depth",this,1).call(this):M(n,"depth",this,1).apply(this,arguments)}},{key:"createParentBoundables",value:function(r,a){j.isTrue(!r.isEmpty());var f=Math.trunc(Math.ceil(r.size()/this.getNodeCapacity())),m=new me(r);Zn.sort(m,n.xComparator);var p=this.verticalSlices(m,Math.trunc(Math.ceil(Math.sqrt(f))));return this.createParentBoundablesFromVerticalSlices(p,a)}},{key:"nearestNeighbour",value:function(){if(arguments.length===1){if(Ie(arguments[0],up)){var r=arguments[0];if(this.isEmpty())return null;var a=new Wn(this.getRoot(),this.getRoot(),r);return this.nearestNeighbour(a)}if(arguments[0]instanceof Wn){var f=arguments[0],m=B.POSITIVE_INFINITY,p=null,I=new Qi;for(I.add(f);!I.isEmpty()&&m>0;){var T=I.poll(),U=T.getDistance();if(U>=m)break;T.isLeaves()?(m=U,p=T):T.expandToQueue(I,m)}return p===null?null:[p.getBoundable(0).getItem(),p.getBoundable(1).getItem()]}}else{if(arguments.length===2){var J=arguments[0],Q=arguments[1];if(this.isEmpty()||J.isEmpty())return null;var ne=new Wn(this.getRoot(),J.getRoot(),Q);return this.nearestNeighbour(ne)}if(arguments.length===3){var ce=arguments[2],fe=new en(arguments[0],arguments[1]),de=new Wn(this.getRoot(),fe,ce);return this.nearestNeighbour(de)[0]}if(arguments.length===4){var Re=arguments[2],be=arguments[3],Ye=new en(arguments[0],arguments[1]),it=new Wn(this.getRoot(),Ye,Re);return this.nearestNeighbourK(it,be)}}}},{key:"isWithinDistance",value:function(){if(arguments.length===2){var r=arguments[0],a=arguments[1],f=B.POSITIVE_INFINITY,m=new Qi;for(m.add(r);!m.isEmpty();){var p=m.poll(),I=p.getDistance();if(I>a)return!1;if(p.maximumDistance()<=a)return!0;if(p.isLeaves()){if((f=I)<=a)return!0}else p.expandToQueue(m,f)}return!1}if(arguments.length===3){var T=arguments[0],U=arguments[1],J=arguments[2],Q=new Wn(this.getRoot(),T.getRoot(),U);return this.isWithinDistance(Q,J)}}},{key:"interfaces_",get:function(){return[op,N]}}],[{key:"constructor_",value:function(){if(arguments.length===0)n.constructor_.call(this,n.DEFAULT_NODE_CAPACITY);else if(arguments.length===1){var r=arguments[0];Kn.constructor_.call(this,r)}}},{key:"centreX",value:function(r){return n.avg(r.getMinX(),r.getMaxX())}},{key:"avg",value:function(r,a){return(r+a)/2}},{key:"getItems",value:function(r){for(var a=new Array(r.size()).fill(null),f=0;!r.isEmpty();){var m=r.poll();a[f]=m.getBoundable(0).getItem(),f++}return a}},{key:"centreY",value:function(r){return n.avg(r.getMinY(),r.getMaxY())}}])})(Kn),Yc=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"computeBounds",value:function(){for(var r=null,a=this.getChildBoundables().iterator();a.hasNext();){var f=a.next();r===null?r=new le(f.getBounds()):r.expandToInclude(f.getBounds())}return r}}],[{key:"constructor_",value:function(){var r=arguments[0];St.constructor_.call(this,r)}}])})(St);zt.STRtreeNode=Yc,zt.xComparator=new((function(){return c((function u(){o(this,u)}),[{key:"interfaces_",get:function(){return[Z]}},{key:"compare",value:function(u,n){return Kn.compareDoubles(zt.centreX(u.getBounds()),zt.centreX(n.getBounds()))}}])})()),zt.yComparator=new((function(){return c((function u(){o(this,u)}),[{key:"interfaces_",get:function(){return[Z]}},{key:"compare",value:function(u,n){return Kn.compareDoubles(zt.centreY(u.getBounds()),zt.centreY(n.getBounds()))}}])})()),zt.intersectsOp=new((function(){return c((function u(){o(this,u)}),[{key:"interfaces_",get:function(){return[IntersectsOp]}},{key:"intersects",value:function(u,n){return u.intersects(n)}}])})()),zt.DEFAULT_NODE_CAPACITY=10;var lp=(function(){function u(){o(this,u)}return c(u,null,[{key:"relativeSign",value:function(n,r){return n<r?-1:n>r?1:0}},{key:"compare",value:function(n,r,a){if(r.equals2D(a))return 0;var f=u.relativeSign(r.x,a.x),m=u.relativeSign(r.y,a.y);switch(n){case 0:return u.compareValue(f,m);case 1:return u.compareValue(m,f);case 2:return u.compareValue(m,-f);case 3:return u.compareValue(-f,m);case 4:return u.compareValue(-f,-m);case 5:return u.compareValue(-m,-f);case 6:return u.compareValue(-m,f);case 7:return u.compareValue(f,-m)}return j.shouldNeverReachHere("invalid octant value"),0}},{key:"compareValue",value:function(n,r){return n<0?-1:n>0?1:r<0?-1:r>0?1:0}}])})(),cp=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"getCoordinate",value:function(){return this.coord}},{key:"print",value:function(u){u.print(this.coord),u.print(" seg # = "+this.segmentIndex)}},{key:"compareTo",value:function(u){var n=u;return this.segmentIndex<n.segmentIndex?-1:this.segmentIndex>n.segmentIndex?1:this.coord.equals2D(n.coord)?0:this._isInterior?n._isInterior?lp.compare(this._segmentOctant,this.coord,n.coord):1:-1}},{key:"isEndPoint",value:function(u){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===u}},{key:"toString",value:function(){return this.segmentIndex+":"+this.coord.toString()}},{key:"isInterior",value:function(){return this._isInterior}},{key:"interfaces_",get:function(){return[q]}}],[{key:"constructor_",value:function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var u=arguments[0],n=arguments[1],r=arguments[2],a=arguments[3];this._segString=u,this.coord=new W(n),this.segmentIndex=r,this._segmentOctant=a,this._isInterior=!n.equals2D(u.getCoordinate(r))}}])})(),hp=(function(){return c((function u(){o(this,u)}),[{key:"hasNext",value:function(){}},{key:"next",value:function(){}},{key:"remove",value:function(){}}])})(),fp=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"getSplitCoordinates",value:function(){var u=new Dr;this.addEndpoints();for(var n=this.iterator(),r=n.next();n.hasNext();){var a=n.next();this.addEdgeCoordinates(r,a,u),r=a}return u.toCoordinateArray()}},{key:"addCollapsedNodes",value:function(){var u=new me;this.findCollapsesFromInsertedNodes(u),this.findCollapsesFromExistingVertices(u);for(var n=u.iterator();n.hasNext();){var r=n.next().intValue();this.add(this._edge.getCoordinate(r),r)}}},{key:"createSplitEdgePts",value:function(u,n){var r=n.segmentIndex-u.segmentIndex+2;if(r===2)return[new W(u.coord),new W(n.coord)];var a=this._edge.getCoordinate(n.segmentIndex),f=n.isInterior()||!n.coord.equals2D(a);f||r--;var m=new Array(r).fill(null),p=0;m[p++]=new W(u.coord);for(var I=u.segmentIndex+1;I<=n.segmentIndex;I++)m[p++]=this._edge.getCoordinate(I);return f&&(m[p]=new W(n.coord)),m}},{key:"print",value:function(u){u.println("Intersections:");for(var n=this.iterator();n.hasNext();)n.next().print(u)}},{key:"findCollapsesFromExistingVertices",value:function(u){for(var n=0;n<this._edge.size()-2;n++){var r=this._edge.getCoordinate(n);this._edge.getCoordinate(n+1);var a=this._edge.getCoordinate(n+2);r.equals2D(a)&&u.add(cn.valueOf(n+1))}}},{key:"addEdgeCoordinates",value:function(u,n,r){var a=this.createSplitEdgePts(u,n);r.add(a,!1)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(u){this.addEndpoints(),this.addCollapsedNodes();for(var n=this.iterator(),r=n.next();n.hasNext();){var a=n.next(),f=this.createSplitEdge(r,a);u.add(f),r=a}}},{key:"findCollapseIndex",value:function(u,n,r){if(!u.coord.equals2D(n.coord))return!1;var a=n.segmentIndex-u.segmentIndex;return n.isInterior()||a--,a===1&&(r[0]=u.segmentIndex+1,!0)}},{key:"findCollapsesFromInsertedNodes",value:function(u){for(var n=new Array(1).fill(null),r=this.iterator(),a=r.next();r.hasNext();){var f=r.next();this.findCollapseIndex(a,f,n)&&u.add(cn.valueOf(n[0])),a=f}}},{key:"getEdge",value:function(){return this._edge}},{key:"addEndpoints",value:function(){var u=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(u),u)}},{key:"createSplitEdge",value:function(u,n){var r=this.createSplitEdgePts(u,n);return new In(r,this._edge.getData())}},{key:"add",value:function(u,n){var r=new cp(this._edge,u,n,this._edge.getSegmentOctant(n)),a=this._nodeMap.get(r);return a!==null?(j.isTrue(a.coord.equals2D(u),"Found equal nodes with different coordinates"),a):(this._nodeMap.put(r,r),r)}},{key:"checkSplitEdgesCorrectness",value:function(u){var n=this._edge.getCoordinates(),r=u.get(0).getCoordinate(0);if(!r.equals2D(n[0]))throw new K("bad split edge start point at "+r);var a=u.get(u.size()-1).getCoordinates(),f=a[a.length-1];if(!f.equals2D(n[n.length-1]))throw new K("bad split edge end point at "+f)}}],[{key:"constructor_",value:function(){this._nodeMap=new Br,this._edge=null;var u=arguments[0];this._edge=u}}])})(),gp=(function(){function u(){o(this,u)}return c(u,null,[{key:"octant",value:function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],r=arguments[1];if(n===0&&r===0)throw new C("Cannot compute the octant for point ( "+n+", "+r+" )");var a=Math.abs(n),f=Math.abs(r);return n>=0?r>=0?a>=f?0:1:a>=f?7:6:r>=0?a>=f?3:2:a>=f?4:5}if(arguments[0]instanceof W&&arguments[1]instanceof W){var m=arguments[0],p=arguments[1],I=p.x-m.x,T=p.y-m.y;if(I===0&&T===0)throw new C("Cannot compute the octant for two identical points "+m);return u.octant(I,T)}}}])})(),dp=(function(){return c((function u(){o(this,u)}),[{key:"getCoordinates",value:function(){}},{key:"size",value:function(){}},{key:"getCoordinate",value:function(u){}},{key:"isClosed",value:function(){}},{key:"setData",value:function(u){}},{key:"getData",value:function(){}}])})(),vp=(function(){return c((function u(){o(this,u)}),[{key:"addIntersection",value:function(u,n){}},{key:"interfaces_",get:function(){return[dp]}}])})(),In=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"getCoordinates",value:function(){return this._pts}},{key:"size",value:function(){return this._pts.length}},{key:"getCoordinate",value:function(n){return this._pts[n]}},{key:"isClosed",value:function(){return this._pts[0].equals(this._pts[this._pts.length-1])}},{key:"getSegmentOctant",value:function(n){return n===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(n),this.getCoordinate(n+1))}},{key:"setData",value:function(n){this._data=n}},{key:"safeOctant",value:function(n,r){return n.equals2D(r)?0:gp.octant(n,r)}},{key:"getData",value:function(){return this._data}},{key:"addIntersection",value:function(){if(arguments.length===2){var n=arguments[0],r=arguments[1];this.addIntersectionNode(n,r)}else if(arguments.length===4){var a=arguments[1],f=arguments[3],m=new W(arguments[0].getIntersection(f));this.addIntersection(m,a)}}},{key:"toString",value:function(){return So.toLineString(new Fr(this._pts))}},{key:"getNodeList",value:function(){return this._nodeList}},{key:"addIntersectionNode",value:function(n,r){var a=r,f=a+1;if(f<this._pts.length){var m=this._pts[f];n.equals2D(m)&&(a=f)}return this._nodeList.add(n,a)}},{key:"addIntersections",value:function(n,r,a){for(var f=0;f<n.getIntersectionNum();f++)this.addIntersection(n,r,a,f)}},{key:"interfaces_",get:function(){return[vp]}}],[{key:"constructor_",value:function(){this._nodeList=new fp(this),this._pts=null,this._data=null;var n=arguments[0],r=arguments[1];this._pts=n,this._data=r}},{key:"getNodedSubstrings",value:function(){if(arguments.length===1){var n=arguments[0],r=new me;return u.getNodedSubstrings(n,r),r}if(arguments.length===2)for(var a=arguments[1],f=arguments[0].iterator();f.hasNext();)f.next().getNodeList().addSplitEdges(a)}}])})(),pt=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"minX",value:function(){return Math.min(this.p0.x,this.p1.x)}},{key:"orientationIndex",value:function(){if(arguments[0]instanceof u){var n=arguments[0],r=Ee.index(this.p0,this.p1,n.p0),a=Ee.index(this.p0,this.p1,n.p1);return r>=0&&a>=0||r<=0&&a<=0?Math.max(r,a):0}if(arguments[0]instanceof W){var f=arguments[0];return Ee.index(this.p0,this.p1,f)}}},{key:"toGeometry",value:function(n){return n.createLineString([this.p0,this.p1])}},{key:"isVertical",value:function(){return this.p0.x===this.p1.x}},{key:"equals",value:function(n){if(!(n instanceof u))return!1;var r=n;return this.p0.equals(r.p0)&&this.p1.equals(r.p1)}},{key:"intersection",value:function(n){var r=new kn;return r.computeIntersection(this.p0,this.p1,n.p0,n.p1),r.hasIntersection()?r.getIntersection(0):null}},{key:"project",value:function(){if(arguments[0]instanceof W){var n=arguments[0];if(n.equals(this.p0)||n.equals(this.p1))return new W(n);var r=this.projectionFactor(n),a=new W;return a.x=this.p0.x+r*(this.p1.x-this.p0.x),a.y=this.p0.y+r*(this.p1.y-this.p0.y),a}if(arguments[0]instanceof u){var f=arguments[0],m=this.projectionFactor(f.p0),p=this.projectionFactor(f.p1);if(m>=1&&p>=1||m<=0&&p<=0)return null;var I=this.project(f.p0);m<0&&(I=this.p0),m>1&&(I=this.p1);var T=this.project(f.p1);return p<0&&(T=this.p0),p>1&&(T=this.p1),new u(I,T)}}},{key:"normalize",value:function(){this.p1.compareTo(this.p0)<0&&this.reverse()}},{key:"angle",value:function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)}},{key:"getCoordinate",value:function(n){return n===0?this.p0:this.p1}},{key:"distancePerpendicular",value:function(n){return Gt.pointToLinePerpendicular(n,this.p0,this.p1)}},{key:"minY",value:function(){return Math.min(this.p0.y,this.p1.y)}},{key:"midPoint",value:function(){return u.midPoint(this.p0,this.p1)}},{key:"projectionFactor",value:function(n){if(n.equals(this.p0))return 0;if(n.equals(this.p1))return 1;var r=this.p1.x-this.p0.x,a=this.p1.y-this.p0.y,f=r*r+a*a;return f<=0?B.NaN:((n.x-this.p0.x)*r+(n.y-this.p0.y)*a)/f}},{key:"closestPoints",value:function(n){var r=this.intersection(n);if(r!==null)return[r,r];var a=new Array(2).fill(null),f=B.MAX_VALUE,m=null,p=this.closestPoint(n.p0);f=p.distance(n.p0),a[0]=p,a[1]=n.p0;var I=this.closestPoint(n.p1);(m=I.distance(n.p1))<f&&(f=m,a[0]=I,a[1]=n.p1);var T=n.closestPoint(this.p0);(m=T.distance(this.p0))<f&&(f=m,a[0]=this.p0,a[1]=T);var U=n.closestPoint(this.p1);return(m=U.distance(this.p1))<f&&(f=m,a[0]=this.p1,a[1]=U),a}},{key:"closestPoint",value:function(n){var r=this.projectionFactor(n);return r>0&&r<1?this.project(n):this.p0.distance(n)<this.p1.distance(n)?this.p0:this.p1}},{key:"maxX",value:function(){return Math.max(this.p0.x,this.p1.x)}},{key:"getLength",value:function(){return this.p0.distance(this.p1)}},{key:"compareTo",value:function(n){var r=n,a=this.p0.compareTo(r.p0);return a!==0?a:this.p1.compareTo(r.p1)}},{key:"reverse",value:function(){var n=this.p0;this.p0=this.p1,this.p1=n}},{key:"equalsTopo",value:function(n){return this.p0.equals(n.p0)&&this.p1.equals(n.p1)||this.p0.equals(n.p1)&&this.p1.equals(n.p0)}},{key:"lineIntersection",value:function(n){return _o.intersection(this.p0,this.p1,n.p0,n.p1)}},{key:"maxY",value:function(){return Math.max(this.p0.y,this.p1.y)}},{key:"pointAlongOffset",value:function(n,r){var a=this.p0.x+n*(this.p1.x-this.p0.x),f=this.p0.y+n*(this.p1.y-this.p0.y),m=this.p1.x-this.p0.x,p=this.p1.y-this.p0.y,I=Math.sqrt(m*m+p*p),T=0,U=0;if(r!==0){if(I<=0)throw new IllegalStateException("Cannot compute offset from zero-length line segment");T=r*m/I,U=r*p/I}return new W(a-U,f+T)}},{key:"setCoordinates",value:function(){if(arguments.length===1){var n=arguments[0];this.setCoordinates(n.p0,n.p1)}else if(arguments.length===2){var r=arguments[0],a=arguments[1];this.p0.x=r.x,this.p0.y=r.y,this.p1.x=a.x,this.p1.y=a.y}}},{key:"segmentFraction",value:function(n){var r=this.projectionFactor(n);return r<0?r=0:(r>1||B.isNaN(r))&&(r=1),r}},{key:"toString",value:function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"}},{key:"isHorizontal",value:function(){return this.p0.y===this.p1.y}},{key:"reflect",value:function(n){var r=this.p1.getY()-this.p0.getY(),a=this.p0.getX()-this.p1.getX(),f=this.p0.getY()*(this.p1.getX()-this.p0.getX())-this.p0.getX()*(this.p1.getY()-this.p0.getY()),m=r*r+a*a,p=r*r-a*a,I=n.getX(),T=n.getY();return new W((-p*I-2*r*a*T-2*r*f)/m,(p*T-2*r*a*I-2*a*f)/m)}},{key:"distance",value:function(){if(arguments[0]instanceof u){var n=arguments[0];return Gt.segmentToSegment(this.p0,this.p1,n.p0,n.p1)}if(arguments[0]instanceof W){var r=arguments[0];return Gt.pointToSegment(r,this.p0,this.p1)}}},{key:"pointAlong",value:function(n){var r=new W;return r.x=this.p0.x+n*(this.p1.x-this.p0.x),r.y=this.p0.y+n*(this.p1.y-this.p0.y),r}},{key:"hashCode",value:function(){var n=B.doubleToLongBits(this.p0.x);n^=31*B.doubleToLongBits(this.p0.y);var r=Math.trunc(n)^Math.trunc(n>>32),a=B.doubleToLongBits(this.p1.x);return a^=31*B.doubleToLongBits(this.p1.y),r^(Math.trunc(a)^Math.trunc(a>>32))}},{key:"interfaces_",get:function(){return[q,N]}}],[{key:"constructor_",value:function(){if(this.p0=null,this.p1=null,arguments.length===0)u.constructor_.call(this,new W,new W);else if(arguments.length===1){var n=arguments[0];u.constructor_.call(this,n.p0,n.p1)}else if(arguments.length===2){var r=arguments[0],a=arguments[1];this.p0=r,this.p1=a}else if(arguments.length===4){var f=arguments[0],m=arguments[1],p=arguments[2],I=arguments[3];u.constructor_.call(this,new W(f,m),new W(p,I))}}},{key:"midPoint",value:function(n,r){return new W((n.x+r.x)/2,(n.y+r.y)/2)}}])})(),yp=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"overlap",value:function(){if(arguments.length!==2){if(arguments.length===4){var u=arguments[1],n=arguments[2],r=arguments[3];arguments[0].getLineSegment(u,this._overlapSeg1),n.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}}}],[{key:"constructor_",value:function(){this._overlapSeg1=new pt,this._overlapSeg2=new pt}}])})(),zc=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"getLineSegment",value:function(u,n){n.p0=this._pts[u],n.p1=this._pts[u+1]}},{key:"computeSelect",value:function(u,n,r,a){var f=this._pts[n],m=this._pts[r];if(r-n==1)return a.select(this,n),null;if(!u.intersects(f,m))return null;var p=Math.trunc((n+r)/2);n<p&&this.computeSelect(u,n,p,a),p<r&&this.computeSelect(u,p,r,a)}},{key:"getCoordinates",value:function(){for(var u=new Array(this._end-this._start+1).fill(null),n=0,r=this._start;r<=this._end;r++)u[n++]=this._pts[r];return u}},{key:"computeOverlaps",value:function(){if(arguments.length===2){var u=arguments[0],n=arguments[1];this.computeOverlaps(this._start,this._end,u,u._start,u._end,n)}else if(arguments.length===6){var r=arguments[0],a=arguments[1],f=arguments[2],m=arguments[3],p=arguments[4],I=arguments[5];if(a-r==1&&p-m==1)return I.overlap(this,r,f,m),null;if(!this.overlaps(r,a,f,m,p))return null;var T=Math.trunc((r+a)/2),U=Math.trunc((m+p)/2);r<T&&(m<U&&this.computeOverlaps(r,T,f,m,U,I),U<p&&this.computeOverlaps(r,T,f,U,p,I)),T<a&&(m<U&&this.computeOverlaps(T,a,f,m,U,I),U<p&&this.computeOverlaps(T,a,f,U,p,I))}}},{key:"setId",value:function(u){this._id=u}},{key:"select",value:function(u,n){this.computeSelect(u,this._start,this._end,n)}},{key:"getEnvelope",value:function(){if(this._env===null){var u=this._pts[this._start],n=this._pts[this._end];this._env=new le(u,n)}return this._env}},{key:"overlaps",value:function(u,n,r,a,f){return le.intersects(this._pts[u],this._pts[n],r._pts[a],r._pts[f])}},{key:"getEndIndex",value:function(){return this._end}},{key:"getStartIndex",value:function(){return this._start}},{key:"getContext",value:function(){return this._context}},{key:"getId",value:function(){return this._id}}],[{key:"constructor_",value:function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var u=arguments[0],n=arguments[1],r=arguments[2],a=arguments[3];this._pts=u,this._start=n,this._end=r,this._context=a}}])})(),mp=(function(){function u(){o(this,u)}return c(u,null,[{key:"findChainEnd",value:function(n,r){for(var a=r;a<n.length-1&&n[a].equals2D(n[a+1]);)a++;if(a>=n.length-1)return n.length-1;for(var f=ht.quadrant(n[a],n[a+1]),m=r+1;m<n.length&&!(!n[m-1].equals2D(n[m])&&ht.quadrant(n[m-1],n[m])!==f);)m++;return m-1}},{key:"getChains",value:function(){if(arguments.length===1){var n=arguments[0];return u.getChains(n,null)}if(arguments.length===2){var r=arguments[0],a=arguments[1],f=new me,m=0;do{var p=u.findChainEnd(r,m),I=new zc(r,m,p,a);f.add(I),m=p}while(m<r.length-1);return f}}}])})(),Co=(function(){return c((function u(){o(this,u)}),[{key:"computeNodes",value:function(u){}},{key:"getNodedSubstrings",value:function(){}}])})(),Xc=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"setSegmentIntersector",value:function(u){this._segInt=u}},{key:"interfaces_",get:function(){return[Co]}}],[{key:"constructor_",value:function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var u=arguments[0];this.setSegmentIntersector(u)}}}}])})(),Oo=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"getMonotoneChains",value:function(){return this._monoChains}},{key:"getNodedSubstrings",value:function(){return In.getNodedSubstrings(this._nodedSegStrings)}},{key:"getIndex",value:function(){return this._index}},{key:"add",value:function(r){for(var a=mp.getChains(r.getCoordinates(),r).iterator();a.hasNext();){var f=a.next();f.setId(this._idCounter++),this._index.insert(f.getEnvelope(),f),this._monoChains.add(f)}}},{key:"computeNodes",value:function(r){this._nodedSegStrings=r;for(var a=r.iterator();a.hasNext();)this.add(a.next());this.intersectChains()}},{key:"intersectChains",value:function(){for(var r=new Uc(this._segInt),a=this._monoChains.iterator();a.hasNext();)for(var f=a.next(),m=this._index.query(f.getEnvelope()).iterator();m.hasNext();){var p=m.next();if(p.getId()>f.getId()&&(f.computeOverlaps(p,r),this._nOverlaps++),this._segInt.isDone())return null}}}],[{key:"constructor_",value:function(){if(this._monoChains=new me,this._index=new zt,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0,arguments.length!==0){if(arguments.length===1){var r=arguments[0];Xc.constructor_.call(this,r)}}}}])})(Xc),Uc=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"overlap",value:function(){if(arguments.length!==4)return M(n,"overlap",this,1).apply(this,arguments);var r=arguments[1],a=arguments[2],f=arguments[3],m=arguments[0].getContext(),p=a.getContext();this._si.processIntersections(m,r,p,f)}}],[{key:"constructor_",value:function(){this._si=null;var r=arguments[0];this._si=r}}])})(yp);Oo.SegmentOverlapAction=Uc;var Ct=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"isDeletable",value:function(n,r,a,f){var m=this._inputLine[n],p=this._inputLine[r],I=this._inputLine[a];return!!this.isConcave(m,p,I)&&!!this.isShallow(m,p,I,f)&&this.isShallowSampled(m,p,n,a,f)}},{key:"deleteShallowConcavities",value:function(){for(var n=1,r=this.findNextNonDeletedIndex(n),a=this.findNextNonDeletedIndex(r),f=!1;a<this._inputLine.length;){var m=!1;this.isDeletable(n,r,a,this._distanceTol)&&(this._isDeleted[r]=u.DELETE,m=!0,f=!0),n=m?a:r,r=this.findNextNonDeletedIndex(n),a=this.findNextNonDeletedIndex(r)}return f}},{key:"isShallowConcavity",value:function(n,r,a,f){return Ee.index(n,r,a)===this._angleOrientation&&Gt.pointToSegment(r,n,a)<f}},{key:"isShallowSampled",value:function(n,r,a,f,m){var p=Math.trunc((f-a)/u.NUM_PTS_TO_CHECK);p<=0&&(p=1);for(var I=a;I<f;I+=p)if(!this.isShallow(n,r,this._inputLine[I],m))return!1;return!0}},{key:"isConcave",value:function(n,r,a){var f=Ee.index(n,r,a)===this._angleOrientation;return f}},{key:"simplify",value:function(n){this._distanceTol=Math.abs(n),n<0&&(this._angleOrientation=Ee.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var r=!1;do r=this.deleteShallowConcavities();while(r);return this.collapseLine()}},{key:"findNextNonDeletedIndex",value:function(n){for(var r=n+1;r<this._inputLine.length&&this._isDeleted[r]===u.DELETE;)r++;return r}},{key:"isShallow",value:function(n,r,a,f){return Gt.pointToSegment(r,n,a)<f}},{key:"collapseLine",value:function(){for(var n=new Dr,r=0;r<this._inputLine.length;r++)this._isDeleted[r]!==u.DELETE&&n.add(this._inputLine[r]);return n.toCoordinateArray()}}],[{key:"constructor_",value:function(){this._inputLine=null,this._distanceTol=null,this._isDeleted=null,this._angleOrientation=Ee.COUNTERCLOCKWISE;var n=arguments[0];this._inputLine=n}},{key:"simplify",value:function(n,r){return new u(n).simplify(r)}}])})();Ct.INIT=0,Ct.DELETE=1,Ct.KEEP=1,Ct.NUM_PTS_TO_CHECK=10;var Vc=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"getCoordinates",value:function(){return this._ptList.toArray(u.COORDINATE_ARRAY_TYPE)}},{key:"setPrecisionModel",value:function(n){this._precisionModel=n}},{key:"addPt",value:function(n){var r=new W(n);if(this._precisionModel.makePrecise(r),this.isRedundant(r))return null;this._ptList.add(r)}},{key:"reverse",value:function(){}},{key:"addPts",value:function(n,r){if(r)for(var a=0;a<n.length;a++)this.addPt(n[a]);else for(var f=n.length-1;f>=0;f--)this.addPt(n[f])}},{key:"isRedundant",value:function(n){if(this._ptList.size()<1)return!1;var r=this._ptList.get(this._ptList.size()-1);return n.distance(r)<this._minimimVertexDistance}},{key:"toString",value:function(){return new Hn().createLineString(this.getCoordinates()).toString()}},{key:"closeRing",value:function(){if(this._ptList.size()<1)return null;var n=new W(this._ptList.get(0)),r=this._ptList.get(this._ptList.size()-1);if(n.equals(r))return null;this._ptList.add(n)}},{key:"setMinimumVertexDistance",value:function(n){this._minimimVertexDistance=n}}],[{key:"constructor_",value:function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new me}}])})();Vc.COORDINATE_ARRAY_TYPE=new Array(0).fill(null);var _t=(function(){function u(){o(this,u)}return c(u,null,[{key:"toDegrees",value:function(n){return 180*n/Math.PI}},{key:"normalize",value:function(n){for(;n>Math.PI;)n-=u.PI_TIMES_2;for(;n<=-Math.PI;)n+=u.PI_TIMES_2;return n}},{key:"angle",value:function(){if(arguments.length===1){var n=arguments[0];return Math.atan2(n.y,n.x)}if(arguments.length===2){var r=arguments[0],a=arguments[1],f=a.x-r.x,m=a.y-r.y;return Math.atan2(m,f)}}},{key:"isAcute",value:function(n,r,a){var f=n.x-r.x,m=n.y-r.y;return f*(a.x-r.x)+m*(a.y-r.y)>0}},{key:"isObtuse",value:function(n,r,a){var f=n.x-r.x,m=n.y-r.y;return f*(a.x-r.x)+m*(a.y-r.y)<0}},{key:"interiorAngle",value:function(n,r,a){var f=u.angle(r,n),m=u.angle(r,a);return Math.abs(m-f)}},{key:"normalizePositive",value:function(n){if(n<0){for(;n<0;)n+=u.PI_TIMES_2;n>=u.PI_TIMES_2&&(n=0)}else{for(;n>=u.PI_TIMES_2;)n-=u.PI_TIMES_2;n<0&&(n=0)}return n}},{key:"angleBetween",value:function(n,r,a){var f=u.angle(r,n),m=u.angle(r,a);return u.diff(f,m)}},{key:"diff",value:function(n,r){var a=null;return(a=n<r?r-n:n-r)>Math.PI&&(a=2*Math.PI-a),a}},{key:"toRadians",value:function(n){return n*Math.PI/180}},{key:"getTurn",value:function(n,r){var a=Math.sin(r-n);return a>0?u.COUNTERCLOCKWISE:a<0?u.CLOCKWISE:u.NONE}},{key:"angleBetweenOriented",value:function(n,r,a){var f=u.angle(r,n),m=u.angle(r,a)-f;return m<=-Math.PI?m+u.PI_TIMES_2:m>Math.PI?m-u.PI_TIMES_2:m}}])})();_t.PI_TIMES_2=2*Math.PI,_t.PI_OVER_2=Math.PI/2,_t.PI_OVER_4=Math.PI/4,_t.COUNTERCLOCKWISE=Ee.COUNTERCLOCKWISE,_t.CLOCKWISE=Ee.CLOCKWISE,_t.NONE=Ee.COLLINEAR;var Gr=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"addNextSegment",value:function(n,r){if(this._s0=this._s1,this._s1=this._s2,this._s2=n,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 a=Ee.index(this._s0,this._s1,this._s2),f=a===Ee.CLOCKWISE&&this._side===ie.LEFT||a===Ee.COUNTERCLOCKWISE&&this._side===ie.RIGHT;a===0?this.addCollinear(r):f?this.addOutsideTurn(a,r):this.addInsideTurn(a,r)}},{key:"addLineEndCap",value:function(n,r){var a=new pt(n,r),f=new pt;this.computeOffsetSegment(a,ie.LEFT,this._distance,f);var m=new pt;this.computeOffsetSegment(a,ie.RIGHT,this._distance,m);var p=r.x-n.x,I=r.y-n.y,T=Math.atan2(I,p);switch(this._bufParams.getEndCapStyle()){case S.CAP_ROUND:this._segList.addPt(f.p1),this.addDirectedFillet(r,T+Math.PI/2,T-Math.PI/2,Ee.CLOCKWISE,this._distance),this._segList.addPt(m.p1);break;case S.CAP_FLAT:this._segList.addPt(f.p1),this._segList.addPt(m.p1);break;case S.CAP_SQUARE:var U=new W;U.x=Math.abs(this._distance)*Math.cos(T),U.y=Math.abs(this._distance)*Math.sin(T);var J=new W(f.p1.x+U.x,f.p1.y+U.y),Q=new W(m.p1.x+U.x,m.p1.y+U.y);this._segList.addPt(J),this._segList.addPt(Q)}}},{key:"getCoordinates",value:function(){return this._segList.getCoordinates()}},{key:"addMitreJoin",value:function(n,r,a,f){var m=_o.intersection(r.p0,r.p1,a.p0,a.p1);if(m!==null&&(f<=0?1:m.distance(n)/Math.abs(f))<=this._bufParams.getMitreLimit())return this._segList.addPt(m),null;this.addLimitedMitreJoin(r,a,f,this._bufParams.getMitreLimit())}},{key:"addOutsideTurn",value:function(n,r){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*u.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===S.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===S.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(r&&this._segList.addPt(this._offset0.p1),this.addCornerFillet(this._s1,this._offset0.p1,this._offset1.p0,n,this._distance),this._segList.addPt(this._offset1.p0))}},{key:"createSquare",value:function(n){this._segList.addPt(new W(n.x+this._distance,n.y+this._distance)),this._segList.addPt(new W(n.x+this._distance,n.y-this._distance)),this._segList.addPt(new W(n.x-this._distance,n.y-this._distance)),this._segList.addPt(new W(n.x-this._distance,n.y+this._distance)),this._segList.closeRing()}},{key:"addSegments",value:function(n,r){this._segList.addPts(n,r)}},{key:"addFirstSegment",value:function(){this._segList.addPt(this._offset1.p0)}},{key:"addCornerFillet",value:function(n,r,a,f,m){var p=r.x-n.x,I=r.y-n.y,T=Math.atan2(I,p),U=a.x-n.x,J=a.y-n.y,Q=Math.atan2(J,U);f===Ee.CLOCKWISE?T<=Q&&(T+=2*Math.PI):T>=Q&&(T-=2*Math.PI),this._segList.addPt(r),this.addDirectedFillet(n,T,Q,f,m),this._segList.addPt(a)}},{key:"addLastSegment",value:function(){this._segList.addPt(this._offset1.p1)}},{key:"initSideSegments",value:function(n,r,a){this._s1=n,this._s2=r,this._side=a,this._seg1.setCoordinates(n,r),this.computeOffsetSegment(this._seg1,a,this._distance,this._offset1)}},{key:"addLimitedMitreJoin",value:function(n,r,a,f){var m=this._seg0.p1,p=_t.angle(m,this._seg0.p0),I=_t.angleBetweenOriented(this._seg0.p0,m,this._seg1.p1)/2,T=_t.normalize(p+I),U=_t.normalize(T+Math.PI),J=f*a,Q=a-J*Math.abs(Math.sin(I)),ne=m.x+J*Math.cos(U),ce=m.y+J*Math.sin(U),fe=new W(ne,ce),de=new pt(m,fe),Re=de.pointAlongOffset(1,Q),be=de.pointAlongOffset(1,-Q);this._side===ie.LEFT?(this._segList.addPt(Re),this._segList.addPt(be)):(this._segList.addPt(be),this._segList.addPt(Re))}},{key:"addDirectedFillet",value:function(n,r,a,f,m){var p=f===Ee.CLOCKWISE?-1:1,I=Math.abs(r-a),T=Math.trunc(I/this._filletAngleQuantum+.5);if(T<1)return null;for(var U=I/T,J=new W,Q=0;Q<T;Q++){var ne=r+p*Q*U;J.x=n.x+m*Math.cos(ne),J.y=n.y+m*Math.sin(ne),this._segList.addPt(J)}}},{key:"computeOffsetSegment",value:function(n,r,a,f){var m=r===ie.LEFT?1:-1,p=n.p1.x-n.p0.x,I=n.p1.y-n.p0.y,T=Math.sqrt(p*p+I*I),U=m*a*p/T,J=m*a*I/T;f.p0.x=n.p0.x-J,f.p0.y=n.p0.y+U,f.p1.x=n.p1.x-J,f.p1.y=n.p1.y+U}},{key:"addInsideTurn",value:function(n,r){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*u.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var a=new W((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(a);var f=new W((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(f)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}}},{key:"createCircle",value:function(n){var r=new W(n.x+this._distance,n.y);this._segList.addPt(r),this.addDirectedFillet(n,0,2*Math.PI,-1,this._distance),this._segList.closeRing()}},{key:"addBevelJoin",value:function(n,r){this._segList.addPt(n.p1),this._segList.addPt(r.p0)}},{key:"init",value:function(n){this._distance=n,this._maxCurveSegmentError=n*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Vc,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(n*u.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)}},{key:"addCollinear",value:function(n){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===S.JOIN_BEVEL||this._bufParams.getJoinStyle()===S.JOIN_MITRE?(n&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addCornerFillet(this._s1,this._offset0.p1,this._offset1.p0,Ee.CLOCKWISE,this._distance))}},{key:"closeRing",value:function(){this._segList.closeRing()}},{key:"hasNarrowConcaveAngle",value:function(){return this._hasNarrowConcaveAngle}}],[{key:"constructor_",value:function(){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 pt,this._seg1=new pt,this._offset0=new pt,this._offset1=new pt,this._side=0,this._hasNarrowConcaveAngle=!1;var n=arguments[0],r=arguments[1],a=arguments[2];this._precisionModel=n,this._bufParams=r,this._li=new kn,this._filletAngleQuantum=Math.PI/2/r.getQuadrantSegments(),r.getQuadrantSegments()>=8&&r.getJoinStyle()===S.JOIN_ROUND&&(this._closingSegLengthFactor=u.MAX_CLOSING_SEG_LEN_FACTOR),this.init(a)}}])})();Gr.OFFSET_SEGMENT_SEPARATION_FACTOR=.001,Gr.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR=.001,Gr.CURVE_VERTEX_SNAP_DISTANCE_FACTOR=1e-6,Gr.MAX_CLOSING_SEG_LEN_FACTOR=80;var pp=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"getOffsetCurve",value:function(n,r){if(this._distance=r,r===0)return null;var a=r<0,f=Math.abs(r),m=this.getSegGen(f);n.length<=1?this.computePointCurve(n[0],m):this.computeOffsetCurve(n,a,m);var p=m.getCoordinates();return a&&et.reverse(p),p}},{key:"computeSingleSidedBufferCurve",value:function(n,r,a){var f=this.simplifyTolerance(this._distance);if(r){a.addSegments(n,!0);var m=Ct.simplify(n,-f),p=m.length-1;a.initSideSegments(m[p],m[p-1],ie.LEFT),a.addFirstSegment();for(var I=p-2;I>=0;I--)a.addNextSegment(m[I],!0)}else{a.addSegments(n,!1);var T=Ct.simplify(n,f),U=T.length-1;a.initSideSegments(T[0],T[1],ie.LEFT),a.addFirstSegment();for(var J=2;J<=U;J++)a.addNextSegment(T[J],!0)}a.addLastSegment(),a.closeRing()}},{key:"computeRingBufferCurve",value:function(n,r,a){var f=this.simplifyTolerance(this._distance);r===ie.RIGHT&&(f=-f);var m=Ct.simplify(n,f),p=m.length-1;a.initSideSegments(m[p-1],m[0],r);for(var I=1;I<=p;I++){var T=I!==1;a.addNextSegment(m[I],T)}a.closeRing()}},{key:"computeLineBufferCurve",value:function(n,r){var a=this.simplifyTolerance(this._distance),f=Ct.simplify(n,a),m=f.length-1;r.initSideSegments(f[0],f[1],ie.LEFT);for(var p=2;p<=m;p++)r.addNextSegment(f[p],!0);r.addLastSegment(),r.addLineEndCap(f[m-1],f[m]);var I=Ct.simplify(n,-a),T=I.length-1;r.initSideSegments(I[T],I[T-1],ie.LEFT);for(var U=T-2;U>=0;U--)r.addNextSegment(I[U],!0);r.addLastSegment(),r.addLineEndCap(I[1],I[0]),r.closeRing()}},{key:"computePointCurve",value:function(n,r){switch(this._bufParams.getEndCapStyle()){case S.CAP_ROUND:r.createCircle(n);break;case S.CAP_SQUARE:r.createSquare(n)}}},{key:"getLineCurve",value:function(n,r){if(this._distance=r,this.isLineOffsetEmpty(r))return null;var a=Math.abs(r),f=this.getSegGen(a);if(n.length<=1)this.computePointCurve(n[0],f);else if(this._bufParams.isSingleSided()){var m=r<0;this.computeSingleSidedBufferCurve(n,m,f)}else this.computeLineBufferCurve(n,f);return f.getCoordinates()}},{key:"getBufferParameters",value:function(){return this._bufParams}},{key:"simplifyTolerance",value:function(n){return n*this._bufParams.getSimplifyFactor()}},{key:"getRingCurve",value:function(n,r,a){if(this._distance=a,n.length<=2)return this.getLineCurve(n,a);if(a===0)return u.copyCoordinates(n);var f=this.getSegGen(a);return this.computeRingBufferCurve(n,r,f),f.getCoordinates()}},{key:"computeOffsetCurve",value:function(n,r,a){var f=this.simplifyTolerance(this._distance);if(r){var m=Ct.simplify(n,-f),p=m.length-1;a.initSideSegments(m[p],m[p-1],ie.LEFT),a.addFirstSegment();for(var I=p-2;I>=0;I--)a.addNextSegment(m[I],!0)}else{var T=Ct.simplify(n,f),U=T.length-1;a.initSideSegments(T[0],T[1],ie.LEFT),a.addFirstSegment();for(var J=2;J<=U;J++)a.addNextSegment(T[J],!0)}a.addLastSegment()}},{key:"isLineOffsetEmpty",value:function(n){return n===0||n<0&&!this._bufParams.isSingleSided()}},{key:"getSegGen",value:function(n){return new Gr(this._precisionModel,this._bufParams,n)}}],[{key:"constructor_",value:function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var n=arguments[0],r=arguments[1];this._precisionModel=n,this._bufParams=r}},{key:"copyCoordinates",value:function(n){for(var r=new Array(n.length).fill(null),a=0;a<r.length;a++)r[a]=new W(n[a]);return r}}])})(),Hc=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"findStabbedSegments",value:function(){if(arguments.length===1){for(var u=arguments[0],n=new me,r=this._subgraphs.iterator();r.hasNext();){var a=r.next(),f=a.getEnvelope();u.y<f.getMinY()||u.y>f.getMaxY()||this.findStabbedSegments(u,a.getDirectedEdges(),n)}return n}if(arguments.length===3){if(Ie(arguments[2],Jt)&&arguments[0]instanceof W&&arguments[1]instanceof bo){for(var m=arguments[0],p=arguments[1],I=arguments[2],T=p.getEdge().getCoordinates(),U=0;U<T.length-1;U++)if(this._seg.p0=T[U],this._seg.p1=T[U+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<m.x||this._seg.isHorizontal()||m.y<this._seg.p0.y||m.y>this._seg.p1.y||Ee.index(this._seg.p0,this._seg.p1,m)===Ee.RIGHT)){var J=p.getDepth(ie.LEFT);this._seg.p0.equals(T[U])||(J=p.getDepth(ie.RIGHT));var Q=new $c(this._seg,J);I.add(Q)}}else if(Ie(arguments[2],Jt)&&arguments[0]instanceof W&&Ie(arguments[1],Jt))for(var ne=arguments[0],ce=arguments[2],fe=arguments[1].iterator();fe.hasNext();){var de=fe.next();de.isForward()&&this.findStabbedSegments(ne,de,ce)}}}},{key:"getDepth",value:function(u){var n=this.findStabbedSegments(u);return n.size()===0?0:Zn.min(n)._leftDepth}}],[{key:"constructor_",value:function(){this._subgraphs=null,this._seg=new pt;var u=arguments[0];this._subgraphs=u}}])})(),$c=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"compareTo",value:function(u){var n=u;if(this._upwardSeg.minX()>=n._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=n._upwardSeg.minX())return-1;var r=this._upwardSeg.orientationIndex(n._upwardSeg);return r!==0||(r=-1*n._upwardSeg.orientationIndex(this._upwardSeg))!==0?r:this._upwardSeg.compareTo(n._upwardSeg)}},{key:"compareX",value:function(u,n){var r=u.p0.compareTo(n.p0);return r!==0?r:u.p1.compareTo(n.p1)}},{key:"toString",value:function(){return this._upwardSeg.toString()}},{key:"interfaces_",get:function(){return[q]}}],[{key:"constructor_",value:function(){this._upwardSeg=null,this._leftDepth=null;var u=arguments[0],n=arguments[1];this._upwardSeg=new pt(u),this._leftDepth=n}}])})();Hc.DepthSegment=$c;var Zc=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,null,[{key:"constructor_",value:function(){b.constructor_.call(this,"Projective point not representable on the Cartesian plane.")}}])})(b),To=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"getY",value:function(){var n=this.y/this.w;if(B.isNaN(n)||B.isInfinite(n))throw new Zc;return n}},{key:"getX",value:function(){var n=this.x/this.w;if(B.isNaN(n)||B.isInfinite(n))throw new Zc;return n}},{key:"getCoordinate",value:function(){var n=new W;return n.x=this.getX(),n.y=this.getY(),n}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.w=null,arguments.length===0)this.x=0,this.y=0,this.w=1;else if(arguments.length===1){var n=arguments[0];this.x=n.x,this.y=n.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var r=arguments[0],a=arguments[1];this.x=r,this.y=a,this.w=1}else if(arguments[0]instanceof u&&arguments[1]instanceof u){var f=arguments[0],m=arguments[1];this.x=f.y*m.w-m.y*f.w,this.y=m.x*f.w-f.x*m.w,this.w=f.x*m.y-m.x*f.y}else if(arguments[0]instanceof W&&arguments[1]instanceof W){var p=arguments[0],I=arguments[1];this.x=p.y-I.y,this.y=I.x-p.x,this.w=p.x*I.y-I.x*p.y}}else if(arguments.length===3){var T=arguments[0],U=arguments[1],J=arguments[2];this.x=T,this.y=U,this.w=J}else if(arguments.length===4){var Q=arguments[0],ne=arguments[1],ce=arguments[2],fe=arguments[3],de=Q.y-ne.y,Re=ne.x-Q.x,be=Q.x*ne.y-ne.x*Q.y,Ye=ce.y-fe.y,it=fe.x-ce.x,ut=ce.x*fe.y-fe.x*ce.y;this.x=Re*ut-it*be,this.y=Ye*be-de*ut,this.w=de*it-Ye*Re}}}])})(),_p=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"area",value:function(){return u.area(this.p0,this.p1,this.p2)}},{key:"signedArea",value:function(){return u.signedArea(this.p0,this.p1,this.p2)}},{key:"interpolateZ",value:function(n){if(n===null)throw new C("Supplied point is null.");return u.interpolateZ(n,this.p0,this.p1,this.p2)}},{key:"longestSideLength",value:function(){return u.longestSideLength(this.p0,this.p1,this.p2)}},{key:"isAcute",value:function(){return u.isAcute(this.p0,this.p1,this.p2)}},{key:"circumcentre",value:function(){return u.circumcentre(this.p0,this.p1,this.p2)}},{key:"area3D",value:function(){return u.area3D(this.p0,this.p1,this.p2)}},{key:"centroid",value:function(){return u.centroid(this.p0,this.p1,this.p2)}},{key:"inCentre",value:function(){return u.inCentre(this.p0,this.p1,this.p2)}}],[{key:"constructor_",value:function(){this.p0=null,this.p1=null,this.p2=null;var n=arguments[0],r=arguments[1],a=arguments[2];this.p0=n,this.p1=r,this.p2=a}},{key:"area",value:function(n,r,a){return Math.abs(((a.x-n.x)*(r.y-n.y)-(r.x-n.x)*(a.y-n.y))/2)}},{key:"signedArea",value:function(n,r,a){return((a.x-n.x)*(r.y-n.y)-(r.x-n.x)*(a.y-n.y))/2}},{key:"det",value:function(n,r,a,f){return n*f-r*a}},{key:"interpolateZ",value:function(n,r,a,f){var m=r.x,p=r.y,I=a.x-m,T=f.x-m,U=a.y-p,J=f.y-p,Q=I*J-T*U,ne=n.x-m,ce=n.y-p,fe=(J*ne-T*ce)/Q,de=(-U*ne+I*ce)/Q;return r.getZ()+fe*(a.getZ()-r.getZ())+de*(f.getZ()-r.getZ())}},{key:"longestSideLength",value:function(n,r,a){var f=n.distance(r),m=r.distance(a),p=a.distance(n),I=f;return m>I&&(I=m),p>I&&(I=p),I}},{key:"circumcentreDD",value:function(n,r,a){var f=pe.valueOf(n.x).subtract(a.x),m=pe.valueOf(n.y).subtract(a.y),p=pe.valueOf(r.x).subtract(a.x),I=pe.valueOf(r.y).subtract(a.y),T=pe.determinant(f,m,p,I).multiply(2),U=f.sqr().add(m.sqr()),J=p.sqr().add(I.sqr()),Q=pe.determinant(m,U,I,J),ne=pe.determinant(f,U,p,J),ce=pe.valueOf(a.x).subtract(Q.divide(T)).doubleValue(),fe=pe.valueOf(a.y).add(ne.divide(T)).doubleValue();return new W(ce,fe)}},{key:"isAcute",value:function(n,r,a){return!!_t.isAcute(n,r,a)&&!!_t.isAcute(r,a,n)&&!!_t.isAcute(a,n,r)}},{key:"circumcentre",value:function(n,r,a){var f=a.x,m=a.y,p=n.x-f,I=n.y-m,T=r.x-f,U=r.y-m,J=2*u.det(p,I,T,U),Q=u.det(I,p*p+I*I,U,T*T+U*U),ne=u.det(p,p*p+I*I,T,T*T+U*U);return new W(f-Q/J,m+ne/J)}},{key:"perpendicularBisector",value:function(n,r){var a=r.x-n.x,f=r.y-n.y,m=new To(n.x+a/2,n.y+f/2,1),p=new To(n.x-f+a/2,n.y+a+f/2,1);return new To(m,p)}},{key:"angleBisector",value:function(n,r,a){var f=r.distance(n),m=f/(f+r.distance(a)),p=a.x-n.x,I=a.y-n.y;return new W(n.x+m*p,n.y+m*I)}},{key:"area3D",value:function(n,r,a){var f=r.x-n.x,m=r.y-n.y,p=r.getZ()-n.getZ(),I=a.x-n.x,T=a.y-n.y,U=a.getZ()-n.getZ(),J=m*U-p*T,Q=p*I-f*U,ne=f*T-m*I,ce=J*J+Q*Q+ne*ne,fe=Math.sqrt(ce)/2;return fe}},{key:"centroid",value:function(n,r,a){var f=(n.x+r.x+a.x)/3,m=(n.y+r.y+a.y)/3;return new W(f,m)}},{key:"inCentre",value:function(n,r,a){var f=r.distance(a),m=n.distance(a),p=n.distance(r),I=f+m+p,T=(f*n.x+m*r.x+p*a.x)/I,U=(f*n.y+m*r.y+p*a.y)/I;return new W(T,U)}}])})(),xp=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"addRingSide",value:function(u,n,r,a,f){if(n===0&&u.length<Ar.MINIMUM_VALID_SIZE)return null;var m=a,p=f;u.length>=Ar.MINIMUM_VALID_SIZE&&Ee.isCCW(u)&&(m=f,p=a,r=ie.opposite(r));var I=this._curveBuilder.getRingCurve(u,r,n);this.addCurve(I,m,p)}},{key:"addRingBothSides",value:function(u,n){this.addRingSide(u,n,ie.LEFT,$.EXTERIOR,$.INTERIOR),this.addRingSide(u,n,ie.RIGHT,$.INTERIOR,$.EXTERIOR)}},{key:"addPoint",value:function(u){if(this._distance<=0)return null;var n=u.getCoordinates(),r=this._curveBuilder.getLineCurve(n,this._distance);this.addCurve(r,$.EXTERIOR,$.INTERIOR)}},{key:"addPolygon",value:function(u){var n=this._distance,r=ie.LEFT;this._distance<0&&(n=-this._distance,r=ie.RIGHT);var a=u.getExteriorRing(),f=et.removeRepeatedPoints(a.getCoordinates());if(this._distance<0&&this.isErodedCompletely(a,this._distance)||this._distance<=0&&f.length<3)return null;this.addRingSide(f,n,r,$.EXTERIOR,$.INTERIOR);for(var m=0;m<u.getNumInteriorRing();m++){var p=u.getInteriorRingN(m),I=et.removeRepeatedPoints(p.getCoordinates());this._distance>0&&this.isErodedCompletely(p,-this._distance)||this.addRingSide(I,n,ie.opposite(r),$.INTERIOR,$.EXTERIOR)}}},{key:"isTriangleErodedCompletely",value:function(u,n){var r=new _p(u[0],u[1],u[2]),a=r.inCentre();return Gt.pointToSegment(a,r.p0,r.p1)<Math.abs(n)}},{key:"addLineString",value:function(u){if(this._curveBuilder.isLineOffsetEmpty(this._distance))return null;var n=et.removeRepeatedPoints(u.getCoordinates());if(et.isRing(n)&&!this._curveBuilder.getBufferParameters().isSingleSided())this.addRingBothSides(n,this._distance);else{var r=this._curveBuilder.getLineCurve(n,this._distance);this.addCurve(r,$.EXTERIOR,$.INTERIOR)}}},{key:"addCurve",value:function(u,n,r){if(u===null||u.length<2)return null;var a=new In(u,new Mt(0,$.BOUNDARY,n,r));this._curveList.add(a)}},{key:"getCurves",value:function(){return this.add(this._inputGeom),this._curveList}},{key:"add",value:function(u){if(u.isEmpty())return null;if(u instanceof Hi)this.addPolygon(u);else if(u instanceof Rr)this.addLineString(u);else if(u instanceof xo)this.addPoint(u);else if(u instanceof Eo)this.addCollection(u);else if(u instanceof No)this.addCollection(u);else if(u instanceof Io)this.addCollection(u);else{if(!(u instanceof mt))throw new ue(u.getGeometryType());this.addCollection(u)}}},{key:"isErodedCompletely",value:function(u,n){var r=u.getCoordinates();if(r.length<4)return n<0;if(r.length===4)return this.isTriangleErodedCompletely(r,n);var a=u.getEnvelopeInternal(),f=Math.min(a.getHeight(),a.getWidth());return n<0&&2*Math.abs(n)>f}},{key:"addCollection",value:function(u){for(var n=0;n<u.getNumGeometries();n++){var r=u.getGeometryN(n);this.add(r)}}}],[{key:"constructor_",value:function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new me;var u=arguments[0],n=arguments[1],r=arguments[2];this._inputGeom=u,this._distance=n,this._curveBuilder=r}}])})(),Ep=(function(){return c((function u(){o(this,u)}),[{key:"locate",value:function(u){}}])})(),wp=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"next",value:function(){if(this._atStart)return this._atStart=!1,u.isAtomic(this._parent)&&this._index++,this._parent;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new Se;var n=this._parent.getGeometryN(this._index++);return n instanceof mt?(this._subcollectionIterator=new u(n),this._subcollectionIterator.next()):n}},{key:"remove",value:function(){throw new ue(this.getClass().getName())}},{key:"hasNext",value:function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)}},{key:"interfaces_",get:function(){return[hp]}}],[{key:"constructor_",value:function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var n=arguments[0];this._parent=n,this._atStart=!0,this._index=0,this._max=n.getNumGeometries()}},{key:"isAtomic",value:function(n){return!(n instanceof mt)}}])})(),kp=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"locate",value:function(n){return u.locate(n,this._geom)}},{key:"interfaces_",get:function(){return[Ep]}}],[{key:"constructor_",value:function(){this._geom=null;var n=arguments[0];this._geom=n}},{key:"locatePointInPolygon",value:function(n,r){if(r.isEmpty())return $.EXTERIOR;var a=r.getExteriorRing(),f=u.locatePointInRing(n,a);if(f!==$.INTERIOR)return f;for(var m=0;m<r.getNumInteriorRing();m++){var p=r.getInteriorRingN(m),I=u.locatePointInRing(n,p);if(I===$.BOUNDARY)return $.BOUNDARY;if(I===$.INTERIOR)return $.EXTERIOR}return $.INTERIOR}},{key:"locatePointInRing",value:function(n,r){return r.getEnvelopeInternal().intersects(n)?Po.locateInRing(n,r.getCoordinates()):$.EXTERIOR}},{key:"containsPointInPolygon",value:function(n,r){return $.EXTERIOR!==u.locatePointInPolygon(n,r)}},{key:"locateInGeometry",value:function(n,r){if(r instanceof Hi)return u.locatePointInPolygon(n,r);if(r instanceof mt)for(var a=new wp(r);a.hasNext();){var f=a.next();if(f!==r){var m=u.locateInGeometry(n,f);if(m!==$.EXTERIOR)return m}}return $.EXTERIOR}},{key:"isContained",value:function(n,r){return $.EXTERIOR!==u.locate(n,r)}},{key:"locate",value:function(n,r){return r.isEmpty()?$.EXTERIOR:r.getEnvelopeInternal().intersects(n)?u.locateInGeometry(n,r):$.EXTERIOR}}])})(),Ip=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"getNextCW",value:function(u){this.getEdges();var n=this._edgeList.indexOf(u),r=n-1;return n===0&&(r=this._edgeList.size()-1),this._edgeList.get(r)}},{key:"propagateSideLabels",value:function(u){for(var n=$.NONE,r=this.iterator();r.hasNext();){var a=r.next().getLabel();a.isArea(u)&&a.getLocation(u,ie.LEFT)!==$.NONE&&(n=a.getLocation(u,ie.LEFT))}if(n===$.NONE)return null;for(var f=n,m=this.iterator();m.hasNext();){var p=m.next(),I=p.getLabel();if(I.getLocation(u,ie.ON)===$.NONE&&I.setLocation(u,ie.ON,f),I.isArea(u)){var T=I.getLocation(u,ie.LEFT),U=I.getLocation(u,ie.RIGHT);if(U!==$.NONE){if(U!==f)throw new Qt("side location conflict",p.getCoordinate());T===$.NONE&&j.shouldNeverReachHere("found single null side (at "+p.getCoordinate()+")"),f=T}else j.isTrue(I.getLocation(u,ie.LEFT)===$.NONE,"found single null side"),I.setLocation(u,ie.RIGHT,f),I.setLocation(u,ie.LEFT,f)}}}},{key:"getCoordinate",value:function(){var u=this.iterator();return u.hasNext()?u.next().getCoordinate():null}},{key:"print",value:function(u){It.out.println("EdgeEndStar: "+this.getCoordinate());for(var n=this.iterator();n.hasNext();)n.next().print(u)}},{key:"isAreaLabelsConsistent",value:function(u){return this.computeEdgeEndLabels(u.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)}},{key:"checkAreaLabelsConsistent",value:function(u){var n=this.getEdges();if(n.size()<=0)return!0;var r=n.size()-1,a=n.get(r).getLabel().getLocation(u,ie.LEFT);j.isTrue(a!==$.NONE,"Found unlabelled area edge");for(var f=a,m=this.iterator();m.hasNext();){var p=m.next().getLabel();j.isTrue(p.isArea(u),"Found non-area edge");var I=p.getLocation(u,ie.LEFT),T=p.getLocation(u,ie.RIGHT);if(I===T||T!==f)return!1;f=I}return!0}},{key:"findIndex",value:function(u){this.iterator();for(var n=0;n<this._edgeList.size();n++)if(this._edgeList.get(n)===u)return n;return-1}},{key:"iterator",value:function(){return this.getEdges().iterator()}},{key:"getEdges",value:function(){return this._edgeList===null&&(this._edgeList=new me(this._edgeMap.values())),this._edgeList}},{key:"getLocation",value:function(u,n,r){return this._ptInAreaLocation[u]===$.NONE&&(this._ptInAreaLocation[u]=kp.locate(n,r[u].getGeometry())),this._ptInAreaLocation[u]}},{key:"toString",value:function(){var u=new ln;u.append("EdgeEndStar: "+this.getCoordinate()),u.append(`
6
6
  `);for(var n=this.iterator();n.hasNext();){var r=n.next();u.append(r),u.append(`
7
- `)}return u.toString()}},{key:"computeEdgeEndLabels",value:function(u){for(var n=this.iterator();n.hasNext();)n.next().computeLabel(u)}},{key:"computeLabelling",value:function(u){this.computeEdgeEndLabels(u[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var n=[!1,!1],r=this.iterator();r.hasNext();)for(var a=r.next().getLabel(),f=0;f<2;f++)a.isLine(f)&&a.getLocation(f)===$.BOUNDARY&&(n[f]=!0);for(var m=this.iterator();m.hasNext();)for(var p=m.next(),I=p.getLabel(),O=0;O<2;O++)if(I.isAnyNull(O)){var U=$.NONE;if(n[O])U=$.EXTERIOR;else{var J=p.getCoordinate();U=this.getLocation(O,J,u)}I.setAllLocationsIfNull(O,U)}}},{key:"getDegree",value:function(){return this._edgeMap.size()}},{key:"insertEdgeEnd",value:function(u,n){this._edgeMap.put(u,n),this._edgeList=null}}],[{key:"constructor_",value:function(){this._edgeMap=new Br,this._edgeList=null,this._ptInAreaLocation=[$.NONE,$.NONE]}}])})(),Ip=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"linkResultDirectedEdges",value:function(){this.getResultAreaEdges();for(var r=null,a=null,f=this._SCANNING_FOR_INCOMING,m=0;m<this._resultAreaEdgeList.size();m++){var p=this._resultAreaEdgeList.get(m),I=p.getSym();if(p.getLabel().isArea())switch(r===null&&p.isInResult()&&(r=p),f){case this._SCANNING_FOR_INCOMING:if(!I.isInResult())continue;a=I,f=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!p.isInResult())continue;a.setNext(p),f=this._SCANNING_FOR_INCOMING}}if(f===this._LINKING_TO_OUTGOING){if(r===null)throw new Qt("no outgoing dirEdge found",this.getCoordinate());j.isTrue(r.isInResult(),"unable to link last incoming dirEdge"),a.setNext(r)}}},{key:"insert",value:function(r){var a=r;this.insertEdgeEnd(a,a)}},{key:"getRightmostEdge",value:function(){var r=this.getEdges(),a=r.size();if(a<1)return null;var f=r.get(0);if(a===1)return f;var m=r.get(a-1),p=f.getQuadrant(),I=m.getQuadrant();return ht.isNorthern(p)&&ht.isNorthern(I)?f:ht.isNorthern(p)||ht.isNorthern(I)?f.getDy()!==0?f:m.getDy()!==0?m:(j.shouldNeverReachHere("found two horizontal edges incident on node"),null):m}},{key:"print",value:function(r){It.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var a=this.iterator();a.hasNext();){var f=a.next();r.print("out "),f.print(r),r.println(),r.print("in "),f.getSym().print(r),r.println()}}},{key:"getResultAreaEdges",value:function(){if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new me;for(var r=this.iterator();r.hasNext();){var a=r.next();(a.isInResult()||a.getSym().isInResult())&&this._resultAreaEdgeList.add(a)}return this._resultAreaEdgeList}},{key:"updateLabelling",value:function(r){for(var a=this.iterator();a.hasNext();){var f=a.next().getLabel();f.setAllLocationsIfNull(0,r.getLocation(0)),f.setAllLocationsIfNull(1,r.getLocation(1))}}},{key:"linkAllDirectedEdges",value:function(){this.getEdges();for(var r=null,a=null,f=this._edgeList.size()-1;f>=0;f--){var m=this._edgeList.get(f),p=m.getSym();a===null&&(a=p),r!==null&&p.setNext(r),r=m}a.setNext(r)}},{key:"computeDepths",value:function(){if(arguments.length===1){var r=arguments[0],a=this.findIndex(r),f=r.getDepth(ie.LEFT),m=r.getDepth(ie.RIGHT),p=this.computeDepths(a+1,this._edgeList.size(),f);if(this.computeDepths(0,a,p)!==m)throw new Qt("depth mismatch at "+r.getCoordinate())}else if(arguments.length===3){for(var I=arguments[1],O=arguments[2],U=arguments[0];U<I;U++){var J=this._edgeList.get(U);J.setEdgeDepths(ie.RIGHT,O),O=J.getDepth(ie.LEFT)}return O}}},{key:"mergeSymLabels",value:function(){for(var r=this.iterator();r.hasNext();){var a=r.next();a.getLabel().merge(a.getSym().getLabel())}}},{key:"linkMinimalDirectedEdges",value:function(r){for(var a=null,f=null,m=this._SCANNING_FOR_INCOMING,p=this._resultAreaEdgeList.size()-1;p>=0;p--){var I=this._resultAreaEdgeList.get(p),O=I.getSym();switch(a===null&&I.getEdgeRing()===r&&(a=I),m){case this._SCANNING_FOR_INCOMING:if(O.getEdgeRing()!==r)continue;f=O,m=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(I.getEdgeRing()!==r)continue;f.setNextMin(I),m=this._SCANNING_FOR_INCOMING}}m===this._LINKING_TO_OUTGOING&&(j.isTrue(a!==null,"found null for first outgoing dirEdge"),j.isTrue(a.getEdgeRing()===r,"unable to link last incoming dirEdge"),f.setNextMin(a))}},{key:"getOutgoingDegree",value:function(){if(arguments.length===0){for(var r=0,a=this.iterator();a.hasNext();)a.next().isInResult()&&r++;return r}if(arguments.length===1){for(var f=arguments[0],m=0,p=this.iterator();p.hasNext();)p.next().getEdgeRing()===f&&m++;return m}}},{key:"getLabel",value:function(){return this._label}},{key:"findCoveredLineEdges",value:function(){for(var r=$.NONE,a=this.iterator();a.hasNext();){var f=a.next(),m=f.getSym();if(!f.isLineEdge()){if(f.isInResult()){r=$.INTERIOR;break}if(m.isInResult()){r=$.EXTERIOR;break}}}if(r===$.NONE)return null;for(var p=r,I=this.iterator();I.hasNext();){var O=I.next(),U=O.getSym();O.isLineEdge()?O.getEdge().setCovered(p===$.INTERIOR):(O.isInResult()&&(p=$.EXTERIOR),U.isInResult()&&(p=$.INTERIOR))}}},{key:"computeLabelling",value:function(r){M(n,"computeLabelling",this,1).call(this,r),this._label=new Mt($.NONE);for(var a=this.iterator();a.hasNext();)for(var f=a.next().getEdge().getLabel(),m=0;m<2;m++){var p=f.getLocation(m);p!==$.INTERIOR&&p!==$.BOUNDARY||this._label.setLocation(m,$.INTERIOR)}}}],[{key:"constructor_",value:function(){this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}}])})(kp),Np=(function(u){function n(){return o(this,n),s(this,n)}return v(n,u),c(n,[{key:"createNode",value:function(r){return new Ji(r,new Ip)}}])})(Fc),Wc=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"compareTo",value:function(n){var r=n;return u.compareOriented(this._pts,this._orientation,r._pts,r._orientation)}},{key:"interfaces_",get:function(){return[q]}}],[{key:"constructor_",value:function(){this._pts=null,this._orientation=null;var n=arguments[0];this._pts=n,this._orientation=u.orientation(n)}},{key:"orientation",value:function(n){return et.increasingDirection(n)===1}},{key:"compareOriented",value:function(n,r,a,f){for(var m=r?1:-1,p=f?1:-1,I=r?n.length:-1,O=f?a.length:-1,U=r?0:n.length-1,J=f?0:a.length-1;;){var Q=n[U].compareTo(a[J]);if(Q!==0)return Q;var ne=(U+=m)===I,ce=(J+=p)===O;if(ne&&!ce)return-1;if(!ne&&ce)return 1;if(ne&&ce)return 0}}}])})(),Mp=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"print",value:function(u){u.print("MULTILINESTRING ( ");for(var n=0;n<this._edges.size();n++){var r=this._edges.get(n);n>0&&u.print(","),u.print("(");for(var a=r.getCoordinates(),f=0;f<a.length;f++)f>0&&u.print(","),u.print(a[f].x+" "+a[f].y);u.println(")")}u.print(") ")}},{key:"addAll",value:function(u){for(var n=u.iterator();n.hasNext();)this.add(n.next())}},{key:"findEdgeIndex",value:function(u){for(var n=0;n<this._edges.size();n++)if(this._edges.get(n).equals(u))return n;return-1}},{key:"iterator",value:function(){return this._edges.iterator()}},{key:"getEdges",value:function(){return this._edges}},{key:"get",value:function(u){return this._edges.get(u)}},{key:"findEqualEdge",value:function(u){var n=new Wc(u.getCoordinates());return this._ocaMap.get(n)}},{key:"add",value:function(u){this._edges.add(u);var n=new Wc(u.getCoordinates());this._ocaMap.put(n,u)}}],[{key:"constructor_",value:function(){this._edges=new me,this._ocaMap=new Br}}])})(),Kc=(function(){return c((function u(){o(this,u)}),[{key:"processIntersections",value:function(u,n,r,a){}},{key:"isDone",value:function(){}}])})(),Sp=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"isTrivialIntersection",value:function(n,r,a,f){if(n===a&&this._li.getIntersectionNum()===1){if(u.isAdjacentSegments(r,f))return!0;if(n.isClosed()){var m=n.size()-1;if(r===0&&f===m||f===0&&r===m)return!0}}return!1}},{key:"getProperIntersectionPoint",value:function(){return this._properIntersectionPoint}},{key:"hasProperInteriorIntersection",value:function(){return this._hasProperInterior}},{key:"getLineIntersector",value:function(){return this._li}},{key:"hasProperIntersection",value:function(){return this._hasProper}},{key:"processIntersections",value:function(n,r,a,f){if(n===a&&r===f)return null;this.numTests++;var m=n.getCoordinates()[r],p=n.getCoordinates()[r+1],I=a.getCoordinates()[f],O=a.getCoordinates()[f+1];this._li.computeIntersection(m,p,I,O),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(n,r,a,f)||(this._hasIntersection=!0,n.addIntersections(this._li,r,0),a.addIntersections(this._li,f,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))}},{key:"hasIntersection",value:function(){return this._hasIntersection}},{key:"isDone",value:function(){return!1}},{key:"hasInteriorIntersection",value:function(){return this._hasInterior}},{key:"interfaces_",get:function(){return[Kc]}}],[{key:"constructor_",value: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 n=arguments[0];this._li=n}},{key:"isAdjacentSegments",value:function(n,r){return Math.abs(n-r)===1}}])})(),Pp=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"getSegmentIndex",value:function(){return this.segmentIndex}},{key:"getCoordinate",value:function(){return this.coord}},{key:"print",value:function(u){u.print(this.coord),u.print(" seg # = "+this.segmentIndex),u.println(" dist = "+this.dist)}},{key:"compareTo",value:function(u){var n=u;return this.compare(n.segmentIndex,n.dist)}},{key:"isEndPoint",value:function(u){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===u}},{key:"toString",value:function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist}},{key:"getDistance",value:function(){return this.dist}},{key:"compare",value:function(u,n){return this.segmentIndex<u?-1:this.segmentIndex>u?1:this.dist<n?-1:this.dist>n?1:0}},{key:"interfaces_",get:function(){return[q]}}],[{key:"constructor_",value:function(){this.coord=null,this.segmentIndex=null,this.dist=null;var u=arguments[0],n=arguments[1],r=arguments[2];this.coord=new W(u),this.segmentIndex=n,this.dist=r}}])})(),Lp=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"print",value:function(u){u.println("Intersections:");for(var n=this.iterator();n.hasNext();)n.next().print(u)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(u){this.addEndpoints();for(var n=this.iterator(),r=n.next();n.hasNext();){var a=n.next(),f=this.createSplitEdge(r,a);u.add(f),r=a}}},{key:"addEndpoints",value:function(){var u=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[u],u,0)}},{key:"createSplitEdge",value:function(u,n){var r=n.segmentIndex-u.segmentIndex+2,a=this.edge.pts[n.segmentIndex],f=n.dist>0||!n.coord.equals2D(a);f||r--;var m=new Array(r).fill(null),p=0;m[p++]=new W(u.coord);for(var I=u.segmentIndex+1;I<=n.segmentIndex;I++)m[p++]=this.edge.pts[I];return f&&(m[p]=n.coord),new Qc(m,new Mt(this.edge._label))}},{key:"add",value:function(u,n,r){var a=new Pp(u,n,r),f=this._nodeMap.get(a);return f!==null?f:(this._nodeMap.put(a,a),a)}},{key:"isIntersection",value:function(u){for(var n=this.iterator();n.hasNext();)if(n.next().coord.equals(u))return!0;return!1}}],[{key:"constructor_",value:function(){this._nodeMap=new Br,this.edge=null;var u=arguments[0];this.edge=u}}])})(),bp=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"isIntersects",value:function(){return!this.isDisjoint()}},{key:"isCovers",value:function(){return(u.isTrue(this._matrix[$.INTERIOR][$.INTERIOR])||u.isTrue(this._matrix[$.INTERIOR][$.BOUNDARY])||u.isTrue(this._matrix[$.BOUNDARY][$.INTERIOR])||u.isTrue(this._matrix[$.BOUNDARY][$.BOUNDARY]))&&this._matrix[$.EXTERIOR][$.INTERIOR]===ae.FALSE&&this._matrix[$.EXTERIOR][$.BOUNDARY]===ae.FALSE}},{key:"isCoveredBy",value:function(){return(u.isTrue(this._matrix[$.INTERIOR][$.INTERIOR])||u.isTrue(this._matrix[$.INTERIOR][$.BOUNDARY])||u.isTrue(this._matrix[$.BOUNDARY][$.INTERIOR])||u.isTrue(this._matrix[$.BOUNDARY][$.BOUNDARY]))&&this._matrix[$.INTERIOR][$.EXTERIOR]===ae.FALSE&&this._matrix[$.BOUNDARY][$.EXTERIOR]===ae.FALSE}},{key:"set",value:function(){if(arguments.length===1)for(var n=arguments[0],r=0;r<n.length;r++){var a=Math.trunc(r/3),f=r%3;this._matrix[a][f]=ae.toDimensionValue(n.charAt(r))}else if(arguments.length===3){var m=arguments[0],p=arguments[1],I=arguments[2];this._matrix[m][p]=I}}},{key:"isContains",value:function(){return u.isTrue(this._matrix[$.INTERIOR][$.INTERIOR])&&this._matrix[$.EXTERIOR][$.INTERIOR]===ae.FALSE&&this._matrix[$.EXTERIOR][$.BOUNDARY]===ae.FALSE}},{key:"setAtLeast",value:function(){if(arguments.length===1)for(var n=arguments[0],r=0;r<n.length;r++){var a=Math.trunc(r/3),f=r%3;this.setAtLeast(a,f,ae.toDimensionValue(n.charAt(r)))}else if(arguments.length===3){var m=arguments[0],p=arguments[1],I=arguments[2];this._matrix[m][p]<I&&(this._matrix[m][p]=I)}}},{key:"setAtLeastIfValid",value:function(n,r,a){n>=0&&r>=0&&this.setAtLeast(n,r,a)}},{key:"isWithin",value:function(){return u.isTrue(this._matrix[$.INTERIOR][$.INTERIOR])&&this._matrix[$.INTERIOR][$.EXTERIOR]===ae.FALSE&&this._matrix[$.BOUNDARY][$.EXTERIOR]===ae.FALSE}},{key:"isTouches",value:function(n,r){return n>r?this.isTouches(r,n):(n===ae.A&&r===ae.A||n===ae.L&&r===ae.L||n===ae.L&&r===ae.A||n===ae.P&&r===ae.A||n===ae.P&&r===ae.L)&&this._matrix[$.INTERIOR][$.INTERIOR]===ae.FALSE&&(u.isTrue(this._matrix[$.INTERIOR][$.BOUNDARY])||u.isTrue(this._matrix[$.BOUNDARY][$.INTERIOR])||u.isTrue(this._matrix[$.BOUNDARY][$.BOUNDARY]))}},{key:"isOverlaps",value:function(n,r){return n===ae.P&&r===ae.P||n===ae.A&&r===ae.A?u.isTrue(this._matrix[$.INTERIOR][$.INTERIOR])&&u.isTrue(this._matrix[$.INTERIOR][$.EXTERIOR])&&u.isTrue(this._matrix[$.EXTERIOR][$.INTERIOR]):n===ae.L&&r===ae.L&&this._matrix[$.INTERIOR][$.INTERIOR]===1&&u.isTrue(this._matrix[$.INTERIOR][$.EXTERIOR])&&u.isTrue(this._matrix[$.EXTERIOR][$.INTERIOR])}},{key:"isEquals",value:function(n,r){return n===r&&u.isTrue(this._matrix[$.INTERIOR][$.INTERIOR])&&this._matrix[$.INTERIOR][$.EXTERIOR]===ae.FALSE&&this._matrix[$.BOUNDARY][$.EXTERIOR]===ae.FALSE&&this._matrix[$.EXTERIOR][$.INTERIOR]===ae.FALSE&&this._matrix[$.EXTERIOR][$.BOUNDARY]===ae.FALSE}},{key:"toString",value:function(){for(var n=new Zi("123456789"),r=0;r<3;r++)for(var a=0;a<3;a++)n.setCharAt(3*r+a,ae.toDimensionSymbol(this._matrix[r][a]));return n.toString()}},{key:"setAll",value:function(n){for(var r=0;r<3;r++)for(var a=0;a<3;a++)this._matrix[r][a]=n}},{key:"get",value:function(n,r){return this._matrix[n][r]}},{key:"transpose",value:function(){var n=this._matrix[1][0];return this._matrix[1][0]=this._matrix[0][1],this._matrix[0][1]=n,n=this._matrix[2][0],this._matrix[2][0]=this._matrix[0][2],this._matrix[0][2]=n,n=this._matrix[2][1],this._matrix[2][1]=this._matrix[1][2],this._matrix[1][2]=n,this}},{key:"matches",value:function(n){if(n.length!==9)throw new C("Should be length 9: "+n);for(var r=0;r<3;r++)for(var a=0;a<3;a++)if(!u.matches(this._matrix[r][a],n.charAt(3*r+a)))return!1;return!0}},{key:"add",value:function(n){for(var r=0;r<3;r++)for(var a=0;a<3;a++)this.setAtLeast(r,a,n.get(r,a))}},{key:"isDisjoint",value:function(){return this._matrix[$.INTERIOR][$.INTERIOR]===ae.FALSE&&this._matrix[$.INTERIOR][$.BOUNDARY]===ae.FALSE&&this._matrix[$.BOUNDARY][$.INTERIOR]===ae.FALSE&&this._matrix[$.BOUNDARY][$.BOUNDARY]===ae.FALSE}},{key:"isCrosses",value:function(n,r){return n===ae.P&&r===ae.L||n===ae.P&&r===ae.A||n===ae.L&&r===ae.A?u.isTrue(this._matrix[$.INTERIOR][$.INTERIOR])&&u.isTrue(this._matrix[$.INTERIOR][$.EXTERIOR]):n===ae.L&&r===ae.P||n===ae.A&&r===ae.P||n===ae.A&&r===ae.L?u.isTrue(this._matrix[$.INTERIOR][$.INTERIOR])&&u.isTrue(this._matrix[$.EXTERIOR][$.INTERIOR]):n===ae.L&&r===ae.L&&this._matrix[$.INTERIOR][$.INTERIOR]===0}},{key:"interfaces_",get:function(){return[w]}}],[{key:"constructor_",value:function(){if(this._matrix=null,arguments.length===0)this._matrix=Array(3).fill().map((function(){return Array(3)})),this.setAll(ae.FALSE);else if(arguments.length===1){if(typeof arguments[0]=="string"){var n=arguments[0];u.constructor_.call(this),this.set(n)}else if(arguments[0]instanceof u){var r=arguments[0];u.constructor_.call(this),this._matrix[$.INTERIOR][$.INTERIOR]=r._matrix[$.INTERIOR][$.INTERIOR],this._matrix[$.INTERIOR][$.BOUNDARY]=r._matrix[$.INTERIOR][$.BOUNDARY],this._matrix[$.INTERIOR][$.EXTERIOR]=r._matrix[$.INTERIOR][$.EXTERIOR],this._matrix[$.BOUNDARY][$.INTERIOR]=r._matrix[$.BOUNDARY][$.INTERIOR],this._matrix[$.BOUNDARY][$.BOUNDARY]=r._matrix[$.BOUNDARY][$.BOUNDARY],this._matrix[$.BOUNDARY][$.EXTERIOR]=r._matrix[$.BOUNDARY][$.EXTERIOR],this._matrix[$.EXTERIOR][$.INTERIOR]=r._matrix[$.EXTERIOR][$.INTERIOR],this._matrix[$.EXTERIOR][$.BOUNDARY]=r._matrix[$.EXTERIOR][$.BOUNDARY],this._matrix[$.EXTERIOR][$.EXTERIOR]=r._matrix[$.EXTERIOR][$.EXTERIOR]}}}},{key:"matches",value:function(){if(Number.isInteger(arguments[0])&&typeof arguments[1]=="string"){var n=arguments[0],r=arguments[1];return r===ae.SYM_DONTCARE||r===ae.SYM_TRUE&&(n>=0||n===ae.TRUE)||r===ae.SYM_FALSE&&n===ae.FALSE||r===ae.SYM_P&&n===ae.P||r===ae.SYM_L&&n===ae.L||r===ae.SYM_A&&n===ae.A}if(typeof arguments[0]=="string"&&typeof arguments[1]=="string"){var a=arguments[1];return new u(arguments[0]).matches(a)}}},{key:"isTrue",value:function(n){return n>=0||n===ae.TRUE}}])})(),Cp=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"size",value:function(){return this._size}},{key:"addAll",value:function(n){return n===null||n.length===0?null:(this.ensureCapacity(this._size+n.length),It.arraycopy(n,0,this._data,this._size,n.length),void(this._size+=n.length))}},{key:"ensureCapacity",value:function(n){if(n<=this._data.length)return null;var r=Math.max(n,2*this._data.length);this._data=xn.copyOf(this._data,r)}},{key:"toArray",value:function(){var n=new Array(this._size).fill(null);return It.arraycopy(this._data,0,n,0,this._size),n}},{key:"add",value:function(n){this.ensureCapacity(this._size+1),this._data[this._size]=n,++this._size}}],[{key:"constructor_",value:function(){if(this._data=null,this._size=0,arguments.length===0)u.constructor_.call(this,10);else if(arguments.length===1){var n=arguments[0];this._data=new Array(n).fill(null)}}}])})(),Tp=(function(){function u(){o(this,u)}return c(u,[{key:"getChainStartIndices",value:function(n){var r=0,a=new Cp(Math.trunc(n.length/2));a.add(r);do{var f=this.findChainEnd(n,r);a.add(f),r=f}while(r<n.length-1);return a.toArray()}},{key:"findChainEnd",value:function(n,r){for(var a=ht.quadrant(n[r],n[r+1]),f=r+1;f<n.length&&ht.quadrant(n[f-1],n[f])===a;)f++;return f-1}},{key:"OLDgetChainStartIndices",value:function(n){var r=0,a=new me;a.add(r);do{var f=this.findChainEnd(n,r);a.add(f),r=f}while(r<n.length-1);return u.toIntArray(a)}}],[{key:"toIntArray",value:function(n){for(var r=new Array(n.size()).fill(null),a=0;a<r.length;a++)r[a]=n.get(a).intValue();return r}}])})(),Op=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"getCoordinates",value:function(){return this.pts}},{key:"getMaxX",value:function(u){var n=this.pts[this.startIndex[u]].x,r=this.pts[this.startIndex[u+1]].x;return n>r?n:r}},{key:"getMinX",value:function(u){var n=this.pts[this.startIndex[u]].x,r=this.pts[this.startIndex[u+1]].x;return n<r?n:r}},{key:"computeIntersectsForChain",value:function(){if(arguments.length===4){var u=arguments[0],n=arguments[1],r=arguments[2],a=arguments[3];this.computeIntersectsForChain(this.startIndex[u],this.startIndex[u+1],n,n.startIndex[r],n.startIndex[r+1],a)}else if(arguments.length===6){var f=arguments[0],m=arguments[1],p=arguments[2],I=arguments[3],O=arguments[4],U=arguments[5];if(m-f==1&&O-I==1)return U.addIntersections(this.e,f,p.e,I),null;if(!this.overlaps(f,m,p,I,O))return null;var J=Math.trunc((f+m)/2),Q=Math.trunc((I+O)/2);f<J&&(I<Q&&this.computeIntersectsForChain(f,J,p,I,Q,U),Q<O&&this.computeIntersectsForChain(f,J,p,Q,O,U)),J<m&&(I<Q&&this.computeIntersectsForChain(J,m,p,I,Q,U),Q<O&&this.computeIntersectsForChain(J,m,p,Q,O,U))}}},{key:"overlaps",value:function(u,n,r,a,f){return le.intersects(this.pts[u],this.pts[n],r.pts[a],r.pts[f])}},{key:"getStartIndexes",value:function(){return this.startIndex}},{key:"computeIntersects",value:function(u,n){for(var r=0;r<this.startIndex.length-1;r++)for(var a=0;a<u.startIndex.length-1;a++)this.computeIntersectsForChain(r,u,a,n)}}],[{key:"constructor_",value:function(){this.e=null,this.pts=null,this.startIndex=null;var u=arguments[0];this.e=u,this.pts=u.getCoordinates();var n=new Tp;this.startIndex=n.getChainStartIndices(this.pts)}}])})(),Jc=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"getDepth",value:function(n,r){return this._depth[n][r]}},{key:"setDepth",value:function(n,r,a){this._depth[n][r]=a}},{key:"isNull",value:function(){if(arguments.length===0){for(var n=0;n<2;n++)for(var r=0;r<3;r++)if(this._depth[n][r]!==u.NULL_VALUE)return!1;return!0}if(arguments.length===1){var a=arguments[0];return this._depth[a][1]===u.NULL_VALUE}if(arguments.length===2){var f=arguments[0],m=arguments[1];return this._depth[f][m]===u.NULL_VALUE}}},{key:"normalize",value:function(){for(var n=0;n<2;n++)if(!this.isNull(n)){var r=this._depth[n][1];this._depth[n][2]<r&&(r=this._depth[n][2]),r<0&&(r=0);for(var a=1;a<3;a++){var f=0;this._depth[n][a]>r&&(f=1),this._depth[n][a]=f}}}},{key:"getDelta",value:function(n){return this._depth[n][ie.RIGHT]-this._depth[n][ie.LEFT]}},{key:"getLocation",value:function(n,r){return this._depth[n][r]<=0?$.EXTERIOR:$.INTERIOR}},{key:"toString",value:function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]}},{key:"add",value:function(){if(arguments.length===1)for(var n=arguments[0],r=0;r<2;r++)for(var a=1;a<3;a++){var f=n.getLocation(r,a);f!==$.EXTERIOR&&f!==$.INTERIOR||(this.isNull(r,a)?this._depth[r][a]=u.depthAtLocation(f):this._depth[r][a]+=u.depthAtLocation(f))}else if(arguments.length===3){var m=arguments[0],p=arguments[1];arguments[2]===$.INTERIOR&&this._depth[m][p]++}}}],[{key:"constructor_",value:function(){this._depth=Array(2).fill().map((function(){return Array(3)}));for(var n=0;n<2;n++)for(var r=0;r<3;r++)this._depth[n][r]=u.NULL_VALUE}},{key:"depthAtLocation",value:function(n){return n===$.EXTERIOR?0:n===$.INTERIOR?1:u.NULL_VALUE}}])})();Jc.NULL_VALUE=-1;var Qc=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"getDepth",value:function(){return this._depth}},{key:"getCollapsedEdge",value:function(){var r=new Array(2).fill(null);return r[0]=this.pts[0],r[1]=this.pts[1],new n(r,Mt.toLineLabel(this._label))}},{key:"isIsolated",value:function(){return this._isIsolated}},{key:"getCoordinates",value:function(){return this.pts}},{key:"setIsolated",value:function(r){this._isIsolated=r}},{key:"setName",value:function(r){this._name=r}},{key:"equals",value:function(r){if(!(r instanceof n))return!1;var a=r;if(this.pts.length!==a.pts.length)return!1;for(var f=!0,m=!0,p=this.pts.length,I=0;I<this.pts.length;I++)if(this.pts[I].equals2D(a.pts[I])||(f=!1),this.pts[I].equals2D(a.pts[--p])||(m=!1),!f&&!m)return!1;return!0}},{key:"getCoordinate",value:function(){if(arguments.length===0)return this.pts.length>0?this.pts[0]:null;if(arguments.length===1){var r=arguments[0];return this.pts[r]}}},{key:"print",value:function(r){r.print("edge "+this._name+": "),r.print("LINESTRING (");for(var a=0;a<this.pts.length;a++)a>0&&r.print(","),r.print(this.pts[a].x+" "+this.pts[a].y);r.print(") "+this._label+" "+this._depthDelta)}},{key:"computeIM",value:function(r){n.updateIM(this._label,r)}},{key:"isCollapsed",value:function(){return!!this._label.isArea()&&this.pts.length===3&&!!this.pts[0].equals(this.pts[2])}},{key:"isClosed",value:function(){return this.pts[0].equals(this.pts[this.pts.length-1])}},{key:"getMaximumSegmentIndex",value:function(){return this.pts.length-1}},{key:"getDepthDelta",value:function(){return this._depthDelta}},{key:"getNumPoints",value:function(){return this.pts.length}},{key:"printReverse",value:function(r){r.print("edge "+this._name+": ");for(var a=this.pts.length-1;a>=0;a--)r.print(this.pts[a]+" ");r.println("")}},{key:"getMonotoneChainEdge",value:function(){return this._mce===null&&(this._mce=new Op(this)),this._mce}},{key:"getEnvelope",value:function(){if(this._env===null){this._env=new le;for(var r=0;r<this.pts.length;r++)this._env.expandToInclude(this.pts[r])}return this._env}},{key:"addIntersection",value:function(r,a,f,m){var p=new W(r.getIntersection(m)),I=a,O=r.getEdgeDistance(f,m),U=I+1;if(U<this.pts.length){var J=this.pts[U];p.equals2D(J)&&(I=U,O=0)}this.eiList.add(p,I,O)}},{key:"toString",value:function(){var r=new Zi;r.append("edge "+this._name+": "),r.append("LINESTRING (");for(var a=0;a<this.pts.length;a++)a>0&&r.append(","),r.append(this.pts[a].x+" "+this.pts[a].y);return r.append(") "+this._label+" "+this._depthDelta),r.toString()}},{key:"isPointwiseEqual",value:function(r){if(this.pts.length!==r.pts.length)return!1;for(var a=0;a<this.pts.length;a++)if(!this.pts[a].equals2D(r.pts[a]))return!1;return!0}},{key:"setDepthDelta",value:function(r){this._depthDelta=r}},{key:"getEdgeIntersectionList",value:function(){return this.eiList}},{key:"addIntersections",value:function(r,a,f){for(var m=0;m<r.getIntersectionNum();m++)this.addIntersection(r,a,f,m)}}],[{key:"constructor_",value:function(){if(this.pts=null,this._env=null,this.eiList=new Lp(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Jc,this._depthDelta=0,arguments.length===1){var r=arguments[0];n.constructor_.call(this,r,null)}else if(arguments.length===2){var a=arguments[0],f=arguments[1];this.pts=a,this._label=f}}},{key:"updateIM",value:function(){if(!(arguments.length===2&&arguments[1]instanceof bp&&arguments[0]instanceof Mt))return M(n,"updateIM",this).apply(this,arguments);var r=arguments[0],a=arguments[1];a.setAtLeastIfValid(r.getLocation(0,ie.ON),r.getLocation(1,ie.ON),1),r.isArea()&&(a.setAtLeastIfValid(r.getLocation(0,ie.LEFT),r.getLocation(1,ie.LEFT),2),a.setAtLeastIfValid(r.getLocation(0,ie.RIGHT),r.getLocation(1,ie.RIGHT),2))}}])})(Tc),jc=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"setWorkingPrecisionModel",value:function(n){this._workingPrecisionModel=n}},{key:"insertUniqueEdge",value:function(n){var r=this._edgeList.findEqualEdge(n);if(r!==null){var a=r.getLabel(),f=n.getLabel();r.isPointwiseEqual(n)||(f=new Mt(n.getLabel())).flip(),a.merge(f);var m=u.depthDelta(f),p=r.getDepthDelta()+m;r.setDepthDelta(p)}else this._edgeList.add(n),n.setDepthDelta(u.depthDelta(n.getLabel()))}},{key:"buildSubgraphs",value:function(n,r){for(var a=new me,f=n.iterator();f.hasNext();){var m=f.next(),p=m.getRightmostCoordinate(),I=new Hc(a).getDepth(p);m.computeDepth(I),m.findResultEdges(),a.add(m),r.add(m.getDirectedEdges(),m.getNodes())}}},{key:"createSubgraphs",value:function(n){for(var r=new me,a=n.getNodes().iterator();a.hasNext();){var f=a.next();if(!f.isVisited()){var m=new qm;m.create(f),r.add(m)}}return Zn.sort(r,Zn.reverseOrder()),r}},{key:"createEmptyResultGeometry",value:function(){return this._geomFact.createPolygon()}},{key:"getNoder",value:function(n){if(this._workingNoder!==null)return this._workingNoder;var r=new To,a=new kn;return a.setPrecisionModel(n),r.setSegmentIntersector(new Sp(a)),r}},{key:"buffer",value:function(n,r){var a=this._workingPrecisionModel;a===null&&(a=n.getPrecisionModel()),this._geomFact=n.getFactory();var f=new mp(a,this._bufParams),m=new _p(n,r,f).getCurves();if(m.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(m,a),this._graph=new qc(new Np),this._graph.addEdges(this._edgeList.getEdges());var p=this.createSubgraphs(this._graph),I=new ip(this._geomFact);this.buildSubgraphs(p,I);var O=I.getPolygons();return O.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(O)}},{key:"computeNodedEdges",value:function(n,r){var a=this.getNoder(r);a.computeNodes(n);for(var f=a.getNodedSubstrings().iterator();f.hasNext();){var m=f.next(),p=m.getCoordinates();if(p.length!==2||!p[0].equals2D(p[1])){var I=m.getData(),O=new Qc(m.getCoordinates(),new Mt(I));this.insertUniqueEdge(O)}}}},{key:"setNoder",value:function(n){this._workingNoder=n}}],[{key:"constructor_",value:function(){this._bufParams=null,this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new Mp;var n=arguments[0];this._bufParams=n}},{key:"depthDelta",value:function(n){var r=n.getLocation(0,ie.LEFT),a=n.getLocation(0,ie.RIGHT);return r===$.INTERIOR&&a===$.EXTERIOR?1:r===$.EXTERIOR&&a===$.INTERIOR?-1:0}},{key:"convertSegStrings",value:function(n){for(var r=new Hn,a=new me;n.hasNext();){var f=n.next(),m=r.createLineString(f.getCoordinates());a.add(m)}return r.buildGeometry(a)}}])})(),Rp=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"rescale",value:function(){if(Ie(arguments[0],Me))for(var n=arguments[0].iterator();n.hasNext();){var r=n.next();this.rescale(r.getCoordinates())}else if(arguments[0]instanceof Array){for(var a=arguments[0],f=0;f<a.length;f++)a[f].x=a[f].x/this._scaleFactor+this._offsetX,a[f].y=a[f].y/this._scaleFactor+this._offsetY;a.length===2&&a[0].equals2D(a[1])&&It.out.println(a)}}},{key:"scale",value:function(){if(Ie(arguments[0],Me)){for(var n=arguments[0],r=new me(n.size()),a=n.iterator();a.hasNext();){var f=a.next();r.add(new In(this.scale(f.getCoordinates()),f.getData()))}return r}if(arguments[0]instanceof Array){for(var m=arguments[0],p=new Array(m.length).fill(null),I=0;I<m.length;I++)p[I]=new W(Math.round((m[I].x-this._offsetX)*this._scaleFactor),Math.round((m[I].y-this._offsetY)*this._scaleFactor),m[I].getZ());return et.removeRepeatedPoints(p)}}},{key:"isIntegerPrecision",value:function(){return this._scaleFactor===1}},{key:"getNodedSubstrings",value:function(){var n=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(n),n}},{key:"computeNodes",value:function(n){var r=n;this._isScaled&&(r=this.scale(n)),this._noder.computeNodes(r)}},{key:"interfaces_",get:function(){return[Co]}}],[{key:"constructor_",value:function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,arguments.length===2){var n=arguments[0],r=arguments[1];u.constructor_.call(this,n,r,0,0)}else if(arguments.length===4){var a=arguments[0],f=arguments[1];this._noder=a,this._scaleFactor=f,this._isScaled=!this.isIntegerPrecision()}}}])})(),eh=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"checkEndPtVertexIntersections",value:function(){if(arguments.length===0)for(var n=this._segStrings.iterator();n.hasNext();){var r=n.next().getCoordinates();this.checkEndPtVertexIntersections(r[0],this._segStrings),this.checkEndPtVertexIntersections(r[r.length-1],this._segStrings)}else if(arguments.length===2){for(var a=arguments[0],f=arguments[1].iterator();f.hasNext();)for(var m=f.next().getCoordinates(),p=1;p<m.length-1;p++)if(m[p].equals(a))throw new K("found endpt/interior pt intersection at index "+p+" :pt "+a)}}},{key:"checkInteriorIntersections",value:function(){if(arguments.length===0)for(var n=this._segStrings.iterator();n.hasNext();)for(var r=n.next(),a=this._segStrings.iterator();a.hasNext();){var f=a.next();this.checkInteriorIntersections(r,f)}else if(arguments.length===2)for(var m=arguments[0],p=arguments[1],I=m.getCoordinates(),O=p.getCoordinates(),U=0;U<I.length-1;U++)for(var J=0;J<O.length-1;J++)this.checkInteriorIntersections(m,U,p,J);else if(arguments.length===4){var Q=arguments[0],ne=arguments[1],ce=arguments[2],fe=arguments[3];if(Q===ce&&ne===fe)return null;var de=Q.getCoordinates()[ne],Re=Q.getCoordinates()[ne+1],be=ce.getCoordinates()[fe],Ye=ce.getCoordinates()[fe+1];if(this._li.computeIntersection(de,Re,be,Ye),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,de,Re)||this.hasInteriorIntersection(this._li,be,Ye)))throw new K("found non-noded intersection at "+de+"-"+Re+" and "+be+"-"+Ye)}}},{key:"checkValid",value:function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()}},{key:"checkCollapses",value:function(){if(arguments.length===0)for(var n=this._segStrings.iterator();n.hasNext();){var r=n.next();this.checkCollapses(r)}else if(arguments.length===1)for(var a=arguments[0].getCoordinates(),f=0;f<a.length-2;f++)this.checkCollapse(a[f],a[f+1],a[f+2])}},{key:"hasInteriorIntersection",value:function(n,r,a){for(var f=0;f<n.getIntersectionNum();f++){var m=n.getIntersection(f);if(!m.equals(r)&&!m.equals(a))return!0}return!1}},{key:"checkCollapse",value:function(n,r,a){if(n.equals(a))throw new K("found non-noded collapse at "+u.fact.createLineString([n,r,a]))}}],[{key:"constructor_",value:function(){this._li=new kn,this._segStrings=null;var n=arguments[0];this._segStrings=n}}])})();eh.fact=new Hn;var Ro=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"intersectsScaled",value:function(n,r){var a=Math.min(n.x,r.x),f=Math.max(n.x,r.x),m=Math.min(n.y,r.y),p=Math.max(n.y,r.y),I=this._maxx<a||this._minx>f||this._maxy<m||this._miny>p;if(I)return!1;var O=this.intersectsToleranceSquare(n,r);return j.isTrue(!(I&&O),"Found bad envelope test"),O}},{key:"initCorners",value:function(n){var r=.5;this._minx=n.x-r,this._maxx=n.x+r,this._miny=n.y-r,this._maxy=n.y+r,this._corner[0]=new W(this._maxx,this._maxy),this._corner[1]=new W(this._minx,this._maxy),this._corner[2]=new W(this._minx,this._miny),this._corner[3]=new W(this._maxx,this._miny)}},{key:"intersects",value:function(n,r){return this._scaleFactor===1?this.intersectsScaled(n,r):(this.copyScaled(n,this._p0Scaled),this.copyScaled(r,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))}},{key:"scale",value:function(n){return Math.round(n*this._scaleFactor)}},{key:"getCoordinate",value:function(){return this._originalPt}},{key:"copyScaled",value:function(n,r){r.x=this.scale(n.x),r.y=this.scale(n.y)}},{key:"getSafeEnvelope",value:function(){if(this._safeEnv===null){var n=u.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new le(this._originalPt.x-n,this._originalPt.x+n,this._originalPt.y-n,this._originalPt.y+n)}return this._safeEnv}},{key:"intersectsPixelClosure",value:function(n,r){return this._li.computeIntersection(n,r,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,r,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,r,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,r,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))}},{key:"intersectsToleranceSquare",value:function(n,r){var a=!1,f=!1;return this._li.computeIntersection(n,r,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(n,r,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(a=!0),this._li.computeIntersection(n,r,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(f=!0),this._li.computeIntersection(n,r,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!a||!f)||!!n.equals(this._pt)||!!r.equals(this._pt))))}},{key:"addSnappedNode",value:function(n,r){var a=n.getCoordinate(r),f=n.getCoordinate(r+1);return!!this.intersects(a,f)&&(n.addIntersection(this.getCoordinate(),r),!0)}}],[{key:"constructor_",value: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 n=arguments[0],r=arguments[1],a=arguments[2];if(this._originalPt=n,this._pt=n,this._scaleFactor=r,this._li=a,r<=0)throw new C("Scale factor must be non-zero");r!==1&&(this._pt=new W(this.scale(n.x),this.scale(n.y)),this._p0Scaled=new W,this._p1Scaled=new W),this.initCorners(this._pt)}}])})();Ro.SAFE_ENV_EXPANSION_FACTOR=.75;var Ap=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"select",value:function(){if(arguments.length!==1){if(arguments.length===2){var u=arguments[1];arguments[0].getLineSegment(u,this.selectedSegment),this.select(this.selectedSegment)}}}}],[{key:"constructor_",value:function(){this.selectedSegment=new pt}}])})(),th=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"snap",value:function(){if(arguments.length===1){var u=arguments[0];return this.snap(u,null,-1)}if(arguments.length===3){var n=arguments[0],r=arguments[1],a=arguments[2],f=n.getSafeEnvelope(),m=new nh(n,r,a);return this._index.query(f,new((function(){return c((function p(){o(this,p)}),[{key:"interfaces_",get:function(){return[Gc]}},{key:"visitItem",value:function(p){p.select(f,m)}}])})())),m.isNodeAdded()}}}],[{key:"constructor_",value:function(){this._index=null;var u=arguments[0];this._index=u}}])})(),nh=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"isNodeAdded",value:function(){return this._isNodeAdded}},{key:"select",value:function(){if(!(arguments.length===2&&Number.isInteger(arguments[1])&&arguments[0]instanceof zc))return M(n,"select",this,1).apply(this,arguments);var r=arguments[1],a=arguments[0].getContext();if(this._parentEdge===a&&(r===this._hotPixelVertexIndex||r+1===this._hotPixelVertexIndex))return null;this._isNodeAdded|=this._hotPixel.addSnappedNode(a,r)}}],[{key:"constructor_",value:function(){this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var r=arguments[0],a=arguments[1],f=arguments[2];this._hotPixel=r,this._parentEdge=a,this._hotPixelVertexIndex=f}}])})(Ap);th.HotPixelSnapAction=nh;var Dp=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"processIntersections",value:function(u,n,r,a){if(u===r&&n===a)return null;var f=u.getCoordinates()[n],m=u.getCoordinates()[n+1],p=r.getCoordinates()[a],I=r.getCoordinates()[a+1];if(this._li.computeIntersection(f,m,p,I),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var O=0;O<this._li.getIntersectionNum();O++)this._interiorIntersections.add(this._li.getIntersection(O));u.addIntersections(this._li,n,0),r.addIntersections(this._li,a,1)}}},{key:"isDone",value:function(){return!1}},{key:"getInteriorIntersections",value:function(){return this._interiorIntersections}},{key:"interfaces_",get:function(){return[Kc]}}],[{key:"constructor_",value:function(){this._li=null,this._interiorIntersections=null;var u=arguments[0];this._li=u,this._interiorIntersections=new me}}])})(),Fp=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"checkCorrectness",value:function(u){var n=In.getNodedSubstrings(u),r=new eh(n);try{r.checkValid()}catch(a){if(!(a instanceof b))throw a;a.printStackTrace()}}},{key:"getNodedSubstrings",value:function(){return In.getNodedSubstrings(this._nodedSegStrings)}},{key:"snapRound",value:function(u,n){var r=this.findInteriorIntersections(u,n);this.computeIntersectionSnaps(r),this.computeVertexSnaps(u)}},{key:"findInteriorIntersections",value:function(u,n){var r=new Dp(n);return this._noder.setSegmentIntersector(r),this._noder.computeNodes(u),r.getInteriorIntersections()}},{key:"computeVertexSnaps",value:function(){if(Ie(arguments[0],Me))for(var u=arguments[0].iterator();u.hasNext();){var n=u.next();this.computeVertexSnaps(n)}else if(arguments[0]instanceof In)for(var r=arguments[0],a=r.getCoordinates(),f=0;f<a.length;f++){var m=new Ro(a[f],this._scaleFactor,this._li);this._pointSnapper.snap(m,r,f)&&r.addIntersection(a[f],f)}}},{key:"computeNodes",value:function(u){this._nodedSegStrings=u,this._noder=new To,this._pointSnapper=new th(this._noder.getIndex()),this.snapRound(u,this._li)}},{key:"computeIntersectionSnaps",value:function(u){for(var n=u.iterator();n.hasNext();){var r=n.next(),a=new Ro(r,this._scaleFactor,this._li);this._pointSnapper.snap(a)}}},{key:"interfaces_",get:function(){return[Co]}}],[{key:"constructor_",value:function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var u=arguments[0];this._pm=u,this._li=new kn,this._li.setPrecisionModel(u),this._scaleFactor=u.getScale()}}])})(),Jn=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"bufferFixedPrecision",value:function(n){var r=new Rp(new Fp(new bt(1)),n.getScale()),a=new jc(this._bufParams);a.setWorkingPrecisionModel(n),a.setNoder(r),this._resultGeometry=a.buffer(this._argGeom,this._distance)}},{key:"bufferReducedPrecision",value:function(){if(arguments.length===0){for(var n=u.MAX_PRECISION_DIGITS;n>=0;n--){try{this.bufferReducedPrecision(n)}catch(m){if(!(m instanceof Qt))throw m;this._saveException=m}if(this._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var r=arguments[0],a=u.precisionScaleFactor(this._argGeom,this._distance,r),f=new bt(a);this.bufferFixedPrecision(f)}}},{key:"computeGeometry",value:function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var n=this._argGeom.getFactory().getPrecisionModel();n.getType()===bt.FIXED?this.bufferFixedPrecision(n):this.bufferReducedPrecision()}},{key:"setQuadrantSegments",value:function(n){this._bufParams.setQuadrantSegments(n)}},{key:"bufferOriginalPrecision",value:function(){try{var n=new jc(this._bufParams);this._resultGeometry=n.buffer(this._argGeom,this._distance)}catch(r){if(!(r instanceof K))throw r;this._saveException=r}}},{key:"getResultGeometry",value:function(n){return this._distance=n,this.computeGeometry(),this._resultGeometry}},{key:"setEndCapStyle",value:function(n){this._bufParams.setEndCapStyle(n)}}],[{key:"constructor_",value:function(){if(this._argGeom=null,this._distance=null,this._bufParams=new S,this._resultGeometry=null,this._saveException=null,arguments.length===1){var n=arguments[0];this._argGeom=n}else if(arguments.length===2){var r=arguments[0],a=arguments[1];this._argGeom=r,this._bufParams=a}}},{key:"bufferOp",value:function(){if(arguments.length===2){var n=arguments[1];return new u(arguments[0]).getResultGeometry(n)}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof oe&&typeof arguments[1]=="number"){var r=arguments[1],a=arguments[2],f=new u(arguments[0]);return f.setQuadrantSegments(a),f.getResultGeometry(r)}if(arguments[2]instanceof S&&arguments[0]instanceof oe&&typeof arguments[1]=="number"){var m=arguments[1];return new u(arguments[0],arguments[2]).getResultGeometry(m)}}else if(arguments.length===4){var p=arguments[1],I=arguments[2],O=arguments[3],U=new u(arguments[0]);return U.setQuadrantSegments(I),U.setEndCapStyle(O),U.getResultGeometry(p)}}},{key:"precisionScaleFactor",value:function(n,r,a){var f=n.getEnvelopeInternal(),m=Or.max(Math.abs(f.getMaxX()),Math.abs(f.getMaxY()),Math.abs(f.getMinX()),Math.abs(f.getMinY()))+2*(r>0?r:0),p=a-Math.trunc(Math.log(m)/Math.log(10)+1);return Math.pow(10,p)}}])})();Jn.CAP_ROUND=S.CAP_ROUND,Jn.CAP_BUTT=S.CAP_FLAT,Jn.CAP_FLAT=S.CAP_FLAT,Jn.CAP_SQUARE=S.CAP_SQUARE,Jn.MAX_PRECISION_DIGITS=12;var qp=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],rh=(function(){return c((function u(n){o(this,u),this.geometryFactory=n||new Hn}),[{key:"read",value:function(u){var n,r=(n=typeof u=="string"?JSON.parse(u):u).type;if(!Pt[r])throw new Error("Unknown GeoJSON type: "+n.type);return qp.indexOf(r)!==-1?Pt[r].call(this,n.coordinates):r==="GeometryCollection"?Pt[r].call(this,n.geometries):Pt[r].call(this,n)}},{key:"write",value:function(u){var n=u.getGeometryType();if(!Xt[n])throw new Error("Geometry is not supported");return Xt[n].call(this,u)}}])})(),Pt={Feature:function(u){var n={};for(var r in u)n[r]=u[r];if(u.geometry){var a=u.geometry.type;if(!Pt[a])throw new Error("Unknown GeoJSON type: "+u.type);n.geometry=this.read(u.geometry)}return u.bbox&&(n.bbox=Pt.bbox.call(this,u.bbox)),n},FeatureCollection:function(u){var n={};if(u.features){n.features=[];for(var r=0;r<u.features.length;++r)n.features.push(this.read(u.features[r]))}return u.bbox&&(n.bbox=this.parse.bbox.call(this,u.bbox)),n},coordinates:function(u){for(var n=[],r=0;r<u.length;++r){var a=u[r];n.push(l(W,R(a)))}return n},bbox:function(u){return this.geometryFactory.createLinearRing([new W(u[0],u[1]),new W(u[2],u[1]),new W(u[2],u[3]),new W(u[0],u[3]),new W(u[0],u[1])])},Point:function(u){var n=l(W,R(u));return this.geometryFactory.createPoint(n)},MultiPoint:function(u){for(var n=[],r=0;r<u.length;++r)n.push(Pt.Point.call(this,u[r]));return this.geometryFactory.createMultiPoint(n)},LineString:function(u){var n=Pt.coordinates.call(this,u);return this.geometryFactory.createLineString(n)},MultiLineString:function(u){for(var n=[],r=0;r<u.length;++r)n.push(Pt.LineString.call(this,u[r]));return this.geometryFactory.createMultiLineString(n)},Polygon:function(u){for(var n=Pt.coordinates.call(this,u[0]),r=this.geometryFactory.createLinearRing(n),a=[],f=1;f<u.length;++f){var m=u[f],p=Pt.coordinates.call(this,m),I=this.geometryFactory.createLinearRing(p);a.push(I)}return this.geometryFactory.createPolygon(r,a)},MultiPolygon:function(u){for(var n=[],r=0;r<u.length;++r){var a=u[r];n.push(Pt.Polygon.call(this,a))}return this.geometryFactory.createMultiPolygon(n)},GeometryCollection:function(u){for(var n=[],r=0;r<u.length;++r){var a=u[r];n.push(this.read(a))}return this.geometryFactory.createGeometryCollection(n)}},Xt={coordinate:function(u){var n=[u.x,u.y];return u.z&&n.push(u.z),u.m&&n.push(u.m),n},Point:function(u){return{type:"Point",coordinates:Xt.coordinate.call(this,u.getCoordinate())}},MultiPoint:function(u){for(var n=[],r=0;r<u._geometries.length;++r){var a=u._geometries[r],f=Xt.Point.call(this,a);n.push(f.coordinates)}return{type:"MultiPoint",coordinates:n}},LineString:function(u){for(var n=[],r=u.getCoordinates(),a=0;a<r.length;++a){var f=r[a];n.push(Xt.coordinate.call(this,f))}return{type:"LineString",coordinates:n}},MultiLineString:function(u){for(var n=[],r=0;r<u._geometries.length;++r){var a=u._geometries[r],f=Xt.LineString.call(this,a);n.push(f.coordinates)}return{type:"MultiLineString",coordinates:n}},Polygon:function(u){var n=[],r=Xt.LineString.call(this,u._shell);n.push(r.coordinates);for(var a=0;a<u._holes.length;++a){var f=u._holes[a],m=Xt.LineString.call(this,f);n.push(m.coordinates)}return{type:"Polygon",coordinates:n}},MultiPolygon:function(u){for(var n=[],r=0;r<u._geometries.length;++r){var a=u._geometries[r],f=Xt.Polygon.call(this,a);n.push(f.coordinates)}return{type:"MultiPolygon",coordinates:n}},GeometryCollection:function(u){for(var n=[],r=0;r<u._geometries.length;++r){var a=u._geometries[r],f=a.getGeometryType();n.push(Xt[f].call(this,a))}return{type:"GeometryCollection",geometries:n}}};return{BufferOp:Jn,GeoJSONReader:(function(){return c((function u(n){o(this,u),this.parser=new rh(n||new Hn)}),[{key:"read",value:function(u){return this.parser.read(u)}}])})(),GeoJSONWriter:(function(){return c((function u(){o(this,u),this.parser=new rh(this.geometryFactory)}),[{key:"write",value:function(u){return this.parser.write(u)}}])})()}}))})(ei)),ei.exports}var jf=Qf();const eg=gr(jf);function sn(){return new ti}function ti(){this.reset()}ti.prototype={constructor:ti,reset:function(){this.s=this.t=0},add:function(t){Ba(ni,t,this.t),Ba(this,ni.s,this.s),this.s?this.t+=ni.t:this.s=ni.t},valueOf:function(){return this.s}};var ni=new ti;function Ba(t,e,i){var s=t.s=e+i,o=s-e,l=s-o;t.t=e-l+(i-o)}var ze=1e-6,Ae=Math.PI,At=Ae/2,Ga=Ae/4,Dt=Ae*2,on=180/Ae,xt=Ae/180,tt=Math.abs,tg=Math.atan,Rn=Math.atan2,Ve=Math.cos,He=Math.sin,An=Math.sqrt;function Ya(t){return t>1?0:t<-1?Ae:Math.acos(t)}function yn(t){return t>1?At:t<-1?-At:Math.asin(t)}function vr(){}function ri(t,e){t&&Xa.hasOwnProperty(t.type)&&Xa[t.type](t,e)}var za={Feature:function(t,e){ri(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,o=i.length;++s<o;)ri(i[s].geometry,e)}},Xa={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 i=t.coordinates,s=-1,o=i.length;++s<o;)t=i[s],e.point(t[0],t[1],t[2])},LineString:function(t,e){Is(t.coordinates,e,0)},MultiLineString:function(t,e){for(var i=t.coordinates,s=-1,o=i.length;++s<o;)Is(i[s],e,0)},Polygon:function(t,e){Ua(t.coordinates,e)},MultiPolygon:function(t,e){for(var i=t.coordinates,s=-1,o=i.length;++s<o;)Ua(i[s],e)},GeometryCollection:function(t,e){for(var i=t.geometries,s=-1,o=i.length;++s<o;)ri(i[s],e)}};function Is(t,e,i){var s=-1,o=t.length-i,l;for(e.lineStart();++s<o;)l=t[s],e.point(l[0],l[1],l[2]);e.lineEnd()}function Ua(t,e){var i=-1,s=t.length;for(e.polygonStart();++i<s;)Is(t[i],e,1);e.polygonEnd()}function ng(t,e){t&&za.hasOwnProperty(t.type)?za[t.type](t,e):ri(t,e)}sn(),sn();function Ns(t){return[Rn(t[1],t[0]),yn(t[2])]}function Dn(t){var e=t[0],i=t[1],s=Ve(i);return[s*Ve(e),s*He(e),He(i)]}function ii(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function si(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 Ms(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function oi(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Ss(t){var e=An(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}sn();function Va(t,e){function i(s,o){return s=t(s,o),e(s[0],s[1])}return t.invert&&e.invert&&(i.invert=function(s,o){return s=e.invert(s,o),s&&t.invert(s[0],s[1])}),i}function Ps(t,e){return[t>Ae?t-Dt:t<-Ae?t+Dt:t,e]}Ps.invert=Ps;function rg(t,e,i){return(t%=Dt)?e||i?Va($a(t),Za(e,i)):$a(t):e||i?Za(e,i):Ps}function Ha(t){return function(e,i){return e+=t,[e>Ae?e-Dt:e<-Ae?e+Dt:e,i]}}function $a(t){var e=Ha(t);return e.invert=Ha(-t),e}function Za(t,e){var i=Ve(t),s=He(t),o=Ve(e),l=He(e);function h(c,g){var d=Ve(g),y=Ve(c)*d,v=He(c)*d,_=He(g),E=_*i+y*s;return[Rn(v*o-E*l,y*i-_*s),yn(E*o+v*l)]}return h.invert=function(c,g){var d=Ve(g),y=Ve(c)*d,v=He(c)*d,_=He(g),E=_*o-v*l;return[Rn(v*o+_*l,y*i+E*s),yn(E*i-y*s)]},h}function ig(t,e,i,s,o,l){if(i){var h=Ve(e),c=He(e),g=s*i;o==null?(o=e+s*Dt,l=e-g/2):(o=Wa(h,o),l=Wa(h,l),(s>0?o<l:o>l)&&(o+=s*Dt));for(var d,y=o;s>0?y>l:y<l;y-=g)d=Ns([h,-c*Ve(y),-c*He(y)]),t.point(d[0],d[1])}}function Wa(t,e){e=Dn(e),e[0]-=t,Ss(e);var i=Ya(-e[1]);return((-e[2]<0?-i:i)+Dt-ze)%Dt}function Ka(){var t=[],e;return{point:function(i,s){e.push([i,s])},lineStart:function(){t.push(e=[])},lineEnd:vr,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var i=t;return t=[],e=null,i}}}function sg(t,e,i,s,o,l){var h=t[0],c=t[1],g=e[0],d=e[1],y=0,v=1,_=g-h,E=d-c,M;if(M=i-h,!(!_&&M>0)){if(M/=_,_<0){if(M<y)return;M<v&&(v=M)}else if(_>0){if(M>v)return;M>y&&(y=M)}if(M=o-h,!(!_&&M<0)){if(M/=_,_<0){if(M>v)return;M>y&&(y=M)}else if(_>0){if(M<y)return;M<v&&(v=M)}if(M=s-c,!(!E&&M>0)){if(M/=E,E<0){if(M<y)return;M<v&&(v=M)}else if(E>0){if(M>v)return;M>y&&(y=M)}if(M=l-c,!(!E&&M<0)){if(M/=E,E<0){if(M>v)return;M>y&&(y=M)}else if(E>0){if(M<y)return;M<v&&(v=M)}return y>0&&(t[0]=h+y*_,t[1]=c+y*E),v<1&&(e[0]=h+v*_,e[1]=c+v*E),!0}}}}}function ai(t,e){return tt(t[0]-e[0])<ze&&tt(t[1]-e[1])<ze}function ui(t,e,i,s){this.x=t,this.z=e,this.o=i,this.e=s,this.v=!1,this.n=this.p=null}function Ja(t,e,i,s,o){var l=[],h=[],c,g;if(t.forEach(function(M){if(!((R=M.length-1)<=0)){var R,Y=M[0],H=M[R],x;if(ai(Y,H)){for(o.lineStart(),c=0;c<R;++c)o.point((Y=M[c])[0],Y[1]);o.lineEnd();return}l.push(x=new ui(Y,M,null,!0)),h.push(x.o=new ui(Y,null,x,!1)),l.push(x=new ui(H,M,null,!1)),h.push(x.o=new ui(H,null,x,!0))}}),!!l.length){for(h.sort(e),Qa(l),Qa(h),c=0,g=h.length;c<g;++c)h[c].e=i=!i;for(var d=l[0],y,v;;){for(var _=d,E=!0;_.v;)if((_=_.n)===d)return;y=_.z,o.lineStart();do{if(_.v=_.o.v=!0,_.e){if(E)for(c=0,g=y.length;c<g;++c)o.point((v=y[c])[0],v[1]);else s(_.x,_.n.x,1,o);_=_.n}else{if(E)for(y=_.p.z,c=y.length-1;c>=0;--c)o.point((v=y[c])[0],v[1]);else s(_.x,_.p.x,-1,o);_=_.p}_=_.o,y=_.z,E=!E}while(!_.v);o.lineEnd()}}}function Qa(t){if(e=t.length){for(var e,i=0,s=t[0],o;++i<e;)s.n=o=t[i],o.p=s,s=o;s.n=o=t[0],o.p=s}}function ja(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function og(t){return t.length===1&&(t=ag(t)),{left:function(e,i,s,o){for(s==null&&(s=0),o==null&&(o=e.length);s<o;){var l=s+o>>>1;t(e[l],i)<0?s=l+1:o=l}return s},right:function(e,i,s,o){for(s==null&&(s=0),o==null&&(o=e.length);s<o;){var l=s+o>>>1;t(e[l],i)>0?o=l:s=l+1}return s}}}function ag(t){return function(e,i){return ja(t(e),i)}}og(ja);function eu(t){for(var e=t.length,i,s=-1,o=0,l,h;++s<e;)o+=t[s].length;for(l=new Array(o);--e>=0;)for(h=t[e],i=h.length;--i>=0;)l[--o]=h[i];return l}var yr=1e9,li=-yr;function ug(t,e,i,s){function o(d,y){return t<=d&&d<=i&&e<=y&&y<=s}function l(d,y,v,_){var E=0,M=0;if(d==null||(E=h(d,v))!==(M=h(y,v))||g(d,y)<0^v>0)do _.point(E===0||E===3?t:i,E>1?s:e);while((E=(E+v+4)%4)!==M);else _.point(y[0],y[1])}function h(d,y){return tt(d[0]-t)<ze?y>0?0:3:tt(d[0]-i)<ze?y>0?2:1:tt(d[1]-e)<ze?y>0?1:0:y>0?3:2}function c(d,y){return g(d.x,y.x)}function g(d,y){var v=h(d,1),_=h(y,1);return v!==_?v-_:v===0?y[1]-d[1]:v===1?d[0]-y[0]:v===2?d[1]-y[1]:y[0]-d[0]}return function(d){var y=d,v=Ka(),_,E,M,R,Y,H,x,S,b,C,A,q={point:w,lineStart:F,lineEnd:X,polygonStart:L,polygonEnd:D};function w(V,k){o(V,k)&&y.point(V,k)}function N(){for(var V=0,k=0,T=E.length;k<T;++k)for(var P=E[k],G=1,B=P.length,Z=P[0],K,ee,j=Z[0],te=Z[1];G<B;++G)K=j,ee=te,Z=P[G],j=Z[0],te=Z[1],ee<=s?te>s&&(j-K)*(s-ee)>(te-ee)*(t-K)&&++V:te<=s&&(j-K)*(s-ee)<(te-ee)*(t-K)&&--V;return V}function L(){y=v,_=[],E=[],A=!0}function D(){var V=N(),k=A&&V,T=(_=eu(_)).length;(k||T)&&(d.polygonStart(),k&&(d.lineStart(),l(null,null,1,d),d.lineEnd()),T&&Ja(_,c,V,l,d),d.polygonEnd()),y=d,_=E=M=null}function F(){q.point=z,E&&E.push(M=[]),C=!0,b=!1,x=S=NaN}function X(){_&&(z(R,Y),H&&b&&v.rejoin(),_.push(v.result())),q.point=w,b&&y.lineEnd()}function z(V,k){var T=o(V,k);if(E&&M.push([V,k]),C)R=V,Y=k,H=T,C=!1,T&&(y.lineStart(),y.point(V,k));else if(T&&b)y.point(V,k);else{var P=[x=Math.max(li,Math.min(yr,x)),S=Math.max(li,Math.min(yr,S))],G=[V=Math.max(li,Math.min(yr,V)),k=Math.max(li,Math.min(yr,k))];sg(P,G,t,e,i,s)?(b||(y.lineStart(),y.point(P[0],P[1])),y.point(G[0],G[1]),T||y.lineEnd(),A=!1):T&&(y.lineStart(),y.point(V,k),A=!1)}x=V,S=k,b=T}return q}}var Ls=sn();function lg(t,e){var i=e[0],s=e[1],o=[He(i),-Ve(i),0],l=0,h=0;Ls.reset();for(var c=0,g=t.length;c<g;++c)if(y=(d=t[c]).length)for(var d,y,v=d[y-1],_=v[0],E=v[1]/2+Ga,M=He(E),R=Ve(E),Y=0;Y<y;++Y,_=x,M=b,R=C,v=H){var H=d[Y],x=H[0],S=H[1]/2+Ga,b=He(S),C=Ve(S),A=x-_,q=A>=0?1:-1,w=q*A,N=w>Ae,L=M*b;if(Ls.add(Rn(L*q*He(w),R*C+L*Ve(w))),l+=N?A+q*Dt:A,N^_>=i^x>=i){var D=si(Dn(v),Dn(H));Ss(D);var F=si(o,D);Ss(F);var X=(N^A>=0?-1:1)*yn(F[2]);(s>X||s===X&&(D[0]||D[1]))&&(h+=N^A>=0?1:-1)}}return(l<-ze||l<ze&&Ls<-ze)^h&1}sn();function tu(t){return t}sn(),sn();var Fn=1/0,ci=Fn,mr=-Fn,hi=mr,nu={point:cg,lineStart:vr,lineEnd:vr,polygonStart:vr,polygonEnd:vr,result:function(){var t=[[Fn,ci],[mr,hi]];return mr=hi=-(ci=Fn=1/0),t}};function cg(t,e){t<Fn&&(Fn=t),t>mr&&(mr=t),e<ci&&(ci=e),e>hi&&(hi=e)}sn();function ru(t,e,i,s){return function(o,l){var h=e(l),c=o.invert(s[0],s[1]),g=Ka(),d=e(g),y=!1,v,_,E,M={point:R,lineStart:H,lineEnd:x,polygonStart:function(){M.point=S,M.lineStart=b,M.lineEnd=C,_=[],v=[]},polygonEnd:function(){M.point=R,M.lineStart=H,M.lineEnd=x,_=eu(_);var A=lg(v,c);_.length?(y||(l.polygonStart(),y=!0),Ja(_,fg,A,i,l)):A&&(y||(l.polygonStart(),y=!0),l.lineStart(),i(null,null,1,l),l.lineEnd()),y&&(l.polygonEnd(),y=!1),_=v=null},sphere:function(){l.polygonStart(),l.lineStart(),i(null,null,1,l),l.lineEnd(),l.polygonEnd()}};function R(A,q){var w=o(A,q);t(A=w[0],q=w[1])&&l.point(A,q)}function Y(A,q){var w=o(A,q);h.point(w[0],w[1])}function H(){M.point=Y,h.lineStart()}function x(){M.point=R,h.lineEnd()}function S(A,q){E.push([A,q]);var w=o(A,q);d.point(w[0],w[1])}function b(){d.lineStart(),E=[]}function C(){S(E[0][0],E[0][1]),d.lineEnd();var A=d.clean(),q=g.result(),w,N=q.length,L,D,F;if(E.pop(),v.push(E),E=null,!!N){if(A&1){if(D=q[0],(L=D.length-1)>0){for(y||(l.polygonStart(),y=!0),l.lineStart(),w=0;w<L;++w)l.point((F=D[w])[0],F[1]);l.lineEnd()}return}N>1&&A&2&&q.push(q.pop().concat(q.shift())),_.push(q.filter(hg))}}return M}}function hg(t){return t.length>1}function fg(t,e){return((t=t.x)[0]<0?t[1]-At-ze:At-t[1])-((e=e.x)[0]<0?e[1]-At-ze:At-e[1])}const iu=ru(function(){return!0},gg,vg,[-Ae,-At]);function gg(t){var e=NaN,i=NaN,s=NaN,o;return{lineStart:function(){t.lineStart(),o=1},point:function(l,h){var c=l>0?Ae:-Ae,g=tt(l-e);tt(g-Ae)<ze?(t.point(e,i=(i+h)/2>0?At:-At),t.point(s,i),t.lineEnd(),t.lineStart(),t.point(c,i),t.point(l,i),o=0):s!==c&&g>=Ae&&(tt(e-s)<ze&&(e-=s*ze),tt(l-c)<ze&&(l-=c*ze),i=dg(e,i,l,h),t.point(s,i),t.lineEnd(),t.lineStart(),t.point(c,i),o=0),t.point(e=l,i=h),s=c},lineEnd:function(){t.lineEnd(),e=i=NaN},clean:function(){return 2-o}}}function dg(t,e,i,s){var o,l,h=He(t-i);return tt(h)>ze?tg((He(e)*(l=Ve(s))*He(i)-He(s)*(o=Ve(e))*He(t))/(o*l*h)):(e+s)/2}function vg(t,e,i,s){var o;if(t==null)o=i*At,s.point(-Ae,o),s.point(0,o),s.point(Ae,o),s.point(Ae,0),s.point(Ae,-o),s.point(0,-o),s.point(-Ae,-o),s.point(-Ae,0),s.point(-Ae,o);else if(tt(t[0]-e[0])>ze){var l=t[0]<e[0]?Ae:-Ae;o=i*l/2,s.point(-l,o),s.point(0,o),s.point(l,o)}else s.point(e[0],e[1])}function yg(t,e){var i=Ve(t),s=i>0,o=tt(i)>ze;function l(y,v,_,E){ig(E,t,e,_,y,v)}function h(y,v){return Ve(y)*Ve(v)>i}function c(y){var v,_,E,M,R;return{lineStart:function(){M=E=!1,R=1},point:function(Y,H){var x=[Y,H],S,b=h(Y,H),C=s?b?0:d(Y,H):b?d(Y+(Y<0?Ae:-Ae),H):0;if(!v&&(M=E=b)&&y.lineStart(),b!==E&&(S=g(v,x),(!S||ai(v,S)||ai(x,S))&&(x[0]+=ze,x[1]+=ze,b=h(x[0],x[1]))),b!==E)R=0,b?(y.lineStart(),S=g(x,v),y.point(S[0],S[1])):(S=g(v,x),y.point(S[0],S[1]),y.lineEnd()),v=S;else if(o&&v&&s^b){var A;!(C&_)&&(A=g(x,v,!0))&&(R=0,s?(y.lineStart(),y.point(A[0][0],A[0][1]),y.point(A[1][0],A[1][1]),y.lineEnd()):(y.point(A[1][0],A[1][1]),y.lineEnd(),y.lineStart(),y.point(A[0][0],A[0][1])))}b&&(!v||!ai(v,x))&&y.point(x[0],x[1]),v=x,E=b,_=C},lineEnd:function(){E&&y.lineEnd(),v=null},clean:function(){return R|(M&&E)<<1}}}function g(y,v,_){var E=Dn(y),M=Dn(v),R=[1,0,0],Y=si(E,M),H=ii(Y,Y),x=Y[0],S=H-x*x;if(!S)return!_&&y;var b=i*H/S,C=-i*x/S,A=si(R,Y),q=oi(R,b),w=oi(Y,C);Ms(q,w);var N=A,L=ii(q,N),D=ii(N,N),F=L*L-D*(ii(q,q)-1);if(!(F<0)){var X=An(F),z=oi(N,(-L-X)/D);if(Ms(z,q),z=Ns(z),!_)return z;var V=y[0],k=v[0],T=y[1],P=v[1],G;k<V&&(G=V,V=k,k=G);var B=k-V,Z=tt(B-Ae)<ze,K=Z||B<ze;if(!Z&&P<T&&(G=T,T=P,P=G),K?Z?T+P>0^z[1]<(tt(z[0]-V)<ze?T:P):T<=z[1]&&z[1]<=P:B>Ae^(V<=z[0]&&z[0]<=k)){var ee=oi(N,(-L+X)/D);return Ms(ee,q),[z,Ns(ee)]}}}function d(y,v){var _=s?t:Ae-t,E=0;return y<-_?E|=1:y>_&&(E|=2),v<-_?E|=4:v>_&&(E|=8),E}return ru(h,c,l,s?[0,-t]:[-Ae,t-Ae])}function su(t){return function(e){var i=new bs;for(var s in t)i[s]=t[s];return i.stream=e,i}}function bs(){}bs.prototype={constructor:bs,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()}};function ou(t,e,i){var s=e[1][0]-e[0][0],o=e[1][1]-e[0][1],l=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),l!=null&&t.clipExtent(null),ng(i,t.stream(nu));var h=nu.result(),c=Math.min(s/(h[1][0]-h[0][0]),o/(h[1][1]-h[0][1])),g=+e[0][0]+(s-c*(h[1][0]+h[0][0]))/2,d=+e[0][1]+(o-c*(h[1][1]+h[0][1]))/2;return l!=null&&t.clipExtent(l),t.scale(c*150).translate([g,d])}function mg(t,e,i){return ou(t,[[0,0],e],i)}var au=16,pg=Ve(30*xt);function uu(t,e){return+e?xg(t,e):_g(t)}function _g(t){return su({point:function(e,i){e=t(e,i),this.stream.point(e[0],e[1])}})}function xg(t,e){function i(s,o,l,h,c,g,d,y,v,_,E,M,R,Y){var H=d-s,x=y-o,S=H*H+x*x;if(S>4*e&&R--){var b=h+_,C=c+E,A=g+M,q=An(b*b+C*C+A*A),w=yn(A/=q),N=tt(tt(A)-1)<ze||tt(l-v)<ze?(l+v)/2:Rn(C,b),L=t(N,w),D=L[0],F=L[1],X=D-s,z=F-o,V=x*X-H*z;(V*V/S>e||tt((H*X+x*z)/S-.5)>.3||h*_+c*E+g*M<pg)&&(i(s,o,l,h,c,g,D,F,N,b/=q,C/=q,A,R,Y),Y.point(D,F),i(D,F,N,b,C,A,d,y,v,_,E,M,R,Y))}}return function(s){var o,l,h,c,g,d,y,v,_,E,M,R,Y={point:H,lineStart:x,lineEnd:b,polygonStart:function(){s.polygonStart(),Y.lineStart=C},polygonEnd:function(){s.polygonEnd(),Y.lineStart=x}};function H(w,N){w=t(w,N),s.point(w[0],w[1])}function x(){v=NaN,Y.point=S,s.lineStart()}function S(w,N){var L=Dn([w,N]),D=t(w,N);i(v,_,y,E,M,R,v=D[0],_=D[1],y=w,E=L[0],M=L[1],R=L[2],au,s),s.point(v,_)}function b(){Y.point=H,s.lineEnd()}function C(){x(),Y.point=A,Y.lineEnd=q}function A(w,N){S(o=w,N),l=v,h=_,c=E,g=M,d=R,Y.point=S}function q(){i(v,_,y,E,M,R,l,h,o,c,g,d,au,s),Y.lineEnd=b,b()}return Y}}var Eg=su({point:function(t,e){this.stream.point(t*xt,e*xt)}});function wg(t){return kg(function(){return t})()}function kg(t){var e,i=150,s=480,o=250,l,h,c=0,g=0,d=0,y=0,v=0,_,E,M=null,R=iu,Y=null,H,x,S,b=tu,C=.5,A=uu(D,C),q,w;function N(z){return z=E(z[0]*xt,z[1]*xt),[z[0]*i+l,h-z[1]*i]}function L(z){return z=E.invert((z[0]-l)/i,(h-z[1])/i),z&&[z[0]*on,z[1]*on]}function D(z,V){return z=e(z,V),[z[0]*i+l,h-z[1]*i]}N.stream=function(z){return q&&w===z?q:q=Eg(R(_,A(b(w=z))))},N.clipAngle=function(z){return arguments.length?(R=+z?yg(M=z*xt,6*xt):(M=null,iu),X()):M*on},N.clipExtent=function(z){return arguments.length?(b=z==null?(Y=H=x=S=null,tu):ug(Y=+z[0][0],H=+z[0][1],x=+z[1][0],S=+z[1][1]),X()):Y==null?null:[[Y,H],[x,S]]},N.scale=function(z){return arguments.length?(i=+z,F()):i},N.translate=function(z){return arguments.length?(s=+z[0],o=+z[1],F()):[s,o]},N.center=function(z){return arguments.length?(c=z[0]%360*xt,g=z[1]%360*xt,F()):[c*on,g*on]},N.rotate=function(z){return arguments.length?(d=z[0]%360*xt,y=z[1]%360*xt,v=z.length>2?z[2]%360*xt:0,F()):[d*on,y*on,v*on]},N.precision=function(z){return arguments.length?(A=uu(D,C=z*z),X()):An(C)},N.fitExtent=function(z,V){return ou(N,z,V)},N.fitSize=function(z,V){return mg(N,z,V)};function F(){E=Va(_=rg(d,y,v),e);var z=e(c,g);return l=s-z[0]*i,h=o+z[1]*i,X()}function X(){return q=w=null,N}return function(){return e=t.apply(this,arguments),N.invert=e.invert&&L,F()}}function lu(t){return function(e,i){var s=Ve(e),o=Ve(i),l=t(s*o);return[l*o*He(e),l*He(i)]}}function cu(t){return function(e,i){var s=An(e*e+i*i),o=t(s),l=He(o),h=Ve(o);return[Rn(e*l,s*h),yn(s&&i*l/s)]}}var Ig=lu(function(t){return An(2/(1+t))});Ig.invert=cu(function(t){return 2*yn(t/2)});var hu=lu(function(t){return(t=Ya(t))&&t/He(t)});hu.invert=cu(function(t){return t});function Ng(){return wg(hu).scale(79.4188).clipAngle(180-.001)}function fu(t,e){return[t,e]}fu.invert=fu;var{BufferOp:Mg,GeoJSONReader:Sg,GeoJSONWriter:Pg}=eg;function Lg(t,e,i){i=i||{};var s=i.units||"kilometers",o=i.steps||8;if(!t)throw new Error("geojson is required");if(typeof i!="object")throw new Error("options must be an object");if(typeof o!="number")throw new Error("steps must be an number");if(e===void 0)throw new Error("radius is required");if(o<=0)throw new Error("steps must be greater than 0");var l=[];switch(t.type){case"GeometryCollection":return rt(t,function(h){var c=fi(h,e,s,o);c&&l.push(c)}),he(l);case"FeatureCollection":return Le(t,function(h){var c=fi(h,e,s,o);c&&Le(c,function(g){g&&l.push(g)})}),he(l)}return fi(t,e,s,o)}function fi(t,e,i,s){var o=t.properties||{},l=t.type==="Feature"?t.geometry:t;if(l.type==="GeometryCollection"){var h=[];return rt(t,function(R){var Y=fi(R,e,i,s);Y&&h.push(Y)}),he(h)}var c=bg(l),g={type:l.type,coordinates:du(l.coordinates,c)},d=new Sg,y=d.read(g),v=er(Mn(e,i),"meters"),_=Mg.bufferOp(y,v,s),E=new Pg;if(_=E.write(_),!gu(_.coordinates)){var M={type:_.type,coordinates:vu(_.coordinates,c)};return We(M,o)}}function gu(t){return Array.isArray(t[0])?gu(t[0]):isNaN(t[0])}function du(t,e){return typeof t[0]!="object"?e(t):t.map(function(i){return du(i,e)})}function vu(t,e){return typeof t[0]!="object"?e.invert(t):t.map(function(i){return vu(i,e)})}function bg(t){var e=jr(t).geometry.coordinates,i=[-e[0],-e[1]];return Ng().rotate(i).scale(Ke)}function Cs(t,e={}){let i=0,s=0,o=0;return rt(t,function(l,h,c){let g=e.weight?c?.[e.weight]:void 0;if(g=g??1,!Je(g))throw new Error("weight value must be a number for feature index "+h);g=Number(g),g>0&&Xe(l,function(d){i+=d[0]*g,s+=d[1]*g,o+=g})}),_e([i/o,s/o],e.properties,e)}function Zt(t,e={}){let i=0,s=0,o=0;return Xe(t,function(l){i+=l[0],s+=l[1],o++},!0),_e([i/o,s/o],e.properties)}function Cg(t,e={}){if(e=e||{},!Ce(e))throw new Error("options is invalid");var i=e.counter||10;if(!Je(i))throw new Error("counter must be a number");var s=e.weight,o=Cs(t,{weight:e.weight}),l=he([]);Le(t,function(c){var g;l.features.push(Zt(c,{properties:{weight:(g=c.properties)==null?void 0:g[s]}}))});const h={tolerance:e.tolerance,medianCandidates:[]};return yu(o.geometry.coordinates,[0,0],l,h,i)}function yu(t,e,i,s,o){var l=s.tolerance||.001,h=0,c=0,g=0,d=0;if(Le(i,function(_){var E,M=(E=_.properties)==null?void 0:E.weight,R=M??1;if(R=Number(R),!Je(R))throw new Error("weight value must be a number");if(R>0){d+=1;var Y=R*Be(_,t);Y===0&&(Y=1);var H=R/Y;h+=_.geometry.coordinates[0]*H,c+=_.geometry.coordinates[1]*H,g+=H}}),d<1)throw new Error("no features to measure");var y=h/g,v=c/g;return d===1||o===0||Math.abs(y-e[0])<l&&Math.abs(v-e[1])<l?_e([y,v],{medianCandidates:s.medianCandidates}):(s.medianCandidates.push([y,v]),yu([y,v],t,i,s,o-1))}var gi={exports:{}},di={exports:{}},Tg=di.exports,mu;function Og(){return mu||(mu=1,(function(t,e){(function(i,s){t.exports=s()})(Tg,function(){function i(x,S,b,C,A){(function q(w,N,L,D,F){for(;D>L;){if(D-L>600){var X=D-L+1,z=N-L+1,V=Math.log(X),k=.5*Math.exp(2*V/3),T=.5*Math.sqrt(V*k*(X-k)/X)*(z-X/2<0?-1:1),P=Math.max(L,Math.floor(N-z*k/X+T)),G=Math.min(D,Math.floor(N+(X-z)*k/X+T));q(w,N,P,G,F)}var B=w[N],Z=L,K=D;for(s(w,L,N),F(w[D],B)>0&&s(w,L,D);Z<K;){for(s(w,Z,K),Z++,K--;F(w[Z],B)<0;)Z++;for(;F(w[K],B)>0;)K--}F(w[L],B)===0?s(w,L,K):s(w,++K,D),K<=N&&(L=K+1),N<=K&&(D=K-1)}})(x,S,b||0,C||x.length-1,A||o)}function s(x,S,b){var C=x[S];x[S]=x[b],x[b]=C}function o(x,S){return x<S?-1:x>S?1:0}var l=function(x){x===void 0&&(x=9),this._maxEntries=Math.max(4,x),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function h(x,S,b){if(!b)return S.indexOf(x);for(var C=0;C<S.length;C++)if(b(x,S[C]))return C;return-1}function c(x,S){g(x,0,x.children.length,S,x)}function g(x,S,b,C,A){A||(A=Y(null)),A.minX=1/0,A.minY=1/0,A.maxX=-1/0,A.maxY=-1/0;for(var q=S;q<b;q++){var w=x.children[q];d(A,x.leaf?C(w):w)}return A}function d(x,S){return x.minX=Math.min(x.minX,S.minX),x.minY=Math.min(x.minY,S.minY),x.maxX=Math.max(x.maxX,S.maxX),x.maxY=Math.max(x.maxY,S.maxY),x}function y(x,S){return x.minX-S.minX}function v(x,S){return x.minY-S.minY}function _(x){return(x.maxX-x.minX)*(x.maxY-x.minY)}function E(x){return x.maxX-x.minX+(x.maxY-x.minY)}function M(x,S){return x.minX<=S.minX&&x.minY<=S.minY&&S.maxX<=x.maxX&&S.maxY<=x.maxY}function R(x,S){return S.minX<=x.maxX&&S.minY<=x.maxY&&S.maxX>=x.minX&&S.maxY>=x.minY}function Y(x){return{children:x,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function H(x,S,b,C,A){for(var q=[S,b];q.length;)if(!((b=q.pop())-(S=q.pop())<=C)){var w=S+Math.ceil((b-S)/C/2)*C;i(x,w,S,b,A),q.push(S,w,w,b)}}return l.prototype.all=function(){return this._all(this.data,[])},l.prototype.search=function(x){var S=this.data,b=[];if(!R(x,S))return b;for(var C=this.toBBox,A=[];S;){for(var q=0;q<S.children.length;q++){var w=S.children[q],N=S.leaf?C(w):w;R(x,N)&&(S.leaf?b.push(w):M(x,N)?this._all(w,b):A.push(w))}S=A.pop()}return b},l.prototype.collides=function(x){var S=this.data;if(!R(x,S))return!1;for(var b=[];S;){for(var C=0;C<S.children.length;C++){var A=S.children[C],q=S.leaf?this.toBBox(A):A;if(R(x,q)){if(S.leaf||M(x,q))return!0;b.push(A)}}S=b.pop()}return!1},l.prototype.load=function(x){if(!x||!x.length)return this;if(x.length<this._minEntries){for(var S=0;S<x.length;S++)this.insert(x[S]);return this}var b=this._build(x.slice(),0,x.length-1,0);if(this.data.children.length)if(this.data.height===b.height)this._splitRoot(this.data,b);else{if(this.data.height<b.height){var C=this.data;this.data=b,b=C}this._insert(b,this.data.height-b.height-1,!0)}else this.data=b;return this},l.prototype.insert=function(x){return x&&this._insert(x,this.data.height-1),this},l.prototype.clear=function(){return this.data=Y([]),this},l.prototype.remove=function(x,S){if(!x)return this;for(var b,C,A,q=this.data,w=this.toBBox(x),N=[],L=[];q||N.length;){if(q||(q=N.pop(),C=N[N.length-1],b=L.pop(),A=!0),q.leaf){var D=h(x,q.children,S);if(D!==-1)return q.children.splice(D,1),N.push(q),this._condense(N),this}A||q.leaf||!M(q,w)?C?(b++,q=C.children[b],A=!1):q=null:(N.push(q),L.push(b),b=0,C=q,q=q.children[0])}return this},l.prototype.toBBox=function(x){return x},l.prototype.compareMinX=function(x,S){return x.minX-S.minX},l.prototype.compareMinY=function(x,S){return x.minY-S.minY},l.prototype.toJSON=function(){return this.data},l.prototype.fromJSON=function(x){return this.data=x,this},l.prototype._all=function(x,S){for(var b=[];x;)x.leaf?S.push.apply(S,x.children):b.push.apply(b,x.children),x=b.pop();return S},l.prototype._build=function(x,S,b,C){var A,q=b-S+1,w=this._maxEntries;if(q<=w)return c(A=Y(x.slice(S,b+1)),this.toBBox),A;C||(C=Math.ceil(Math.log(q)/Math.log(w)),w=Math.ceil(q/Math.pow(w,C-1))),(A=Y([])).leaf=!1,A.height=C;var N=Math.ceil(q/w),L=N*Math.ceil(Math.sqrt(w));H(x,S,b,L,this.compareMinX);for(var D=S;D<=b;D+=L){var F=Math.min(D+L-1,b);H(x,D,F,N,this.compareMinY);for(var X=D;X<=F;X+=N){var z=Math.min(X+N-1,F);A.children.push(this._build(x,X,z,C-1))}}return c(A,this.toBBox),A},l.prototype._chooseSubtree=function(x,S,b,C){for(;C.push(S),!S.leaf&&C.length-1!==b;){for(var A=1/0,q=1/0,w=void 0,N=0;N<S.children.length;N++){var L=S.children[N],D=_(L),F=(X=x,z=L,(Math.max(z.maxX,X.maxX)-Math.min(z.minX,X.minX))*(Math.max(z.maxY,X.maxY)-Math.min(z.minY,X.minY))-D);F<q?(q=F,A=D<A?D:A,w=L):F===q&&D<A&&(A=D,w=L)}S=w||S.children[0]}var X,z;return S},l.prototype._insert=function(x,S,b){var C=b?x:this.toBBox(x),A=[],q=this._chooseSubtree(C,this.data,S,A);for(q.children.push(x),d(q,C);S>=0&&A[S].children.length>this._maxEntries;)this._split(A,S),S--;this._adjustParentBBoxes(C,A,S)},l.prototype._split=function(x,S){var b=x[S],C=b.children.length,A=this._minEntries;this._chooseSplitAxis(b,A,C);var q=this._chooseSplitIndex(b,A,C),w=Y(b.children.splice(q,b.children.length-q));w.height=b.height,w.leaf=b.leaf,c(b,this.toBBox),c(w,this.toBBox),S?x[S-1].children.push(w):this._splitRoot(b,w)},l.prototype._splitRoot=function(x,S){this.data=Y([x,S]),this.data.height=x.height+1,this.data.leaf=!1,c(this.data,this.toBBox)},l.prototype._chooseSplitIndex=function(x,S,b){for(var C,A,q,w,N,L,D,F=1/0,X=1/0,z=S;z<=b-S;z++){var V=g(x,0,z,this.toBBox),k=g(x,z,b,this.toBBox),T=(A=V,q=k,w=void 0,N=void 0,L=void 0,D=void 0,w=Math.max(A.minX,q.minX),N=Math.max(A.minY,q.minY),L=Math.min(A.maxX,q.maxX),D=Math.min(A.maxY,q.maxY),Math.max(0,L-w)*Math.max(0,D-N)),P=_(V)+_(k);T<F?(F=T,C=z,X=P<X?P:X):T===F&&P<X&&(X=P,C=z)}return C||b-S},l.prototype._chooseSplitAxis=function(x,S,b){var C=x.leaf?this.compareMinX:y,A=x.leaf?this.compareMinY:v;this._allDistMargin(x,S,b,C)<this._allDistMargin(x,S,b,A)&&x.children.sort(C)},l.prototype._allDistMargin=function(x,S,b,C){x.children.sort(C);for(var A=this.toBBox,q=g(x,0,S,A),w=g(x,b-S,b,A),N=E(q)+E(w),L=S;L<b-S;L++){var D=x.children[L];d(q,x.leaf?A(D):D),N+=E(q)}for(var F=b-S-1;F>=S;F--){var X=x.children[F];d(w,x.leaf?A(X):X),N+=E(w)}return N},l.prototype._adjustParentBBoxes=function(x,S,b){for(var C=b;C>=0;C--)d(S[C],x)},l.prototype._condense=function(x){for(var S=x.length-1,b=void 0;S>=0;S--)x[S].children.length===0?S>0?(b=x[S-1].children).splice(b.indexOf(x[S]),1):this.clear():c(x[S],this.toBBox)},l})})(di)),di.exports}class Rg{constructor(e=[],i=Ag){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],i=this.data.pop();return this.length--,this.length>0&&(this.data[0]=i,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:i,compare:s}=this,o=i[e];for(;e>0;){const l=e-1>>1,h=i[l];if(s(o,h)>=0)break;i[e]=h,e=l}i[e]=o}_down(e){const{data:i,compare:s}=this,o=this.length>>1,l=i[e];for(;e<o;){let h=(e<<1)+1,c=i[h];const g=h+1;if(g<this.length&&s(i[g],c)<0&&(h=g,c=i[g]),s(c,l)>=0)break;i[e]=c,e=h}i[e]=l}}function Ag(t,e){return t<e?-1:t>e?1:0}const Dg=Rf(Object.freeze(Object.defineProperty({__proto__:null,default:Rg},Symbol.toStringTag,{value:"Module"})));var pr={exports:{}},Ts,pu;function Fg(){return pu||(pu=1,Ts=function(e,i,s,o){var l=e[0],h=e[1],c=!1;s===void 0&&(s=0),o===void 0&&(o=i.length);for(var g=(o-s)/2,d=0,y=g-1;d<g;y=d++){var v=i[s+d*2+0],_=i[s+d*2+1],E=i[s+y*2+0],M=i[s+y*2+1],R=_>h!=M>h&&l<(E-v)*(h-_)/(M-_)+v;R&&(c=!c)}return c}),Ts}var Os,_u;function qg(){return _u||(_u=1,Os=function(e,i,s,o){var l=e[0],h=e[1],c=!1;s===void 0&&(s=0),o===void 0&&(o=i.length);for(var g=o-s,d=0,y=g-1;d<g;y=d++){var v=i[d+s][0],_=i[d+s][1],E=i[y+s][0],M=i[y+s][1],R=_>h!=M>h&&l<(E-v)*(h-_)/(M-_)+v;R&&(c=!c)}return c}),Os}var xu;function Bg(){if(xu)return pr.exports;xu=1;var t=Fg(),e=qg();return pr.exports=function(s,o,l,h){return o.length>0&&Array.isArray(o[0])?e(s,o,l,h):t(s,o,l,h)},pr.exports.nested=e,pr.exports.flat=t,pr.exports}var _r={exports:{}},Gg=_r.exports,Eu;function Yg(){return Eu||(Eu=1,(function(t,e){(function(i,s){s(e)})(Gg,function(i){const o=33306690738754706e-32;function l(R,Y,H,x,S){let b,C,A,q,w=Y[0],N=x[0],L=0,D=0;N>w==N>-w?(b=w,w=Y[++L]):(b=N,N=x[++D]);let F=0;if(L<R&&D<H)for(N>w==N>-w?(A=b-((C=w+b)-w),w=Y[++L]):(A=b-((C=N+b)-N),N=x[++D]),b=C,A!==0&&(S[F++]=A);L<R&&D<H;)N>w==N>-w?(A=b-((C=b+w)-(q=C-b))+(w-q),w=Y[++L]):(A=b-((C=b+N)-(q=C-b))+(N-q),N=x[++D]),b=C,A!==0&&(S[F++]=A);for(;L<R;)A=b-((C=b+w)-(q=C-b))+(w-q),w=Y[++L],b=C,A!==0&&(S[F++]=A);for(;D<H;)A=b-((C=b+N)-(q=C-b))+(N-q),N=x[++D],b=C,A!==0&&(S[F++]=A);return b===0&&F!==0||(S[F++]=b),F}function h(R){return new Float64Array(R)}const c=33306690738754716e-32,g=22204460492503146e-32,d=11093356479670487e-47,y=h(4),v=h(8),_=h(12),E=h(16),M=h(4);i.orient2d=function(R,Y,H,x,S,b){const C=(Y-b)*(H-S),A=(R-S)*(x-b),q=C-A;if(C===0||A===0||C>0!=A>0)return q;const w=Math.abs(C+A);return Math.abs(q)>=c*w?q:-(function(N,L,D,F,X,z,V){let k,T,P,G,B,Z,K,ee,j,te,re,se,W,ge,le,oe,$,Me;const Se=N-X,ue=D-X,ke=L-z,ct=F-z;B=(le=(ee=Se-(K=(Z=134217729*Se)-(Z-Se)))*(te=ct-(j=(Z=134217729*ct)-(Z-ct)))-((ge=Se*ct)-K*j-ee*j-K*te))-(re=le-($=(ee=ke-(K=(Z=134217729*ke)-(Z-ke)))*(te=ue-(j=(Z=134217729*ue)-(Z-ue)))-((oe=ke*ue)-K*j-ee*j-K*te))),y[0]=le-(re+B)+(B-$),B=(W=ge-((se=ge+re)-(B=se-ge))+(re-B))-(re=W-oe),y[1]=W-(re+B)+(B-oe),B=(Me=se+re)-se,y[2]=se-(Me-B)+(re-B),y[3]=Me;let Bt=(function(yo,Ie){let ln=Ie[0];for(let cn=1;cn<yo;cn++)ln+=Ie[cn];return ln})(4,y),ie=g*V;if(Bt>=ie||-Bt>=ie||(k=N-(Se+(B=N-Se))+(B-X),P=D-(ue+(B=D-ue))+(B-X),T=L-(ke+(B=L-ke))+(B-z),G=F-(ct+(B=F-ct))+(B-z),k===0&&T===0&&P===0&&G===0)||(ie=d*V+o*Math.abs(Bt),(Bt+=Se*G+ct*k-(ke*P+ue*T))>=ie||-Bt>=ie))return Bt;B=(le=(ee=k-(K=(Z=134217729*k)-(Z-k)))*(te=ct-(j=(Z=134217729*ct)-(Z-ct)))-((ge=k*ct)-K*j-ee*j-K*te))-(re=le-($=(ee=T-(K=(Z=134217729*T)-(Z-T)))*(te=ue-(j=(Z=134217729*ue)-(Z-ue)))-((oe=T*ue)-K*j-ee*j-K*te))),M[0]=le-(re+B)+(B-$),B=(W=ge-((se=ge+re)-(B=se-ge))+(re-B))-(re=W-oe),M[1]=W-(re+B)+(B-oe),B=(Me=se+re)-se,M[2]=se-(Me-B)+(re-B),M[3]=Me;const Yi=l(4,y,4,M,v);B=(le=(ee=Se-(K=(Z=134217729*Se)-(Z-Se)))*(te=G-(j=(Z=134217729*G)-(Z-G)))-((ge=Se*G)-K*j-ee*j-K*te))-(re=le-($=(ee=ke-(K=(Z=134217729*ke)-(Z-ke)))*(te=P-(j=(Z=134217729*P)-(Z-P)))-((oe=ke*P)-K*j-ee*j-K*te))),M[0]=le-(re+B)+(B-$),B=(W=ge-((se=ge+re)-(B=se-ge))+(re-B))-(re=W-oe),M[1]=W-(re+B)+(B-oe),B=(Me=se+re)-se,M[2]=se-(Me-B)+(re-B),M[3]=Me;const zi=l(Yi,v,4,M,_);B=(le=(ee=k-(K=(Z=134217729*k)-(Z-k)))*(te=G-(j=(Z=134217729*G)-(Z-G)))-((ge=k*G)-K*j-ee*j-K*te))-(re=le-($=(ee=T-(K=(Z=134217729*T)-(Z-T)))*(te=P-(j=(Z=134217729*P)-(Z-P)))-((oe=T*P)-K*j-ee*j-K*te))),M[0]=le-(re+B)+(B-$),B=(W=ge-((se=ge+re)-(B=se-ge))+(re-B))-(re=W-oe),M[1]=W-(re+B)+(B-oe),B=(Me=se+re)-se,M[2]=se-(Me-B)+(re-B),M[3]=Me;const Jt=l(zi,_,4,M,E);return E[Jt-1]})(R,Y,H,x,S,b,w)},i.orient2dfast=function(R,Y,H,x,S,b){return(Y-b)*(H-S)-(R-S)*(x-b)},Object.defineProperty(i,"__esModule",{value:!0})})})(_r,_r.exports)),_r.exports}var wu;function zg(){if(wu)return gi.exports;wu=1;var t=Og(),e=Dg,i=Bg(),s=Yg().orient2d;e.default&&(e=e.default),gi.exports=o,gi.exports.default=o;function o(b,C,A){C=Math.max(0,C===void 0?2:C),A=A||0;var q=E(b),w=new t(16);w.toBBox=function(K){return{minX:K[0],minY:K[1],maxX:K[0],maxY:K[1]}},w.compareMinX=function(K,ee){return K[0]-ee[0]},w.compareMinY=function(K,ee){return K[1]-ee[1]},w.load(b);for(var N=[],L=0,D;L<q.length;L++){var F=q[L];w.remove(F),D=M(F,D),N.push(D)}var X=new t(16);for(L=0;L<N.length;L++)X.insert(_(N[L]));for(var z=C*C,V=A*A;N.length;){var k=N.shift(),T=k.p,P=k.next.p,G=R(T,P);if(!(G<V)){var B=G/z;F=l(w,k.prev.p,T,P,k.next.next.p,B,X),F&&Math.min(R(F,T),R(F,P))<=B&&(N.push(k),N.push(M(F,k)),w.remove(F),X.remove(k),X.insert(_(k)),X.insert(_(k.next)))}}k=D;var Z=[];do Z.push(k.p),k=k.next;while(k!==D);return Z.push(k.p),Z}function l(b,C,A,q,w,N,L){for(var D=new e([],h),F=b.data;F;){for(var X=0;X<F.children.length;X++){var z=F.children[X],V=F.leaf?Y(z,A,q):c(A,q,z);V>N||D.push({node:z,dist:V})}for(;D.length&&!D.peek().node.children;){var k=D.pop(),T=k.node,P=Y(T,C,A),G=Y(T,q,w);if(k.dist<P&&k.dist<G&&d(A,T,L)&&d(q,T,L))return T}F=D.pop(),F&&(F=F.node)}return null}function h(b,C){return b.dist-C.dist}function c(b,C,A){if(g(b,A)||g(C,A))return 0;var q=H(b[0],b[1],C[0],C[1],A.minX,A.minY,A.maxX,A.minY);if(q===0)return 0;var w=H(b[0],b[1],C[0],C[1],A.minX,A.minY,A.minX,A.maxY);if(w===0)return 0;var N=H(b[0],b[1],C[0],C[1],A.maxX,A.minY,A.maxX,A.maxY);if(N===0)return 0;var L=H(b[0],b[1],C[0],C[1],A.minX,A.maxY,A.maxX,A.maxY);return L===0?0:Math.min(q,w,N,L)}function g(b,C){return b[0]>=C.minX&&b[0]<=C.maxX&&b[1]>=C.minY&&b[1]<=C.maxY}function d(b,C,A){for(var q=Math.min(b[0],C[0]),w=Math.min(b[1],C[1]),N=Math.max(b[0],C[0]),L=Math.max(b[1],C[1]),D=A.search({minX:q,minY:w,maxX:N,maxY:L}),F=0;F<D.length;F++)if(v(D[F].p,D[F].next.p,b,C))return!1;return!0}function y(b,C,A){return s(b[0],b[1],C[0],C[1],A[0],A[1])}function v(b,C,A,q){return b!==q&&C!==A&&y(b,C,A)>0!=y(b,C,q)>0&&y(A,q,b)>0!=y(A,q,C)>0}function _(b){var C=b.p,A=b.next.p;return b.minX=Math.min(C[0],A[0]),b.minY=Math.min(C[1],A[1]),b.maxX=Math.max(C[0],A[0]),b.maxY=Math.max(C[1],A[1]),b}function E(b){for(var C=b[0],A=b[0],q=b[0],w=b[0],N=0;N<b.length;N++){var L=b[N];L[0]<C[0]&&(C=L),L[0]>q[0]&&(q=L),L[1]<A[1]&&(A=L),L[1]>w[1]&&(w=L)}var D=[C,A,q,w],F=D.slice();for(N=0;N<b.length;N++)i(b[N],D)||F.push(b[N]);return S(F)}function M(b,C){var A={p:b,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return C?(A.next=C.next,A.prev=C,C.next.prev=A,C.next=A):(A.prev=A,A.next=A),A}function R(b,C){var A=b[0]-C[0],q=b[1]-C[1];return A*A+q*q}function Y(b,C,A){var q=C[0],w=C[1],N=A[0]-q,L=A[1]-w;if(N!==0||L!==0){var D=((b[0]-q)*N+(b[1]-w)*L)/(N*N+L*L);D>1?(q=A[0],w=A[1]):D>0&&(q+=N*D,w+=L*D)}return N=b[0]-q,L=b[1]-w,N*N+L*L}function H(b,C,A,q,w,N,L,D){var F=A-b,X=q-C,z=L-w,V=D-N,k=b-w,T=C-N,P=F*F+X*X,G=F*z+X*V,B=z*z+V*V,Z=F*k+X*T,K=z*k+V*T,ee=P*B-G*G,j,te,re,se,W=ee,ge=ee;ee===0?(te=0,W=1,se=K,ge=B):(te=G*K-B*Z,se=P*K-G*Z,te<0?(te=0,se=K,ge=B):te>W&&(te=W,se=K+G,ge=B)),se<0?(se=0,-Z<0?te=0:-Z>P?te=W:(te=-Z,W=P)):se>ge&&(se=ge,-Z+G<0?te=0:-Z+G>P?te=W:(te=-Z+G,W=P)),j=te===0?0:te/W,re=se===0?0:se/ge;var le=(1-j)*b+j*A,oe=(1-j)*C+j*q,$=(1-re)*w+re*L,Me=(1-re)*N+re*D,Se=$-le,ue=Me-oe;return Se*Se+ue*ue}function x(b,C){return b[0]===C[0]?b[1]-C[1]:b[0]-C[0]}function S(b){b.sort(x);for(var C=[],A=0;A<b.length;A++){for(;C.length>=2&&y(C[C.length-2],C[C.length-1],b[A])<=0;)C.pop();C.push(b[A])}for(var q=[],w=b.length-1;w>=0;w--){for(;q.length>=2&&y(q[q.length-2],q[q.length-1],b[w])<=0;)q.pop();q.push(b[w])}return q.pop(),C.pop(),C.concat(q)}return gi.exports}var Xg=zg();const Ug=gr(Xg);function ku(t,e={}){e.concavity=e.concavity||1/0;const i=[];if(Xe(t,o=>{i.push([o[0],o[1]])}),!i.length)return null;const s=Ug(i,e.concavity);return s.length>3?ye([s]):null}function Iu(t,e={}){switch(gt(t)){case"Point":return _e(Te(t),e.properties);case"Polygon":var i=[];Xe(t,function(b){i.push(b)});var s=Zt(t,{properties:e.properties}),o=s.geometry.coordinates,l=0,h=0,c=0,g,d,y,v,_,E,M,R,Y=i.map(function(b){return[b[0]-o[0],b[1]-o[1]]});for(g=0;g<i.length-1;g++)d=Y[g],v=d[0],E=d[1],y=Y[g+1],_=y[0],M=y[1],R=v*M-_*E,c+=R,l+=(v+_)*R,h+=(E+M)*R;if(c===0)return s;var H=c*.5,x=1/(6*H);return _e([o[0]+x*l,o[1]+x*h],e.properties);default:var S=ku(t);return S?Iu(S,{properties:e.properties}):Zt(t,{properties:e.properties})}}function Rs(t,e,i={}){const s=i.steps||64,o=i.properties?i.properties:!Array.isArray(t)&&t.type==="Feature"&&t.properties?t.properties:{},l=[];for(let h=0;h<s;h++)l.push(rn(t,e,h*-360/s,i).geometry.coordinates);return l.push(l[0]),ye([l],o)}function je(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return Nu(t);case"FeatureCollection":return Vg(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return As(t);default:throw new Error("unknown GeoJSON type")}}function Nu(t){const e={type:"Feature"};return Object.keys(t).forEach(i=>{switch(i){case"type":case"properties":case"geometry":return;default:e[i]=t[i]}}),e.properties=vi(t.properties),t.geometry==null?e.geometry=null:e.geometry=As(t.geometry),e}function vi(t){const e={};return t&&Object.keys(t).forEach(i=>{const s=t[i];typeof s=="object"?s===null?e[i]=null:Array.isArray(s)?e[i]=s.map(o=>o):e[i]=vi(s):e[i]=s}),e}function Vg(t){const e={type:"FeatureCollection"};return Object.keys(t).forEach(i=>{switch(i){case"type":case"features":return;default:e[i]=t[i]}}),e.features=t.features.map(i=>Nu(i)),e}function As(t){const e={type:t.type};return t.bbox&&(e.bbox=t.bbox),t.type==="GeometryCollection"?(e.geometries=t.geometries.map(i=>As(i)),e):(e.coordinates=Mu(t.coordinates),e)}function Mu(t){const e=t;return typeof e[0]!="object"?e.slice():e.map(i=>Mu(i))}function Su(t,e){if(!t)throw new Error("geojson is required");if(t.type!=="FeatureCollection")throw new Error("geojson must be a FeatureCollection");if(e==null)throw new Error("filter is required");var i=[];return Le(t,function(s){yi(s.properties,e)&&i.push(s)}),he(i)}function Ds(t,e,i){if(!t)throw new Error("geojson is required");if(t.type!=="FeatureCollection")throw new Error("geojson must be a FeatureCollection");if(e==null)throw new Error("property is required");for(var s=Fs(t,e),o=Object.keys(s),l=0;l<o.length;l++){for(var h=o[l],c=s[h],g=[],d=0;d<c.length;d++)g.push(t.features[c[d]]);i(he(g),h,l)}}function Pu(t,e,i,s){var o=s;return Ds(t,e,function(l,h,c){c===0&&s===void 0?o=l:o=i(o,l,h,c)}),o}function Fs(t,e){var i={};return Le(t,function(s,o){var l=s.properties||{};if(Object.prototype.hasOwnProperty.call(l,String(e))){var h=l[e];Object.prototype.hasOwnProperty.call(i,h)?i[h].push(o):i[h]=[o]}}),i}function yi(t,e){if(t===void 0)return!1;var i=typeof e;if(i==="number"||i==="string")return Object.prototype.hasOwnProperty.call(t,e);if(Array.isArray(e)){for(var s=0;s<e.length;s++)if(!yi(t,e[s]))return!1;return!0}else return qs(t,e)}function qs(t,e){for(var i=Object.keys(e),s=0;s<i.length;s++){var o=i[s];if(t[o]!==e[o])return!1}return!0}function Lu(t,e){if(!e)return{};if(!e.length)return{};for(var i={},s=0;s<e.length;s++){var o=e[s];Object.prototype.hasOwnProperty.call(t,o)&&(i[o]=t[o])}return i}const Hg=Object.freeze(Object.defineProperty({__proto__:null,applyFilter:yi,clusterEach:Ds,clusterReduce:Pu,createBins:Fs,filterProperties:Lu,getCluster:Su,propertiesContainsFilter:qs},Symbol.toStringTag,{value:"Module"}));function $g(t,e,i={}){i.mutate!==!0&&(t=je(t));const s=i.minPoints||3,o=Vr(e,i.units);var l=new dt(t.features.length),h=t.features.map(E=>!1),c=t.features.map(E=>!1),g=t.features.map(E=>!1),d=t.features.map(E=>-1);l.load(t.features.map((E,M)=>{var[R,Y]=E.geometry.coordinates;return{minX:R,minY:Y,maxX:R,maxY:Y,index:M}}));const y=E=>{const M=t.features[E],[R,Y]=M.geometry.coordinates,H=Math.max(Y-o,-90),x=Math.min(Y+o,90),S=(function(){return H<0&&x>0?o:Math.abs(H)<Math.abs(x)?o/Math.cos(Ze(x)):o/Math.cos(Ze(H))})(),b=Math.max(R-S,-360),C=Math.min(R+S,360),A={minX:b,minY:H,maxX:C,maxY:x};return l.search(A).filter(q=>{const w=q.index,N=t.features[w];return Be(M,N,{units:"kilometers"})<=e})},v=(E,M)=>{for(var R=0;R<M.length;R++){var Y=M[R];const H=Y.index;if(!h[H]){h[H]=!0;const x=y(H);x.length>=s&&M.push(...x)}c[H]||(c[H]=!0,d[H]=E)}};var _=0;return t.features.forEach((E,M)=>{if(h[M])return;const R=y(M);if(R.length>=s){const Y=_;_++,h[M]=!0,v(Y,R)}else g[M]=!0}),t.features.forEach((E,M)=>{var R=t.features[M];R.properties||(R.properties={}),d[M]>=0?(R.properties.dbscan=g[M]?"edge":"core",R.properties.cluster=d[M]):R.properties.dbscan="noise"}),t}var Bs,bu;function Cu(){return bu||(bu=1,Bs={eudist:function(e,i,s){for(var o=e.length,l=0,h=0;h<o;h++){var c=(e[h]||0)-(i[h]||0);l+=c*c}return s?Math.sqrt(l):l},mandist:function(e,i,s){for(var o=e.length,l=0,h=0;h<o;h++)l+=Math.abs((e[h]||0)-(i[h]||0));return s?Math.sqrt(l):l},dist:function(e,i,s){var o=Math.abs(e-i);return s?o:o*o}}),Bs}var Gs,Tu;function Zg(){if(Tu)return Gs;Tu=1;var t=Cu(),e=t.eudist,i=t.dist;return Gs={kmrand:function(o,l){for(var h={},c=[],g=l<<2,d=o.length,y=o[0].length>0;c.length<l&&g-- >0;){var v=o[Math.floor(Math.random()*d)],_=y?v.join("_"):""+v;h[_]||(h[_]=!0,c.push(v))}if(c.length<l)throw new Error("Error initializating clusters");return c},kmpp:function(o,l){var h=o[0].length?e:i,c=[],g=o.length,d=o[0].length>0,y=o[Math.floor(Math.random()*g)];for(d?y.join("_"):""+y,c.push(y);c.length<l;){for(var v=[],_=c.length,E=0,M=[],R=0;R<g;R++){for(var Y=1/0,H=0;H<_;H++){var x=h(o[R],c[H]);x<=Y&&(Y=x)}v[R]=Y}for(var S=0;S<g;S++)E+=v[S];for(var b=0;b<g;b++)M[b]={i:b,v:o[b],pr:v[b]/E,cs:0};M.sort(function(w,N){return w.pr-N.pr}),M[0].cs=M[0].pr;for(var C=1;C<g;C++)M[C].cs=M[C-1].cs+M[C].pr;for(var A=Math.random(),q=0;q<g-1&&M[q++].cs<A;);c.push(M[q-1].v)}return c}},Gs}var Ys,Ou;function Wg(){if(Ou)return Ys;Ou=1;var t=Cu(),e=Zg(),i=t.eudist;t.mandist,t.dist;var s=e.kmrand,o=e.kmpp,l=1e4;function h(g,d,y){y=y||[];for(var v=0;v<g;v++)y[v]=d;return y}function c(g,d,y,v){var _=[],E=[],M=[],R=[],Y=!1,H=v||l,x=g.length,S=g[0].length,b=S>0,C=[];if(y)y=="kmrand"?_=s(g,d):y=="kmpp"?_=o(g,d):_=y;else for(var A={};_.length<d;){var q=Math.floor(Math.random()*x);A[q]||(A[q]=!0,_.push(g[q]))}do{h(d,0,C);for(var w=0;w<x;w++){for(var N=1/0,L=0,D=0;D<d;D++){var R=b?i(g[w],_[D]):Math.abs(g[w]-_[D]);R<=N&&(N=R,L=D)}M[w]=L,C[L]++}for(var F=[],E=[],X=0;X<d;X++)F[X]=b?h(S,0,F[X]):0,E[X]=_[X];if(b){for(var z=0;z<d;z++)_[z]=[];for(var V=0;V<x;V++)for(var k=M[V],T=F[k],P=g[V],G=0;G<S;G++)T[G]+=P[G];Y=!0;for(var B=0;B<d;B++){for(var Z=_[B],K=F[B],ee=E[B],j=C[B],te=0;te<S;te++)Z[te]=K[te]/j||0;if(Y){for(var re=0;re<S;re++)if(ee[re]!=Z[re]){Y=!1;break}}}}else{for(var se=0;se<x;se++){var W=M[se];F[W]+=g[se]}for(var ge=0;ge<d;ge++)_[ge]=F[ge]/C[ge]||0;Y=!0;for(var le=0;le<d;le++)if(E[le]!=_[le]){Y=!1;break}}Y=Y||--H<=0}while(!Y);return{it:l-H,k:d,idxs:M,centroids:_}}return Ys=c,Ys}var Kg=Wg();const Jg=gr(Kg);function Qg(t,e={}){var i=t.features.length;e.numberOfClusters=e.numberOfClusters||Math.round(Math.sqrt(i/2)),e.numberOfClusters>i&&(e.numberOfClusters=i),e.mutate!==!0&&(t=je(t));var s=rr(t),o=s.slice(0,e.numberOfClusters),l=Jg(s,e.numberOfClusters,o),h={};return l.centroids.forEach(function(c,g){h[g]=c}),Le(t,function(c,g){var d=l.idxs[g];c.properties.cluster=d,c.properties.centroid=h[d]}),t}function jg(t,e,i,s){var o=new dt(6),l=e.features.map(function(h){var c;return{minX:h.geometry.coordinates[0],minY:h.geometry.coordinates[1],maxX:h.geometry.coordinates[0],maxY:h.geometry.coordinates[1],property:(c=h.properties)==null?void 0:c[i]}});return o.load(l),t.features.forEach(function(h){h.properties||(h.properties={});var c=Fe(h),g=o.search({minX:c[0],minY:c[1],maxX:c[2],maxY:c[3]}),d=[];g.forEach(function(y){xe([y.minX,y.minY],h)&&d.push(y.property)}),h.properties[s]=d}),t}function ed(t){var e={MultiPoint:{coordinates:[],properties:[]},MultiLineString:{coordinates:[],properties:[]},MultiPolygon:{coordinates:[],properties:[]}};return Le(t,i=>{var s;switch((s=i.geometry)==null?void 0:s.type){case"Point":e.MultiPoint.coordinates.push(i.geometry.coordinates),e.MultiPoint.properties.push(i.properties);break;case"MultiPoint":e.MultiPoint.coordinates.push(...i.geometry.coordinates),e.MultiPoint.properties.push(i.properties);break;case"LineString":e.MultiLineString.coordinates.push(i.geometry.coordinates),e.MultiLineString.properties.push(i.properties);break;case"MultiLineString":e.MultiLineString.coordinates.push(...i.geometry.coordinates),e.MultiLineString.properties.push(i.properties);break;case"Polygon":e.MultiPolygon.coordinates.push(i.geometry.coordinates),e.MultiPolygon.properties.push(i.properties);break;case"MultiPolygon":e.MultiPolygon.coordinates.push(...i.geometry.coordinates),e.MultiPolygon.properties.push(i.properties);break}}),he(Object.keys(e).filter(function(i){return e[i].coordinates.length}).sort().map(function(i){var s={type:i,coordinates:e[i].coordinates},o={collectedProperties:e[i].properties};return We(s,o)}))}function Ru(t,e){let i=!1;return he(rd(t.features.map(s=>{const o={x:s.geometry.coordinates[0],y:s.geometry.coordinates[1]};return e?o.z=s.properties[e]:s.geometry.coordinates.length===3&&(i=!0,o.z=s.geometry.coordinates[2]),o})).map(s=>{const o=[s.a.x,s.a.y],l=[s.b.x,s.b.y],h=[s.c.x,s.c.y];let c={};return i?(o.push(s.a.z),l.push(s.b.z),h.push(s.c.z)):c={a:s.a.z,b:s.b.z,c:s.c.z},ye([[o,l,h,o]],c)}))}var Au=class{constructor(t,e,i){this.a=t,this.b=e,this.c=i;const s=e.x-t.x,o=e.y-t.y,l=i.x-t.x,h=i.y-t.y,c=s*(t.x+e.x)+o*(t.y+e.y),g=l*(t.x+i.x)+h*(t.y+i.y),d=2*(s*(i.y-e.y)-o*(i.x-e.x));let y,v;this.x=(h*c-o*g)/d,this.y=(s*g-l*c)/d,y=this.x-t.x,v=this.y-t.y,this.r=y*y+v*v}};function td(t,e){return e.x-t.x}function nd(t){let e=t.length,i,s,o,l,h;e:for(;e;)for(s=t[--e],i=t[--e],o=e;o;)if(h=t[--o],l=t[--o],i===l&&s===h||i===h&&s===l){t.splice(e,2),t.splice(o,2),e-=2;continue e}}function rd(t){if(t.length<3)return[];t.sort(td);let e=t.length-1;const i=t[e].x,s=t[0].x;let o=t[e].y,l=o;const h=1e-12;let c,g,d,y,v,_;for(;e--;)t[e].y<o&&(o=t[e].y),t[e].y>l&&(l=t[e].y);let E=s-i,M=l-o;const R=E>M?E:M,Y=(s+i)*.5,H=(l+o)*.5,x=[new Au({__sentinel:!0,x:Y-20*R,y:H-R},{__sentinel:!0,x:Y,y:H+20*R},{__sentinel:!0,x:Y+20*R,y:H-R})],S=[],b=[];let C;for(e=t.length;e--;){for(b.length=0,C=x.length;C--;){if(E=t[e].x-x[C].x,E>0&&E*E>x[C].r){S.push(x[C]),x.splice(C,1);continue}M=t[e].y-x[C].y,!(E*E+M*M>x[C].r)&&(b.push(x[C].a,x[C].b,x[C].b,x[C].c,x[C].c,x[C].a),x.splice(C,1))}for(nd(b),C=b.length;C;)g=b[--C],c=b[--C],d=t[e],y=g.x-c.x,v=g.y-c.y,_=2*(y*(d.y-g.y)-v*(d.x-g.x)),Math.abs(_)>h&&x.push(new Au(c,g,d))}for(Array.prototype.push.apply(S,x),e=S.length;e--;)(S[e].a.__sentinel||S[e].b.__sentinel||S[e].c.__sentinel)&&S.splice(e,1);return S}function id(t){return t}function sd(t){if(t==null)return id;var e,i,s=t.scale[0],o=t.scale[1],l=t.translate[0],h=t.translate[1];return function(c,g){g||(e=i=0);var d=2,y=c.length,v=new Array(y);for(v[0]=(e+=c[0])*s+l,v[1]=(i+=c[1])*o+h;d<y;)v[d]=c[d],++d;return v}}function od(t,e){for(var i,s=t.length,o=s-e;o<--s;)i=t[o],t[o++]=t[s],t[s]=i}function Du(t,e){var i=sd(t.transform),s=t.arcs;function o(y,v){v.length&&v.pop();for(var _=s[y<0?~y:y],E=0,M=_.length;E<M;++E)v.push(i(_[E],E));y<0&&od(v,M)}function l(y){return i(y)}function h(y){for(var v=[],_=0,E=y.length;_<E;++_)o(y[_],v);return v.length<2&&v.push(v[0]),v}function c(y){for(var v=h(y);v.length<4;)v.push(v[0]);return v}function g(y){return y.map(c)}function d(y){var v=y.type,_;switch(v){case"GeometryCollection":return{type:v,geometries:y.geometries.map(d)};case"Point":_=l(y.coordinates);break;case"MultiPoint":_=y.coordinates.map(l);break;case"LineString":_=h(y.arcs);break;case"MultiLineString":_=y.arcs.map(h);break;case"Polygon":_=g(y.arcs);break;case"MultiPolygon":_=y.arcs.map(g);break;default:return null}return{type:v,coordinates:_}}return d(e)}function ad(t,e){var i={},s={},o={},l=[],h=-1;e.forEach(function(d,y){var v=t.arcs[d<0?~d:d],_;v.length<3&&!v[1][0]&&!v[1][1]&&(_=e[++h],e[h]=d,e[y]=_)}),e.forEach(function(d){var y=c(d),v=y[0],_=y[1],E,M;if(E=o[v])if(delete o[E.end],E.push(d),E.end=_,M=s[_]){delete s[M.start];var R=M===E?E:E.concat(M);s[R.start=E.start]=o[R.end=M.end]=R}else s[E.start]=o[E.end]=E;else if(E=s[_])if(delete s[E.start],E.unshift(d),E.start=v,M=o[v]){delete o[M.end];var Y=M===E?E:M.concat(E);s[Y.start=M.start]=o[Y.end=E.end]=Y}else s[E.start]=o[E.end]=E;else E=[d],s[E.start=v]=o[E.end=_]=E});function c(d){var y=t.arcs[d<0?~d:d],v=y[0],_;return t.transform?(_=[0,0],y.forEach(function(E){_[0]+=E[0],_[1]+=E[1]})):_=y[y.length-1],d<0?[_,v]:[v,_]}function g(d,y){for(var v in d){var _=d[v];delete y[_.start],delete _.start,delete _.end,_.forEach(function(E){i[E<0?~E:E]=1}),l.push(_)}}return g(o,s),g(s,o),e.forEach(function(d){i[d<0?~d:d]||l.push([d])}),l}function ud(t){for(var e=-1,i=t.length,s,o=t[i-1],l=0;++e<i;)s=o,o=t[e],l+=s[0]*o[1]-s[1]*o[0];return Math.abs(l)}function ld(t){return Du(t,cd.apply(this,arguments))}function cd(t,e){var i={},s=[],o=[];e.forEach(l);function l(g){switch(g.type){case"GeometryCollection":g.geometries.forEach(l);break;case"Polygon":h(g.arcs);break;case"MultiPolygon":g.arcs.forEach(h);break}}function h(g){g.forEach(function(d){d.forEach(function(y){(i[y=y<0?~y:y]||(i[y]=[])).push(g)})}),s.push(g)}function c(g){return ud(Du(t,{type:"Polygon",arcs:[g]}).coordinates[0])}return s.forEach(function(g){if(!g._){var d=[],y=[g];for(g._=1,o.push(d);g=y.pop();)d.push(g),g.forEach(function(v){v.forEach(function(_){i[_<0?~_:_].forEach(function(E){E._||(E._=1,y.push(E))})})})}}),s.forEach(function(g){delete g._}),{type:"MultiPolygon",arcs:o.map(function(g){var d=[],y;if(g.forEach(function(R){R.forEach(function(Y){Y.forEach(function(H){i[H<0?~H:H].length<2&&d.push(H)})})}),d=ad(t,d),(y=d.length)>1)for(var v=1,_=c(d[0]),E,M;v<y;++v)(E=c(d[v]))>_&&(M=d[0],d[0]=d[v],d[v]=M,_=E);return d}).filter(function(g){return g.length>0})}}var zs=Object.prototype.hasOwnProperty;function hd(t){var e=1/0,i=1/0,s=-1/0,o=-1/0;function l(v){v!=null&&zs.call(h,v.type)&&h[v.type](v)}var h={GeometryCollection:function(v){v.geometries.forEach(l)},Point:function(v){c(v.coordinates)},MultiPoint:function(v){v.coordinates.forEach(c)},LineString:function(v){g(v.arcs)},MultiLineString:function(v){v.arcs.forEach(g)},Polygon:function(v){v.arcs.forEach(g)},MultiPolygon:function(v){v.arcs.forEach(d)}};function c(v){var _=v[0],E=v[1];_<e&&(e=_),_>s&&(s=_),E<i&&(i=E),E>o&&(o=E)}function g(v){v.forEach(c)}function d(v){v.forEach(g)}for(var y in t)l(t[y]);return s>=e&&o>=i?[e,i,s,o]:void 0}function fd(t,e,i,s,o){arguments.length===3&&(s=Array,o=null);for(var l=new s(t=1<<Math.max(4,Math.ceil(Math.log(t)/Math.LN2))),h=t-1,c=0;c<t;++c)l[c]=o;function g(v){for(var _=e(v)&h,E=l[_],M=0;E!=o;){if(i(E,v))return!0;if(++M>=t)throw new Error("full hashset");E=l[_=_+1&h]}return l[_]=v,!0}function d(v){for(var _=e(v)&h,E=l[_],M=0;E!=o;){if(i(E,v))return!0;if(++M>=t)break;E=l[_=_+1&h]}return!1}function y(){for(var v=[],_=0,E=l.length;_<E;++_){var M=l[_];M!=o&&v.push(M)}return v}return{add:g,has:d,values:y}}function Xs(t,e,i,s,o,l){arguments.length===3&&(s=l=Array,o=null);for(var h=new s(t=1<<Math.max(4,Math.ceil(Math.log(t)/Math.LN2))),c=new l(t),g=t-1,d=0;d<t;++d)h[d]=o;function y(M,R){for(var Y=e(M)&g,H=h[Y],x=0;H!=o;){if(i(H,M))return c[Y]=R;if(++x>=t)throw new Error("full hashmap");H=h[Y=Y+1&g]}return h[Y]=M,c[Y]=R,R}function v(M,R){for(var Y=e(M)&g,H=h[Y],x=0;H!=o;){if(i(H,M))return c[Y];if(++x>=t)throw new Error("full hashmap");H=h[Y=Y+1&g]}return h[Y]=M,c[Y]=R,R}function _(M,R){for(var Y=e(M)&g,H=h[Y],x=0;H!=o;){if(i(H,M))return c[Y];if(++x>=t)break;H=h[Y=Y+1&g]}return R}function E(){for(var M=[],R=0,Y=h.length;R<Y;++R){var H=h[R];H!=o&&M.push(H)}return M}return{set:y,maybeSet:v,get:_,keys:E}}function mn(t,e){return t[0]===e[0]&&t[1]===e[1]}var Fu=new ArrayBuffer(16),qu=new Float64Array(Fu),mi=new Uint32Array(Fu);function Us(t){qu[0]=t[0],qu[1]=t[1];var e=mi[0]^mi[1];return e=e<<5^e>>7^mi[2]^mi[3],e&2147483647}function gd(t){var e=t.coordinates,i=t.lines,s=t.rings,o=A(),l=new Int32Array(e.length),h=new Int32Array(e.length),c=new Int32Array(e.length),g=new Int8Array(e.length),d=0,y,v,_,E,M;for(y=0,v=e.length;y<v;++y)l[y]=h[y]=c[y]=-1;for(y=0,v=i.length;y<v;++y){var R=i[y],Y=R[0],H=R[1];for(E=o[Y],M=o[++Y],++d,g[E]=1;++Y<=H;)C(y,_=E,E=M,M=o[Y]);++d,g[M]=1}for(y=0,v=e.length;y<v;++y)l[y]=-1;for(y=0,v=s.length;y<v;++y){var x=s[y],S=x[0]+1,b=x[1];for(_=o[b-1],E=o[S-1],M=o[S],C(y,_,E,M);++S<=b;)C(y,_=E,E=M,M=o[S])}function C(D,F,X,z){if(l[X]!==D){l[X]=D;var V=h[X];if(V>=0){var k=c[X];(V!==F||k!==z)&&(V!==z||k!==F)&&(++d,g[X]=1)}else h[X]=F,c[X]=z}}function A(){for(var D=Xs(e.length*1.4,q,w,Int32Array,-1,Int32Array),F=new Int32Array(e.length),X=0,z=e.length;X<z;++X)F[X]=D.maybeSet(X,X);return F}function q(D){return Us(e[D])}function w(D,F){return mn(e[D],e[F])}l=h=c=null;var N=fd(d*1.4,Us,mn),L;for(y=0,v=e.length;y<v;++y)g[L=o[y]]&&N.add(e[L]);return N}function dd(t){var e=gd(t),i=t.coordinates,s=t.lines,o=t.rings,l,h,c;for(h=0,c=s.length;h<c;++h)for(var g=s[h],d=g[0],y=g[1];++d<y;)e.has(i[d])&&(l={0:d,1:g[1]},g[1]=d,g=g.next=l);for(h=0,c=o.length;h<c;++h)for(var v=o[h],_=v[0],E=_,M=v[1],R=e.has(i[_]);++E<M;)e.has(i[E])&&(R?(l={0:E,1:v[1]},v[1]=E,v=v.next=l):(vd(i,_,M,M-E),i[M]=i[_],R=!0,E=_));return t}function vd(t,e,i,s){Vs(t,e,i),Vs(t,e,e+s),Vs(t,e+s,i)}function Vs(t,e,i){for(var s=e+(i---e>>1),o;e<s;++e,--i)o=t[e],t[e]=t[i],t[i]=o}function yd(t){var e=t.coordinates,i=t.lines,s,o=t.rings,l,h=i.length+o.length,c,g;for(delete t.lines,delete t.rings,c=0,g=i.length;c<g;++c)for(s=i[c];s=s.next;)++h;for(c=0,g=o.length;c<g;++c)for(l=o[c];l=l.next;)++h;var d=Xs(h*2*1.4,Us,mn),y=t.arcs=[];for(c=0,g=i.length;c<g;++c){s=i[c];do v(s);while(s=s.next)}for(c=0,g=o.length;c<g;++c)if(l=o[c],l.next)do v(l);while(l=l.next);else _(l);function v(x){var S,b,C,A,q,w,N,L;if(C=d.get(S=e[x[0]])){for(N=0,L=C.length;N<L;++N)if(A=C[N],E(A,x)){x[0]=A[0],x[1]=A[1];return}}if(q=d.get(b=e[x[1]])){for(N=0,L=q.length;N<L;++N)if(w=q[N],M(w,x)){x[1]=w[0],x[0]=w[1];return}}C?C.push(x):d.set(S,[x]),q?q.push(x):d.set(b,[x]),y.push(x)}function _(x){var S,b,C,A,q;if(b=d.get(S=e[x[0]]))for(A=0,q=b.length;A<q;++A){if(C=b[A],R(C,x)){x[0]=C[0],x[1]=C[1];return}if(Y(C,x)){x[0]=C[1],x[1]=C[0];return}}if(b=d.get(S=e[x[0]+H(x)]))for(A=0,q=b.length;A<q;++A){if(C=b[A],R(C,x)){x[0]=C[0],x[1]=C[1];return}if(Y(C,x)){x[0]=C[1],x[1]=C[0];return}}b?b.push(x):d.set(S,[x]),y.push(x)}function E(x,S){var b=x[0],C=S[0],A=x[1],q=S[1];if(b-A!==C-q)return!1;for(;b<=A;++b,++C)if(!mn(e[b],e[C]))return!1;return!0}function M(x,S){var b=x[0],C=S[0],A=x[1],q=S[1];if(b-A!==C-q)return!1;for(;b<=A;++b,--q)if(!mn(e[b],e[q]))return!1;return!0}function R(x,S){var b=x[0],C=S[0],A=x[1],q=S[1],w=A-b;if(w!==q-C)return!1;for(var N=H(x),L=H(S),D=0;D<w;++D)if(!mn(e[b+(D+N)%w],e[C+(D+L)%w]))return!1;return!0}function Y(x,S){var b=x[0],C=S[0],A=x[1],q=S[1],w=A-b;if(w!==q-C)return!1;for(var N=H(x),L=w-H(S),D=0;D<w;++D)if(!mn(e[b+(D+N)%w],e[q-(D+L)%w]))return!1;return!0}function H(x){for(var S=x[0],b=x[1],C=S,A=C,q=e[C];++C<b;){var w=e[C];(w[0]<q[0]||w[0]===q[0]&&w[1]<q[1])&&(A=C,q=w)}return A-S}return t}function md(t){var e=-1,i=[],s=[],o=[];function l(v){v&&zs.call(h,v.type)&&h[v.type](v)}var h={GeometryCollection:function(v){v.geometries.forEach(l)},LineString:function(v){v.arcs=c(v.arcs)},MultiLineString:function(v){v.arcs=v.arcs.map(c)},Polygon:function(v){v.arcs=v.arcs.map(g)},MultiPolygon:function(v){v.arcs=v.arcs.map(d)}};function c(v){for(var _=0,E=v.length;_<E;++_)o[++e]=v[_];var M={0:e-E+1,1:e};return i.push(M),M}function g(v){for(var _=0,E=v.length;_<E;++_)o[++e]=v[_];var M={0:e-E+1,1:e};return s.push(M),M}function d(v){return v.map(g)}for(var y in t)l(t[y]);return{type:"Topology",coordinates:o,lines:i,rings:s,objects:t}}function pd(t){var e={},i;for(i in t)e[i]=_d(t[i]);return e}function _d(t){return t==null?{type:null}:(t.type==="FeatureCollection"?xd:t.type==="Feature"?Bu:Hs)(t)}function xd(t){var e={type:"GeometryCollection",geometries:t.features.map(Bu)};return t.bbox!=null&&(e.bbox=t.bbox),e}function Bu(t){var e=Hs(t.geometry),i;t.id!=null&&(e.id=t.id),t.bbox!=null&&(e.bbox=t.bbox);for(i in t.properties){e.properties=t.properties;break}return e}function Hs(t){if(t==null)return{type:null};var e=t.type==="GeometryCollection"?{type:"GeometryCollection",geometries:t.geometries.map(Hs)}:t.type==="Point"||t.type==="MultiPoint"?{type:t.type,coordinates:t.coordinates}:{type:t.type,arcs:t.coordinates};return t.bbox!=null&&(e.bbox=t.bbox),e}function Ed(t,e){var i=hd(t=pd(t)),s=yd(dd(md(t))),o=s.coordinates,l=Xs(s.arcs.length*1.4,wd,kd);t=s.objects,s.bbox=i,s.arcs=s.arcs.map(function(v,_){return l.set(v,_),o.slice(v[0],v[1]+1)}),delete s.coordinates,o=null;function h(v){v&&zs.call(c,v.type)&&c[v.type](v)}var c={GeometryCollection:function(v){v.geometries.forEach(h)},LineString:function(v){v.arcs=g(v.arcs)},MultiLineString:function(v){v.arcs=v.arcs.map(g)},Polygon:function(v){v.arcs=v.arcs.map(g)},MultiPolygon:function(v){v.arcs=v.arcs.map(d)}};function g(v){var _=[];do{var E=l.get(v);_.push(v[0]<v[1]?E:~E)}while(v=v.next);return _}function d(v){return v.map(g)}for(var y in t)h(t[y]);return s}function wd(t){var e=t[0],i=t[1],s;return i<e&&(s=e,e=i,i=s),e+31*i}function kd(t,e){var i=t[0],s=t[1],o=e[0],l=e[1],h;return s<i&&(h=i,i=s,s=h),l<o&&(h=o,o=l,l=h),i===o&&s===l}function Id(t,e={}){if(e=e||{},!Ce(e))throw new Error("options is invalid");const i=e.mutate;if(gt(t)!=="FeatureCollection")throw new Error("geojson must be a FeatureCollection");if(!t.features.length)throw new Error("geojson is empty");(i===!1||i===void 0)&&(t=je(t));const s=[],o=ls(t,(l,h)=>{const c=Nd(l,h);return c||(s.push(l),h)});return o&&s.push(o),s.length?s.length===1?s[0]:tn(s.map(l=>l.coordinates)):null}function pi(t){return t[0].toString()+","+t[1].toString()}function Nd(t,e){const i=t.geometry.coordinates,s=e.geometry.coordinates,o=pi(i[0]),l=pi(i[i.length-1]),h=pi(s[0]),c=pi(s[s.length-1]);let g;if(o===c)g=s.concat(i.slice(1));else if(h===l)g=i.concat(s.slice(1));else if(o===h)g=i.slice(1).reverse().concat(s);else if(l===c)g=i.concat(s.reverse().slice(1));else return null;return Pe(g)}function Md(t,e={}){if(gt(t)!=="FeatureCollection")throw new Error("geojson must be a FeatureCollection");if(!t.features.length)throw new Error("geojson is empty");(e.mutate===!1||e.mutate===void 0)&&(t=je(t));const i=[];Qe(t,l=>{i.push(l.geometry)});const s=Ed({geoms:es(i).geometry});return ld(s,s.objects.geoms.geometries)}function Sd(t,e={}){if(e=e||{},!Ce(e))throw new Error("options is invalid");const i=e.mutate;if(gt(t)!=="FeatureCollection")throw new Error("geojson must be a FeatureCollection");if(!t.features.length)throw new Error("geojson is empty");(i===!1||i===void 0)&&(t=je(t));const s=Pd(t);if(!s)throw new Error("geojson must be homogenous");const o=t;switch(s){case"LineString":return Id(o,e);case"Polygon":return Md(o,e);default:throw new Error(s+" is not supported")}}function Pd(t){const e={};Qe(t,s=>{e[s.geometry.type]=!0});const i=Object.keys(e);return i.length===1?i[0]:null}function Ld(t,e={}){const i=e.maxEdge||1/0,s=bd(t),o=Ru(s);if(o.features=o.features.filter(h=>{const c=h.geometry.coordinates[0][0],g=h.geometry.coordinates[0][1],d=h.geometry.coordinates[0][2],y=Be(c,g,e),v=Be(g,d,e),_=Be(c,d,e);return y<=i&&v<=i&&_<=i}),o.features.length<1)return null;const l=Sd(o);return l.coordinates.length===1&&(l.coordinates=l.coordinates[0],l.type="Polygon"),We(l)}function bd(t){const e=[],i={};return Le(t,s=>{if(!s.geometry)return;const o=s.geometry.coordinates.join("-");Object.prototype.hasOwnProperty.call(i,o)||(e.push(s),i[o]=!0)}),he(e)}var Cd=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,$s=Math.ceil,Et=Math.floor,vt="[BigNumber Error] ",Gu=vt+"Number primitive has more than 15 significant digits: ",Lt=1e14,Ne=14,Zs=9007199254740991,Ws=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],an=1e7,nt=1e9;function Yu(t){var e,i,s,o=x.prototype={constructor:x,toString:null,valueOf:null},l=new x(1),h=20,c=4,g=-7,d=21,y=-1e7,v=1e7,_=!1,E=1,M=0,R={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},Y="0123456789abcdefghijklmnopqrstuvwxyz",H=!0;function x(w,N){var L,D,F,X,z,V,k,T,P=this;if(!(P instanceof x))return new x(w,N);if(N==null){if(w&&w._isBigNumber===!0){P.s=w.s,!w.c||w.e>v?P.c=P.e=null:w.e<y?P.c=[P.e=0]:(P.e=w.e,P.c=w.c.slice());return}if((V=typeof w=="number")&&w*0==0){if(P.s=1/w<0?(w=-w,-1):1,w===~~w){for(X=0,z=w;z>=10;z/=10,X++);X>v?P.c=P.e=null:(P.e=X,P.c=[w]);return}T=String(w)}else{if(!Cd.test(T=String(w)))return s(P,T,V);P.s=T.charCodeAt(0)==45?(T=T.slice(1),-1):1}(X=T.indexOf("."))>-1&&(T=T.replace(".","")),(z=T.search(/e/i))>0?(X<0&&(X=z),X+=+T.slice(z+1),T=T.substring(0,z)):X<0&&(X=T.length)}else{if($e(N,2,Y.length,"Base"),N==10&&H)return P=new x(w),A(P,h+P.e+1,c);if(T=String(w),V=typeof w=="number"){if(w*0!=0)return s(P,T,V,N);if(P.s=1/w<0?(T=T.slice(1),-1):1,x.DEBUG&&T.replace(/^0\.0*|\./,"").length>15)throw Error(Gu+w)}else P.s=T.charCodeAt(0)===45?(T=T.slice(1),-1):1;for(L=Y.slice(0,N),X=z=0,k=T.length;z<k;z++)if(L.indexOf(D=T.charAt(z))<0){if(D=="."){if(z>X){X=k;continue}}else if(!F&&(T==T.toUpperCase()&&(T=T.toLowerCase())||T==T.toLowerCase()&&(T=T.toUpperCase()))){F=!0,z=-1,X=0;continue}return s(P,String(w),V,N)}V=!1,T=i(T,N,10,P.s),(X=T.indexOf("."))>-1?T=T.replace(".",""):X=T.length}for(z=0;T.charCodeAt(z)===48;z++);for(k=T.length;T.charCodeAt(--k)===48;);if(T=T.slice(z,++k)){if(k-=z,V&&x.DEBUG&&k>15&&(w>Zs||w!==Et(w)))throw Error(Gu+P.s*w);if((X=X-z-1)>v)P.c=P.e=null;else if(X<y)P.c=[P.e=0];else{if(P.e=X,P.c=[],z=(X+1)%Ne,X<0&&(z+=Ne),z<k){for(z&&P.c.push(+T.slice(0,z)),k-=Ne;z<k;)P.c.push(+T.slice(z,z+=Ne));z=Ne-(T=T.slice(z)).length}else z-=k;for(;z--;T+="0");P.c.push(+T)}}else P.c=[P.e=0]}x.clone=Yu,x.ROUND_UP=0,x.ROUND_DOWN=1,x.ROUND_CEIL=2,x.ROUND_FLOOR=3,x.ROUND_HALF_UP=4,x.ROUND_HALF_DOWN=5,x.ROUND_HALF_EVEN=6,x.ROUND_HALF_CEIL=7,x.ROUND_HALF_FLOOR=8,x.EUCLID=9,x.config=x.set=function(w){var N,L;if(w!=null)if(typeof w=="object"){if(w.hasOwnProperty(N="DECIMAL_PLACES")&&(L=w[N],$e(L,0,nt,N),h=L),w.hasOwnProperty(N="ROUNDING_MODE")&&(L=w[N],$e(L,0,8,N),c=L),w.hasOwnProperty(N="EXPONENTIAL_AT")&&(L=w[N],L&&L.pop?($e(L[0],-nt,0,N),$e(L[1],0,nt,N),g=L[0],d=L[1]):($e(L,-nt,nt,N),g=-(d=L<0?-L:L))),w.hasOwnProperty(N="RANGE"))if(L=w[N],L&&L.pop)$e(L[0],-nt,-1,N),$e(L[1],1,nt,N),y=L[0],v=L[1];else if($e(L,-nt,nt,N),L)y=-(v=L<0?-L:L);else throw Error(vt+N+" cannot be zero: "+L);if(w.hasOwnProperty(N="CRYPTO"))if(L=w[N],L===!!L)if(L)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))_=L;else throw _=!L,Error(vt+"crypto unavailable");else _=L;else throw Error(vt+N+" not true or false: "+L);if(w.hasOwnProperty(N="MODULO_MODE")&&(L=w[N],$e(L,0,9,N),E=L),w.hasOwnProperty(N="POW_PRECISION")&&(L=w[N],$e(L,0,nt,N),M=L),w.hasOwnProperty(N="FORMAT"))if(L=w[N],typeof L=="object")R=L;else throw Error(vt+N+" not an object: "+L);if(w.hasOwnProperty(N="ALPHABET"))if(L=w[N],typeof L=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(L))H=L.slice(0,10)=="0123456789",Y=L;else throw Error(vt+N+" invalid: "+L)}else throw Error(vt+"Object expected: "+w);return{DECIMAL_PLACES:h,ROUNDING_MODE:c,EXPONENTIAL_AT:[g,d],RANGE:[y,v],CRYPTO:_,MODULO_MODE:E,POW_PRECISION:M,FORMAT:R,ALPHABET:Y}},x.isBigNumber=function(w){if(!w||w._isBigNumber!==!0)return!1;if(!x.DEBUG)return!0;var N,L,D=w.c,F=w.e,X=w.s;e:if({}.toString.call(D)=="[object Array]"){if((X===1||X===-1)&&F>=-nt&&F<=nt&&F===Et(F)){if(D[0]===0){if(F===0&&D.length===1)return!0;break e}if(N=(F+1)%Ne,N<1&&(N+=Ne),String(D[0]).length==N){for(N=0;N<D.length;N++)if(L=D[N],L<0||L>=Lt||L!==Et(L))break e;if(L!==0)return!0}}}else if(D===null&&F===null&&(X===null||X===1||X===-1))return!0;throw Error(vt+"Invalid BigNumber: "+w)},x.maximum=x.max=function(){return b(arguments,-1)},x.minimum=x.min=function(){return b(arguments,1)},x.random=(function(){var w=9007199254740992,N=Math.random()*w&2097151?function(){return Et(Math.random()*w)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(L){var D,F,X,z,V,k=0,T=[],P=new x(l);if(L==null?L=h:$e(L,0,nt),z=$s(L/Ne),_)if(crypto.getRandomValues){for(D=crypto.getRandomValues(new Uint32Array(z*=2));k<z;)V=D[k]*131072+(D[k+1]>>>11),V>=9e15?(F=crypto.getRandomValues(new Uint32Array(2)),D[k]=F[0],D[k+1]=F[1]):(T.push(V%1e14),k+=2);k=z/2}else if(crypto.randomBytes){for(D=crypto.randomBytes(z*=7);k<z;)V=(D[k]&31)*281474976710656+D[k+1]*1099511627776+D[k+2]*4294967296+D[k+3]*16777216+(D[k+4]<<16)+(D[k+5]<<8)+D[k+6],V>=9e15?crypto.randomBytes(7).copy(D,k):(T.push(V%1e14),k+=7);k=z/7}else throw _=!1,Error(vt+"crypto unavailable");if(!_)for(;k<z;)V=N(),V<9e15&&(T[k++]=V%1e14);for(z=T[--k],L%=Ne,z&&L&&(V=Ws[Ne-L],T[k]=Et(z/V)*V);T[k]===0;T.pop(),k--);if(k<0)T=[X=0];else{for(X=-1;T[0]===0;T.splice(0,1),X-=Ne);for(k=1,V=T[0];V>=10;V/=10,k++);k<Ne&&(X-=Ne-k)}return P.e=X,P.c=T,P}})(),x.sum=function(){for(var w=1,N=arguments,L=new x(N[0]);w<N.length;)L=L.plus(N[w++]);return L},i=(function(){var w="0123456789";function N(L,D,F,X){for(var z,V=[0],k,T=0,P=L.length;T<P;){for(k=V.length;k--;V[k]*=D);for(V[0]+=X.indexOf(L.charAt(T++)),z=0;z<V.length;z++)V[z]>F-1&&(V[z+1]==null&&(V[z+1]=0),V[z+1]+=V[z]/F|0,V[z]%=F)}return V.reverse()}return function(L,D,F,X,z){var V,k,T,P,G,B,Z,K,ee=L.indexOf("."),j=h,te=c;for(ee>=0&&(P=M,M=0,L=L.replace(".",""),K=new x(D),B=K.pow(L.length-ee),M=P,K.c=N(Wt(kt(B.c),B.e,"0"),10,F,w),K.e=K.c.length),Z=N(L,D,F,z?(V=Y,w):(V=w,Y)),T=P=Z.length;Z[--P]==0;Z.pop());if(!Z[0])return V.charAt(0);if(ee<0?--T:(B.c=Z,B.e=T,B.s=X,B=e(B,K,j,te,F),Z=B.c,G=B.r,T=B.e),k=T+j+1,ee=Z[k],P=F/2,G=G||k<0||Z[k+1]!=null,G=te<4?(ee!=null||G)&&(te==0||te==(B.s<0?3:2)):ee>P||ee==P&&(te==4||G||te==6&&Z[k-1]&1||te==(B.s<0?8:7)),k<1||!Z[0])L=G?Wt(V.charAt(1),-j,V.charAt(0)):V.charAt(0);else{if(Z.length=k,G)for(--F;++Z[--k]>F;)Z[k]=0,k||(++T,Z=[1].concat(Z));for(P=Z.length;!Z[--P];);for(ee=0,L="";ee<=P;L+=V.charAt(Z[ee++]));L=Wt(L,T,V.charAt(0))}return L}})(),e=(function(){function w(D,F,X){var z,V,k,T,P=0,G=D.length,B=F%an,Z=F/an|0;for(D=D.slice();G--;)k=D[G]%an,T=D[G]/an|0,z=Z*k+T*B,V=B*k+z%an*an+P,P=(V/X|0)+(z/an|0)+Z*T,D[G]=V%X;return P&&(D=[P].concat(D)),D}function N(D,F,X,z){var V,k;if(X!=z)k=X>z?1:-1;else for(V=k=0;V<X;V++)if(D[V]!=F[V]){k=D[V]>F[V]?1:-1;break}return k}function L(D,F,X,z){for(var V=0;X--;)D[X]-=V,V=D[X]<F[X]?1:0,D[X]=V*z+D[X]-F[X];for(;!D[0]&&D.length>1;D.splice(0,1));}return function(D,F,X,z,V){var k,T,P,G,B,Z,K,ee,j,te,re,se,W,ge,le,oe,$,Me=D.s==F.s?1:-1,Se=D.c,ue=F.c;if(!Se||!Se[0]||!ue||!ue[0])return new x(!D.s||!F.s||(Se?ue&&Se[0]==ue[0]:!ue)?NaN:Se&&Se[0]==0||!ue?Me*0:Me/0);for(ee=new x(Me),j=ee.c=[],T=D.e-F.e,Me=X+T+1,V||(V=Lt,T=wt(D.e/Ne)-wt(F.e/Ne),Me=Me/Ne|0),P=0;ue[P]==(Se[P]||0);P++);if(ue[P]>(Se[P]||0)&&T--,Me<0)j.push(1),G=!0;else{for(ge=Se.length,oe=ue.length,P=0,Me+=2,B=Et(V/(ue[0]+1)),B>1&&(ue=w(ue,B,V),Se=w(Se,B,V),oe=ue.length,ge=Se.length),W=oe,te=Se.slice(0,oe),re=te.length;re<oe;te[re++]=0);$=ue.slice(),$=[0].concat($),le=ue[0],ue[1]>=V/2&&le++;do{if(B=0,k=N(ue,te,oe,re),k<0){if(se=te[0],oe!=re&&(se=se*V+(te[1]||0)),B=Et(se/le),B>1)for(B>=V&&(B=V-1),Z=w(ue,B,V),K=Z.length,re=te.length;N(Z,te,K,re)==1;)B--,L(Z,oe<K?$:ue,K,V),K=Z.length,k=1;else B==0&&(k=B=1),Z=ue.slice(),K=Z.length;if(K<re&&(Z=[0].concat(Z)),L(te,Z,re,V),re=te.length,k==-1)for(;N(ue,te,oe,re)<1;)B++,L(te,oe<re?$:ue,re,V),re=te.length}else k===0&&(B++,te=[0]);j[P++]=B,te[0]?te[re++]=Se[W]||0:(te=[Se[W]],re=1)}while((W++<ge||te[0]!=null)&&Me--);G=te[0]!=null,j[0]||j.splice(0,1)}if(V==Lt){for(P=1,Me=j[0];Me>=10;Me/=10,P++);A(ee,X+(ee.e=P+T*Ne-1)+1,z,G)}else ee.e=T,ee.r=+G;return ee}})();function S(w,N,L,D){var F,X,z,V,k;if(L==null?L=c:$e(L,0,8),!w.c)return w.toString();if(F=w.c[0],z=w.e,N==null)k=kt(w.c),k=D==1||D==2&&(z<=g||z>=d)?xi(k,z):Wt(k,z,"0");else if(w=A(new x(w),N,L),X=w.e,k=kt(w.c),V=k.length,D==1||D==2&&(N<=X||X<=g)){for(;V<N;k+="0",V++);k=xi(k,X)}else if(N-=z+(D===2&&X>z),k=Wt(k,X,"0"),X+1>V){if(--N>0)for(k+=".";N--;k+="0");}else if(N+=X-V,N>0)for(X+1==V&&(k+=".");N--;k+="0");return w.s<0&&F?"-"+k:k}function b(w,N){for(var L,D,F=1,X=new x(w[0]);F<w.length;F++)D=new x(w[F]),(!D.s||(L=pn(X,D))===N||L===0&&X.s===N)&&(X=D);return X}function C(w,N,L){for(var D=1,F=N.length;!N[--F];N.pop());for(F=N[0];F>=10;F/=10,D++);return(L=D+L*Ne-1)>v?w.c=w.e=null:L<y?w.c=[w.e=0]:(w.e=L,w.c=N),w}s=(function(){var w=/^(-?)0([xbo])(?=\w[\w.]*$)/i,N=/^([^.]+)\.$/,L=/^\.([^.]+)$/,D=/^-?(Infinity|NaN)$/,F=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(X,z,V,k){var T,P=V?z:z.replace(F,"");if(D.test(P))X.s=isNaN(P)?null:P<0?-1:1;else{if(!V&&(P=P.replace(w,function(G,B,Z){return T=(Z=Z.toLowerCase())=="x"?16:Z=="b"?2:8,!k||k==T?B:G}),k&&(T=k,P=P.replace(N,"$1").replace(L,"0.$1")),z!=P))return new x(P,T);if(x.DEBUG)throw Error(vt+"Not a"+(k?" base "+k:"")+" number: "+z);X.s=null}X.c=X.e=null}})();function A(w,N,L,D){var F,X,z,V,k,T,P,G=w.c,B=Ws;if(G){e:{for(F=1,V=G[0];V>=10;V/=10,F++);if(X=N-F,X<0)X+=Ne,z=N,k=G[T=0],P=Et(k/B[F-z-1]%10);else if(T=$s((X+1)/Ne),T>=G.length)if(D){for(;G.length<=T;G.push(0));k=P=0,F=1,X%=Ne,z=X-Ne+1}else break e;else{for(k=V=G[T],F=1;V>=10;V/=10,F++);X%=Ne,z=X-Ne+F,P=z<0?0:Et(k/B[F-z-1]%10)}if(D=D||N<0||G[T+1]!=null||(z<0?k:k%B[F-z-1]),D=L<4?(P||D)&&(L==0||L==(w.s<0?3:2)):P>5||P==5&&(L==4||D||L==6&&(X>0?z>0?k/B[F-z]:0:G[T-1])%10&1||L==(w.s<0?8:7)),N<1||!G[0])return G.length=0,D?(N-=w.e+1,G[0]=B[(Ne-N%Ne)%Ne],w.e=-N||0):G[0]=w.e=0,w;if(X==0?(G.length=T,V=1,T--):(G.length=T+1,V=B[Ne-X],G[T]=z>0?Et(k/B[F-z]%B[z])*V:0),D)for(;;)if(T==0){for(X=1,z=G[0];z>=10;z/=10,X++);for(z=G[0]+=V,V=1;z>=10;z/=10,V++);X!=V&&(w.e++,G[0]==Lt&&(G[0]=1));break}else{if(G[T]+=V,G[T]!=Lt)break;G[T--]=0,V=1}for(X=G.length;G[--X]===0;G.pop());}w.e>v?w.c=w.e=null:w.e<y&&(w.c=[w.e=0])}return w}function q(w){var N,L=w.e;return L===null?w.toString():(N=kt(w.c),N=L<=g||L>=d?xi(N,L):Wt(N,L,"0"),w.s<0?"-"+N:N)}return o.absoluteValue=o.abs=function(){var w=new x(this);return w.s<0&&(w.s=1),w},o.comparedTo=function(w,N){return pn(this,new x(w,N))},o.decimalPlaces=o.dp=function(w,N){var L,D,F,X=this;if(w!=null)return $e(w,0,nt),N==null?N=c:$e(N,0,8),A(new x(X),w+X.e+1,N);if(!(L=X.c))return null;if(D=((F=L.length-1)-wt(this.e/Ne))*Ne,F=L[F])for(;F%10==0;F/=10,D--);return D<0&&(D=0),D},o.dividedBy=o.div=function(w,N){return e(this,new x(w,N),h,c)},o.dividedToIntegerBy=o.idiv=function(w,N){return e(this,new x(w,N),0,1)},o.exponentiatedBy=o.pow=function(w,N){var L,D,F,X,z,V,k,T,P,G=this;if(w=new x(w),w.c&&!w.isInteger())throw Error(vt+"Exponent not an integer: "+q(w));if(N!=null&&(N=new x(N)),V=w.e>14,!G.c||!G.c[0]||G.c[0]==1&&!G.e&&G.c.length==1||!w.c||!w.c[0])return P=new x(Math.pow(+q(G),V?w.s*(2-_i(w)):+q(w))),N?P.mod(N):P;if(k=w.s<0,N){if(N.c?!N.c[0]:!N.s)return new x(NaN);D=!k&&G.isInteger()&&N.isInteger(),D&&(G=G.mod(N))}else{if(w.e>9&&(G.e>0||G.e<-1||(G.e==0?G.c[0]>1||V&&G.c[1]>=24e7:G.c[0]<8e13||V&&G.c[0]<=9999975e7)))return X=G.s<0&&_i(w)?-0:0,G.e>-1&&(X=1/X),new x(k?1/X:X);M&&(X=$s(M/Ne+2))}for(V?(L=new x(.5),k&&(w.s=1),T=_i(w)):(F=Math.abs(+q(w)),T=F%2),P=new x(l);;){if(T){if(P=P.times(G),!P.c)break;X?P.c.length>X&&(P.c.length=X):D&&(P=P.mod(N))}if(F){if(F=Et(F/2),F===0)break;T=F%2}else if(w=w.times(L),A(w,w.e+1,1),w.e>14)T=_i(w);else{if(F=+q(w),F===0)break;T=F%2}G=G.times(G),X?G.c&&G.c.length>X&&(G.c.length=X):D&&(G=G.mod(N))}return D?P:(k&&(P=l.div(P)),N?P.mod(N):X?A(P,M,c,z):P)},o.integerValue=function(w){var N=new x(this);return w==null?w=c:$e(w,0,8),A(N,N.e+1,w)},o.isEqualTo=o.eq=function(w,N){return pn(this,new x(w,N))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(w,N){return pn(this,new x(w,N))>0},o.isGreaterThanOrEqualTo=o.gte=function(w,N){return(N=pn(this,new x(w,N)))===1||N===0},o.isInteger=function(){return!!this.c&&wt(this.e/Ne)>this.c.length-2},o.isLessThan=o.lt=function(w,N){return pn(this,new x(w,N))<0},o.isLessThanOrEqualTo=o.lte=function(w,N){return(N=pn(this,new x(w,N)))===-1||N===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(w,N){var L,D,F,X,z=this,V=z.s;if(w=new x(w,N),N=w.s,!V||!N)return new x(NaN);if(V!=N)return w.s=-N,z.plus(w);var k=z.e/Ne,T=w.e/Ne,P=z.c,G=w.c;if(!k||!T){if(!P||!G)return P?(w.s=-N,w):new x(G?z:NaN);if(!P[0]||!G[0])return G[0]?(w.s=-N,w):new x(P[0]?z:c==3?-0:0)}if(k=wt(k),T=wt(T),P=P.slice(),V=k-T){for((X=V<0)?(V=-V,F=P):(T=k,F=G),F.reverse(),N=V;N--;F.push(0));F.reverse()}else for(D=(X=(V=P.length)<(N=G.length))?V:N,V=N=0;N<D;N++)if(P[N]!=G[N]){X=P[N]<G[N];break}if(X&&(F=P,P=G,G=F,w.s=-w.s),N=(D=G.length)-(L=P.length),N>0)for(;N--;P[L++]=0);for(N=Lt-1;D>V;){if(P[--D]<G[D]){for(L=D;L&&!P[--L];P[L]=N);--P[L],P[D]+=Lt}P[D]-=G[D]}for(;P[0]==0;P.splice(0,1),--T);return P[0]?C(w,P,T):(w.s=c==3?-1:1,w.c=[w.e=0],w)},o.modulo=o.mod=function(w,N){var L,D,F=this;return w=new x(w,N),!F.c||!w.s||w.c&&!w.c[0]?new x(NaN):!w.c||F.c&&!F.c[0]?new x(F):(E==9?(D=w.s,w.s=1,L=e(F,w,0,3),w.s=D,L.s*=D):L=e(F,w,0,E),w=F.minus(L.times(w)),!w.c[0]&&E==1&&(w.s=F.s),w)},o.multipliedBy=o.times=function(w,N){var L,D,F,X,z,V,k,T,P,G,B,Z,K,ee,j,te=this,re=te.c,se=(w=new x(w,N)).c;if(!re||!se||!re[0]||!se[0])return!te.s||!w.s||re&&!re[0]&&!se||se&&!se[0]&&!re?w.c=w.e=w.s=null:(w.s*=te.s,!re||!se?w.c=w.e=null:(w.c=[0],w.e=0)),w;for(D=wt(te.e/Ne)+wt(w.e/Ne),w.s*=te.s,k=re.length,G=se.length,k<G&&(K=re,re=se,se=K,F=k,k=G,G=F),F=k+G,K=[];F--;K.push(0));for(ee=Lt,j=an,F=G;--F>=0;){for(L=0,B=se[F]%j,Z=se[F]/j|0,z=k,X=F+z;X>F;)T=re[--z]%j,P=re[z]/j|0,V=Z*T+P*B,T=B*T+V%j*j+K[X]+L,L=(T/ee|0)+(V/j|0)+Z*P,K[X--]=T%ee;K[X]=L}return L?++D:K.splice(0,1),C(w,K,D)},o.negated=function(){var w=new x(this);return w.s=-w.s||null,w},o.plus=function(w,N){var L,D=this,F=D.s;if(w=new x(w,N),N=w.s,!F||!N)return new x(NaN);if(F!=N)return w.s=-N,D.minus(w);var X=D.e/Ne,z=w.e/Ne,V=D.c,k=w.c;if(!X||!z){if(!V||!k)return new x(F/0);if(!V[0]||!k[0])return k[0]?w:new x(V[0]?D:F*0)}if(X=wt(X),z=wt(z),V=V.slice(),F=X-z){for(F>0?(z=X,L=k):(F=-F,L=V),L.reverse();F--;L.push(0));L.reverse()}for(F=V.length,N=k.length,F-N<0&&(L=k,k=V,V=L,N=F),F=0;N;)F=(V[--N]=V[N]+k[N]+F)/Lt|0,V[N]=Lt===V[N]?0:V[N]%Lt;return F&&(V=[F].concat(V),++z),C(w,V,z)},o.precision=o.sd=function(w,N){var L,D,F,X=this;if(w!=null&&w!==!!w)return $e(w,1,nt),N==null?N=c:$e(N,0,8),A(new x(X),w,N);if(!(L=X.c))return null;if(F=L.length-1,D=F*Ne+1,F=L[F]){for(;F%10==0;F/=10,D--);for(F=L[0];F>=10;F/=10,D++);}return w&&X.e+1>D&&(D=X.e+1),D},o.shiftedBy=function(w){return $e(w,-Zs,Zs),this.times("1e"+w)},o.squareRoot=o.sqrt=function(){var w,N,L,D,F,X=this,z=X.c,V=X.s,k=X.e,T=h+4,P=new x("0.5");if(V!==1||!z||!z[0])return new x(!V||V<0&&(!z||z[0])?NaN:z?X:1/0);if(V=Math.sqrt(+q(X)),V==0||V==1/0?(N=kt(z),(N.length+k)%2==0&&(N+="0"),V=Math.sqrt(+N),k=wt((k+1)/2)-(k<0||k%2),V==1/0?N="5e"+k:(N=V.toExponential(),N=N.slice(0,N.indexOf("e")+1)+k),L=new x(N)):L=new x(V+""),L.c[0]){for(k=L.e,V=k+T,V<3&&(V=0);;)if(F=L,L=P.times(F.plus(e(X,F,T,1))),kt(F.c).slice(0,V)===(N=kt(L.c)).slice(0,V))if(L.e<k&&--V,N=N.slice(V-3,V+1),N=="9999"||!D&&N=="4999"){if(!D&&(A(F,F.e+h+2,0),F.times(F).eq(X))){L=F;break}T+=4,V+=4,D=1}else{(!+N||!+N.slice(1)&&N.charAt(0)=="5")&&(A(L,L.e+h+2,1),w=!L.times(L).eq(X));break}}return A(L,L.e+h+1,c,w)},o.toExponential=function(w,N){return w!=null&&($e(w,0,nt),w++),S(this,w,N,1)},o.toFixed=function(w,N){return w!=null&&($e(w,0,nt),w=w+this.e+1),S(this,w,N)},o.toFormat=function(w,N,L){var D,F=this;if(L==null)w!=null&&N&&typeof N=="object"?(L=N,N=null):w&&typeof w=="object"?(L=w,w=N=null):L=R;else if(typeof L!="object")throw Error(vt+"Argument not an object: "+L);if(D=F.toFixed(w,N),F.c){var X,z=D.split("."),V=+L.groupSize,k=+L.secondaryGroupSize,T=L.groupSeparator||"",P=z[0],G=z[1],B=F.s<0,Z=B?P.slice(1):P,K=Z.length;if(k&&(X=V,V=k,k=X,K-=X),V>0&&K>0){for(X=K%V||V,P=Z.substr(0,X);X<K;X+=V)P+=T+Z.substr(X,V);k>0&&(P+=T+Z.slice(X)),B&&(P="-"+P)}D=G?P+(L.decimalSeparator||"")+((k=+L.fractionGroupSize)?G.replace(new RegExp("\\d{"+k+"}\\B","g"),"$&"+(L.fractionGroupSeparator||"")):G):P}return(L.prefix||"")+D+(L.suffix||"")},o.toFraction=function(w){var N,L,D,F,X,z,V,k,T,P,G,B,Z=this,K=Z.c;if(w!=null&&(V=new x(w),!V.isInteger()&&(V.c||V.s!==1)||V.lt(l)))throw Error(vt+"Argument "+(V.isInteger()?"out of range: ":"not an integer: ")+q(V));if(!K)return new x(Z);for(N=new x(l),T=L=new x(l),D=k=new x(l),B=kt(K),X=N.e=B.length-Z.e-1,N.c[0]=Ws[(z=X%Ne)<0?Ne+z:z],w=!w||V.comparedTo(N)>0?X>0?N:T:V,z=v,v=1/0,V=new x(B),k.c[0]=0;P=e(V,N,0,1),F=L.plus(P.times(D)),F.comparedTo(w)!=1;)L=D,D=F,T=k.plus(P.times(F=T)),k=F,N=V.minus(P.times(F=N)),V=F;return F=e(w.minus(L),D,0,1),k=k.plus(F.times(T)),L=L.plus(F.times(D)),k.s=T.s=Z.s,X=X*2,G=e(T,D,X,c).minus(Z).abs().comparedTo(e(k,L,X,c).minus(Z).abs())<1?[T,D]:[k,L],v=z,G},o.toNumber=function(){return+q(this)},o.toPrecision=function(w,N){return w!=null&&$e(w,1,nt),S(this,w,N,2)},o.toString=function(w){var N,L=this,D=L.s,F=L.e;return F===null?D?(N="Infinity",D<0&&(N="-"+N)):N="NaN":(w==null?N=F<=g||F>=d?xi(kt(L.c),F):Wt(kt(L.c),F,"0"):w===10&&H?(L=A(new x(L),h+F+1,c),N=Wt(kt(L.c),L.e,"0")):($e(w,2,Y.length,"Base"),N=i(Wt(kt(L.c),F,"0"),10,w,D,!0)),D<0&&L.c[0]&&(N="-"+N)),N},o.valueOf=o.toJSON=function(){return q(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,t!=null&&x.set(t),x}function wt(t){var e=t|0;return t>0||t===e?e:e-1}function kt(t){for(var e,i,s=1,o=t.length,l=t[0]+"";s<o;){for(e=t[s++]+"",i=Ne-e.length;i--;e="0"+e);l+=e}for(o=l.length;l.charCodeAt(--o)===48;);return l.slice(0,o+1||1)}function pn(t,e){var i,s,o=t.c,l=e.c,h=t.s,c=e.s,g=t.e,d=e.e;if(!h||!c)return null;if(i=o&&!o[0],s=l&&!l[0],i||s)return i?s?0:-c:h;if(h!=c)return h;if(i=h<0,s=g==d,!o||!l)return s?0:!o^i?1:-1;if(!s)return g>d^i?1:-1;for(c=(g=o.length)<(d=l.length)?g:d,h=0;h<c;h++)if(o[h]!=l[h])return o[h]>l[h]^i?1:-1;return g==d?0:g>d^i?1:-1}function $e(t,e,i,s){if(t<e||t>i||t!==Et(t))throw Error(vt+(s||"Argument")+(typeof t=="number"?t<e||t>i?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function _i(t){var e=t.c.length-1;return wt(t.e/Ne)==e&&t.c[e]%2!=0}function xi(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function Wt(t,e,i){var s,o;if(e<0){for(o=i+".";++e;o+=i);t=o+t}else if(s=t.length,++e>s){for(o=i,e-=s;--e;o+=i);t+=o}else e<s&&(t=t.slice(0,e)+"."+t.slice(e));return t}var Ft=Yu(),Td=class{key;left=null;right=null;constructor(t){this.key=t}},xr=class extends Td{constructor(t){super(t)}},Od=class{size=0;modificationCount=0;splayCount=0;splay(t){const e=this.root;if(e==null)return this.compare(t,t),-1;let i=null,s=null,o=null,l=null,h=e;const c=this.compare;let g;for(;;)if(g=c(h.key,t),g>0){let d=h.left;if(d==null||(g=c(d.key,t),g>0&&(h.left=d.right,d.right=h,h=d,d=h.left,d==null)))break;i==null?s=h:i.left=h,i=h,h=d}else if(g<0){let d=h.right;if(d==null||(g=c(d.key,t),g<0&&(h.right=d.left,d.left=h,h=d,d=h.right,d==null)))break;o==null?l=h:o.right=h,o=h,h=d}else break;return o!=null&&(o.right=h.left,h.left=l),i!=null&&(i.left=h.right,h.right=s),this.root!==h&&(this.root=h,this.splayCount++),g}splayMin(t){let e=t,i=e.left;for(;i!=null;){const s=i;e.left=s.right,s.right=e,e=s,i=e.left}return e}splayMax(t){let e=t,i=e.right;for(;i!=null;){const s=i;e.right=s.left,s.left=e,e=s,i=e.right}return e}_delete(t){if(this.root==null||this.splay(t)!=0)return null;let i=this.root;const s=i,o=i.left;if(this.size--,o==null)this.root=i.right;else{const l=i.right;i=this.splayMax(o),i.right=l,this.root=i}return this.modificationCount++,s}addNewRoot(t,e){this.size++,this.modificationCount++;const i=this.root;if(i==null){this.root=t;return}e<0?(t.left=i,t.right=i.right,i.right=null):(t.right=i,t.left=i.left,i.left=null),this.root=t}_first(){const t=this.root;return t==null?null:(this.root=this.splayMin(t),this.root)}_last(){const t=this.root;return t==null?null:(this.root=this.splayMax(t),this.root)}clear(){this.root=null,this.size=0,this.modificationCount++}has(t){return this.validKey(t)&&this.splay(t)==0}defaultCompare(){return(t,e)=>t<e?-1:t>e?1:0}wrap(){return{getRoot:()=>this.root,setRoot:t=>{this.root=t},getSize:()=>this.size,getModificationCount:()=>this.modificationCount,getSplayCount:()=>this.splayCount,setSplayCount:t=>{this.splayCount=t},splay:t=>this.splay(t),has:t=>this.has(t)}}},Ei=class zr extends Od{root=null;compare;validKey;constructor(e,i){super(),this.compare=e??this.defaultCompare(),this.validKey=i??(s=>s!=null&&s!=null)}delete(e){return this.validKey(e)?this._delete(e)!=null:!1}deleteAll(e){for(const i of e)this.delete(i)}forEach(e){const i=this[Symbol.iterator]();let s;for(;s=i.next(),!s.done;)e(s.value,s.value,this)}add(e){const i=this.splay(e);return i!=0&&this.addNewRoot(new xr(e),i),this}addAndReturn(e){const i=this.splay(e);return i!=0&&this.addNewRoot(new xr(e),i),this.root.key}addAll(e){for(const i of e)this.add(i)}isEmpty(){return this.root==null}isNotEmpty(){return this.root!=null}single(){if(this.size==0)throw"Bad state: No element";if(this.size>1)throw"Bad state: Too many element";return this.root.key}first(){if(this.size==0)throw"Bad state: No element";return this._first().key}last(){if(this.size==0)throw"Bad state: No element";return this._last().key}lastBefore(e){if(e==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(e)<0)return this.root.key;let s=this.root.left;if(s==null)return null;let o=s.right;for(;o!=null;)s=o,o=s.right;return s.key}firstAfter(e){if(e==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(e)>0)return this.root.key;let s=this.root.right;if(s==null)return null;let o=s.left;for(;o!=null;)s=o,o=s.left;return s.key}retainAll(e){const i=new zr(this.compare,this.validKey),s=this.modificationCount;for(const o of e){if(s!=this.modificationCount)throw"Concurrent modification during iteration.";this.validKey(o)&&this.splay(o)==0&&i.add(this.root.key)}i.size!=this.size&&(this.root=i.root,this.size=i.size,this.modificationCount++)}lookup(e){return!this.validKey(e)||this.splay(e)!=0?null:this.root.key}intersection(e){const i=new zr(this.compare,this.validKey);for(const s of this)e.has(s)&&i.add(s);return i}difference(e){const i=new zr(this.compare,this.validKey);for(const s of this)e.has(s)||i.add(s);return i}union(e){const i=this.clone();return i.addAll(e),i}clone(){const e=new zr(this.compare,this.validKey);return e.size=this.size,e.root=this.copyNode(this.root),e}copyNode(e){if(e==null)return null;function i(o,l){let h,c;do{if(h=o.left,c=o.right,h!=null){const g=new xr(h.key);l.left=g,i(h,g)}if(c!=null){const g=new xr(c.key);l.right=g,o=c,l=g}}while(c!=null)}const s=new xr(e.key);return i(e,s),s}toSet(){return this.clone()}entries(){return new Ad(this.wrap())}keys(){return this[Symbol.iterator]()}values(){return this[Symbol.iterator]()}[Symbol.iterator](){return new Rd(this.wrap())}[Symbol.toStringTag]="[object Set]"},zu=class{tree;path=new Array;modificationCount=null;splayCount;constructor(t){this.tree=t,this.splayCount=t.getSplayCount()}[Symbol.iterator](){return this}next(){return this.moveNext()?{done:!1,value:this.current()}:{done:!0,value:null}}current(){if(!this.path.length)return null;const t=this.path[this.path.length-1];return this.getValue(t)}rebuildPath(t){this.path.splice(0,this.path.length),this.tree.splay(t),this.path.push(this.tree.getRoot()),this.splayCount=this.tree.getSplayCount()}findLeftMostDescendent(t){for(;t!=null;)this.path.push(t),t=t.left}moveNext(){if(this.modificationCount!=this.tree.getModificationCount()){if(this.modificationCount==null){this.modificationCount=this.tree.getModificationCount();let i=this.tree.getRoot();for(;i!=null;)this.path.push(i),i=i.left;return this.path.length>0}throw"Concurrent modification during iteration."}if(!this.path.length)return!1;this.splayCount!=this.tree.getSplayCount()&&this.rebuildPath(this.path[this.path.length-1].key);let t=this.path[this.path.length-1],e=t.right;if(e!=null){for(;e!=null;)this.path.push(e),e=e.left;return!0}for(this.path.pop();this.path.length&&this.path[this.path.length-1].right===t;)t=this.path.pop();return this.path.length>0}},Rd=class extends zu{getValue(t){return t.key}},Ad=class extends zu{getValue(t){return[t.key,t.key]}},Xu=t=>()=>t,Ks=t=>{const e=t?(i,s)=>s.minus(i).abs().isLessThanOrEqualTo(t):Xu(!1);return(i,s)=>e(i,s)?0:i.comparedTo(s)};function Dd(t){const e=t?(i,s,o,l,h)=>i.exponentiatedBy(2).isLessThanOrEqualTo(l.minus(s).exponentiatedBy(2).plus(h.minus(o).exponentiatedBy(2)).times(t)):Xu(!1);return(i,s,o)=>{const l=i.x,h=i.y,c=o.x,g=o.y,d=h.minus(g).times(s.x.minus(c)).minus(l.minus(c).times(s.y.minus(g)));return e(d,l,h,c,g)?0:d.comparedTo(0)}}var Fd=t=>t,qd=t=>{if(t){const e=new Ei(Ks(t)),i=new Ei(Ks(t)),s=(l,h)=>h.addAndReturn(l),o=l=>({x:s(l.x,e),y:s(l.y,i)});return o({x:new Ft(0),y:new Ft(0)}),o}return Fd},Js=t=>({set:e=>{Kt=Js(e)},reset:()=>Js(t),compare:Ks(t),snap:qd(t),orient:Dd(t)}),Kt=Js(),Er=(t,e)=>t.ll.x.isLessThanOrEqualTo(e.x)&&e.x.isLessThanOrEqualTo(t.ur.x)&&t.ll.y.isLessThanOrEqualTo(e.y)&&e.y.isLessThanOrEqualTo(t.ur.y),Qs=(t,e)=>{if(e.ur.x.isLessThan(t.ll.x)||t.ur.x.isLessThan(e.ll.x)||e.ur.y.isLessThan(t.ll.y)||t.ur.y.isLessThan(e.ll.y))return null;const i=t.ll.x.isLessThan(e.ll.x)?e.ll.x:t.ll.x,s=t.ur.x.isLessThan(e.ur.x)?t.ur.x:e.ur.x,o=t.ll.y.isLessThan(e.ll.y)?e.ll.y:t.ll.y,l=t.ur.y.isLessThan(e.ur.y)?t.ur.y:e.ur.y;return{ll:{x:i,y:o},ur:{x:s,y:l}}},wi=(t,e)=>t.x.times(e.y).minus(t.y.times(e.x)),Uu=(t,e)=>t.x.times(e.x).plus(t.y.times(e.y)),ki=t=>Uu(t,t).sqrt(),Bd=(t,e,i)=>{const s={x:e.x.minus(t.x),y:e.y.minus(t.y)},o={x:i.x.minus(t.x),y:i.y.minus(t.y)};return wi(o,s).div(ki(o)).div(ki(s))},Gd=(t,e,i)=>{const s={x:e.x.minus(t.x),y:e.y.minus(t.y)},o={x:i.x.minus(t.x),y:i.y.minus(t.y)};return Uu(o,s).div(ki(o)).div(ki(s))},Vu=(t,e,i)=>e.y.isZero()?null:{x:t.x.plus(e.x.div(e.y).times(i.minus(t.y))),y:i},Hu=(t,e,i)=>e.x.isZero()?null:{x:i,y:t.y.plus(e.y.div(e.x).times(i.minus(t.x)))},Yd=(t,e,i,s)=>{if(e.x.isZero())return Hu(i,s,t.x);if(s.x.isZero())return Hu(t,e,i.x);if(e.y.isZero())return Vu(i,s,t.y);if(s.y.isZero())return Vu(t,e,i.y);const o=wi(e,s);if(o.isZero())return null;const l={x:i.x.minus(t.x),y:i.y.minus(t.y)},h=wi(l,e).div(o),c=wi(l,s).div(o),g=t.x.plus(c.times(e.x)),d=i.x.plus(h.times(s.x)),y=t.y.plus(c.times(e.y)),v=i.y.plus(h.times(s.y)),_=g.plus(d).div(2),E=y.plus(v).div(2);return{x:_,y:E}},qt=class ch{point;isLeft;segment;otherSE;consumedBy;static compare(e,i){const s=ch.comparePoints(e.point,i.point);return s!==0?s:(e.point!==i.point&&e.link(i),e.isLeft!==i.isLeft?e.isLeft?1:-1:Ii.compare(e.segment,i.segment))}static comparePoints(e,i){return e.x.isLessThan(i.x)?-1:e.x.isGreaterThan(i.x)?1:e.y.isLessThan(i.y)?-1:e.y.isGreaterThan(i.y)?1:0}constructor(e,i){e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=i}link(e){if(e.point===this.point)throw new Error("Tried to link already linked events");const i=e.point.events;for(let s=0,o=i.length;s<o;s++){const l=i[s];this.point.events.push(l),l.point=this.point}this.checkForConsuming()}checkForConsuming(){const e=this.point.events.length;for(let i=0;i<e;i++){const s=this.point.events[i];if(s.segment.consumedBy===void 0)for(let o=i+1;o<e;o++){const l=this.point.events[o];l.consumedBy===void 0&&s.otherSE.point.events===l.otherSE.point.events&&s.segment.consume(l.segment)}}}getAvailableLinkedEvents(){const e=[];for(let i=0,s=this.point.events.length;i<s;i++){const o=this.point.events[i];o!==this&&!o.segment.ringOut&&o.segment.isInResult()&&e.push(o)}return e}getLeftmostComparator(e){const i=new Map,s=o=>{const l=o.otherSE;i.set(o,{sine:Bd(this.point,e.point,l.point),cosine:Gd(this.point,e.point,l.point)})};return(o,l)=>{i.has(o)||s(o),i.has(l)||s(l);const{sine:h,cosine:c}=i.get(o),{sine:g,cosine:d}=i.get(l);return h.isGreaterThanOrEqualTo(0)&&g.isGreaterThanOrEqualTo(0)?c.isLessThan(d)?1:c.isGreaterThan(d)?-1:0:h.isLessThan(0)&&g.isLessThan(0)?c.isLessThan(d)?-1:c.isGreaterThan(d)?1:0:g.isLessThan(h)?-1:g.isGreaterThan(h)?1:0}}},zd=class Fo{events;poly;_isExteriorRing;_enclosingRing;static factory(e){const i=[];for(let s=0,o=e.length;s<o;s++){const l=e[s];if(!l.isInResult()||l.ringOut)continue;let h=null,c=l.leftSE,g=l.rightSE;const d=[c],y=c.point,v=[];for(;h=c,c=g,d.push(c),c.point!==y;)for(;;){const _=c.getAvailableLinkedEvents();if(_.length===0){const R=d[0].point,Y=d[d.length-1].point;throw new Error(`Unable to complete output ring starting at [${R.x}, ${R.y}]. Last matching segment found ends at [${Y.x}, ${Y.y}].`)}if(_.length===1){g=_[0].otherSE;break}let E=null;for(let R=0,Y=v.length;R<Y;R++)if(v[R].point===c.point){E=R;break}if(E!==null){const R=v.splice(E)[0],Y=d.splice(R.index);Y.unshift(Y[0].otherSE),i.push(new Fo(Y.reverse()));continue}v.push({index:d.length,point:c.point});const M=c.getLeftmostComparator(h);g=_.sort(M)[0].otherSE;break}i.push(new Fo(d))}return i}constructor(e){this.events=e;for(let i=0,s=e.length;i<s;i++)e[i].segment.ringOut=this;this.poly=null}getGeom(){let e=this.events[0].point;const i=[e];for(let d=1,y=this.events.length-1;d<y;d++){const v=this.events[d].point,_=this.events[d+1].point;Kt.orient(v,e,_)!==0&&(i.push(v),e=v)}if(i.length===1)return null;const s=i[0],o=i[1];Kt.orient(s,e,o)===0&&i.shift(),i.push(i[0]);const l=this.isExteriorRing()?1:-1,h=this.isExteriorRing()?0:i.length-1,c=this.isExteriorRing()?i.length:-1,g=[];for(let d=h;d!=c;d+=l)g.push([i[d].x.toNumber(),i[d].y.toNumber()]);return g}isExteriorRing(){if(this._isExteriorRing===void 0){const e=this.enclosingRing();this._isExteriorRing=e?!e.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let e=this.events[0];for(let o=1,l=this.events.length;o<l;o++){const h=this.events[o];qt.compare(e,h)>0&&(e=h)}let i=e.segment.prevInResult(),s=i?i.prevInResult():null;for(;;){if(!i)return null;if(!s)return i.ringOut;if(s.ringOut!==i.ringOut)return s.ringOut?.enclosingRing()!==i.ringOut?i.ringOut:i.ringOut?.enclosingRing();i=s.prevInResult(),s=i?i.prevInResult():null}}},$u=class{exteriorRing;interiorRings;constructor(t){this.exteriorRing=t,t.poly=this,this.interiorRings=[]}addInterior(t){this.interiorRings.push(t),t.poly=this}getGeom(){const t=this.exteriorRing.getGeom();if(t===null)return null;const e=[t];for(let i=0,s=this.interiorRings.length;i<s;i++){const o=this.interiorRings[i].getGeom();o!==null&&e.push(o)}return e}},Xd=class{rings;polys;constructor(t){this.rings=t,this.polys=this._composePolys(t)}getGeom(){const t=[];for(let e=0,i=this.polys.length;e<i;e++){const s=this.polys[e].getGeom();s!==null&&t.push(s)}return t}_composePolys(t){const e=[];for(let i=0,s=t.length;i<s;i++){const o=t[i];if(!o.poly)if(o.isExteriorRing())e.push(new $u(o));else{const l=o.enclosingRing();l?.poly||e.push(new $u(l)),l?.poly?.addInterior(o)}}return e}},Ud=class{queue;tree;segments;constructor(t,e=Ii.compare){this.queue=t,this.tree=new Ei(e),this.segments=[]}process(t){const e=t.segment,i=[];if(t.consumedBy)return t.isLeft?this.queue.delete(t.otherSE):this.tree.delete(e),i;t.isLeft&&this.tree.add(e);let s=e,o=e;do s=this.tree.lastBefore(s);while(s!=null&&s.consumedBy!=null);do o=this.tree.firstAfter(o);while(o!=null&&o.consumedBy!=null);if(t.isLeft){let l=null;if(s){const c=s.getIntersection(e);if(c!==null&&(e.isAnEndpoint(c)||(l=c),!s.isAnEndpoint(c))){const g=this._splitSafely(s,c);for(let d=0,y=g.length;d<y;d++)i.push(g[d])}}let h=null;if(o){const c=o.getIntersection(e);if(c!==null&&(e.isAnEndpoint(c)||(h=c),!o.isAnEndpoint(c))){const g=this._splitSafely(o,c);for(let d=0,y=g.length;d<y;d++)i.push(g[d])}}if(l!==null||h!==null){let c=null;l===null?c=h:h===null?c=l:c=qt.comparePoints(l,h)<=0?l:h,this.queue.delete(e.rightSE),i.push(e.rightSE);const g=e.split(c);for(let d=0,y=g.length;d<y;d++)i.push(g[d])}i.length>0?(this.tree.delete(e),i.push(t)):(this.segments.push(e),e.prev=s)}else{if(s&&o){const l=s.getIntersection(o);if(l!==null){if(!s.isAnEndpoint(l)){const h=this._splitSafely(s,l);for(let c=0,g=h.length;c<g;c++)i.push(h[c])}if(!o.isAnEndpoint(l)){const h=this._splitSafely(o,l);for(let c=0,g=h.length;c<g;c++)i.push(h[c])}}}this.tree.delete(e)}return i}_splitSafely(t,e){this.tree.delete(t);const i=t.rightSE;this.queue.delete(i);const s=t.split(e);return s.push(i),t.consumedBy===void 0&&this.tree.add(t),s}},Vd=class{type;numMultiPolys;run(t,e,i){wr.type=t;const s=[new Wu(e,!0)];for(let d=0,y=i.length;d<y;d++)s.push(new Wu(i[d],!1));if(wr.numMultiPolys=s.length,wr.type==="difference"){const d=s[0];let y=1;for(;y<s.length;)Qs(s[y].bbox,d.bbox)!==null?y++:s.splice(y,1)}if(wr.type==="intersection")for(let d=0,y=s.length;d<y;d++){const v=s[d];for(let _=d+1,E=s.length;_<E;_++)if(Qs(v.bbox,s[_].bbox)===null)return[]}const o=new Ei(qt.compare);for(let d=0,y=s.length;d<y;d++){const v=s[d].getSweepEvents();for(let _=0,E=v.length;_<E;_++)o.add(v[_])}const l=new Ud(o);let h=null;for(o.size!=0&&(h=o.first(),o.delete(h));h;){const d=l.process(h);for(let y=0,v=d.length;y<v;y++){const _=d[y];_.consumedBy===void 0&&o.add(_)}o.size!=0?(h=o.first(),o.delete(h)):h=null}Kt.reset();const c=zd.factory(l.segments);return new Xd(c).getGeom()}},wr=new Vd,qn=wr,Hd=0,Ii=class ji{id;leftSE;rightSE;rings;windings;ringOut;consumedBy;prev;_prevInResult;_beforeState;_afterState;_isInResult;static compare(e,i){const s=e.leftSE.point.x,o=i.leftSE.point.x,l=e.rightSE.point.x,h=i.rightSE.point.x;if(h.isLessThan(s))return 1;if(l.isLessThan(o))return-1;const c=e.leftSE.point.y,g=i.leftSE.point.y,d=e.rightSE.point.y,y=i.rightSE.point.y;if(s.isLessThan(o)){if(g.isLessThan(c)&&g.isLessThan(d))return 1;if(g.isGreaterThan(c)&&g.isGreaterThan(d))return-1;const v=e.comparePoint(i.leftSE.point);if(v<0)return 1;if(v>0)return-1;const _=i.comparePoint(e.rightSE.point);return _!==0?_:-1}if(s.isGreaterThan(o)){if(c.isLessThan(g)&&c.isLessThan(y))return-1;if(c.isGreaterThan(g)&&c.isGreaterThan(y))return 1;const v=i.comparePoint(e.leftSE.point);if(v!==0)return v;const _=e.comparePoint(i.rightSE.point);return _<0?1:_>0?-1:1}if(c.isLessThan(g))return-1;if(c.isGreaterThan(g))return 1;if(l.isLessThan(h)){const v=i.comparePoint(e.rightSE.point);if(v!==0)return v}if(l.isGreaterThan(h)){const v=e.comparePoint(i.rightSE.point);if(v<0)return 1;if(v>0)return-1}if(!l.eq(h)){const v=d.minus(c),_=l.minus(s),E=y.minus(g),M=h.minus(o);if(v.isGreaterThan(_)&&E.isLessThan(M))return 1;if(v.isLessThan(_)&&E.isGreaterThan(M))return-1}return l.isGreaterThan(h)?1:l.isLessThan(h)||d.isLessThan(y)?-1:d.isGreaterThan(y)?1:e.id<i.id?-1:e.id>i.id?1:0}constructor(e,i,s,o){this.id=++Hd,this.leftSE=e,e.segment=this,e.otherSE=i,this.rightSE=i,i.segment=this,i.otherSE=e,this.rings=s,this.windings=o}static fromRing(e,i,s){let o,l,h;const c=qt.comparePoints(e,i);if(c<0)o=e,l=i,h=1;else if(c>0)o=i,l=e,h=-1;else throw new Error(`Tried to create degenerate segment at [${e.x}, ${e.y}]`);const g=new qt(o,!0),d=new qt(l,!1);return new ji(g,d,[s],[h])}replaceRightSE(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const e=this.leftSE.point.y,i=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:e.isLessThan(i)?e:i},ur:{x:this.rightSE.point.x,y:e.isGreaterThan(i)?e:i}}}vector(){return{x:this.rightSE.point.x.minus(this.leftSE.point.x),y:this.rightSE.point.y.minus(this.leftSE.point.y)}}isAnEndpoint(e){return e.x.eq(this.leftSE.point.x)&&e.y.eq(this.leftSE.point.y)||e.x.eq(this.rightSE.point.x)&&e.y.eq(this.rightSE.point.y)}comparePoint(e){return Kt.orient(this.leftSE.point,e,this.rightSE.point)}getIntersection(e){const i=this.bbox(),s=e.bbox(),o=Qs(i,s);if(o===null)return null;const l=this.leftSE.point,h=this.rightSE.point,c=e.leftSE.point,g=e.rightSE.point,d=Er(i,c)&&this.comparePoint(c)===0,y=Er(s,l)&&e.comparePoint(l)===0,v=Er(i,g)&&this.comparePoint(g)===0,_=Er(s,h)&&e.comparePoint(h)===0;if(y&&d)return _&&!v?h:!_&&v?g:null;if(y)return v&&l.x.eq(g.x)&&l.y.eq(g.y)?null:l;if(d)return _&&h.x.eq(c.x)&&h.y.eq(c.y)?null:c;if(_&&v)return null;if(_)return h;if(v)return g;const E=Yd(l,this.vector(),c,e.vector());return E===null||!Er(o,E)?null:Kt.snap(E)}split(e){const i=[],s=e.events!==void 0,o=new qt(e,!0),l=new qt(e,!1),h=this.rightSE;this.replaceRightSE(l),i.push(l),i.push(o);const c=new ji(o,h,this.rings.slice(),this.windings.slice());return qt.comparePoints(c.leftSE.point,c.rightSE.point)>0&&c.swapEvents(),qt.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),s&&(o.checkForConsuming(),l.checkForConsuming()),i}swapEvents(){const e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let i=0,s=this.windings.length;i<s;i++)this.windings[i]*=-1}consume(e){let i=this,s=e;for(;i.consumedBy;)i=i.consumedBy;for(;s.consumedBy;)s=s.consumedBy;const o=ji.compare(i,s);if(o!==0){if(o>0){const l=i;i=s,s=l}if(i.prev===s){const l=i;i=s,s=l}for(let l=0,h=s.rings.length;l<h;l++){const c=s.rings[l],g=s.windings[l],d=i.rings.indexOf(c);d===-1?(i.rings.push(c),i.windings.push(g)):i.windings[d]+=g}s.rings=null,s.windings=null,s.consumedBy=i,s.leftSE.consumedBy=i.leftSE,s.rightSE.consumedBy=i.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{const e=this.prev.consumedBy||this.prev;this._beforeState=e.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;const e=this.beforeState();this._afterState={rings:e.rings.slice(0),windings:e.windings.slice(0),multiPolys:[]};const i=this._afterState.rings,s=this._afterState.windings,o=this._afterState.multiPolys;for(let c=0,g=this.rings.length;c<g;c++){const d=this.rings[c],y=this.windings[c],v=i.indexOf(d);v===-1?(i.push(d),s.push(y)):s[v]+=y}const l=[],h=[];for(let c=0,g=i.length;c<g;c++){if(s[c]===0)continue;const d=i[c],y=d.poly;if(h.indexOf(y)===-1)if(d.isExterior)l.push(y);else{h.indexOf(y)===-1&&h.push(y);const v=l.indexOf(d.poly);v!==-1&&l.splice(v,1)}}for(let c=0,g=l.length;c<g;c++){const d=l[c].multiPoly;o.indexOf(d)===-1&&o.push(d)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;const e=this.beforeState().multiPolys,i=this.afterState().multiPolys;switch(qn.type){case"union":{const s=e.length===0,o=i.length===0;this._isInResult=s!==o;break}case"intersection":{let s,o;e.length<i.length?(s=e.length,o=i.length):(s=i.length,o=e.length),this._isInResult=o===qn.numMultiPolys&&s<o;break}case"xor":{const s=Math.abs(e.length-i.length);this._isInResult=s%2===1;break}case"difference":{const s=o=>o.length===1&&o[0].isSubject;this._isInResult=s(e)!==s(i);break}}return this._isInResult}},Zu=class{poly;isExterior;segments;bbox;constructor(t,e,i){if(!Array.isArray(t)||t.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=e,this.isExterior=i,this.segments=[],typeof t[0][0]!="number"||typeof t[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const s=Kt.snap({x:new Ft(t[0][0]),y:new Ft(t[0][1])});this.bbox={ll:{x:s.x,y:s.y},ur:{x:s.x,y:s.y}};let o=s;for(let l=1,h=t.length;l<h;l++){if(typeof t[l][0]!="number"||typeof t[l][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const c=Kt.snap({x:new Ft(t[l][0]),y:new Ft(t[l][1])});c.x.eq(o.x)&&c.y.eq(o.y)||(this.segments.push(Ii.fromRing(o,c,this)),c.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=c.x),c.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=c.y),c.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=c.x),c.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=c.y),o=c)}(!s.x.eq(o.x)||!s.y.eq(o.y))&&this.segments.push(Ii.fromRing(o,s,this))}getSweepEvents(){const t=[];for(let e=0,i=this.segments.length;e<i;e++){const s=this.segments[e];t.push(s.leftSE),t.push(s.rightSE)}return t}},$d=class{multiPoly;exteriorRing;interiorRings;bbox;constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Zu(t[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let i=1,s=t.length;i<s;i++){const o=new Zu(t[i],this,!1);o.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=e}getSweepEvents(){const t=this.exteriorRing.getSweepEvents();for(let e=0,i=this.interiorRings.length;e<i;e++){const s=this.interiorRings[e].getSweepEvents();for(let o=0,l=s.length;o<l;o++)t.push(s[o])}return t}},Wu=class{isSubject;polys;bbox;constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof t[0][0][0]=="number"&&(t=[t])}catch{}this.polys=[],this.bbox={ll:{x:new Ft(Number.POSITIVE_INFINITY),y:new Ft(Number.POSITIVE_INFINITY)},ur:{x:new Ft(Number.NEGATIVE_INFINITY),y:new Ft(Number.NEGATIVE_INFINITY)}};for(let i=0,s=t.length;i<s;i++){const o=new $d(t[i],this);o.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=e}getSweepEvents(){const t=[];for(let e=0,i=this.polys.length;e<i;e++){const s=this.polys[e].getSweepEvents();for(let o=0,l=s.length;o<l;o++)t.push(s[o])}return t}},un=(t,...e)=>qn.run("union",t,e),Ku=(t,...e)=>qn.run("intersection",t,e),Zd=(t,...e)=>qn.run("xor",t,e),Ju=(t,...e)=>qn.run("difference",t,e),Wd=Kt.set;const Kd=Object.freeze(Object.defineProperty({__proto__:null,difference:Ju,intersection:Ku,setPrecision:Wd,union:un,xor:Zd},Symbol.toStringTag,{value:"Module"}));function Jd(t){const e=[];if(rt(t,o=>{e.push(o.coordinates)}),e.length<2)throw new Error("Must have at least two features");const i=t.features[0].properties||{},s=Ju(e[0],...e.slice(1));return s.length===0?null:s.length===1?ye(s[0],i):ft(s,i)}function js(t){if(!t)throw new Error("geojson is required");var e=[];return Qe(t,function(i){e.push(i)}),he(e)}function Qd(t,e={}){if(e=e||{},!Ce(e))throw new Error("options is invalid");const{propertyName:i}=e;Ut(t,"Polygon","dissolve");const s=[];if(i){const o={};Le(t,function(h){h.properties&&(Object.prototype.hasOwnProperty.call(o,h.properties[i])||(o[h.properties[i]]=[]),o[h.properties[i]].push(h))});const l=Object.keys(o);for(let h=0;h<l.length;h++){const c=ft(un.apply(null,o[l[h]].map(function(g){return g.geometry.coordinates})));c&&c.properties&&(c.properties[i]=l[h],s.push(c))}}else return js(ft(un.apply(null,t.features.map(function(o){return o.geometry.coordinates}))));return js(he(s))}function jd(t,e,i=2){const s=Te(t),o=Te(e),l=s[0]-o[0],h=s[1]-o[1];return i===1?Math.abs(l)+Math.abs(h):Math.pow(Math.pow(l,i)+Math.pow(h,i),1/i)}function Qu(t,e){var i,s;e=e||{};const o=e.threshold||1e4,l=e.p||2,h=(i=e.binary)!=null?i:!1,c=e.alpha||-1,g=(s=e.standardization)!=null?s:!1,d=[];Le(t,v=>{d.push(Zt(v))});const y=[];for(let v=0;v<d.length;v++)y[v]=[];for(let v=0;v<d.length;v++)for(let _=v;_<d.length;_++){v===_&&(y[v][_]=0);const E=jd(d[v],d[_],l);y[v][_]=E,y[_][v]=E}for(let v=0;v<d.length;v++)for(let _=0;_<d.length;_++){const E=y[v][_];E!==0&&(h?E<=o?y[v][_]=1:y[v][_]=0:E<=o?y[v][_]=Math.pow(E,c):y[v][_]=0)}if(g)for(let v=0;v<d.length;v++){const _=y[v].reduce((E,M)=>E+M,0);for(let E=0;E<d.length;E++)y[v][E]=y[v][E]/_}return y}function Bn(t,e,i={}){const s=Te(t),o=Te(e);o[0]+=o[0]-s[0]>180?-360:s[0]-o[0]>180?360:0;const l=ev(s,o);return fn(l,"meters",i.units)}function ev(t,e,i){i=i===void 0?Ke:Number(i);const s=i,o=t[1]*Math.PI/180,l=e[1]*Math.PI/180,h=l-o;let c=Math.abs(e[0]-t[0])*Math.PI/180;c>Math.PI&&(c-=2*Math.PI);const g=Math.log(Math.tan(l/2+Math.PI/4)/Math.tan(o/2+Math.PI/4)),d=Math.abs(g)>1e-11?h/g:Math.cos(o);return Math.sqrt(h*h+d*d*c*c)*s}function Ni(t,e,i,s={}){const o=e<0;let l=fn(Math.abs(e),s.units,"meters");o&&(l=-Math.abs(l));const h=Te(t),c=tv(h,l,i);return c[0]+=c[0]-h[0]>180?-360:h[0]-c[0]>180?360:0,_e(c,s.properties)}function tv(t,e,i,s){s=s===void 0?Ke:Number(s);const o=e/s,l=t[0]*Math.PI/180,h=Ze(t[1]),c=Ze(i),g=o*Math.cos(c);let d=h+g;Math.abs(d)>Math.PI/2&&(d=d>0?Math.PI-d:-Math.PI-d);const y=Math.log(Math.tan(d/2+Math.PI/4)/Math.tan(h/2+Math.PI/4)),v=Math.abs(y)>1e-11?g/y:Math.cos(h),_=o*Math.sin(c)/v;return[((l+_)*180/Math.PI+540)%360-180,d*180/Math.PI]}function ju(t,e,i){if(i=i||{},!Ce(i))throw new Error("options is invalid");const s=i.pivot,o=i.mutate;if(!t)throw new Error("geojson is required");if(e==null||isNaN(e))throw new Error("angle is required");if(e===0)return t;const l=s??Zt(t);return(o===!1||o===void 0)&&(t=je(t)),Xe(t,function(h){const g=gn(l,h)+e,d=Bn(l,h),y=ve(Ni(l,d,g));h[0]=y[0],h[1]=y[1]}),t}function el(t,e,i,s){s=s||{};let o=s.steps||64;const l=s.units||"kilometers";let h=s.angle||0;const c=s.pivot||t,g=s.properties||{};if(!t)throw new Error("center is required");if(!e)throw new Error("xSemiAxis is required");if(!i)throw new Error("ySemiAxis is required");if(!Ce(s))throw new Error("options must be an object");if(!Je(o))throw new Error("steps must be a number");if(!Je(h))throw new Error("angle must be a number");const d=Te(ju(_e(Te(t)),h,{pivot:c}));h=-90+h,o=Math.ceil(o/4);let y=[],v=[];const _=e,E=i,M=E,R=(_-E)/(Math.PI/2),Y=(_+E)*Math.PI/4,H=.5,x=o;let S=0,b=0;for(let A=0;A<o;A++)b+=S,R===0?S=Y/x/M:S=(-(R*b+M)+Math.sqrt(Math.pow(R*b+M,2)-4*(H*R)*-(Y/x)))/(2*(H*R)),b!=0&&y.push(b);v.push(0);for(let A=0;A<y.length;A++)v.push(y[A]);v.push(Math.PI/2);for(let A=0;A<y.length;A++)v.push(Math.PI-y[y.length-A-1]);v.push(Math.PI);for(let A=0;A<y.length;A++)v.push(Math.PI+y[A]);v.push(3*Math.PI/2);for(let A=0;A<y.length;A++)v.push(2*Math.PI-y[y.length-A-1]);v.push(0);const C=[];for(const A of v){const q=Math.atan2(E*Math.sin(A),_*Math.cos(A)),w=Math.sqrt(Math.pow(_,2)*Math.pow(E,2)/(Math.pow(_*Math.sin(q),2)+Math.pow(E*Math.cos(q),2)));C.push(rn(d,w,h+Ot(q),{units:l}).geometry.coordinates)}return ye([C],g)}function tl(t){return sr(Fe(t))}function Mi(t){const e=[];return t.type==="FeatureCollection"?Le(t,function(i){Xe(i,function(s){e.push(_e(s,i.properties))})}):t.type==="Feature"?Xe(t,function(i){e.push(_e(i,t.properties))}):Xe(t,function(i){e.push(_e(i))}),he(e)}function nv(t,e){var i;if(e=e||{},!Ce(e))throw new Error("options is invalid");const s=(i=e.mutate)!=null?i:!1;if(!t)throw new Error("geojson is required");return(s===!1||s===void 0)&&(t=je(t)),Xe(t,function(o){var l=o[0],h=o[1];o[0]=h,o[1]=l}),t}var nl=Math.PI/180,rl=180/Math.PI,kr=function(t,e){this.lon=t,this.lat=e,this.x=nl*t,this.y=nl*e};kr.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)},kr.prototype.antipode=function(){var t=-1*this.lat,e=this.lon<0?180+this.lon:(180-this.lon)*-1;return new kr(e,t)};var il=function(){this.coords=[],this.length=0};il.prototype.move_to=function(t){this.length++,this.coords.push(t)};var eo=function(t){this.properties=t||{},this.geometries=[]};eo.prototype.json=function(){if(this.geometries.length<=0)return{geometry:{type:"LineString",coordinates:null},type:"Feature",properties:this.properties};if(this.geometries.length===1)return{geometry:{type:"LineString",coordinates:this.geometries[0].coords},type:"Feature",properties:this.properties};for(var t=[],e=0;e<this.geometries.length;e++)t.push(this.geometries[e].coords);return{geometry:{type:"MultiLineString",coordinates:t},type:"Feature",properties:this.properties}},eo.prototype.wkt=function(){for(var t="",e="LINESTRING(",i=function(l){e+=l[0]+" "+l[1]+","},s=0;s<this.geometries.length;s++){if(this.geometries[s].coords.length===0)return"LINESTRING(empty)";var o=this.geometries[s].coords;o.forEach(i),t+=e.substring(0,e.length-1)+")"}return t};var to=function(t,e,i){if(!t||t.x===void 0||t.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");if(!e||e.x===void 0||e.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");this.start=new kr(t.x,t.y),this.end=new kr(e.x,e.y),this.properties=i||{};var s=this.start.x-this.end.x,o=this.start.y-this.end.y,l=Math.pow(Math.sin(o/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(s/2),2);if(this.g=2*Math.asin(Math.sqrt(l)),this.g===Math.PI)throw new Error("it appears "+this.start.view()+" and "+this.end.view()+" are 'antipodal', e.g diametrically opposite, thus there is no single route but rather infinite");if(isNaN(this.g))throw new Error("could not calculate great circle between "+t+" and "+e)};to.prototype.interpolate=function(t){var e=Math.sin((1-t)*this.g)/Math.sin(this.g),i=Math.sin(t*this.g)/Math.sin(this.g),s=e*Math.cos(this.start.y)*Math.cos(this.start.x)+i*Math.cos(this.end.y)*Math.cos(this.end.x),o=e*Math.cos(this.start.y)*Math.sin(this.start.x)+i*Math.cos(this.end.y)*Math.sin(this.end.x),l=e*Math.sin(this.start.y)+i*Math.sin(this.end.y),h=rl*Math.atan2(l,Math.sqrt(Math.pow(s,2)+Math.pow(o,2))),c=rl*Math.atan2(o,s);return[c,h]},to.prototype.Arc=function(t,e){var i=[];if(!t||t<=2)i.push([this.start.lon,this.start.lat]),i.push([this.end.lon,this.end.lat]);else for(var s=1/(t-1),o=0;o<t;++o){var l=s*o,h=this.interpolate(l);i.push(h)}for(var c=!1,g=0,d=e&&e.offset?e.offset:10,y=180-d,v=-180+d,_=360-d,E=1;E<i.length;++E){var M=i[E-1][0],R=i[E][0],Y=Math.abs(R-M);Y>_&&(R>y&&M<v||M>y&&R<v)?c=!0:Y>g&&(g=Y)}var H=[];if(c&&g<d){var x=[];H.push(x);for(var S=0;S<i.length;++S){var b=parseFloat(i[S][0]);if(S>0&&Math.abs(b-i[S-1][0])>_){var C=parseFloat(i[S-1][0]),A=parseFloat(i[S-1][1]),q=parseFloat(i[S][0]),w=parseFloat(i[S][1]);if(C>-180&&C<v&&q===180&&S+1<i.length&&i[S-1][0]>-180&&i[S-1][0]<v){x.push([-180,i[S][1]]),S++,x.push([i[S][0],i[S][1]]);continue}else if(C>y&&C<180&&q===-180&&S+1<i.length&&i[S-1][0]>y&&i[S-1][0]<180){x.push([180,i[S][1]]),S++,x.push([i[S][0],i[S][1]]);continue}if(C<v&&q>y){var N=C;C=q,q=N;var L=A;A=w,w=L}if(C>y&&q<v&&(q+=360),C<=180&&q>=180&&C<q){var D=(180-C)/(q-C),F=D*w+(1-D)*A;x.push([i[S-1][0]>y?180:-180,F]),x=[],x.push([i[S-1][0]>y?-180:180,F]),H.push(x)}else x=[],H.push(x);x.push([b,i[S][1]])}else x.push([i[S][0],i[S][1]])}}else{var X=[];H.push(X);for(var z=0;z<i.length;++z)X.push([i[z][0],i[z][1]])}for(var V=new eo(this.properties),k=0;k<H.length;++k){var T=new il;V.geometries.push(T);for(var P=H[k],G=0;G<P.length;++G)T.move_to(P[G])}return V};function rv(t,e,i){if(i=i||{},typeof i!="object")throw new Error("options is invalid");var s=i.properties,o=i.npoints,l=i.offset;if(t=Te(t),e=Te(e),s=s||{},o=o||100,t[0]===e[0]&&t[1]===e[1]){const g=Array(o);return g.fill([t[0],t[1]]),Pe(g,s)}l=l||10;var h=new to({x:t[0],y:t[1]},{x:e[0],y:e[1]},s),c=h.Arc(o,{offset:l});return c.json()}function Ir(t,e={}){const i=[];if(rt(t,o=>{i.push(o.coordinates)}),i.length<2)throw new Error("Must specify at least 2 geometries");const s=Ku(i[0],...i.slice(1));return s.length===0?null:s.length===1?ye(s[0],e.properties):ft(s,e.properties)}function sl(t,e,i={}){const s=JSON.stringify(i.properties||{}),[o,l,h,c]=t,g=(l+c)/2,d=(o+h)/2,v=e*2/Be([o,g],[h,g],i)*(h-o),E=e*2/Be([d,l],[d,c],i)*(c-l),M=v/2,R=M*2,Y=Math.sqrt(3)/2*E,H=h-o,x=c-l,S=3/4*R,b=Y,C=(H-R)/(R-M/2),A=Math.floor(C),q=(A*S-M/2-H)/2-M/2+S/2,w=Math.floor((x-Y)/Y);let N=(x-w*Y)/2;const L=w*Y-x>Y/2;L&&(N-=Y/4);const D=[],F=[];for(let z=0;z<6;z++){const V=2*Math.PI/6*z;D.push(Math.cos(V)),F.push(Math.sin(V))}const X=[];for(let z=0;z<=A;z++)for(let V=0;V<=w;V++){const k=z%2===1;if(V===0&&k||V===0&&L)continue;const T=z*S+o-q;let P=V*b+l+N;if(k&&(P-=Y/2),i.triangles===!0)sv([T,P],v/2,E/2,JSON.parse(s),D,F).forEach(function(G){i.mask?Ir(he([i.mask,G]))&&X.push(G):X.push(G)});else{const G=iv([T,P],v/2,E/2,JSON.parse(s),D,F);i.mask?Ir(he([i.mask,G]))&&X.push(G):X.push(G)}}return he(X)}function iv(t,e,i,s,o,l){const h=[];for(let c=0;c<6;c++){const g=t[0]+e*o[c],d=t[1]+i*l[c];h.push([g,d])}return h.push(h[0].slice()),ye([h],s)}function sv(t,e,i,s,o,l){const h=[];for(let c=0;c<6;c++){const g=[];g.push(t),g.push([t[0]+e*o[c],t[1]+i*l[c]]),g.push([t[0]+e*o[(c+1)%6],t[1]+i*l[(c+1)%6]]),g.push(t),h.push(ye([g],s))}return h}function ol(t,e,i={}){i.mask&&!i.units&&(i.units="kilometers");for(var s=[],o=t[0],l=t[1],h=t[2],c=t[3],g=e/Be([o,l],[h,l],i),d=g*(h-o),y=e/Be([o,l],[o,c],i),v=y*(c-l),_=h-o,E=c-l,M=Math.floor(_/d),R=Math.floor(E/v),Y=(_-M*d)/2,H=(E-R*v)/2,x=o+Y;x<=h;){for(var S=l+H;S<=c;){var b=_e([x,S],i.properties);i.mask?Aa(b,i.mask)&&s.push(b):s.push(b),S+=v}x+=d}return he(s)}function al(t,e,i,s={}){const o=[],l=t[0],h=t[1],c=t[2],g=t[3],d=c-l,y=fn(e,s.units,"degrees"),v=g-h,_=fn(i,s.units,"degrees"),E=Math.floor(Math.abs(d)/y),M=Math.floor(Math.abs(v)/_),R=(d-E*y)/2,Y=(v-M*_)/2;let H=l+R;for(let x=0;x<E;x++){let S=h+Y;for(let b=0;b<M;b++){const C=ye([[[H,S],[H,S+_],[H+y,S+_],[H+y,S],[H,S]]],s.properties);s.mask?Ea(s.mask,C)&&o.push(C):o.push(C),S+=_}H+=y}return he(o)}function no(t,e,i={}){return al(t,e,e,i)}function ul(t,e,i={}){for(var s=[],o=e/Be([t[0],t[1]],[t[2],t[1]],i),l=o*(t[2]-t[0]),h=e/Be([t[0],t[1]],[t[0],t[3]],i),c=h*(t[3]-t[1]),g=0,d=t[0];d<=t[2];){for(var y=0,v=t[1];v<=t[3];){var _=null,E=null;g%2===0&&y%2===0?(_=ye([[[d,v],[d,v+c],[d+l,v],[d,v]]],i.properties),E=ye([[[d,v+c],[d+l,v+c],[d+l,v],[d,v+c]]],i.properties)):g%2===0&&y%2===1?(_=ye([[[d,v],[d+l,v+c],[d+l,v],[d,v]]],i.properties),E=ye([[[d,v],[d,v+c],[d+l,v+c],[d,v]]],i.properties)):y%2===0&&g%2===1?(_=ye([[[d,v],[d,v+c],[d+l,v+c],[d,v]]],i.properties),E=ye([[[d,v],[d+l,v+c],[d+l,v],[d,v]]],i.properties)):y%2===1&&g%2===1&&(_=ye([[[d,v],[d,v+c],[d+l,v],[d,v]]],i.properties),E=ye([[[d,v+c],[d+l,v+c],[d+l,v],[d,v+c]]],i.properties)),i.mask?(Ir(he([i.mask,_]))&&s.push(_),Ir(he([i.mask,E]))&&s.push(E)):(s.push(_),s.push(E)),v+=c,y++}g++,d+=l}return he(s)}function ov(t,e,i){if(i=i||{},typeof i!="object")throw new Error("options is invalid");var s=i.gridType,o=i.property,l=i.weight,h=i.bbox;if(!t)throw new Error("points is required");if(Ut(t,"Point","input must contain Points"),!e)throw new Error("cellSize is required");if(l!==void 0&&typeof l!="number")throw new Error("weight must be a number");o=o||"elevation",s=s||"square",l=l||1,h=h??Fe(t),tr(h);var c;switch(s){case"point":case"points":c=ol(h,e,i);break;case"square":case"squares":c=no(h,e,i);break;case"hex":case"hexes":c=sl(h,e,i);break;case"triangle":case"triangles":c=ul(h,e,i);break;default:throw new Error("invalid gridType")}var g=[];return Le(c,function(d){var y=0,v=0;Le(t,function(E){var M=s==="point"?d:Zt(d),R=Be(M,E,i),Y;if(o!==void 0&&(Y=E.properties[o]),Y===void 0&&(Y=E.geometry.coordinates[2]),Y===void 0)throw new Error("zValue is missing");R===0&&(y=Y);var H=1/Math.pow(R,l);v+=H,y+=H*Y});var _=je(d);_.properties[o]=y/v,g.push(_)}),he(g)}var av=Object.defineProperty,ll=Object.getOwnPropertySymbols,uv=Object.prototype.hasOwnProperty,lv=Object.prototype.propertyIsEnumerable,cl=(t,e,i)=>e in t?av(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,hl=(t,e)=>{for(var i in e||(e={}))uv.call(e,i)&&cl(t,i,e[i]);if(ll)for(var i of ll(e))lv.call(e,i)&&cl(t,i,e[i]);return t};function cv(t,e){if(e=e||{},!Ce(e))throw new Error("options is invalid");var i=e.zProperty||"elevation",s=e.flip,o=e.flags;Ut(t,"Point","input must contain Points");for(var l=hv(t,s),h=[],c=0;c<l.length;c++){for(var g=l[c],d=[],y=0;y<g.length;y++){var v=g[y];v.properties[i]?d.push(v.properties[i]):d.push(0),o===!0&&(v.properties.matrixPosition=[c,y])}h.push(d)}return h}function hv(t,e){var i={};Le(t,function(l){var h=ve(l)[1];i[h]||(i[h]=[]),i[h].push(l)});var s=Object.keys(i).map(function(l){var h=i[l],c=h.sort(function(g,d){return ve(g)[0]-ve(d)[0]});return c}),o=s.sort(function(l,h){return e?ve(l[0])[1]-ve(h[0])[1]:ve(h[0])[1]-ve(l[0])[1]});return o}function fv(t,e,i){if(i=i||{},!Ce(i))throw new Error("options is invalid");const s=i.zProperty||"elevation",o=i.commonProperties||{},l=i.breaksProperties||[];if(Ut(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(!Ce(o))throw new Error("commonProperties is not an Object");if(!Array.isArray(l))throw new Error("breaksProperties is not an Array");const h=cv(t,{zProperty:s,flip:!0}),c=h[0].length;if(h.length<2||c<2)throw new Error("Matrix of points must be at least 2x2");for(let y=1;y<h.length;y++)if(h[y].length!==c)throw new Error("Matrix of points is not uniform in the x dimension");let g=gv(h,e,s);g=vv(g,h,t);const d=g.map((y,v)=>{if(l[v]&&!Ce(l[v]))throw new Error("Each mappedProperty is required to be an Object");const _=hl(hl({},o),l[v]);return _[s]=y[s],ft(y.groupedRings,_)});return he(d)}function gv(t,e,i){const s=[];let o;for(let l=1;l<e.length;l++){l===1&&(o=fl(t,+e[0]));const h=+e[l],c=+e[l-1],g=fl(t,h),d=g.map(E=>E.map(M=>[M[0],M[1]]).reverse()),y=dv(o.concat(d),t),v=yv(y),_=mv(v);if(_.length===0&&t[0][0]<h&&t[0][0]>=c){const E=t[0].length,M=t.length;_.push([[[0,0],[E-1,0],[E-1,M-1],[0,M-1],[0,0]]])}s.push({groupedRings:_,[i]:c+"-"+h}),o=g}return s}function fl(t,e){const i=[],s=t[0].length,o=t.length;for(let h=0;h<o-1;h++)for(let c=0;c<s-1;c++){const g=t[h+1][c+1],d=t[h][c+1],y=t[h][c],v=t[h+1][c];switch((v>=e?8:0)|(g>=e?4:0)|(d>=e?2:0)|(y>=e?1:0)){case 0:continue;case 1:i.push([[c+l(y,d),h],[c,h+l(y,v)]]);break;case 2:i.push([[c+1,h+l(d,g)],[c+l(y,d),h]]);break;case 3:i.push([[c+1,h+l(d,g)],[c,h+l(y,v)]]);break;case 4:i.push([[c+l(v,g),h+1],[c+1,h+l(d,g)]]);break;case 5:{(v+g+d+y)/4>=e?i.push([[c+l(v,g),h+1],[c,h+l(y,v)]],[[c+l(y,d),h],[c+1,h+l(d,g)]]):i.push([[c+l(v,g),h+1],[c+1,h+l(d,g)]],[[c+l(y,d),h],[c,h+l(y,v)]]);break}case 6:i.push([[c+l(v,g),h+1],[c+l(y,d),h]]);break;case 7:i.push([[c+l(v,g),h+1],[c,h+l(y,v)]]);break;case 8:i.push([[c,h+l(y,v)],[c+l(v,g),h+1]]);break;case 9:i.push([[c+l(y,d),h],[c+l(v,g),h+1]]);break;case 10:{(v+g+d+y)/4>=e?i.push([[c,h+l(y,v)],[c+l(y,d),h]],[[c+1,h+l(d,g)],[c+l(v,g),h+1]]):i.push([[c,h+l(y,v)],[c+l(v,g),h+1]],[[c+1,h+l(d,g)],[c+l(y,d),h]]);break}case 11:i.push([[c+1,h+l(d,g)],[c+l(v,g),h+1]]);break;case 12:i.push([[c,h+l(y,v)],[c+1,h+l(d,g)]]);break;case 13:i.push([[c+l(y,d),h],[c+1,h+l(d,g)]]);break;case 14:i.push([[c,h+l(y,v)],[c+l(y,d),h]]);break;case 15:continue}}return i;function l(h,c){if(h===c)return .5;let g=(e-h)/(c-h);return g>1?1:g<0?0:g}}function dv(t,e){const i=e.length,s=e[0].length,o=[],l=[];for(;t.length>0;){const h=[...t.shift()];o.push(h);let c;do{c=!1;for(let g=0;g<t.length;g++){const d=t[g];if(d[0][0]===h[h.length-1][0]&&d[0][1]===h[h.length-1][1]){c=!0,h.push(d[1]),t.splice(g,1);break}if(d[1][0]===h[0][0]&&d[1][1]===h[0][1]){c=!0,h.unshift(d[0]),t.splice(g,1);break}}}while(c)}for(;o.length>0;){const h=o[0];if(h[0][0]===h[h.length-1][0]&&h[0][1]===h[h.length-1][1]){l.push(h),o.shift();continue}const c=h[h.length-1];let g,d;if(c[0]===0&&c[1]!==0)g=Si(o,y=>y[0][0]===0&&y[0][1]<c[1],(y,v)=>v[0][1]-y[0][1]),d=[0,0];else if(c[1]===0&&c[0]!==s-1)g=Si(o,y=>y[0][1]===0&&y[0][0]>c[0],(y,v)=>y[0][0]-v[0][0]),d=[s-1,0];else if(c[0]===s-1&&c[1]!==i-1)g=Si(o,y=>y[0][0]===s-1&&y[0][1]>c[1],(y,v)=>y[0][1]-v[0][1]),d=[s-1,i-1];else if(c[1]===i-1&&c[0]!==0)g=Si(o,y=>y[0][1]===i-1&&y[0][0]<c[0],(y,v)=>v[0][0]-y[0][0]),d=[0,i-1];else throw new Error("Contour not closed but is not along an edge");if(g===-1)h.push(d);else if(g===0)h.push([h[0][0],h[0][1]]),l.push(h),o.shift();else{const y=o[g];o.splice(g,1);for(const v of y)h.push(v)}}for(let h=0;h<l.length;h++)l[h].length<4&&(l.splice(h,1),h--);return l}function vv(t,e,i){const s=Fe(i),o=s[2]-s[0],l=s[3]-s[1],h=s[0],c=s[1],g=e[0].length-1,d=e.length-1,y=o/g,v=l/d;return t.map(function(_){return _.groupedRings=_.groupedRings.map(function(E){return E.map(function(M){return M.map(R=>[R[0]*y+h,R[1]*v+c])})}),_})}function yv(t){const e=t.map(function(i){return{ring:i,area:ir(ye([i]))}});return e.sort(function(i,s){return s.area-i.area}),e.map(function(i){return i.ring})}function mv(t){const e=t.map(s=>({lrCoordinates:s,grouped:!1})),i=[];for(;!pv(e);)for(let s=0;s<e.length;s++)if(!e[s].grouped){const o=[];o.push(e[s].lrCoordinates),e[s].grouped=!0;const l=ye([e[s].lrCoordinates]);e:for(let h=s+1;h<e.length;h++)if(!e[h].grouped){const c=ye([e[h].lrCoordinates]);if(gl(c,l)){for(let g=1;g<o.length;g++)if(gl(c,ye([o[g]])))continue e;o.push(e[h].lrCoordinates),e[h].grouped=!0}}i.push(o)}return i}function gl(t,e){const i=Mi(t);for(let s=0;s<i.features.length;s++)if(!xe(i.features[s],e))return!1;return!0}function pv(t){for(let e=0;e<t.length;e++)if(t[e].grouped===!1)return!1;return!0}function Si(t,e,i){let s=-1;for(let o=0;o<t.length;o++)e(t[o])&&(s===-1||i(t[s],t[o])>0)&&(s=o);return s}var _v=Object.defineProperty,dl=Object.getOwnPropertySymbols,xv=Object.prototype.hasOwnProperty,Ev=Object.prototype.propertyIsEnumerable,vl=(t,e,i)=>e in t?_v(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,yl=(t,e)=>{for(var i in e||(e={}))xv.call(e,i)&&vl(t,i,e[i]);if(dl)for(var i of dl(e))Ev.call(e,i)&&vl(t,i,e[i]);return t};function wv(t,e){if(e=e||{},!Ce(e))throw new Error("options is invalid");var i=e.zProperty||"elevation",s=e.flip,o=e.flags;Ut(t,"Point","input must contain Points");for(var l=kv(t,s),h=[],c=0;c<l.length;c++){for(var g=l[c],d=[],y=0;y<g.length;y++){var v=g[y];v.properties[i]?d.push(v.properties[i]):d.push(0),o===!0&&(v.properties.matrixPosition=[c,y])}h.push(d)}return h}function kv(t,e){var i={};Le(t,function(l){var h=ve(l)[1];i[h]||(i[h]=[]),i[h].push(l)});var s=Object.keys(i).map(function(l){var h=i[l],c=h.sort(function(g,d){return ve(g)[0]-ve(d)[0]});return c}),o=s.sort(function(l,h){return e?ve(l[0])[1]-ve(h[0])[1]:ve(h[0])[1]-ve(l[0])[1]});return o}function Iv(t,e,i){if(i=i||{},!Ce(i))throw new Error("options is invalid");const s=i.zProperty||"elevation",o=i.commonProperties||{},l=i.breaksProperties||[];if(Ut(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(!Ce(o))throw new Error("commonProperties must be an Object");if(!Array.isArray(l))throw new Error("breaksProperties must be an Array");const h=wv(t,{zProperty:s,flip:!0}),c=h[0].length;if(h.length<2||c<2)throw new Error("Matrix of points must be at least 2x2");for(let y=1;y<h.length;y++)if(h[y].length!==c)throw new Error("Matrix of points is not uniform in the x dimension");const g=Nv(h,e,s,o,l),d=Sv(g,h,t);return he(d)}function Nv(t,e,i,s,o){const l=[];for(let h=0;h<e.length;h++){const c=+e[h],g=yl(yl({},s),o[h]);g[i]=c;const d=tn(Mv(t,c),g);l.push(d)}return l}function Mv(t,e){const i=[],s=t.length,o=t[0].length;for(let c=0;c<s-1;c++)for(let g=0;g<o-1;g++){const d=t[c+1][g+1],y=t[c][g+1],v=t[c][g],_=t[c+1][g];switch((_>=e?8:0)|(d>=e?4:0)|(y>=e?2:0)|(v>=e?1:0)){case 0:continue;case 1:i.push([[g+h(v,y),c],[g,c+h(v,_)]]);break;case 2:i.push([[g+1,c+h(y,d)],[g+h(v,y),c]]);break;case 3:i.push([[g+1,c+h(y,d)],[g,c+h(v,_)]]);break;case 4:i.push([[g+h(_,d),c+1],[g+1,c+h(y,d)]]);break;case 5:{(_+d+y+v)/4>=e?i.push([[g+h(_,d),c+1],[g,c+h(v,_)]],[[g+h(v,y),c],[g+1,c+h(y,d)]]):i.push([[g+h(_,d),c+1],[g+1,c+h(y,d)]],[[g+h(v,y),c],[g,c+h(v,_)]]);break}case 6:i.push([[g+h(_,d),c+1],[g+h(v,y),c]]);break;case 7:i.push([[g+h(_,d),c+1],[g,c+h(v,_)]]);break;case 8:i.push([[g,c+h(v,_)],[g+h(_,d),c+1]]);break;case 9:i.push([[g+h(v,y),c],[g+h(_,d),c+1]]);break;case 10:{(_+d+y+v)/4>=e?i.push([[g,c+h(v,_)],[g+h(v,y),c]],[[g+1,c+h(y,d)],[g+h(_,d),c+1]]):i.push([[g,c+h(v,_)],[g+h(_,d),c+1]],[[g+1,c+h(y,d)],[g+h(v,y),c]]);break}case 11:i.push([[g+1,c+h(y,d)],[g+h(_,d),c+1]]);break;case 12:i.push([[g,c+h(v,_)],[g+1,c+h(y,d)]]);break;case 13:i.push([[g+h(v,y),c],[g+1,c+h(y,d)]]);break;case 14:i.push([[g,c+h(v,_)],[g+h(v,y),c]]);break;case 15:continue}}const l=[];for(;i.length>0;){const c=[...i.shift()];l.push(c);let g;do{g=!1;for(let d=0;d<i.length;d++){const y=i[d];if(y[0][0]===c[c.length-1][0]&&y[0][1]===c[c.length-1][1]){g=!0,c.push(y[1]),i.splice(d,1);break}if(y[1][0]===c[0][0]&&y[1][1]===c[0][1]){g=!0,c.unshift(y[0]),i.splice(d,1);break}}}while(g)}return l;function h(c,g){if(c===g)return .5;let d=(e-c)/(g-c);return d>1?1:d<0?0:d}}function Sv(t,e,i){const s=Fe(i),o=s[2]-s[0],l=s[3]-s[1],h=s[0],c=s[1],g=e[0].length-1,d=e.length-1,y=o/g,v=l/d,_=E=>{E[0]=E[0]*y+h,E[1]=E[1]*v+c};return t.forEach(E=>{Xe(E,_)}),t}function Pv(t){let e,i;const s={type:"FeatureCollection",features:[]};if(t.type==="Feature"?i=t.geometry:i=t,i.type==="LineString")e=[i.coordinates];else if(i.type==="MultiLineString")e=i.coordinates;else if(i.type==="MultiPolygon")e=[].concat(...i.coordinates);else if(i.type==="Polygon")e=i.coordinates;else throw new Error("Input must be a LineString, MultiLineString, Polygon, or MultiPolygon Feature or Geometry");return e.forEach(o=>{e.forEach(l=>{for(let h=0;h<o.length-1;h++)for(let c=h;c<l.length-1;c++){if(o===l&&(Math.abs(h-c)===1||h===0&&c===o.length-2&&o[h][0]===o[o.length-1][0]&&o[h][1]===o[o.length-1][1]))continue;const g=Lv(o[h][0],o[h][1],o[h+1][0],o[h+1][1],l[c][0],l[c][1],l[c+1][0],l[c+1][1]);g&&s.features.push(_e([g[0],g[1]]))}})}),s}function Lv(t,e,i,s,o,l,h,c){let g,d,y,v,_;const E={x:null,y:null,onLine1:!1,onLine2:!1};return g=(c-l)*(i-t)-(h-o)*(s-e),g===0?E.x!==null&&E.y!==null?E:!1:(d=e-l,y=t-o,v=(h-o)*d-(c-l)*y,_=(i-t)*d-(s-e)*y,d=v/g,y=_/g,E.x=t+d*(i-t),E.y=e+d*(s-e),d>=0&&d<=1&&(E.onLine1=!0),y>=0&&y<=1&&(E.onLine2=!0),E.onLine1&&E.onLine2?[E.x,E.y]:!1)}function ml(t,e={}){return as(t,(i,s)=>{const o=s.geometry.coordinates;return i+Be(o[0],o[1],e)},0)}function pl(t,e,i,s,o={}){const l=o.steps||64,h=_l(i),c=_l(s),g=!Array.isArray(t)&&t.type==="Feature"?t.properties:{};if(h===c)return Pe(Rs(t,e,o).geometry.coordinates[0],g);const d=h,y=h<c?c:c+360;let v=d;const _=[];let E=0;const M=(y-d)/l;for(;v<=y;)_.push(rn(t,e,v,o).geometry.coordinates),E++,v=d+E*M;return Pe(_,g)}function _l(t){let e=t%360;return e<0&&(e+=360),e}function xl(t,e,i,s){if(s=s||{},!Ce(s))throw new Error("options is invalid");var o,l=[];if(t.type==="Feature")o=t.geometry.coordinates;else if(t.type==="LineString")o=t.coordinates;else throw new Error("input must be a LineString Feature or Geometry");for(var h=o.length,c=0,g,d,y,v=0;v<o.length&&!(e>=c&&v===o.length-1);v++){if(c>e&&l.length===0){if(g=e-c,!g)return l.push(o[v]),Pe(l);d=nn(o[v],o[v-1])-180,y=rn(o[v],g,d,s),l.push(y.geometry.coordinates)}if(c>=i)return g=i-c,g?(d=nn(o[v],o[v-1])-180,y=rn(o[v],g,d,s),l.push(y.geometry.coordinates),Pe(l)):(l.push(o[v]),Pe(l));if(c>=e&&l.push(o[v]),v===o.length-1)return Pe(l);c+=Be(o[v],o[v+1],s)}if(c<e&&o.length===h)throw new Error("Start position is beyond line");var _=o[o.length-1];return Pe([_,_])}function bv(t,e,i){if(i=i||{},!Ce(i))throw new Error("options is invalid");var s=i.units,o=i.reverse;if(!t)throw new Error("geojson is required");if(e<=0)throw new Error("segmentLength must be greater than 0");var l=[];return Qe(t,function(h){o&&(h.geometry.coordinates=h.geometry.coordinates.reverse()),Cv(h,e,s,function(c){l.push(c)})}),he(l)}function Cv(t,e,i,s){var o=ml(t,{units:i});if(o<=e)return s(t);var l=o/e;Number.isInteger(l)||(l=Math.floor(l)+1);for(var h=0;h<l;h++){var c=xl(t,e*h,e*(h+1),{units:i});s(c,h)}}function Pi(t){var e=t[0],i=t[1];return[i[0]-e[0],i[1]-e[1]]}function ro(t,e){return t[0]*e[1]-e[0]*t[1]}function Tv(t,e){return[t[0]+e[0],t[1]+e[1]]}function Ov(t,e){return[t[0]-e[0],t[1]-e[1]]}function Rv(t,e){return[t*e[0],t*e[1]]}function Av(t,e){var i=t[0],s=Pi(t),o=e[0],l=Pi(e),h=ro(s,l),c=Ov(o,i),g=ro(c,l),d=g/h,y=Tv(i,Rv(d,s));return y}function Dv(t,e){var i=Pi(t),s=Pi(e);return ro(i,s)===0}function Fv(t,e){return Dv(t,e)?!1:Av(t,e)}function qv(t,e,i){if(i=i||{},!Ce(i))throw new Error("options is invalid");var s=i.units;if(!t)throw new Error("geojson is required");if(e==null||isNaN(e))throw new Error("distance is required");var o=gt(t),l=t.properties;switch(o){case"LineString":return El(t,e,s);case"MultiLineString":var h=[];return Qe(t,function(c){h.push(El(c,e,s).geometry.coordinates)}),tn(h,l);default:throw new Error("geometry "+o+" is not supported")}}function El(t,e,i){var s=[],o=Vr(e,i),l=ve(t),h=[];return l.forEach(function(c,g){if(g!==l.length-1){var d=Bv(c,l[g+1],o);if(s.push(d),g>0){var y=s[g-1],v=Fv(d,y);v!==!1&&(y[1]=v,d[0]=v),h.push(y[0]),g===l.length-2&&(h.push(d[0]),h.push(d[1]))}l.length===2&&(h.push(d[0]),h.push(d[1]))}}),Pe(h,t.properties)}function Bv(t,e,i){var s=Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])),o=t[0]+i*(e[1]-t[1])/s,l=e[0]+i*(e[1]-t[1])/s,h=t[1]+i*(t[0]-e[0])/s,c=e[1]+i*(t[0]-e[0])/s;return[[o,h],[l,c]]}function Gv(t,e,i){var s=ve(i);if(gt(i)!=="LineString")throw new Error("line must be a LineString");var o=$t(i,t),l=$t(i,e),h;o.properties.index<=l.properties.index?h=[o,l]:h=[l,o];for(var c=[h[0].geometry.coordinates],g=h[0].properties.index+1;g<h[1].properties.index+1;g++)c.push(s[g]);return c.push(h[1].geometry.coordinates),Pe(c,i.properties)}function wl(t,e){if(e=e??{},!Ce(e))throw new Error("options is invalid");var i=e.precision,s=e.coordinates,o=e.mutate;if(i=i==null||isNaN(i)?6:i,s=s==null||isNaN(s)?3:s,!t)throw new Error("<geojson> is required");if(typeof i!="number")throw new Error("<precision> must be a number");if(typeof s!="number")throw new Error("<coordinates> must be a number");(o===!1||o===void 0)&&(t=JSON.parse(JSON.stringify(t)));var l=Math.pow(10,i);return Xe(t,function(h){Yv(h,l,s)}),t}function Yv(t,e,i){t.length>i&&t.splice(i,t.length);for(var s=0;s<t.length;s++)t[s]=Math.round(t[s]*e)/e;return t}function zv(t,e){if(!t)throw new Error("line is required");if(!e)throw new Error("splitter is required");var i=gt(t),s=gt(e);if(i!=="LineString")throw new Error("line must be LineString");if(s==="FeatureCollection")throw new Error("splitter cannot be a FeatureCollection");if(s==="GeometryCollection")throw new Error("splitter cannot be a GeometryCollection");var o=wl(e,{precision:7});switch(s){case"Point":return io(t,o);case"MultiPoint":return kl(t,o);case"LineString":case"MultiLineString":case"Polygon":case"MultiPolygon":return kl(t,Rt(t,o,{ignoreSelfIntersections:!0}))}}function kl(t,e){var i=[],s=Qr();return Qe(e,function(o){if(i.forEach(function(c,g){c.id=g}),!i.length)i=io(t,o).features,s.load(he(i));else{var l=s.search(o);if(l.features.length){var h=Il(o,l);i=i.filter(function(c){return c.id!==h.id}),s.remove(h),Le(io(h,o),function(c){i.push(c),s.insert(c)})}}}),he(i)}function io(t,e){var i=[],s=ve(t)[0],o=ve(t)[t.geometry.coordinates.length-1];if(so(s,Te(e))||so(o,Te(e)))return he([t]);var l=Qr(),h=hr(t);l.load(h);var c=l.search(e);if(!c.features.length)return he([t]);var g=Il(e,c),d=[s],y=ss(h,function(v,_,E){var M=ve(_)[1],R=Te(e);return E===g.id?(v.push(R),i.push(Pe(v)),so(R,M)?[R]:[R,M]):(v.push(M),v)},d);return y.length>1&&i.push(Pe(y)),he(i)}function Il(t,e){if(!e.features.length)throw new Error("lines must contain features");if(e.features.length===1)return e.features[0];var i,s=1/0;return Le(e,function(o){var l=$t(o,t),h=l.properties.dist;h<s&&(i=o,s=h)}),i}function so(t,e){return t[0]===e[0]&&t[1]===e[1]}function Xv(t,e={}){var i,s,o,l=e.properties,h=(i=e.autoComplete)!=null?i:!0,c=(s=e.orderCoords)!=null?s:!0,g=(o=e.mutate)!=null?o:!1;if(g||(t=je(t)),t.type==="FeatureCollection"){var d=[];return t.features.forEach(function(y){d.push(ve(Nl(y,{},h,c)))}),ft(d,l)}else return Nl(t,l,h,c)}function Nl(t,e,i,s){e=e||(t.type==="Feature"?t.properties:{});var o=qe(t),l=o.coordinates,h=o.type;if(!l.length)throw new Error("line must contain coordinates");switch(h){case"LineString":return i&&(l=Ml(l)),ye([l],e);case"MultiLineString":var c=[],g=0;return l.forEach(function(d){if(i&&(d=Ml(d)),s){var y=Uv(Fe(Pe(d)));y>g?(c.unshift(d),g=y):c.push(d)}else c.push(d)}),ye(c,e);default:throw new Error("geometry type "+h+" is not supported")}}function Ml(t){var e=t[0],i=e[0],s=e[1],o=t[t.length-1],l=o[0],h=o[1];return(i!==l||s!==h)&&t.push(e),t}function Uv(t){var e=t[0],i=t[1],s=t[2],o=t[3];return Math.abs(e-s)*Math.abs(i-o)}function Vv(t,e,i){var s;const o=(s=i?.mutate)!=null?s:!1;let l=e;e&&o===!1&&(l=je(e));const h=$v(l);let c=null;return t.type==="FeatureCollection"?c=Hv(t):t.type==="Feature"?c=oo(un(t.geometry.coordinates)):c=oo(un(t.coordinates)),c.geometry.coordinates.forEach(function(g){h.geometry.coordinates.push(g[0])}),h}function Hv(t){const e=t.features.length===2?un(t.features[0].geometry.coordinates,t.features[1].geometry.coordinates):un.apply(Kd,t.features.map(function(i){return i.geometry.coordinates}));return oo(e)}function oo(t){return ft(t)}function $v(t){let i=[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]];return t&&(t.type==="Feature"?i=t.geometry.coordinates:i=t.coordinates),ye(i)}function Zv(t,e){const i=Be(t,e),s=nn(t,e);return rn(t,i/2,s)}function Wv(t,e){var i,s;const o=e.inputField,l=e.threshold||1e5,h=e.p||2,c=(i=e.binary)!=null?i:!1,g=e.alpha||-1,d=(s=e.standardization)!=null?s:!0,y=Qu(t,{alpha:g,binary:c,p:h,standardization:d,threshold:l}),v=[];Le(t,L=>{const D=L.properties||{};v.push(D[o])});const _=Sl(v),E=Kv(v);let M=0,R=0,Y=0,H=0;const x=y.length;for(let L=0;L<x;L++){let D=0;for(let F=0;F<x;F++)M+=y[L][F]*(v[L]-_)*(v[F]-_),R+=y[L][F],Y+=Math.pow(y[L][F]+y[F][L],2),D+=y[L][F]+y[F][L];H+=Math.pow(D,2)}Y=.5*Y;const S=M/R/E,b=-1/(x-1),C=x*x*Y-x*H+3*(R*R),A=(x-1)*(x+1)*(R*R),q=C/A-b*b,w=Math.sqrt(q),N=(S-b)/w;return{expectedMoranIndex:b,moranIndex:S,stdNorm:w,zNorm:N}}function Sl(t){let e=0;for(const i of t)e+=i;return e/t.length}function Kv(t){const e=Sl(t);let i=0;for(const s of t)i+=Math.pow(s-e,2);return i/t.length}var Jv=Object.defineProperty,Qv=Object.defineProperties,jv=Object.getOwnPropertyDescriptors,Pl=Object.getOwnPropertySymbols,ey=Object.prototype.hasOwnProperty,ty=Object.prototype.propertyIsEnumerable,Ll=(t,e,i)=>e in t?Jv(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,bl=(t,e)=>{for(var i in e||(e={}))ey.call(e,i)&&Ll(t,i,e[i]);if(Pl)for(var i of Pl(e))ty.call(e,i)&&Ll(t,i,e[i]);return t},Cl=(t,e)=>Qv(t,jv(e));function Li(t,e,i={}){if(!t)throw new Error("targetPoint is required");if(!e)throw new Error("points is required");let s=1/0,o=0;Le(e,(h,c)=>{const g=Be(t,h,i);g<s&&(o=c,s=g)});const l=je(e.features[o]);return Cl(bl({},l),{properties:Cl(bl({},l.properties),{featureIndex:o,distanceToPoint:s})})}function ny(t,e){e=e||{};const i=e.studyArea||sr(Fe(t)),s=e.properties||{},o=e.units||"kilometers",l=[];Le(t,v=>{l.push(Zt(v))});const h=l.length,c=l.map((v,_)=>{const E=he(l.filter((M,R)=>R!==_));return Be(v,Li(v,E).geometry.coordinates,{units:o})}).reduce((v,_)=>v+_,0)/h,g=h/ts(ir(i),"meters",o),d=1/(2*Math.sqrt(g)),y=.26136/Math.sqrt(h*g);return s.nearestNeighborAnalysis={units:o,arealUnits:o+"²",observedMeanDistance:c,expectedMeanDistance:d,nearestNeighborIndex:c/d,numberOfPoints:h,zScore:(c-d)/y},i.properties=s,i}function ao(t,e,i={}){var s,o;const l=(s=i.method)!=null?s:"geodesic",h=(o=i.units)!=null?o:"kilometers";if(!t)throw new Error("pt is required");if(Array.isArray(t)?t=_e(t):t.type==="Point"?t=We(t):nr(t,"Point","point"),!e)throw new Error("line is required");Array.isArray(e)?e=Pe(e):e.type==="LineString"?e=We(e):nr(e,"LineString","line");let c=1/0;const g=t.geometry.coordinates;return Vt(e,d=>{if(d){const y=d.geometry.coordinates[0],v=d.geometry.coordinates[1],_=ry(g,y,v,{method:l});_<c&&(c=_)}}),fn(c,"degrees",h)}function ry(t,e,i,s){if(s.method==="geodesic")return $t(Pe([e,i]).geometry,t,{units:"degrees"}).properties.dist;const o=[i[0]-e[0],i[1]-e[1]],l=[t[0]-e[0],t[1]-e[1]],h=Tl(l,o);if(h<=0)return Bn(t,e,{units:"degrees"});const c=Tl(o,o);if(c<=h)return Bn(t,i,{units:"degrees"});const g=h/c,d=[e[0]+g*o[0],e[1]+g*o[1]];return Bn(t,d,{units:"degrees"})}function Tl(t,e){return t[0]*e[0]+t[1]*e[1]}var iy=Object.defineProperty,Ol=Object.getOwnPropertySymbols,sy=Object.prototype.hasOwnProperty,oy=Object.prototype.propertyIsEnumerable,Rl=(t,e,i)=>e in t?iy(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,uo=(t,e)=>{for(var i in e||(e={}))sy.call(e,i)&&Rl(t,i,e[i]);if(Ol)for(var i of Ol(e))oy.call(e,i)&&Rl(t,i,e[i]);return t};function ay(t,e,i={}){const s=i.units,o=i.properties||{},l=uy(t);if(!l.features.length)throw new Error("points must contain features");if(!e)throw new Error("line is required");if(gt(e)!=="LineString")throw new Error("line must be a LineString");let h=1/0,c=null;return Le(l,g=>{const d=ao(g,e,{units:s});d<h&&(h=d,c=g)}),c&&(c.properties=uo(uo(uo({},{dist:h}),c.properties),o)),c}function uy(t){const e=[];switch(t.geometry?t.geometry.type:t.type){case"GeometryCollection":return rt(t,s=>{s.type==="Point"&&e.push({type:"Feature",properties:{},geometry:s})}),{type:"FeatureCollection",features:e};case"FeatureCollection":return t.features=t.features.filter(s=>s.geometry.type==="Point"),t;default:throw new Error("points must be a Point Collection")}}function ly(t,e){const i=Te(t),l=qe(e).coordinates[0];if(l.length<4)throw new Error("OuterRing of a Polygon must have 4 or more Positions.");const h=e.type==="Feature"&&e.properties||{},c=h.a,g=h.b,d=h.c,y=i[0],v=i[1],_=l[0][0],E=l[0][1],M=c!==void 0?c:l[0][2],R=l[1][0],Y=l[1][1],H=g!==void 0?g:l[1][2],x=l[2][0],S=l[2][1],b=d!==void 0?d:l[2][2];return(b*(y-_)*(v-Y)+M*(y-R)*(v-S)+H*(y-x)*(v-E)-H*(y-_)*(v-S)-b*(y-R)*(v-E)-M*(y-x)*(v-Y))/((y-_)*(v-Y)+(y-R)*(v-S)+(y-x)*(v-E)-(y-_)*(v-S)-(y-R)*(v-E)-(y-x)*(v-Y))}function cy(t){const e=hy(t),i=jr(e);let s=!1,o=0;for(;!s&&o<e.features.length;){const l=e.features[o].geometry;let h,c,g,d,y,v,_=!1;if(l.type==="Point")i.geometry.coordinates[0]===l.coordinates[0]&&i.geometry.coordinates[1]===l.coordinates[1]&&(s=!0);else if(l.type==="MultiPoint"){let E=!1,M=0;for(;!E&&M<l.coordinates.length;)i.geometry.coordinates[0]===l.coordinates[M][0]&&i.geometry.coordinates[1]===l.coordinates[M][1]&&(s=!0,E=!0),M++}else if(l.type==="LineString"){let E=0;for(;!_&&E<l.coordinates.length-1;)h=i.geometry.coordinates[0],c=i.geometry.coordinates[1],g=l.coordinates[E][0],d=l.coordinates[E][1],y=l.coordinates[E+1][0],v=l.coordinates[E+1][1],Al(h,c,g,d,y,v)&&(_=!0,s=!0),E++}else if(l.type==="MultiLineString"){let E=0;for(;E<l.coordinates.length;){_=!1;let M=0;const R=l.coordinates[E];for(;!_&&M<R.length-1;)h=i.geometry.coordinates[0],c=i.geometry.coordinates[1],g=R[M][0],d=R[M][1],y=R[M+1][0],v=R[M+1][1],Al(h,c,g,d,y,v)&&(_=!0,s=!0),M++;E++}}else(l.type==="Polygon"||l.type==="MultiPolygon")&&xe(i,l)&&(s=!0);o++}if(s)return i;{const l=he([]);for(let h=0;h<e.features.length;h++)l.features=l.features.concat(Mi(e.features[h]).features);return _e(Li(i,l).geometry.coordinates)}}function hy(t){return t.type!=="FeatureCollection"?t.type!=="Feature"?he([We(t)]):he([t]):t}function Al(t,e,i,s,o,l){const h=Math.sqrt((o-i)*(o-i)+(l-s)*(l-s)),c=Math.sqrt((t-i)*(t-i)+(e-s)*(e-s)),g=Math.sqrt((o-t)*(o-t)+(l-e)*(l-e));return h===c+g}function Dl(t,e){const i=[];return Le(t,function(s){let o=!1;if(s.geometry.type==="Point")rt(e,function(h){xe(s,h)&&(o=!0)}),o&&i.push(s);else if(s.geometry.type==="MultiPoint"){var l=[];rt(e,function(h){Xe(s,function(c){xe(c,h)&&(o=!0,l.push(c))})}),o&&i.push(jn(l,s.properties))}else throw new Error("Input geometry must be a Point or MultiPoint")}),he(i)}function lo(t,e,i={}){var s,o;const l=(s=i.method)!=null?s:"geodesic",h=(o=i.units)!=null?o:"kilometers";if(!t)throw new Error("point is required");if(!e)throw new Error("polygon or multi-polygon is required");const c=qe(e);if(c.type==="MultiPolygon"){const y=c.coordinates.map(v=>lo(t,ye(v),{method:l,units:h}));return Math.min(...y.map(Math.abs))*(xe(t,e)?-1:1)}if(c.coordinates.length>1){const[y,...v]=c.coordinates.map(E=>lo(t,ye([E]),{method:l,units:h}));if(y>=0)return y;const _=Math.min(...v);return _<0?Math.abs(_):Math.max(_*-1,y)}const g=bn(c);let d=1/0;return Qe(g,y=>{d=Math.min(d,ao(t,y,{method:l,units:h}))}),xe(t,c)?-d:d}function fy(t){return(t>0)-(t<0)||+t}function co(t,e,i){const s=e[0]-t[0],o=e[1]-t[1],l=i[0]-e[0],h=i[1]-e[1];return fy(s*h-l*o)}function gy(t,e){const i=t.geometry.coordinates[0].map(h=>h[0]),s=t.geometry.coordinates[0].map(h=>h[1]),o=e.geometry.coordinates[0].map(h=>h[0]),l=e.geometry.coordinates[0].map(h=>h[1]);return Math.max.apply(null,i)===Math.max.apply(null,o)&&Math.max.apply(null,s)===Math.max.apply(null,l)&&Math.min.apply(null,i)===Math.min.apply(null,o)&&Math.min.apply(null,s)===Math.min.apply(null,l)}function Fl(t,e){return e.geometry.coordinates[0].every(i=>xe(_e(i),t))}function dy(t,e){return t[0]===e[0]&&t[1]===e[1]}var ql=class hh{static buildId(e){return e.join(",")}constructor(e){this.id=hh.buildId(e),this.coordinates=e,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}removeInnerEdge(e){this.innerEdges=this.innerEdges.filter(i=>i.from.id!==e.from.id)}removeOuterEdge(e){this.outerEdges=this.outerEdges.filter(i=>i.to.id!==e.to.id)}addOuterEdge(e){this.outerEdges.push(e),this.outerEdgesSorted=!1}sortOuterEdges(){this.outerEdgesSorted||(this.outerEdges.sort((e,i)=>{const s=e.to,o=i.to;if(s.coordinates[0]-this.coordinates[0]>=0&&o.coordinates[0]-this.coordinates[0]<0)return 1;if(s.coordinates[0]-this.coordinates[0]<0&&o.coordinates[0]-this.coordinates[0]>=0)return-1;if(s.coordinates[0]-this.coordinates[0]===0&&o.coordinates[0]-this.coordinates[0]===0)return s.coordinates[1]-this.coordinates[1]>=0||o.coordinates[1]-this.coordinates[1]>=0?s.coordinates[1]-o.coordinates[1]:o.coordinates[1]-s.coordinates[1];const l=co(this.coordinates,s.coordinates,o.coordinates);if(l<0)return 1;if(l>0)return-1;const h=Math.pow(s.coordinates[0]-this.coordinates[0],2)+Math.pow(s.coordinates[1]-this.coordinates[1],2),c=Math.pow(o.coordinates[0]-this.coordinates[0],2)+Math.pow(o.coordinates[1]-this.coordinates[1],2);return h-c}),this.outerEdgesSorted=!0)}getOuterEdges(){return this.sortOuterEdges(),this.outerEdges}getOuterEdge(e){return this.sortOuterEdges(),this.outerEdges[e]}addInnerEdge(e){this.innerEdges.push(e)}},vy=class fh{getSymetric(){return this.symetric||(this.symetric=new fh(this.to,this.from),this.symetric.symetric=this),this.symetric}constructor(e,i){this.from=e,this.to=i,this.next=void 0,this.label=void 0,this.symetric=void 0,this.ring=void 0,this.from.addOuterEdge(this),this.to.addInnerEdge(this)}deleteEdge(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)}isEqual(e){return this.from.id===e.from.id&&this.to.id===e.to.id}toString(){return`Edge { ${this.from.id} -> ${this.to.id} }`}toLineString(){return Pe([this.from.coordinates,this.to.coordinates])}compareTo(e){return co(e.from.coordinates,e.to.coordinates,this.to.coordinates)}},Bl=class{constructor(){this.edges=[],this.polygon=void 0,this.envelope=void 0}push(t){this.edges.push(t),this.polygon=this.envelope=void 0}get(t){return this.edges[t]}get length(){return this.edges.length}forEach(t){this.edges.forEach(t)}map(t){return this.edges.map(t)}some(t){return this.edges.some(t)}isValid(){return!0}isHole(){const t=this.edges.reduce((o,l,h)=>(l.from.coordinates[1]>this.edges[o].from.coordinates[1]&&(o=h),o),0),e=(t===0?this.length:t)-1,i=(t+1)%this.length,s=co(this.edges[e].from.coordinates,this.edges[t].from.coordinates,this.edges[i].from.coordinates);return s===0?this.edges[e].from.coordinates[0]>this.edges[i].from.coordinates[0]:s>0}toMultiPoint(){return jn(this.edges.map(t=>t.from.coordinates))}toPolygon(){if(this.polygon)return this.polygon;const t=this.edges.map(e=>e.from.coordinates);return t.push(this.edges[0].from.coordinates),this.polygon=ye([t])}getEnvelope(){return this.envelope?this.envelope:this.envelope=tl(this.toPolygon())}static findEdgeRingContaining(t,e){const i=t.getEnvelope();let s,o;return e.forEach(l=>{const h=l.getEnvelope();if(o&&(s=o.getEnvelope()),!gy(h,i)&&Fl(h,i)){const c=t.map(d=>d.from.coordinates);let g;for(const d of c)l.some(y=>dy(d,y.from.coordinates))||(g=d);g&&l.inside(_e(g))&&(!o||Fl(s,h))&&(o=l)}}),o}inside(t){return xe(t,this.toPolygon())}};function yy(t){if(!t)throw new Error("No geojson passed");if(t.type!=="FeatureCollection"&&t.type!=="GeometryCollection"&&t.type!=="MultiLineString"&&t.type!=="LineString"&&t.type!=="Feature")throw new Error(`Invalid input type '${t.type}'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature`)}var my=class gh{static fromGeoJson(e){yy(e);const i=new gh;return Qe(e,s=>{nr(s,"LineString","Graph::fromGeoJson"),rs(s,(o,l)=>{if(o){const h=i.getNode(o),c=i.getNode(l);i.addEdge(h,c)}return l})}),i}getNode(e){const i=ql.buildId(e);let s=this.nodes[i];return s||(s=this.nodes[i]=new ql(e)),s}addEdge(e,i){const s=new vy(e,i),o=s.getSymetric();this.edges.push(s),this.edges.push(o)}constructor(){this.edges=[],this.nodes={}}deleteDangles(){Object.keys(this.nodes).map(e=>this.nodes[e]).forEach(e=>this._removeIfDangle(e))}_removeIfDangle(e){if(e.innerEdges.length<=1){const i=e.getOuterEdges().map(s=>s.to);this.removeNode(e),i.forEach(s=>this._removeIfDangle(s))}}deleteCutEdges(){this._computeNextCWEdges(),this._findLabeledEdgeRings(),this.edges.forEach(e=>{e.label===e.symetric.label&&(this.removeEdge(e.symetric),this.removeEdge(e))})}_computeNextCWEdges(e){typeof e>"u"?Object.keys(this.nodes).forEach(i=>this._computeNextCWEdges(this.nodes[i])):e.getOuterEdges().forEach((i,s)=>{e.getOuterEdge((s===0?e.getOuterEdges().length:s)-1).symetric.next=i})}_computeNextCCWEdges(e,i){const s=e.getOuterEdges();let o,l;for(let h=s.length-1;h>=0;--h){let c=s[h],g=c.symetric,d,y;c.label===i&&(d=c),g.label===i&&(y=g),!(!d||!y)&&(y&&(l=y),d&&(l&&(l.next=d,l=void 0),o||(o=d)))}l&&(l.next=o)}_findLabeledEdgeRings(){const e=[];let i=0;return this.edges.forEach(s=>{if(s.label>=0)return;e.push(s);let o=s;do o.label=i,o=o.next;while(!s.isEqual(o));i++}),e}getEdgeRings(){this._computeNextCWEdges(),this.edges.forEach(i=>{i.label=void 0}),this._findLabeledEdgeRings().forEach(i=>{this._findIntersectionNodes(i).forEach(s=>{this._computeNextCCWEdges(s,i.label)})});const e=[];return this.edges.forEach(i=>{i.ring||e.push(this._findEdgeRing(i))}),e}_findIntersectionNodes(e){const i=[];let s=e;do{let o=0;s.from.getOuterEdges().forEach(l=>{l.label===e.label&&++o}),o>1&&i.push(s.from),s=s.next}while(!e.isEqual(s));return i}_findEdgeRing(e){let i=e;const s=new Bl;do s.push(i),i.ring=s,i=i.next;while(!e.isEqual(i));return s}removeNode(e){e.getOuterEdges().forEach(i=>this.removeEdge(i)),e.innerEdges.forEach(i=>this.removeEdge(i)),delete this.nodes[e.id]}removeEdge(e){this.edges=this.edges.filter(i=>!i.isEqual(e)),e.deleteEdge()}};function py(t){const e=my.fromGeoJson(t);e.deleteDangles(),e.deleteCutEdges();const i=[],s=[];return e.getEdgeRings().filter(o=>o.isValid()).forEach(o=>{o.isHole()?i.push(o):s.push(o)}),i.forEach(o=>{Bl.findEdgeRingContaining(o,s)&&s.push(o)}),he(s.map(o=>o.toPolygon()))}function _y(t,e){e=e||{},e.iterations=e.iterations||1;const{iterations:i}=e,s=[];if(!t)throw new Error("inputPolys is required");return rt(t,function(o,l,h){if(o.type==="Polygon"){let c=[[]];for(let g=0;g<i;g++){let d=[],y=o;g>0&&(y=ye(c).geometry),xy(y,d),c=d.slice(0)}s.push(ye(c,h))}else if(o.type==="MultiPolygon"){let c=[[[]]];for(let g=0;g<i;g++){let d=[],y=o;g>0&&(y=ft(c).geometry),Ey(y,d),c=d.slice(0)}s.push(ft(c,h))}else throw new Error("geometry is invalid, must be Polygon or MultiPolygon")}),he(s)}function xy(t,e){var i,s;Xe(t,function(o,l,h,c,g){if(s!==g)e.push([]);else{var d=i[0],y=i[1],v=o[0],_=o[1];e[g].push([.75*d+.25*v,.75*y+.25*_]),e[g].push([.25*d+.75*v,.25*y+.75*_])}i=o,s=g},!1),e.forEach(function(o){o.push(o[0])})}function Ey(t,e){let i,s,o;Xe(t,function(l,h,c,g,d){if(s!==g)e.push([[]]);else if(o!==d)e[g].push([]);else{var y=i[0],v=i[1],_=l[0],E=l[1];e[g][d].push([.75*y+.25*_,.75*v+.25*E]),e[g][d].push([.25*y+.75*_,.25*v+.75*E])}i=l,s=g,o=d},!1),e.forEach(function(l){l.forEach(function(h){h.push(h[0])})})}function wy(t,e){const i=ve(t),s=ve(e);let o=[],l=[],h;const c=Fe(e);let g=0,d=null;switch(i[0]>c[0]&&i[0]<c[2]&&i[1]>c[1]&&i[1]<c[3]&&(d=Li(t,Mi(e)),g=d.properties.featureIndex),gt(e)){case"Polygon":o=s[0][g],l=s[0][0],d!==null&&d.geometry.coordinates[1]<i[1]&&(l=s[0][g]),h=Nr(s[0][0],s[0][s[0].length-1],i),[o,l]=Gl(s[0],i,h,o,l);break;case"MultiPolygon":for(var v=0,_=0,E=0,M=0;M<s[0].length;M++){v=M;for(var R=!1,Y=0;Y<s[0][M].length;Y++){if(_=Y,E===g){R=!0;break}E++}if(R)break}o=s[0][v][_],l=s[0][v][_],h=Nr(s[0][0][0],s[0][0][s[0][0].length-1],i),s.forEach(function(H){[o,l]=Gl(H[0],i,h,o,l)});break}return he([_e(o),_e(l)])}function Gl(t,e,i,s,o){for(let l=0;l<t.length;l++){const h=t[l];let c=t[l+1];l===t.length-1&&(c=t[0]);const g=Nr(h,c,e);i<=0&&g>0?Iy(e,h,s)||(s=h):i>0&&g<=0&&(ky(e,h,o)||(o=h)),i=g}return[s,o]}function ky(t,e,i){return Nr(t,e,i)>0}function Iy(t,e,i){return Nr(t,e,i)<0}function Nr(t,e,i){return(e[0]-t[0])*(i[1]-t[1])-(i[0]-t[0])*(e[1]-t[1])}function Yl(t,e={}){return Xl(t,"mercator",e)}function zl(t,e={}){return Xl(t,"wgs84",e)}function Xl(t,e,i={}){i=i||{};var s=i.mutate;if(!t)throw new Error("geojson is required");return Array.isArray(t)&&Je(t[0])?t=e==="mercator"?Ul(t):Vl(t):(s!==!0&&(t=je(t)),Xe(t,function(o){var l=e==="mercator"?Ul(o):Vl(o);o[0]=l[0],o[1]=l[1]})),t}function Ul(t){var e=Math.PI/180,i=6378137,s=20037508342789244e-9,o=Math.abs(t[0])<=180?t[0]:t[0]-Ny(t[0])*360,l=[i*o*e,i*Math.log(Math.tan(Math.PI*.25+.5*t[1]*e))];return l[0]>s&&(l[0]=s),l[0]<-s&&(l[0]=-s),l[1]>s&&(l[1]=s),l[1]<-s&&(l[1]=-s),l}function Vl(t){var e=180/Math.PI,i=6378137;return[t[0]*e/i,(Math.PI*.5-2*Math.atan(Math.exp(-t[1]/i)))*e]}function Ny(t){return t<0?-1:t>0?1:0}const My=Object.freeze(Object.defineProperty({__proto__:null,toMercator:Yl,toWgs84:zl},Symbol.toStringTag,{value:"Module"}));function Sy(t,e){e=e||{};const i=e.studyBbox||Fe(t),s=e.confidenceLevel||20,o=t.features,l=o.length,h=ir(sr(i)),c=Math.sqrt(h/l*2),d=no(i,c,{units:"meters"}).features,y={};for(let q=0;q<d.length;q++)y[q]={box:Fe(d[q]),cnt:0};let v=0;for(const q of o)for(const w of Object.keys(y)){const N=y[w].box;if(Ly(Te(q),N)){y[w].cnt+=1,v+=1;break}}let _=0;for(const q of Object.keys(y)){const w=y[q].cnt;w>_&&(_=w)}const E=[],M=Object.keys(y).length,R=v/M;let Y=0;for(let q=0;q<_+1;q++)Y+=Math.exp(-R)*Math.pow(R,q)/by(q),E.push(Y);const H=[];let x=0;for(let q=0;q<_+1;q++){for(const N of Object.keys(y))y[N].cnt===q&&(x+=1);const w=x/M;H.push(w)}let S=0;for(let q=0;q<_+1;q++){const w=Math.abs(E[q]-H[q]);w>S&&(S=w)}const C=Py[s]/Math.sqrt(M),A={criticalValue:C,isRandom:!0,maxAbsoluteDifference:S,observedDistribution:H};return S>C&&(A.isRandom=!1),A}var Py={20:1.07275,15:1.13795,10:1.22385,5:1.3581,2:1.51743,1:1.62762};function Ly(t,e){return e[0]<=t[0]&&e[1]<=t[1]&&e[2]>=t[0]&&e[3]>=t[1]}function by(t){const e=[];function i(s){return s===0||s===1?1:e[s]>0?e[s]:e[s]=i(s-1)*s}return i(t)}function Hl(t){return Ci(t),bi(t)}function bi(t){return Array.isArray(t)?Jl(t):t&&t.bbox?Jl(t.bbox):[Ty(),Oy()]}function Ci(t){t!=null&&(Array.isArray(t)?tr(t):t.bbox!=null&&tr(t.bbox))}function $l(t,e={}){Ci(e.bbox),t==null&&(t=1);const i=[];for(let s=0;s<t;s++)i.push(_e(bi(e.bbox)));return he(i)}function Zl(t,e={}){Ci(e.bbox),t==null&&(t=1),(e.bbox===void 0||e.bbox===null)&&(e.bbox=[-180,-90,180,90]),(!Je(e.num_vertices)||e.num_vertices===void 0)&&(e.num_vertices=10),(!Je(e.max_radial_length)||e.max_radial_length===void 0)&&(e.max_radial_length=10);const i=Math.abs(e.bbox[0]-e.bbox[2]),s=Math.abs(e.bbox[1]-e.bbox[3]),o=Math.min(i/2,s/2);if(e.max_radial_length>o)throw new Error("max_radial_length is greater than the radius of the bbox");const l=[e.bbox[0]+e.max_radial_length,e.bbox[1]+e.max_radial_length,e.bbox[2]-e.max_radial_length,e.bbox[3]-e.max_radial_length],h=[];for(let c=0;c<t;c++){let g=[];const d=[...Array(e.num_vertices+1)].map(Math.random);d.forEach((y,v,_)=>{_[v]=v>0?y+_[v-1]:y}),d.forEach(y=>{y=y*2*Math.PI/d[d.length-1];const v=Math.random();g.push([v*(e.max_radial_length||10)*Math.sin(y),v*(e.max_radial_length||10)*Math.cos(y)])}),g[g.length-1]=g[0],g=g.reverse().map(Cy(bi(l))),h.push(ye([g]))}return he(h)}function Wl(t,e={}){if(e=e||{},!Ce(e))throw new Error("options is invalid");const i=e.bbox;Ci(i);let s=e.num_vertices,o=e.max_length,l=e.max_rotation;t==null&&(t=1),(!Je(s)||s===void 0||s<2)&&(s=10),(!Je(o)||o===void 0)&&(o=1e-4),(!Je(l)||l===void 0)&&(l=Math.PI/8);const h=[];for(let c=0;c<t;c++){const d=[bi(i)];for(let y=0;y<s-1;y++){const _=(y===0?Math.random()*2*Math.PI:Math.tan((d[y][1]-d[y-1][1])/(d[y][0]-d[y-1][0])))+(Math.random()-.5)*l*2,E=Math.random()*o;d.push([d[y][0]+E*Math.cos(_),d[y][1]+E*Math.sin(_)])}h.push(Pe(d))}return he(h)}function Cy(t){return e=>[e[0]+t[0],e[1]+t[1]]}function Kl(){return Math.random()-.5}function Ty(){return Kl()*360}function Oy(){return Kl()*180}function Jl(t){return[Math.random()*(t[2]-t[0])+t[0],Math.random()*(t[3]-t[1])+t[1]]}const Ry=Object.freeze(Object.defineProperty({__proto__:null,randomLineString:Wl,randomPoint:$l,randomPolygon:Zl,randomPosition:Hl},Symbol.toStringTag,{value:"Module"}));function Ay(t,e={}){var i,s;if(e=e||{},!Ce(e))throw new Error("options is invalid");const o=(i=e.mutate)!=null?i:!1,l=(s=e.reverse)!=null?s:!1;if(!t)throw new Error("<geojson> is required");if(typeof l!="boolean")throw new Error("<reverse> must be a boolean");if(typeof o!="boolean")throw new Error("<mutate> must be a boolean");!o&&t.type!=="Point"&&t.type!=="MultiPoint"&&(t=je(t));const h=[];switch(t.type){case"GeometryCollection":return rt(t,function(c){Ti(c,l)}),t;case"FeatureCollection":return Le(t,function(c){const g=Ti(c,l);Le(g,function(d){h.push(d)})}),he(h)}return Ti(t,l)}function Ti(t,e){switch(t.type==="Feature"?t.geometry.type:t.type){case"GeometryCollection":return rt(t,function(s){Ti(s,e)}),t;case"LineString":return Ql(ve(t),e),t;case"Polygon":return jl(ve(t),e),t;case"MultiLineString":return ve(t).forEach(function(s){Ql(s,e)}),t;case"MultiPolygon":return ve(t).forEach(function(s){jl(s,e)}),t;case"Point":case"MultiPoint":return t}}function Ql(t,e){Hr(t)===e&&t.reverse()}function jl(t,e){Hr(t[0])!==e&&t[0].reverse();for(let i=1;i<t.length;i++)Hr(t[i])===e&&t[i].reverse()}function Dy(t,e){if(!t)throw new Error("fc is required");if(e==null)throw new Error("num is required");if(typeof e!="number")throw new Error("num must be a number");var i=he(Fy(t.features,e));return i}function Fy(t,e){for(var i=t.slice(0),s=t.length,o=s-e,l,h;s-- >o;)h=Math.floor((s+1)*Math.random()),l=i[h],i[h]=i[s],i[s]=l;return i.slice(o)}function qy(t,e,i,s,o={}){if(o=o||{},!Ce(o))throw new Error("options is invalid");const l=o.properties;if(!t)throw new Error("center is required");if(i==null)throw new Error("bearing1 is required");if(s==null)throw new Error("bearing2 is required");if(!e)throw new Error("radius is required");if(typeof o!="object")throw new Error("options must be an object");if(ec(i)===ec(s))return Rs(t,e,o);const h=ve(t),c=pl(t,e,i,s,o),g=[[h]];return Xe(c,function(d){g[0].push(d)}),g[0].push(h),ye(g,l)}function ec(t){let e=t%360;return e<0&&(e+=360),e}function tc(t,e,i){if(i=i||{},!Ce(i))throw new Error("options is invalid");const s=i.origin||"centroid",o=i.mutate||!1;if(!t)throw new Error("geojson required");if(typeof e!="number"||e<=0)throw new Error("invalid factor");const l=Array.isArray(s)||typeof s=="object";return o!==!0&&(t=je(t)),t.type==="FeatureCollection"&&!l?(Le(t,function(h,c){t.features[c]=nc(h,e,s)}),t):nc(t,e,s)}function nc(t,e,i){const s=gt(t)==="Point",o=By(t,i);return e===1||s||(Xe(t,function(l){const h=Bn(o,l),c=gn(o,l),g=h*e,d=ve(Ni(o,g,c));l[0]=d[0],l[1]=d[1],l.length===3&&(l[2]*=e)}),delete t.bbox),t}function By(t,e){if(e==null&&(e="centroid"),Array.isArray(e)||typeof e=="object")return Te(e);const i=t.bbox?t.bbox:Fe(t,{recompute:!0}),s=i[0],o=i[1],l=i[2],h=i[3];switch(e){case"sw":case"southwest":case"westsouth":case"bottomleft":return _e([s,o]);case"se":case"southeast":case"eastsouth":case"bottomright":return _e([l,o]);case"nw":case"northwest":case"westnorth":case"topleft":return _e([s,h]);case"ne":case"northeast":case"eastnorth":case"topright":return _e([l,h]);case"center":return jr(t);case void 0:case null:case"centroid":return Zt(t);default:throw new Error("invalid origin")}}function rc(t){for(var e=t,i=[];e.parent;)i.unshift(e),e=e.parent;return i}function Gy(){return new ic(function(t){return t.f})}var Oi={search:function(t,e,i,s){var o;t.cleanDirty(),s=s||{};var l=s.heuristic||Oi.heuristics.manhattan,h=(o=s.closest)!=null?o:!1,c=Gy(),g=e;for(e.h=l(e,i),c.push(e);c.size()>0;){var d=c.pop();if(d===i)return rc(d);d.closed=!0;for(var y=t.neighbors(d),v=0,_=y.length;v<_;++v){var E=y[v];if(!(E.closed||E.isWall())){var M=d.g+E.getCost(d),R=E.visited;(!R||M<E.g)&&(E.visited=!0,E.parent=d,E.h=E.h||l(E,i),E.g=M,E.f=E.g+E.h,t.markDirty(E),h&&(E.h<g.h||E.h===g.h&&E.g<g.g)&&(g=E),R?c.rescoreElement(E):c.push(E))}}}return h?rc(g):[]},heuristics:{manhattan:function(t,e){var i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return i+s},diagonal:function(t,e){var i=1,s=Math.sqrt(2),o=Math.abs(e.x-t.x),l=Math.abs(e.y-t.y);return i*(o+l)+(s-2*i)*Math.min(o,l)}},cleanNode:function(t){t.f=0,t.g=0,t.h=0,t.visited=!1,t.closed=!1,t.parent=null}};function Gn(t,e){e=e||{},this.nodes=[],this.diagonal=!!e.diagonal,this.grid=[];for(var i=0;i<t.length;i++){this.grid[i]=[];for(var s=0,o=t[i];s<o.length;s++){var l=new Ri(i,s,o[s]);this.grid[i][s]=l,this.nodes.push(l)}}this.init()}Gn.prototype.init=function(){this.dirtyNodes=[];for(var t=0;t<this.nodes.length;t++)Oi.cleanNode(this.nodes[t])},Gn.prototype.cleanDirty=function(){for(var t=0;t<this.dirtyNodes.length;t++)Oi.cleanNode(this.dirtyNodes[t]);this.dirtyNodes=[]},Gn.prototype.markDirty=function(t){this.dirtyNodes.push(t)},Gn.prototype.neighbors=function(t){var e=[],i=t.x,s=t.y,o=this.grid;return o[i-1]&&o[i-1][s]&&e.push(o[i-1][s]),o[i+1]&&o[i+1][s]&&e.push(o[i+1][s]),o[i]&&o[i][s-1]&&e.push(o[i][s-1]),o[i]&&o[i][s+1]&&e.push(o[i][s+1]),this.diagonal&&(o[i-1]&&o[i-1][s-1]&&e.push(o[i-1][s-1]),o[i+1]&&o[i+1][s-1]&&e.push(o[i+1][s-1]),o[i-1]&&o[i-1][s+1]&&e.push(o[i-1][s+1]),o[i+1]&&o[i+1][s+1]&&e.push(o[i+1][s+1])),e},Gn.prototype.toString=function(){for(var t=[],e=this.grid,i,s,o,l,h=0,c=e.length;h<c;h++){for(i=[],s=e[h],o=0,l=s.length;o<l;o++)i.push(s[o].weight);t.push(i.join(" "))}return t.join(`
8
- `)};function Ri(t,e,i){this.x=t,this.y=e,this.weight=i}Ri.prototype.toString=function(){return"["+this.x+" "+this.y+"]"},Ri.prototype.getCost=function(t){return t&&t.x!==this.x&&t.y!==this.y?this.weight*1.41421:this.weight},Ri.prototype.isWall=function(){return this.weight===0};function ic(t){this.content=[],this.scoreFunction=t}ic.prototype={push:function(t){this.content.push(t),this.sinkDown(this.content.length-1)},pop:function(){var t=this.content[0],e=this.content.pop();return this.content.length>0&&(this.content[0]=e,this.bubbleUp(0)),t},remove:function(t){var e=this.content.indexOf(t),i=this.content.pop();e!==this.content.length-1&&(this.content[e]=i,this.scoreFunction(i)<this.scoreFunction(t)?this.sinkDown(e):this.bubbleUp(e))},size:function(){return this.content.length},rescoreElement:function(t){this.sinkDown(this.content.indexOf(t))},sinkDown:function(t){for(var e=this.content[t];t>0;){var i=(t+1>>1)-1,s=this.content[i];if(this.scoreFunction(e)<this.scoreFunction(s))this.content[i]=e,this.content[t]=s,t=i;else break}},bubbleUp:function(t){for(var e=this.content.length,i=this.content[t],s=this.scoreFunction(i);;){var o=t+1<<1,l=o-1,h=null,c;if(l<e){var g=this.content[l];c=this.scoreFunction(g),c<s&&(h=l)}if(o<e){var d=this.content[o],y=this.scoreFunction(d);y<(h===null?s:c)&&(h=o)}if(h!==null)this.content[t]=this.content[h],this.content[h]=i,t=h;else break}}};function Yy(t,e,i={}){if(i=i||{},!Ce(i))throw new Error("options is invalid");let s=i.obstacles||he([]),o=i.resolution||100;if(!t)throw new Error("start is required");if(!e)throw new Error("end is required");if(!Je(o)||o<=0)throw new Error("options.resolution must be a number, greater than 0");const l=Te(t),h=Te(e);if(t=_e(l),e=_e(h),s.type==="FeatureCollection"){if(s.features.length===0)return Pe([l,h])}else if(s.type==="Feature"&&s.geometry.type==="Polygon")s=he([s]);else if(s.type==="Polygon")s=he([We(qe(s))]);else throw new Error("invalid obstacles");const c=s;c.features.push(t),c.features.push(e);const g=Fe(tc(sr(Fe(c)),1.15)),[d,y,v,_]=g;c.features.pop(),c.features.pop();const E=Be([d,y],[v,y],i)/o,M=(v-d)/E,R=Be([d,y],[d,_],i)/o,Y=(_-y)/R,H=E%1*M/2,x=R%1*Y/2,S=[],b=[];let C,A,q=1/0,w=1/0,N=_-x,L=0;for(;N>=y;){const k=[],T=[];let P=d+H,G=0;for(;P<=v;){const B=_e([P,N]),Z=zy(B,s);k.push(Z?0:1),T.push(P+"|"+N);const K=Be(B,t);!Z&&K<q&&(q=K,C={x:G,y:L});const ee=Be(B,e);!Z&&ee<w&&(w=ee,A={x:G,y:L}),P+=M,G++}b.push(k),S.push(T),N-=Y,L++}const D=new Gn(b,{diagonal:!0}),F=D.grid[C.y][C.x],X=D.grid[A.y][A.x],z=Oi.search(D,F,X),V=[l];return z.forEach(function(k){const T=S[k.x][k.y].split("|");V.push([+T[0],+T[1]])}),V.push(h),dn(Pe(V))}function zy(t,e){for(let i=0;i<e.features.length;i++)if(xe(t,e.features[i]))return!0;return!1}function Xy(t,e){var i=t[0]-e[0],s=t[1]-e[1];return i*i+s*s}function Uy(t,e,i){var s=e[0],o=e[1],l=i[0]-s,h=i[1]-o;if(l!==0||h!==0){var c=((t[0]-s)*l+(t[1]-o)*h)/(l*l+h*h);c>1?(s=i[0],o=i[1]):c>0&&(s+=l*c,o+=h*c)}return l=t[0]-s,h=t[1]-o,l*l+h*h}function Vy(t,e){for(var i=t[0],s=[i],o,l=1,h=t.length;l<h;l++)o=t[l],Xy(o,i)>e&&(s.push(o),i=o);return i!==o&&s.push(o),s}function ho(t,e,i,s,o){for(var l=s,h,c=e+1;c<i;c++){var g=Uy(t[c],t[e],t[i]);g>l&&(h=c,l=g)}l>s&&(h-e>1&&ho(t,e,h,s,o),o.push(t[h]),i-h>1&&ho(t,h,i,s,o))}function Hy(t,e){var i=t.length-1,s=[t[0]];return ho(t,0,i,e,s),s.push(t[i]),s}function Ai(t,e,i){if(t.length<=2)return t;var s=e!==void 0?e*e:1;return t=i?t:Vy(t,s),t=Hy(t,s),t}function $y(t,e={}){var i,s,o;if(e=e??{},!Ce(e))throw new Error("options is invalid");const l=(i=e.tolerance)!=null?i:1,h=(s=e.highQuality)!=null?s:!1,c=(o=e.mutate)!=null?o:!1;if(!t)throw new Error("geojson is required");if(l&&l<0)throw new Error("invalid tolerance");return c!==!0&&(t=je(t)),rt(t,function(g){Zy(g,l,h)}),t}function Zy(t,e,i){const s=t.type;if(s==="Point"||s==="MultiPoint")return t;if(dn(t,{mutate:!0}),s!=="GeometryCollection")switch(s){case"LineString":t.coordinates=Ai(t.coordinates,e,i);break;case"MultiLineString":t.coordinates=t.coordinates.map(o=>Ai(o,e,i));break;case"Polygon":t.coordinates=sc(t.coordinates,e,i);break;case"MultiPolygon":t.coordinates=t.coordinates.map(o=>sc(o,e,i))}return t}function sc(t,e,i){return t.map(function(s){if(s.length<4)throw new Error("invalid polygon");let o=e,l=Ai(s,o,i);for(;!oc(l)&&o>=Number.EPSILON;)o-=o*.01,l=Ai(s,o,i);return oc(l)?((l[l.length-1][0]!==l[0][0]||l[l.length-1][1]!==l[0][1])&&l.push(l[0]),l):s})}function oc(t){return t.length<3?!1:!(t.length===3&&t[2][0]===t[0][0]&&t[2][1]===t[0][1])}function Wy(t){var e=t[0],i=t[1],s=t[2],o=t[3],l=Be(t.slice(0,2),[s,i]),h=Be(t.slice(0,2),[e,o]);if(l>=h){var c=(i+o)/2;return[e,c-(s-e)/2,s,c+(s-e)/2]}else{var g=(e+s)/2;return[g-(o-i)/2,i,g+(o-i)/2,o]}}function Ky(t,e){var i;if(e=e||{},!Ce(e))throw new Error("options is invalid");const s=e.steps||64,o=e.weight,l=e.properties||{};if(!Je(s))throw new Error("steps must be a number");if(!Ce(l))throw new Error("properties must be a number");const h=rr(t).length,c=Cs(t,{weight:o});let g=0,d=0,y=0;Le(t,function(w){var N;const L=o&&((N=w.properties)==null?void 0:N[o])||1,D=ac(ve(w),ve(c));g+=Math.pow(D.x,2)*L,d+=Math.pow(D.y,2)*L,y+=D.x*D.y*L});const v=g-d,_=Math.sqrt(Math.pow(v,2)+4*Math.pow(y,2)),E=2*y,M=Math.atan((v+_)/E),R=M*180/Math.PI;let Y=0,H=0,x=0;Le(t,function(w){var N;const L=o&&((N=w.properties)==null?void 0:N[o])||1,D=ac(ve(w),ve(c));Y+=Math.pow(D.x*Math.cos(M)-D.y*Math.sin(M),2)*L,H+=Math.pow(D.x*Math.sin(M)+D.y*Math.cos(M),2)*L,x+=L});const S=Math.sqrt(2*Y/x),b=Math.sqrt(2*H/x),C=el(c,S,b,{units:"degrees",angle:R,steps:s,properties:l}),A=Dl(t,he([C])),q={meanCenterCoordinates:ve(c),semiMajorAxis:S,semiMinorAxis:b,numberOfFeatures:h,angle:R,percentageWithinEllipse:100*rr(A).length/h};return C.properties=(i=C.properties)!=null?i:{},C.properties.standardDeviationalEllipse=q,C}function ac(t,e){return{x:t[0]-e[0],y:t[1]-e[1]}}function Jy(t,e,i,s){return t=je(t),e=je(e),Le(t,function(o){o.properties||(o.properties={}),Le(e,function(l){o.properties&&l.properties&&o.properties[s]===void 0&&xe(o,l)&&(o.properties[s]=l.properties[i])})}),t}var Di={exports:{}},uc;function Qy(){if(uc)return Di.exports;uc=1,Di.exports=t,Di.exports.default=t;function t(k,T,P){P=P||2;var G=T&&T.length,B=G?T[0]*P:k.length,Z=e(k,0,B,P,!0),K=[];if(!Z||Z.next===Z.prev)return K;var ee,j,te,re,se,W,ge;if(G&&(Z=g(k,T,Z,P)),k.length>80*P){ee=te=k[0],j=re=k[1];for(var le=P;le<B;le+=P)se=k[le],W=k[le+1],se<ee&&(ee=se),W<j&&(j=W),se>te&&(te=se),W>re&&(re=W);ge=Math.max(te-ee,re-j),ge=ge!==0?32767/ge:0}return s(Z,K,P,ee,j,ge,0),K}function e(k,T,P,G,B){var Z,K;if(B===V(k,T,P,G)>0)for(Z=T;Z<P;Z+=G)K=F(Z,k[Z],k[Z+1],K);else for(Z=P-G;Z>=T;Z-=G)K=F(Z,k[Z],k[Z+1],K);return K&&b(K,K.next)&&(X(K),K=K.next),K}function i(k,T){if(!k)return k;T||(T=k);var P=k,G;do if(G=!1,!P.steiner&&(b(P,P.next)||S(P.prev,P,P.next)===0)){if(X(P),P=T=P.prev,P===P.next)break;G=!0}else P=P.next;while(G||P!==T);return T}function s(k,T,P,G,B,Z,K){if(k){!K&&Z&&E(k,G,B,Z);for(var ee=k,j,te;k.prev!==k.next;){if(j=k.prev,te=k.next,Z?l(k,G,B,Z):o(k)){T.push(j.i/P|0),T.push(k.i/P|0),T.push(te.i/P|0),X(k),k=te.next,ee=te.next;continue}if(k=te,k===ee){K?K===1?(k=h(i(k),T,P),s(k,T,P,G,B,Z,2)):K===2&&c(k,T,P,G,B,Z):s(i(k),T,P,G,B,Z,1);break}}}}function o(k){var T=k.prev,P=k,G=k.next;if(S(T,P,G)>=0)return!1;for(var B=T.x,Z=P.x,K=G.x,ee=T.y,j=P.y,te=G.y,re=B<Z?B<K?B:K:Z<K?Z:K,se=ee<j?ee<te?ee:te:j<te?j:te,W=B>Z?B>K?B:K:Z>K?Z:K,ge=ee>j?ee>te?ee:te:j>te?j:te,le=G.next;le!==T;){if(le.x>=re&&le.x<=W&&le.y>=se&&le.y<=ge&&H(B,ee,Z,j,K,te,le.x,le.y)&&S(le.prev,le,le.next)>=0)return!1;le=le.next}return!0}function l(k,T,P,G){var B=k.prev,Z=k,K=k.next;if(S(B,Z,K)>=0)return!1;for(var ee=B.x,j=Z.x,te=K.x,re=B.y,se=Z.y,W=K.y,ge=ee<j?ee<te?ee:te:j<te?j:te,le=re<se?re<W?re:W:se<W?se:W,oe=ee>j?ee>te?ee:te:j>te?j:te,$=re>se?re>W?re:W:se>W?se:W,Me=R(ge,le,T,P,G),Se=R(oe,$,T,P,G),ue=k.prevZ,ke=k.nextZ;ue&&ue.z>=Me&&ke&&ke.z<=Se;){if(ue.x>=ge&&ue.x<=oe&&ue.y>=le&&ue.y<=$&&ue!==B&&ue!==K&&H(ee,re,j,se,te,W,ue.x,ue.y)&&S(ue.prev,ue,ue.next)>=0||(ue=ue.prevZ,ke.x>=ge&&ke.x<=oe&&ke.y>=le&&ke.y<=$&&ke!==B&&ke!==K&&H(ee,re,j,se,te,W,ke.x,ke.y)&&S(ke.prev,ke,ke.next)>=0))return!1;ke=ke.nextZ}for(;ue&&ue.z>=Me;){if(ue.x>=ge&&ue.x<=oe&&ue.y>=le&&ue.y<=$&&ue!==B&&ue!==K&&H(ee,re,j,se,te,W,ue.x,ue.y)&&S(ue.prev,ue,ue.next)>=0)return!1;ue=ue.prevZ}for(;ke&&ke.z<=Se;){if(ke.x>=ge&&ke.x<=oe&&ke.y>=le&&ke.y<=$&&ke!==B&&ke!==K&&H(ee,re,j,se,te,W,ke.x,ke.y)&&S(ke.prev,ke,ke.next)>=0)return!1;ke=ke.nextZ}return!0}function h(k,T,P){var G=k;do{var B=G.prev,Z=G.next.next;!b(B,Z)&&C(B,G,G.next,Z)&&N(B,Z)&&N(Z,B)&&(T.push(B.i/P|0),T.push(G.i/P|0),T.push(Z.i/P|0),X(G),X(G.next),G=k=Z),G=G.next}while(G!==k);return i(G)}function c(k,T,P,G,B,Z){var K=k;do{for(var ee=K.next.next;ee!==K.prev;){if(K.i!==ee.i&&x(K,ee)){var j=D(K,ee);K=i(K,K.next),j=i(j,j.next),s(K,T,P,G,B,Z,0),s(j,T,P,G,B,Z,0);return}ee=ee.next}K=K.next}while(K!==k)}function g(k,T,P,G){var B=[],Z,K,ee,j,te;for(Z=0,K=T.length;Z<K;Z++)ee=T[Z]*G,j=Z<K-1?T[Z+1]*G:k.length,te=e(k,ee,j,G,!1),te===te.next&&(te.steiner=!0),B.push(Y(te));for(B.sort(d),Z=0;Z<B.length;Z++)P=y(B[Z],P);return P}function d(k,T){return k.x-T.x}function y(k,T){var P=v(k,T);if(!P)return T;var G=D(P,k);return i(G,G.next),i(P,P.next)}function v(k,T){var P=T,G=k.x,B=k.y,Z=-1/0,K;do{if(B<=P.y&&B>=P.next.y&&P.next.y!==P.y){var ee=P.x+(B-P.y)*(P.next.x-P.x)/(P.next.y-P.y);if(ee<=G&&ee>Z&&(Z=ee,K=P.x<P.next.x?P:P.next,ee===G))return K}P=P.next}while(P!==T);if(!K)return null;var j=K,te=K.x,re=K.y,se=1/0,W;P=K;do G>=P.x&&P.x>=te&&G!==P.x&&H(B<re?G:Z,B,te,re,B<re?Z:G,B,P.x,P.y)&&(W=Math.abs(B-P.y)/(G-P.x),N(P,k)&&(W<se||W===se&&(P.x>K.x||P.x===K.x&&_(K,P)))&&(K=P,se=W)),P=P.next;while(P!==j);return K}function _(k,T){return S(k.prev,k,T.prev)<0&&S(T.next,k,k.next)<0}function E(k,T,P,G){var B=k;do B.z===0&&(B.z=R(B.x,B.y,T,P,G)),B.prevZ=B.prev,B.nextZ=B.next,B=B.next;while(B!==k);B.prevZ.nextZ=null,B.prevZ=null,M(B)}function M(k){var T,P,G,B,Z,K,ee,j,te=1;do{for(P=k,k=null,Z=null,K=0;P;){for(K++,G=P,ee=0,T=0;T<te&&(ee++,G=G.nextZ,!!G);T++);for(j=te;ee>0||j>0&&G;)ee!==0&&(j===0||!G||P.z<=G.z)?(B=P,P=P.nextZ,ee--):(B=G,G=G.nextZ,j--),Z?Z.nextZ=B:k=B,B.prevZ=Z,Z=B;P=G}Z.nextZ=null,te*=2}while(K>1);return k}function R(k,T,P,G,B){return k=(k-P)*B|0,T=(T-G)*B|0,k=(k|k<<8)&16711935,k=(k|k<<4)&252645135,k=(k|k<<2)&858993459,k=(k|k<<1)&1431655765,T=(T|T<<8)&16711935,T=(T|T<<4)&252645135,T=(T|T<<2)&858993459,T=(T|T<<1)&1431655765,k|T<<1}function Y(k){var T=k,P=k;do(T.x<P.x||T.x===P.x&&T.y<P.y)&&(P=T),T=T.next;while(T!==k);return P}function H(k,T,P,G,B,Z,K,ee){return(B-K)*(T-ee)>=(k-K)*(Z-ee)&&(k-K)*(G-ee)>=(P-K)*(T-ee)&&(P-K)*(Z-ee)>=(B-K)*(G-ee)}function x(k,T){return k.next.i!==T.i&&k.prev.i!==T.i&&!w(k,T)&&(N(k,T)&&N(T,k)&&L(k,T)&&(S(k.prev,k,T.prev)||S(k,T.prev,T))||b(k,T)&&S(k.prev,k,k.next)>0&&S(T.prev,T,T.next)>0)}function S(k,T,P){return(T.y-k.y)*(P.x-T.x)-(T.x-k.x)*(P.y-T.y)}function b(k,T){return k.x===T.x&&k.y===T.y}function C(k,T,P,G){var B=q(S(k,T,P)),Z=q(S(k,T,G)),K=q(S(P,G,k)),ee=q(S(P,G,T));return!!(B!==Z&&K!==ee||B===0&&A(k,P,T)||Z===0&&A(k,G,T)||K===0&&A(P,k,G)||ee===0&&A(P,T,G))}function A(k,T,P){return T.x<=Math.max(k.x,P.x)&&T.x>=Math.min(k.x,P.x)&&T.y<=Math.max(k.y,P.y)&&T.y>=Math.min(k.y,P.y)}function q(k){return k>0?1:k<0?-1:0}function w(k,T){var P=k;do{if(P.i!==k.i&&P.next.i!==k.i&&P.i!==T.i&&P.next.i!==T.i&&C(P,P.next,k,T))return!0;P=P.next}while(P!==k);return!1}function N(k,T){return S(k.prev,k,k.next)<0?S(k,T,k.next)>=0&&S(k,k.prev,T)>=0:S(k,T,k.prev)<0||S(k,k.next,T)<0}function L(k,T){var P=k,G=!1,B=(k.x+T.x)/2,Z=(k.y+T.y)/2;do P.y>Z!=P.next.y>Z&&P.next.y!==P.y&&B<(P.next.x-P.x)*(Z-P.y)/(P.next.y-P.y)+P.x&&(G=!G),P=P.next;while(P!==k);return G}function D(k,T){var P=new z(k.i,k.x,k.y),G=new z(T.i,T.x,T.y),B=k.next,Z=T.prev;return k.next=T,T.prev=k,P.next=B,B.prev=P,G.next=P,P.prev=G,Z.next=G,G.prev=Z,G}function F(k,T,P,G){var B=new z(k,T,P);return G?(B.next=G.next,B.prev=G,G.next.prev=B,G.next=B):(B.prev=B,B.next=B),B}function X(k){k.next.prev=k.prev,k.prev.next=k.next,k.prevZ&&(k.prevZ.nextZ=k.nextZ),k.nextZ&&(k.nextZ.prevZ=k.prevZ)}function z(k,T,P){this.i=k,this.x=T,this.y=P,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}t.deviation=function(k,T,P,G){var B=T&&T.length,Z=B?T[0]*P:k.length,K=Math.abs(V(k,0,Z,P));if(B)for(var ee=0,j=T.length;ee<j;ee++){var te=T[ee]*P,re=ee<j-1?T[ee+1]*P:k.length;K-=Math.abs(V(k,te,re,P))}var se=0;for(ee=0;ee<G.length;ee+=3){var W=G[ee]*P,ge=G[ee+1]*P,le=G[ee+2]*P;se+=Math.abs((k[W]-k[le])*(k[ge+1]-k[W+1])-(k[W]-k[ge])*(k[le+1]-k[W+1]))}return K===0&&se===0?0:Math.abs((se-K)/K)};function V(k,T,P,G){for(var B=0,Z=T,K=P-G;Z<P;Z+=G)B+=(k[K]-k[Z])*(k[Z+1]+k[K+1]),K=Z;return B}return t.flatten=function(k){for(var T=k[0][0].length,P={vertices:[],holes:[],dimensions:T},G=0,B=0;B<k.length;B++){for(var Z=0;Z<k[B].length;Z++)for(var K=0;K<T;K++)P.vertices.push(k[B][Z][K]);B>0&&(G+=k[B-1].length,P.holes.push(G))}return P},Di.exports}var jy=Qy();const em=gr(jy);function tm(t){if(!t.geometry||t.geometry.type!=="Polygon"&&t.geometry.type!=="MultiPolygon")throw new Error("input must be a Polygon or MultiPolygon");const e={type:"FeatureCollection",features:[]};return t.geometry.type==="Polygon"?e.features=lc(t.geometry.coordinates):t.geometry.coordinates.forEach(function(i){e.features=e.features.concat(lc(i))}),e}function lc(t){const e=nm(t),i=2,s=em(e.vertices,e.holes,i),o=[],l=[];s.forEach(function(c,g){const d=s[g];l.push([e.vertices[d*i],e.vertices[d*i+1]])});for(var h=0;h<l.length;h+=3){const c=l.slice(h,h+3);c.push(l[h]),o.push(ye([c]))}return o}function nm(t){const e=t[0][0].length,i={vertices:[],holes:[],dimensions:e};let s=0;for(let o=0;o<t.length;o++){for(let l=0;l<t[o].length;l++)for(let h=0;h<e;h++)i.vertices.push(t[o][l][h]);o>0&&(s+=t[o-1].length,i.holes.push(s))}return i}function rm(t,e,i,s){if(s=s||{},!Ce(s))throw new Error("options is invalid");var o=s.units,l=s.zTranslation,h=s.mutate;if(!t)throw new Error("geojson is required");if(e==null||isNaN(e))throw new Error("distance is required");if(l&&typeof l!="number"&&isNaN(l))throw new Error("zTranslation is not a number");if(l=l!==void 0?l:0,e===0&&l===0)return t;if(i==null||isNaN(i))throw new Error("direction is required");return e<0&&(e=-e,i=i+180),(h===!1||h===void 0)&&(t=je(t)),Xe(t,function(c){var g=ve(Ni(c,e,i,{units:o}));c[0]=g[0],c[1]=g[1],l&&c.length===3&&(c[2]+=l)}),t}function im(t,e={}){const i=[];if(rt(t,o=>{i.push(o.coordinates)}),i.length<2)throw new Error("Must have at least 2 geometries");const s=un(i[0],...i.slice(1));return s.length===0?null:s.length===1?ye(s[0],e.properties):ft(s,e.properties)}function sm(t,e,i){if(t.geometry.type!=="Polygon")throw new Error("The input feature must be a Polygon");i===void 0&&(i=1);var s=t.geometry.coordinates,o=[],l={};if(i){for(var h=[],c=0;c<s.length;c++)for(var g=0;g<s[c].length-1;g++)h.push(Y(c,g));var d=new dt;d.load(h)}for(var y=0;y<s.length;y++)for(var v=0;v<s[y].length-1;v++)if(i){var _=d.search(Y(y,v));_.forEach(function(H){var x=H.ring,S=H.edge;R(y,v,x,S)})}else for(var E=0;E<s.length;E++)for(var M=0;M<s[E].length-1;M++)R(y,v,E,M);return e||(o={type:"Feature",geometry:{type:"MultiPoint",coordinates:o}}),o;function R(H,x,S,b){var C=s[H][x],A=s[H][x+1],q=s[S][b],w=s[S][b+1],N=om(C,A,q,w);if(N!==null){var L,D;if(A[0]!==C[0]?L=(N[0]-C[0])/(A[0]-C[0]):L=(N[1]-C[1])/(A[1]-C[1]),w[0]!==q[0]?D=(N[0]-q[0])/(w[0]-q[0]):D=(N[1]-q[1])/(w[1]-q[1]),!(L>=1||L<=0||D>=1||D<=0)){var F=N,X=!l[F];X&&(l[F]=!0),e?o.push(e(N,H,x,C,A,L,S,b,q,w,D,X)):o.push(N)}}}function Y(H,x){var S=s[H][x],b=s[H][x+1],C,A,q,w;return S[0]<b[0]?(C=S[0],A=b[0]):(C=b[0],A=S[0]),S[1]<b[1]?(q=S[1],w=b[1]):(q=b[1],w=S[1]),{minX:C,minY:q,maxX:A,maxY:w,ring:H,edge:x}}}function om(t,e,i,s){if(Mr(t,i)||Mr(t,s)||Mr(e,i)||Mr(s,i))return null;var o=t[0],l=t[1],h=e[0],c=e[1],g=i[0],d=i[1],y=s[0],v=s[1],_=(o-h)*(d-v)-(l-c)*(g-y);if(_===0)return null;var E=((o*c-l*h)*(g-y)-(o-h)*(g*v-d*y))/_,M=((o*c-l*h)*(d-v)-(l-c)*(g*v-d*y))/_;return[E,M]}function Mr(t,e){if(!t||!e||t.length!==e.length)return!1;for(var i=0,s=t.length;i<s;i++)if(t[i]instanceof Array&&e[i]instanceof Array){if(!Mr(t[i],e[i]))return!1}else if(t[i]!==e[i])return!1;return!0}function am(t){if(t.type!="Feature")throw new Error("The input must a geojson object of type Feature");if(t.geometry===void 0||t.geometry==null)throw new Error("The input must a geojson object with a non-empty geometry");if(t.geometry.type!="Polygon")throw new Error("The input must be a geojson Polygon");for(var e=t.geometry.coordinates.length,i=[],x=0;x<e;x++){var s=t.geometry.coordinates[x];Sr(s[0],s[s.length-1])||s.push(s[0]);for(var o=0;o<s.length-1;o++)i.push(s[o])}if(!lm(i))throw new Error("The input polygon may not have duplicate vertices (except for the first and last vertex of each ring)");var l=i.length,h=sm(t,function(j,te,re,se,W,ge,le,oe,$,Me,Se,ue){return[j,te,re,se,W,ge,le,oe,$,Me,Se,ue]}),c=h.length;if(c==0){for(var q=[],x=0;x<e;x++)q.push(ye([t.geometry.coordinates[x]],{parent:-1,winding:um(t.geometry.coordinates[x])}));var G=he(q);return B(),Z(),G}for(var g=[],d=[],x=0;x<e;x++){g.push([]);for(var o=0;o<t.geometry.coordinates[x].length-1;o++)g[x].push([new cc(t.geometry.coordinates[x][Yn(o+1,t.geometry.coordinates[x].length-1)],1,[x,o],[x,Yn(o+1,t.geometry.coordinates[x].length-1)],void 0)]),d.push(new hc(t.geometry.coordinates[x][o],[x,Yn(o-1,t.geometry.coordinates[x].length-1)],[x,o],void 0,void 0,!1,!0))}for(var x=0;x<c;x++)g[h[x][1]][h[x][2]].push(new cc(h[x][0],h[x][5],[h[x][1],h[x][2]],[h[x][6],h[x][7]],void 0)),h[x][11]&&d.push(new hc(h[x][0],[h[x][1],h[x][2]],[h[x][6],h[x][7]],void 0,void 0,!0,!0));for(var y=d.length,x=0;x<g.length;x++)for(var o=0;o<g[x].length;o++)g[x][o].sort(function(te,re){return te.param<re.param?-1:1});for(var v=[],x=0;x<y;x++)v.push({minX:d[x].coord[0],minY:d[x].coord[1],maxX:d[x].coord[0],maxY:d[x].coord[1],index:x});var _=new dt;_.load(v);for(var x=0;x<g.length;x++)for(var o=0;o<g[x].length;o++)for(var E=0;E<g[x][o].length;E++){var M;E==g[x][o].length-1?M=g[x][Yn(o+1,t.geometry.coordinates[x].length-1)][0].coord:M=g[x][o][E+1].coord;var R=_.search({minX:M[0],minY:M[1],maxX:M[0],maxY:M[1]})[0];g[x][o][E].nxtIsectAlongEdgeIn=R.index}for(var x=0;x<g.length;x++)for(var o=0;o<g[x].length;o++)for(var E=0;E<g[x][o].length;E++){var M=g[x][o][E].coord,R=_.search({minX:M[0],minY:M[1],maxX:M[0],maxY:M[1]})[0],Y=R.index;Y<l?d[Y].nxtIsectAlongRingAndEdge2=g[x][o][E].nxtIsectAlongEdgeIn:Sr(d[Y].ringAndEdge1,g[x][o][E].ringAndEdgeIn)?d[Y].nxtIsectAlongRingAndEdge1=g[x][o][E].nxtIsectAlongEdgeIn:d[Y].nxtIsectAlongRingAndEdge2=g[x][o][E].nxtIsectAlongEdgeIn}for(var H=[],x=0,o=0;o<e;o++){for(var S=x,E=0;E<t.geometry.coordinates[o].length-1;E++)d[x].coord[0]<d[S].coord[0]&&(S=x),x++;for(var b=d[S].nxtIsectAlongRingAndEdge2,E=0;E<d.length;E++)if(d[E].nxtIsectAlongRingAndEdge1==S||d[E].nxtIsectAlongRingAndEdge2==S){var C=E;break}var A=Fi([d[C].coord,d[S].coord,d[b].coord],!0)?1:-1;H.push({isect:S,parent:-1,winding:A})}H.sort(function(ee,j){return d[ee.isect].coord>d[j.isect].coord?-1:1});for(var q=[];H.length>0;){var w=H.pop(),N=w.isect,L=w.parent,D=w.winding,F=q.length,X=[d[N].coord],z=N;if(d[N].ringAndEdge1Walkable)var V=d[N].ringAndEdge1,k=d[N].nxtIsectAlongRingAndEdge1;else var V=d[N].ringAndEdge2,k=d[N].nxtIsectAlongRingAndEdge2;for(;!Sr(d[N].coord,d[k].coord);){X.push(d[k].coord);for(var T=void 0,x=0;x<H.length;x++)if(H[x].isect==k){T=x;break}if(T!=null&&H.splice(T,1),Sr(V,d[k].ringAndEdge1)){if(V=d[k].ringAndEdge2,d[k].ringAndEdge2Walkable=!1,d[k].ringAndEdge1Walkable){var P={isect:k};Fi([d[z].coord,d[k].coord,d[d[k].nxtIsectAlongRingAndEdge2].coord],D==1)?(P.parent=L,P.winding=-D):(P.parent=F,P.winding=D),H.push(P)}z=k,k=d[k].nxtIsectAlongRingAndEdge2}else{if(V=d[k].ringAndEdge1,d[k].ringAndEdge1Walkable=!1,d[k].ringAndEdge2Walkable){var P={isect:k};Fi([d[z].coord,d[k].coord,d[d[k].nxtIsectAlongRingAndEdge1].coord],D==1)?(P.parent=L,P.winding=-D):(P.parent=F,P.winding=D),H.push(P)}z=k,k=d[k].nxtIsectAlongRingAndEdge1}}X.push(d[k].coord),q.push(ye([X],{index:F,parent:L,winding:D,netWinding:void 0}))}var G=he(q);B(),Z();function B(){for(var ee=[],j=0;j<G.features.length;j++)G.features[j].properties.parent==-1&&ee.push(j);if(ee.length>1)for(var j=0;j<ee.length;j++){for(var te=-1,re=1/0,se=0;se<G.features.length;se++)ee[j]!=se&&xe(G.features[ee[j]].geometry.coordinates[0][0],G.features[se],{ignoreBoundary:!0})&&ir(G.features[se])<re&&(te=se);G.features[ee[j]].properties.parent=te}}function Z(){for(var ee=0;ee<G.features.length;ee++)if(G.features[ee].properties.parent==-1){var j=G.features[ee].properties.winding;G.features[ee].properties.netWinding=j,K(ee,j)}}function K(ee,j){for(var te=0;te<G.features.length;te++)if(G.features[te].properties.parent==ee){var re=j+G.features[te].properties.winding;G.features[te].properties.netWinding=re,K(te,re)}}return G}var cc=function(t,e,i,s,o){this.coord=t,this.param=e,this.ringAndEdgeIn=i,this.ringAndEdgeOut=s,this.nxtIsectAlongEdgeIn=o},hc=function(t,e,i,s,o,l,h){this.coord=t,this.ringAndEdge1=e,this.ringAndEdge2=i,this.nxtIsectAlongRingAndEdge1=s,this.nxtIsectAlongRingAndEdge2=o,this.ringAndEdge1Walkable=l,this.ringAndEdge2Walkable=h};function Fi(t,e){if(typeof e>"u"&&(e=!0),t.length!=3)throw new Error("This function requires an array of three points [x,y]");var i=(t[1][0]-t[0][0])*(t[2][1]-t[0][1])-(t[1][1]-t[0][1])*(t[2][0]-t[0][0]);return i>=0==e}function um(t){for(var e=0,i=0;i<t.length-1;i++)t[i][0]<t[e][0]&&(e=i);if(Fi([t[Yn(e-1,t.length-1)],t[e],t[Yn(e+1,t.length-1)]],!0))var s=1;else var s=-1;return s}function Sr(t,e){if(!t||!e||t.length!=e.length)return!1;for(var i=0,s=t.length;i<s;i++)if(t[i]instanceof Array&&e[i]instanceof Array){if(!Sr(t[i],e[i]))return!1}else if(t[i]!=e[i])return!1;return!0}function Yn(t,e){return(t%e+e)%e}function lm(t){for(var e={},i=1,s=0,o=t.length;s<o;++s){if(Object.prototype.hasOwnProperty.call(e,t[s])){i=0;break}e[t[s]]=1}return i}function cm(t){var e=[];return Qe(t,function(i){i.geometry.type==="Polygon"&&Le(am(i),function(s){e.push(ye(s.geometry.coordinates,i.properties))})}),he(e)}function fc(t){return function(){return t}}function hm(t){return t[0]}function fm(t){return t[1]}function qi(){this._=null}function Bi(t){t.U=t.C=t.L=t.R=t.P=t.N=null}qi.prototype={constructor:qi,insert:function(t,e){var i,s,o;if(t){if(e.P=t,e.N=t.N,t.N&&(t.N.P=e),t.N=e,t.R){for(t=t.R;t.L;)t=t.L;t.L=e}else t.R=e;i=t}else this._?(t=gc(this._),e.P=null,e.N=t,t.P=t.L=e,i=t):(e.P=e.N=null,this._=e,i=null);for(e.L=e.R=null,e.U=i,e.C=!0,t=e;i&&i.C;)s=i.U,i===s.L?(o=s.R,o&&o.C?(i.C=o.C=!1,s.C=!0,t=s):(t===i.R&&(Pr(this,i),t=i,i=t.U),i.C=!1,s.C=!0,Lr(this,s))):(o=s.L,o&&o.C?(i.C=o.C=!1,s.C=!0,t=s):(t===i.L&&(Lr(this,i),t=i,i=t.U),i.C=!1,s.C=!0,Pr(this,s))),i=t.U;this._.C=!1},remove:function(t){t.N&&(t.N.P=t.P),t.P&&(t.P.N=t.N),t.N=t.P=null;var e=t.U,i,s=t.L,o=t.R,l,h;if(s?o?l=gc(o):l=s:l=o,e?e.L===t?e.L=l:e.R=l:this._=l,s&&o?(h=l.C,l.C=t.C,l.L=s,s.U=l,l!==o?(e=l.U,l.U=t.U,t=l.R,e.L=t,l.R=o,o.U=l):(l.U=e,e=l,t=l.R)):(h=t.C,t=l),t&&(t.U=e),!h){if(t&&t.C){t.C=!1;return}do{if(t===this._)break;if(t===e.L){if(i=e.R,i.C&&(i.C=!1,e.C=!0,Pr(this,e),i=e.R),i.L&&i.L.C||i.R&&i.R.C){(!i.R||!i.R.C)&&(i.L.C=!1,i.C=!0,Lr(this,i),i=e.R),i.C=e.C,e.C=i.R.C=!1,Pr(this,e),t=this._;break}}else if(i=e.L,i.C&&(i.C=!1,e.C=!0,Lr(this,e),i=e.L),i.L&&i.L.C||i.R&&i.R.C){(!i.L||!i.L.C)&&(i.R.C=!1,i.C=!0,Pr(this,i),i=e.L),i.C=e.C,e.C=i.L.C=!1,Lr(this,e),t=this._;break}i.C=!0,t=e,e=e.U}while(!t.C);t&&(t.C=!1)}}};function Pr(t,e){var i=e,s=e.R,o=i.U;o?o.L===i?o.L=s:o.R=s:t._=s,s.U=o,i.U=s,i.R=s.L,i.R&&(i.R.U=i),s.L=i}function Lr(t,e){var i=e,s=e.L,o=i.U;o?o.L===i?o.L=s:o.R=s:t._=s,s.U=o,i.U=s,i.L=s.R,i.L&&(i.L.U=i),s.R=i}function gc(t){for(;t.L;)t=t.L;return t}function br(t,e,i,s){var o=[null,null],l=at.push(o)-1;return o.left=t,o.right=e,i&&Gi(o,t,e,i),s&&Gi(o,e,t,s),yt[t.index].halfedges.push(l),yt[e.index].halfedges.push(l),o}function Cr(t,e,i){var s=[e,i];return s.left=t,s}function Gi(t,e,i,s){!t[0]&&!t[1]?(t[0]=s,t.left=e,t.right=i):t.left===i?t[1]=s:t[0]=s}function gm(t,e,i,s,o){var l=t[0],h=t[1],c=l[0],g=l[1],d=h[0],y=h[1],v=0,_=1,E=d-c,M=y-g,R;if(R=e-c,!(!E&&R>0)){if(R/=E,E<0){if(R<v)return;R<_&&(_=R)}else if(E>0){if(R>_)return;R>v&&(v=R)}if(R=s-c,!(!E&&R<0)){if(R/=E,E<0){if(R>_)return;R>v&&(v=R)}else if(E>0){if(R<v)return;R<_&&(_=R)}if(R=i-g,!(!M&&R>0)){if(R/=M,M<0){if(R<v)return;R<_&&(_=R)}else if(M>0){if(R>_)return;R>v&&(v=R)}if(R=o-g,!(!M&&R<0)){if(R/=M,M<0){if(R>_)return;R>v&&(v=R)}else if(M>0){if(R<v)return;R<_&&(_=R)}return!(v>0)&&!(_<1)||(v>0&&(t[0]=[c+v*E,g+v*M]),_<1&&(t[1]=[c+_*E,g+_*M])),!0}}}}}function dm(t,e,i,s,o){var l=t[1];if(l)return!0;var h=t[0],c=t.left,g=t.right,d=c[0],y=c[1],v=g[0],_=g[1],E=(d+v)/2,M=(y+_)/2,R,Y;if(_===y){if(E<e||E>=s)return;if(d>v){if(!h)h=[E,i];else if(h[1]>=o)return;l=[E,o]}else{if(!h)h=[E,o];else if(h[1]<i)return;l=[E,i]}}else if(R=(d-v)/(_-y),Y=M-R*E,R<-1||R>1)if(d>v){if(!h)h=[(i-Y)/R,i];else if(h[1]>=o)return;l=[(o-Y)/R,o]}else{if(!h)h=[(o-Y)/R,o];else if(h[1]<i)return;l=[(i-Y)/R,i]}else if(y<_){if(!h)h=[e,R*e+Y];else if(h[0]>=s)return;l=[s,R*s+Y]}else{if(!h)h=[s,R*s+Y];else if(h[0]<e)return;l=[e,R*e+Y]}return t[0]=h,t[1]=l,!0}function vm(t,e,i,s){for(var o=at.length,l;o--;)(!dm(l=at[o],t,e,i,s)||!gm(l,t,e,i,s)||!(Math.abs(l[0][0]-l[1][0])>Ge||Math.abs(l[0][1]-l[1][1])>Ge))&&delete at[o]}function ym(t){return yt[t.index]={site:t,halfedges:[]}}function mm(t,e){var i=t.site,s=e.left,o=e.right;return i===o&&(o=s,s=i),o?Math.atan2(o[1]-s[1],o[0]-s[0]):(i===s?(s=e[1],o=e[0]):(s=e[0],o=e[1]),Math.atan2(s[0]-o[0],o[1]-s[1]))}function dc(t,e){return e[+(e.left!==t.site)]}function pm(t,e){return e[+(e.left===t.site)]}function _m(){for(var t=0,e=yt.length,i,s,o,l;t<e;++t)if((i=yt[t])&&(l=(s=i.halfedges).length)){var h=new Array(l),c=new Array(l);for(o=0;o<l;++o)h[o]=o,c[o]=mm(i,at[s[o]]);for(h.sort(function(g,d){return c[d]-c[g]}),o=0;o<l;++o)c[o]=s[h[o]];for(o=0;o<l;++o)s[o]=c[o]}}function xm(t,e,i,s){var o=yt.length,l,h,c,g,d,y,v,_,E,M,R,Y,H=!0;for(l=0;l<o;++l)if(h=yt[l]){for(c=h.site,d=h.halfedges,g=d.length;g--;)at[d[g]]||d.splice(g,1);for(g=0,y=d.length;g<y;)M=pm(h,at[d[g]]),R=M[0],Y=M[1],v=dc(h,at[d[++g%y]]),_=v[0],E=v[1],(Math.abs(R-_)>Ge||Math.abs(Y-E)>Ge)&&(d.splice(g,0,at.push(Cr(c,M,Math.abs(R-t)<Ge&&s-Y>Ge?[t,Math.abs(_-t)<Ge?E:s]:Math.abs(Y-s)<Ge&&i-R>Ge?[Math.abs(E-s)<Ge?_:i,s]:Math.abs(R-i)<Ge&&Y-e>Ge?[i,Math.abs(_-i)<Ge?E:e]:Math.abs(Y-e)<Ge&&R-t>Ge?[Math.abs(E-e)<Ge?_:t,e]:null))-1),++y);y&&(H=!1)}if(H){var x,S,b,C=1/0;for(l=0,H=null;l<o;++l)(h=yt[l])&&(c=h.site,x=c[0]-t,S=c[1]-e,b=x*x+S*S,b<C&&(C=b,H=h));if(H){var A=[t,e],q=[t,s],w=[i,s],N=[i,e];H.halfedges.push(at.push(Cr(c=H.site,A,q))-1,at.push(Cr(c,q,w))-1,at.push(Cr(c,w,N))-1,at.push(Cr(c,N,A))-1)}}for(l=0;l<o;++l)(h=yt[l])&&(h.halfedges.length||delete yt[l])}var vc=[],fo;function Em(){Bi(this),this.x=this.y=this.arc=this.site=this.cy=null}function zn(t){var e=t.P,i=t.N;if(!(!e||!i)){var s=e.site,o=t.site,l=i.site;if(s!==l){var h=o[0],c=o[1],g=s[0]-h,d=s[1]-c,y=l[0]-h,v=l[1]-c,_=2*(g*v-d*y);if(!(_>=-1e-12)){var E=g*g+d*d,M=y*y+v*v,R=(v*E-d*M)/_,Y=(g*M-y*E)/_,H=vc.pop()||new Em;H.arc=t,H.site=o,H.x=R+h,H.y=(H.cy=Y+c)+Math.sqrt(R*R+Y*Y),t.circle=H;for(var x=null,S=Tr._;S;)if(H.y<S.y||H.y===S.y&&H.x<=S.x)if(S.L)S=S.L;else{x=S.P;break}else if(S.R)S=S.R;else{x=S;break}Tr.insert(x,H),x||(fo=H)}}}}function Xn(t){var e=t.circle;e&&(e.P||(fo=e.N),Tr.remove(e),vc.push(e),Bi(e),t.circle=null)}var yc=[];function wm(){Bi(this),this.edge=this.site=this.circle=null}function mc(t){var e=yc.pop()||new wm;return e.site=t,e}function go(t){Xn(t),Un.remove(t),yc.push(t),Bi(t)}function km(t){var e=t.circle,i=e.x,s=e.cy,o=[i,s],l=t.P,h=t.N,c=[t];go(t);for(var g=l;g.circle&&Math.abs(i-g.circle.x)<Ge&&Math.abs(s-g.circle.cy)<Ge;)l=g.P,c.unshift(g),go(g),g=l;c.unshift(g),Xn(g);for(var d=h;d.circle&&Math.abs(i-d.circle.x)<Ge&&Math.abs(s-d.circle.cy)<Ge;)h=d.N,c.push(d),go(d),d=h;c.push(d),Xn(d);var y=c.length,v;for(v=1;v<y;++v)d=c[v],g=c[v-1],Gi(d.edge,g.site,d.site,o);g=c[0],d=c[y-1],d.edge=br(g.site,d.site,null,o),zn(g),zn(d)}function Im(t){for(var e=t[0],i=t[1],s,o,l,h,c=Un._;c;)if(l=pc(c,i)-e,l>Ge)c=c.L;else if(h=e-Nm(c,i),h>Ge){if(!c.R){s=c;break}c=c.R}else{l>-Ge?(s=c.P,o=c):h>-Ge?(s=c,o=c.N):s=o=c;break}ym(t);var g=mc(t);if(Un.insert(s,g),!(!s&&!o)){if(s===o){Xn(s),o=mc(s.site),Un.insert(g,o),g.edge=o.edge=br(s.site,g.site),zn(s),zn(o);return}if(!o){g.edge=br(s.site,g.site);return}Xn(s),Xn(o);var d=s.site,y=d[0],v=d[1],_=t[0]-y,E=t[1]-v,M=o.site,R=M[0]-y,Y=M[1]-v,H=2*(_*Y-E*R),x=_*_+E*E,S=R*R+Y*Y,b=[(Y*x-E*S)/H+y,(_*S-R*x)/H+v];Gi(o.edge,d,M,b),g.edge=br(d,t,null,b),o.edge=br(t,M,null,b),zn(s),zn(o)}}function pc(t,e){var i=t.site,s=i[0],o=i[1],l=o-e;if(!l)return s;var h=t.P;if(!h)return-1/0;i=h.site;var c=i[0],g=i[1],d=g-e;if(!d)return c;var y=c-s,v=1/l-1/d,_=y/d;return v?(-_+Math.sqrt(_*_-2*v*(y*y/(-2*d)-g+d/2+o-l/2)))/v+s:(s+c)/2}function Nm(t,e){var i=t.N;if(i)return pc(i,e);var s=t.site;return s[1]===e?s[0]:1/0}var Ge=1e-6,Un,yt,Tr,at;function Mm(t,e,i){return(t[0]-i[0])*(e[1]-t[1])-(t[0]-e[0])*(i[1]-t[1])}function Sm(t,e){return e[1]-t[1]||e[0]-t[0]}function vo(t,e){var i=t.sort(Sm).pop(),s,o,l;for(at=[],yt=new Array(t.length),Un=new qi,Tr=new qi;;)if(l=fo,i&&(!l||i[1]<l.y||i[1]===l.y&&i[0]<l.x))(i[0]!==s||i[1]!==o)&&(Im(i),s=i[0],o=i[1]),i=t.pop();else if(l)km(l.arc);else break;if(_m(),e){var h=+e[0][0],c=+e[0][1],g=+e[1][0],d=+e[1][1];vm(h,c,g,d),xm(h,c,g,d)}this.edges=at,this.cells=yt,Un=Tr=at=yt=null}vo.prototype={constructor:vo,polygons:function(){var t=this.edges;return this.cells.map(function(e){var i=e.halfedges.map(function(s){return dc(e,t[s])});return i.data=e.site.data,i})},triangles:function(){var t=[],e=this.edges;return this.cells.forEach(function(i,s){if(c=(l=i.halfedges).length)for(var o=i.site,l,h=-1,c,g,d=e[l[c-1]],y=d.left===o?d.right:d.left;++h<c;)g=y,d=e[l[h]],y=d.left===o?d.right:d.left,g&&y&&s<g.index&&s<y.index&&Mm(o,g,y)<0&&t.push([o.data,g.data,y.data])}),t},links:function(){return this.edges.filter(function(t){return t.right}).map(function(t){return{source:t.left.data,target:t.right.data}})},find:function(t,e,i){for(var s=this,o,l=s._found||0,h=s.cells.length,c;!(c=s.cells[l]);)if(++l>=h)return null;var g=t-c.site[0],d=e-c.site[1],y=g*g+d*d;do c=s.cells[o=l],l=null,c.halfedges.forEach(function(v){var _=s.edges[v],E=_.left;if(!((E===c.site||!E)&&!(E=_.right))){var M=t-E[0],R=e-E[1],Y=M*M+R*R;Y<y&&(y=Y,l=E.index)}});while(l!==null);return s._found=o,i==null||y<=i*i?c.site:null}};function Pm(){var t=hm,e=fm,i=null;function s(o){return new vo(o.map(function(l,h){var c=[Math.round(t(l,h,o)/Ge)*Ge,Math.round(e(l,h,o)/Ge)*Ge];return c.index=h,c.data=l,c}),i)}return s.polygons=function(o){return s(o).polygons()},s.links=function(o){return s(o).links()},s.triangles=function(o){return s(o).triangles()},s.x=function(o){return arguments.length?(t=typeof o=="function"?o:fc(+o),s):t},s.y=function(o){return arguments.length?(e=typeof o=="function"?o:fc(+o),s):e},s.extent=function(o){return arguments.length?(i=o==null?null:[[+o[0][0],+o[0][1]],[+o[1][0],+o[1][1]]],s):i&&[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},s.size=function(o){return arguments.length?(i=o==null?null:[[0,0],[+o[0],+o[1]]],s):i&&[i[1][0]-i[0][0],i[1][1]-i[0][1]]},s}function Lm(t){return t=t.slice(),t.push(t[0]),ye([t])}function bm(t,e){if(e=e||{},!Ce(e))throw new Error("options is invalid");const i=e.bbox||[-180,-85,180,85];if(!t)throw new Error("points is required");if(!Array.isArray(i))throw new Error("bbox is invalid");return Ut(t,"Point","points"),he(Pm().x(s=>s.geometry.coordinates[0]).y(s=>s.geometry.coordinates[1]).extent([[i[0],i[1]],[i[2],i[3]]]).polygons(t.features).map(function(s,o){return Object.assign(Lm(s),{properties:vi(t.features[o].properties)})}))}const Cm=Object.freeze(Object.defineProperty({__proto__:null,along:ph,angle:_h,applyFilter:yi,area:ir,areaFactors:Ur,azimuthToBearing:Uo,bbox:Fe,bboxClip:Nh,bboxPolygon:sr,bearing:nn,bearingToAzimuth:Sn,bezierSpline:Lh,booleanClockwise:Hr,booleanConcave:bh,booleanContains:Yh,booleanCrosses:ha,booleanDisjoint:ds,booleanEqual:vf,booleanIntersects:Ea,booleanOverlap:Ff,booleanParallel:qf,booleanPointInPolygon:xe,booleanPointOnLine:we,booleanTouches:Gf,booleanValid:Yf,booleanWithin:Aa,buffer:Lg,center:jr,centerMean:Cs,centerMedian:Cg,centerOfMass:Iu,centroid:Zt,circle:Rs,cleanCoords:dn,clone:je,cloneProperties:vi,clusterEach:Ds,clusterReduce:Pu,clusters:Hg,clustersDbscan:$g,clustersKmeans:Qg,collect:jg,collectionOf:Ut,combine:ed,concave:Ld,containsNumber:ns,convertArea:ts,convertLength:fn,convex:ku,coordAll:rr,coordEach:Xe,coordReduce:rs,createBins:Fs,degreesToRadians:Ze,destination:rn,difference:Jd,dissolve:Qd,distance:Be,distanceWeight:Qu,earthRadius:Ke,ellipse:el,envelope:tl,explode:Mi,factors:Xr,feature:We,featureCollection:he,featureEach:Le,featureOf:nr,featureReduce:ss,filterProperties:Lu,findPoint:Jo,findSegment:Ko,flatten:js,flattenEach:Qe,flattenReduce:Wo,flip:nv,geojsonRbush:Qr,geojsonType:Ho,geomEach:rt,geomReduce:os,geometry:Bo,geometryCollection:es,getCluster:Su,getCoord:Te,getCoords:ve,getGeom:qe,getType:gt,greatCircle:rv,helpers:vh,hexGrid:sl,interpolate:ov,intersect:Ir,invariant:yh,isNumber:Je,isObject:Ce,isobands:fv,isolines:Iv,kinks:Pv,length:ml,lengthToDegrees:Vr,lengthToRadians:Mn,lineArc:pl,lineChunk:bv,lineEach:us,lineIntersect:Rt,lineOffset:qv,lineOverlap:ba,lineReduce:ls,lineSegment:hr,lineSlice:Gv,lineSliceAlong:xl,lineSplit:zv,lineString:Pe,lineStrings:zo,lineToPolygon:Xv,mask:Vv,meta:xh,midpoint:Zv,moranIndex:Wv,multiLineString:tn,multiPoint:jn,multiPolygon:ft,nearestNeighborAnalysis:ny,nearestPoint:Li,nearestPointOnLine:$t,nearestPointToLine:ay,planepoint:ly,point:_e,pointGrid:ol,pointOnFeature:cy,pointToLineDistance:ao,pointToPolygonDistance:lo,points:Go,pointsWithinPolygon:Dl,polygon:ye,polygonSmooth:_y,polygonTangents:wy,polygonToLine:bn,polygonize:py,polygons:Yo,projection:My,propEach:is,propReduce:Zo,propertiesContainsFilter:qs,quadratAnalysis:Sy,radiansToDegrees:Ot,radiansToLength:er,random:Ry,randomLineString:Wl,randomPoint:$l,randomPolygon:Zl,randomPosition:Hl,rectangleGrid:al,rewind:Ay,rhumbBearing:gn,rhumbDestination:Ni,rhumbDistance:Bn,round:Xo,sample:Dy,sector:qy,segmentEach:Vt,segmentReduce:as,shortestPath:Yy,simplify:$y,square:Wy,squareGrid:no,standardDeviationalEllipse:Ky,tag:Jy,tesselate:tm,tin:Ru,toMercator:Yl,toWgs84:zl,transformRotate:ju,transformScale:tc,transformTranslate:rm,triangleGrid:ul,truncate:wl,union:im,unkinkPolygon:cm,validateBBox:tr,validateId:Vo,voronoi:bm},Symbol.toStringTag,{value:"Module"})),Tm={animation:!1,timeline:!1,baseLayerPicker:!1,geocoder:!1,sceneModePicker:!1,homeButton:!1,fullscreenButton:!1,navigationHelpButton:!1,infoBox:!1,selectionIndicator:!1};class Om{viewer;constructor(e,i){this.viewer=new qo.Viewer(e,{...Tm,...i})}destroy(){this.viewer&&this.viewer.destroy()}}const Rm="0.1.0";Tt.Cesium=qo,Tt.Viewer=Om,Tt.turf=Cm,Tt.version=Rm,Object.defineProperty(Tt,Symbol.toStringTag,{value:"Module"})}));
7
+ `)}return u.toString()}},{key:"computeEdgeEndLabels",value:function(u){for(var n=this.iterator();n.hasNext();)n.next().computeLabel(u)}},{key:"computeLabelling",value:function(u){this.computeEdgeEndLabels(u[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var n=[!1,!1],r=this.iterator();r.hasNext();)for(var a=r.next().getLabel(),f=0;f<2;f++)a.isLine(f)&&a.getLocation(f)===$.BOUNDARY&&(n[f]=!0);for(var m=this.iterator();m.hasNext();)for(var p=m.next(),I=p.getLabel(),T=0;T<2;T++)if(I.isAnyNull(T)){var U=$.NONE;if(n[T])U=$.EXTERIOR;else{var J=p.getCoordinate();U=this.getLocation(T,J,u)}I.setAllLocationsIfNull(T,U)}}},{key:"getDegree",value:function(){return this._edgeMap.size()}},{key:"insertEdgeEnd",value:function(u,n){this._edgeMap.put(u,n),this._edgeList=null}}],[{key:"constructor_",value:function(){this._edgeMap=new Br,this._edgeList=null,this._ptInAreaLocation=[$.NONE,$.NONE]}}])})(),Np=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"linkResultDirectedEdges",value:function(){this.getResultAreaEdges();for(var r=null,a=null,f=this._SCANNING_FOR_INCOMING,m=0;m<this._resultAreaEdgeList.size();m++){var p=this._resultAreaEdgeList.get(m),I=p.getSym();if(p.getLabel().isArea())switch(r===null&&p.isInResult()&&(r=p),f){case this._SCANNING_FOR_INCOMING:if(!I.isInResult())continue;a=I,f=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!p.isInResult())continue;a.setNext(p),f=this._SCANNING_FOR_INCOMING}}if(f===this._LINKING_TO_OUTGOING){if(r===null)throw new Qt("no outgoing dirEdge found",this.getCoordinate());j.isTrue(r.isInResult(),"unable to link last incoming dirEdge"),a.setNext(r)}}},{key:"insert",value:function(r){var a=r;this.insertEdgeEnd(a,a)}},{key:"getRightmostEdge",value:function(){var r=this.getEdges(),a=r.size();if(a<1)return null;var f=r.get(0);if(a===1)return f;var m=r.get(a-1),p=f.getQuadrant(),I=m.getQuadrant();return ht.isNorthern(p)&&ht.isNorthern(I)?f:ht.isNorthern(p)||ht.isNorthern(I)?f.getDy()!==0?f:m.getDy()!==0?m:(j.shouldNeverReachHere("found two horizontal edges incident on node"),null):m}},{key:"print",value:function(r){It.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var a=this.iterator();a.hasNext();){var f=a.next();r.print("out "),f.print(r),r.println(),r.print("in "),f.getSym().print(r),r.println()}}},{key:"getResultAreaEdges",value:function(){if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new me;for(var r=this.iterator();r.hasNext();){var a=r.next();(a.isInResult()||a.getSym().isInResult())&&this._resultAreaEdgeList.add(a)}return this._resultAreaEdgeList}},{key:"updateLabelling",value:function(r){for(var a=this.iterator();a.hasNext();){var f=a.next().getLabel();f.setAllLocationsIfNull(0,r.getLocation(0)),f.setAllLocationsIfNull(1,r.getLocation(1))}}},{key:"linkAllDirectedEdges",value:function(){this.getEdges();for(var r=null,a=null,f=this._edgeList.size()-1;f>=0;f--){var m=this._edgeList.get(f),p=m.getSym();a===null&&(a=p),r!==null&&p.setNext(r),r=m}a.setNext(r)}},{key:"computeDepths",value:function(){if(arguments.length===1){var r=arguments[0],a=this.findIndex(r),f=r.getDepth(ie.LEFT),m=r.getDepth(ie.RIGHT),p=this.computeDepths(a+1,this._edgeList.size(),f);if(this.computeDepths(0,a,p)!==m)throw new Qt("depth mismatch at "+r.getCoordinate())}else if(arguments.length===3){for(var I=arguments[1],T=arguments[2],U=arguments[0];U<I;U++){var J=this._edgeList.get(U);J.setEdgeDepths(ie.RIGHT,T),T=J.getDepth(ie.LEFT)}return T}}},{key:"mergeSymLabels",value:function(){for(var r=this.iterator();r.hasNext();){var a=r.next();a.getLabel().merge(a.getSym().getLabel())}}},{key:"linkMinimalDirectedEdges",value:function(r){for(var a=null,f=null,m=this._SCANNING_FOR_INCOMING,p=this._resultAreaEdgeList.size()-1;p>=0;p--){var I=this._resultAreaEdgeList.get(p),T=I.getSym();switch(a===null&&I.getEdgeRing()===r&&(a=I),m){case this._SCANNING_FOR_INCOMING:if(T.getEdgeRing()!==r)continue;f=T,m=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(I.getEdgeRing()!==r)continue;f.setNextMin(I),m=this._SCANNING_FOR_INCOMING}}m===this._LINKING_TO_OUTGOING&&(j.isTrue(a!==null,"found null for first outgoing dirEdge"),j.isTrue(a.getEdgeRing()===r,"unable to link last incoming dirEdge"),f.setNextMin(a))}},{key:"getOutgoingDegree",value:function(){if(arguments.length===0){for(var r=0,a=this.iterator();a.hasNext();)a.next().isInResult()&&r++;return r}if(arguments.length===1){for(var f=arguments[0],m=0,p=this.iterator();p.hasNext();)p.next().getEdgeRing()===f&&m++;return m}}},{key:"getLabel",value:function(){return this._label}},{key:"findCoveredLineEdges",value:function(){for(var r=$.NONE,a=this.iterator();a.hasNext();){var f=a.next(),m=f.getSym();if(!f.isLineEdge()){if(f.isInResult()){r=$.INTERIOR;break}if(m.isInResult()){r=$.EXTERIOR;break}}}if(r===$.NONE)return null;for(var p=r,I=this.iterator();I.hasNext();){var T=I.next(),U=T.getSym();T.isLineEdge()?T.getEdge().setCovered(p===$.INTERIOR):(T.isInResult()&&(p=$.EXTERIOR),U.isInResult()&&(p=$.INTERIOR))}}},{key:"computeLabelling",value:function(r){M(n,"computeLabelling",this,1).call(this,r),this._label=new Mt($.NONE);for(var a=this.iterator();a.hasNext();)for(var f=a.next().getEdge().getLabel(),m=0;m<2;m++){var p=f.getLocation(m);p!==$.INTERIOR&&p!==$.BOUNDARY||this._label.setLocation(m,$.INTERIOR)}}}],[{key:"constructor_",value:function(){this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}}])})(Ip),Mp=(function(u){function n(){return o(this,n),s(this,n)}return v(n,u),c(n,[{key:"createNode",value:function(r){return new Ji(r,new Np)}}])})(Fc),Wc=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"compareTo",value:function(n){var r=n;return u.compareOriented(this._pts,this._orientation,r._pts,r._orientation)}},{key:"interfaces_",get:function(){return[q]}}],[{key:"constructor_",value:function(){this._pts=null,this._orientation=null;var n=arguments[0];this._pts=n,this._orientation=u.orientation(n)}},{key:"orientation",value:function(n){return et.increasingDirection(n)===1}},{key:"compareOriented",value:function(n,r,a,f){for(var m=r?1:-1,p=f?1:-1,I=r?n.length:-1,T=f?a.length:-1,U=r?0:n.length-1,J=f?0:a.length-1;;){var Q=n[U].compareTo(a[J]);if(Q!==0)return Q;var ne=(U+=m)===I,ce=(J+=p)===T;if(ne&&!ce)return-1;if(!ne&&ce)return 1;if(ne&&ce)return 0}}}])})(),Sp=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"print",value:function(u){u.print("MULTILINESTRING ( ");for(var n=0;n<this._edges.size();n++){var r=this._edges.get(n);n>0&&u.print(","),u.print("(");for(var a=r.getCoordinates(),f=0;f<a.length;f++)f>0&&u.print(","),u.print(a[f].x+" "+a[f].y);u.println(")")}u.print(") ")}},{key:"addAll",value:function(u){for(var n=u.iterator();n.hasNext();)this.add(n.next())}},{key:"findEdgeIndex",value:function(u){for(var n=0;n<this._edges.size();n++)if(this._edges.get(n).equals(u))return n;return-1}},{key:"iterator",value:function(){return this._edges.iterator()}},{key:"getEdges",value:function(){return this._edges}},{key:"get",value:function(u){return this._edges.get(u)}},{key:"findEqualEdge",value:function(u){var n=new Wc(u.getCoordinates());return this._ocaMap.get(n)}},{key:"add",value:function(u){this._edges.add(u);var n=new Wc(u.getCoordinates());this._ocaMap.put(n,u)}}],[{key:"constructor_",value:function(){this._edges=new me,this._ocaMap=new Br}}])})(),Kc=(function(){return c((function u(){o(this,u)}),[{key:"processIntersections",value:function(u,n,r,a){}},{key:"isDone",value:function(){}}])})(),Pp=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"isTrivialIntersection",value:function(n,r,a,f){if(n===a&&this._li.getIntersectionNum()===1){if(u.isAdjacentSegments(r,f))return!0;if(n.isClosed()){var m=n.size()-1;if(r===0&&f===m||f===0&&r===m)return!0}}return!1}},{key:"getProperIntersectionPoint",value:function(){return this._properIntersectionPoint}},{key:"hasProperInteriorIntersection",value:function(){return this._hasProperInterior}},{key:"getLineIntersector",value:function(){return this._li}},{key:"hasProperIntersection",value:function(){return this._hasProper}},{key:"processIntersections",value:function(n,r,a,f){if(n===a&&r===f)return null;this.numTests++;var m=n.getCoordinates()[r],p=n.getCoordinates()[r+1],I=a.getCoordinates()[f],T=a.getCoordinates()[f+1];this._li.computeIntersection(m,p,I,T),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(n,r,a,f)||(this._hasIntersection=!0,n.addIntersections(this._li,r,0),a.addIntersections(this._li,f,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))}},{key:"hasIntersection",value:function(){return this._hasIntersection}},{key:"isDone",value:function(){return!1}},{key:"hasInteriorIntersection",value:function(){return this._hasInterior}},{key:"interfaces_",get:function(){return[Kc]}}],[{key:"constructor_",value: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 n=arguments[0];this._li=n}},{key:"isAdjacentSegments",value:function(n,r){return Math.abs(n-r)===1}}])})(),Lp=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"getSegmentIndex",value:function(){return this.segmentIndex}},{key:"getCoordinate",value:function(){return this.coord}},{key:"print",value:function(u){u.print(this.coord),u.print(" seg # = "+this.segmentIndex),u.println(" dist = "+this.dist)}},{key:"compareTo",value:function(u){var n=u;return this.compare(n.segmentIndex,n.dist)}},{key:"isEndPoint",value:function(u){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===u}},{key:"toString",value:function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist}},{key:"getDistance",value:function(){return this.dist}},{key:"compare",value:function(u,n){return this.segmentIndex<u?-1:this.segmentIndex>u?1:this.dist<n?-1:this.dist>n?1:0}},{key:"interfaces_",get:function(){return[q]}}],[{key:"constructor_",value:function(){this.coord=null,this.segmentIndex=null,this.dist=null;var u=arguments[0],n=arguments[1],r=arguments[2];this.coord=new W(u),this.segmentIndex=n,this.dist=r}}])})(),bp=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"print",value:function(u){u.println("Intersections:");for(var n=this.iterator();n.hasNext();)n.next().print(u)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(u){this.addEndpoints();for(var n=this.iterator(),r=n.next();n.hasNext();){var a=n.next(),f=this.createSplitEdge(r,a);u.add(f),r=a}}},{key:"addEndpoints",value:function(){var u=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[u],u,0)}},{key:"createSplitEdge",value:function(u,n){var r=n.segmentIndex-u.segmentIndex+2,a=this.edge.pts[n.segmentIndex],f=n.dist>0||!n.coord.equals2D(a);f||r--;var m=new Array(r).fill(null),p=0;m[p++]=new W(u.coord);for(var I=u.segmentIndex+1;I<=n.segmentIndex;I++)m[p++]=this.edge.pts[I];return f&&(m[p]=n.coord),new Qc(m,new Mt(this.edge._label))}},{key:"add",value:function(u,n,r){var a=new Lp(u,n,r),f=this._nodeMap.get(a);return f!==null?f:(this._nodeMap.put(a,a),a)}},{key:"isIntersection",value:function(u){for(var n=this.iterator();n.hasNext();)if(n.next().coord.equals(u))return!0;return!1}}],[{key:"constructor_",value:function(){this._nodeMap=new Br,this.edge=null;var u=arguments[0];this.edge=u}}])})(),Cp=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"isIntersects",value:function(){return!this.isDisjoint()}},{key:"isCovers",value:function(){return(u.isTrue(this._matrix[$.INTERIOR][$.INTERIOR])||u.isTrue(this._matrix[$.INTERIOR][$.BOUNDARY])||u.isTrue(this._matrix[$.BOUNDARY][$.INTERIOR])||u.isTrue(this._matrix[$.BOUNDARY][$.BOUNDARY]))&&this._matrix[$.EXTERIOR][$.INTERIOR]===ae.FALSE&&this._matrix[$.EXTERIOR][$.BOUNDARY]===ae.FALSE}},{key:"isCoveredBy",value:function(){return(u.isTrue(this._matrix[$.INTERIOR][$.INTERIOR])||u.isTrue(this._matrix[$.INTERIOR][$.BOUNDARY])||u.isTrue(this._matrix[$.BOUNDARY][$.INTERIOR])||u.isTrue(this._matrix[$.BOUNDARY][$.BOUNDARY]))&&this._matrix[$.INTERIOR][$.EXTERIOR]===ae.FALSE&&this._matrix[$.BOUNDARY][$.EXTERIOR]===ae.FALSE}},{key:"set",value:function(){if(arguments.length===1)for(var n=arguments[0],r=0;r<n.length;r++){var a=Math.trunc(r/3),f=r%3;this._matrix[a][f]=ae.toDimensionValue(n.charAt(r))}else if(arguments.length===3){var m=arguments[0],p=arguments[1],I=arguments[2];this._matrix[m][p]=I}}},{key:"isContains",value:function(){return u.isTrue(this._matrix[$.INTERIOR][$.INTERIOR])&&this._matrix[$.EXTERIOR][$.INTERIOR]===ae.FALSE&&this._matrix[$.EXTERIOR][$.BOUNDARY]===ae.FALSE}},{key:"setAtLeast",value:function(){if(arguments.length===1)for(var n=arguments[0],r=0;r<n.length;r++){var a=Math.trunc(r/3),f=r%3;this.setAtLeast(a,f,ae.toDimensionValue(n.charAt(r)))}else if(arguments.length===3){var m=arguments[0],p=arguments[1],I=arguments[2];this._matrix[m][p]<I&&(this._matrix[m][p]=I)}}},{key:"setAtLeastIfValid",value:function(n,r,a){n>=0&&r>=0&&this.setAtLeast(n,r,a)}},{key:"isWithin",value:function(){return u.isTrue(this._matrix[$.INTERIOR][$.INTERIOR])&&this._matrix[$.INTERIOR][$.EXTERIOR]===ae.FALSE&&this._matrix[$.BOUNDARY][$.EXTERIOR]===ae.FALSE}},{key:"isTouches",value:function(n,r){return n>r?this.isTouches(r,n):(n===ae.A&&r===ae.A||n===ae.L&&r===ae.L||n===ae.L&&r===ae.A||n===ae.P&&r===ae.A||n===ae.P&&r===ae.L)&&this._matrix[$.INTERIOR][$.INTERIOR]===ae.FALSE&&(u.isTrue(this._matrix[$.INTERIOR][$.BOUNDARY])||u.isTrue(this._matrix[$.BOUNDARY][$.INTERIOR])||u.isTrue(this._matrix[$.BOUNDARY][$.BOUNDARY]))}},{key:"isOverlaps",value:function(n,r){return n===ae.P&&r===ae.P||n===ae.A&&r===ae.A?u.isTrue(this._matrix[$.INTERIOR][$.INTERIOR])&&u.isTrue(this._matrix[$.INTERIOR][$.EXTERIOR])&&u.isTrue(this._matrix[$.EXTERIOR][$.INTERIOR]):n===ae.L&&r===ae.L&&this._matrix[$.INTERIOR][$.INTERIOR]===1&&u.isTrue(this._matrix[$.INTERIOR][$.EXTERIOR])&&u.isTrue(this._matrix[$.EXTERIOR][$.INTERIOR])}},{key:"isEquals",value:function(n,r){return n===r&&u.isTrue(this._matrix[$.INTERIOR][$.INTERIOR])&&this._matrix[$.INTERIOR][$.EXTERIOR]===ae.FALSE&&this._matrix[$.BOUNDARY][$.EXTERIOR]===ae.FALSE&&this._matrix[$.EXTERIOR][$.INTERIOR]===ae.FALSE&&this._matrix[$.EXTERIOR][$.BOUNDARY]===ae.FALSE}},{key:"toString",value:function(){for(var n=new Zi("123456789"),r=0;r<3;r++)for(var a=0;a<3;a++)n.setCharAt(3*r+a,ae.toDimensionSymbol(this._matrix[r][a]));return n.toString()}},{key:"setAll",value:function(n){for(var r=0;r<3;r++)for(var a=0;a<3;a++)this._matrix[r][a]=n}},{key:"get",value:function(n,r){return this._matrix[n][r]}},{key:"transpose",value:function(){var n=this._matrix[1][0];return this._matrix[1][0]=this._matrix[0][1],this._matrix[0][1]=n,n=this._matrix[2][0],this._matrix[2][0]=this._matrix[0][2],this._matrix[0][2]=n,n=this._matrix[2][1],this._matrix[2][1]=this._matrix[1][2],this._matrix[1][2]=n,this}},{key:"matches",value:function(n){if(n.length!==9)throw new C("Should be length 9: "+n);for(var r=0;r<3;r++)for(var a=0;a<3;a++)if(!u.matches(this._matrix[r][a],n.charAt(3*r+a)))return!1;return!0}},{key:"add",value:function(n){for(var r=0;r<3;r++)for(var a=0;a<3;a++)this.setAtLeast(r,a,n.get(r,a))}},{key:"isDisjoint",value:function(){return this._matrix[$.INTERIOR][$.INTERIOR]===ae.FALSE&&this._matrix[$.INTERIOR][$.BOUNDARY]===ae.FALSE&&this._matrix[$.BOUNDARY][$.INTERIOR]===ae.FALSE&&this._matrix[$.BOUNDARY][$.BOUNDARY]===ae.FALSE}},{key:"isCrosses",value:function(n,r){return n===ae.P&&r===ae.L||n===ae.P&&r===ae.A||n===ae.L&&r===ae.A?u.isTrue(this._matrix[$.INTERIOR][$.INTERIOR])&&u.isTrue(this._matrix[$.INTERIOR][$.EXTERIOR]):n===ae.L&&r===ae.P||n===ae.A&&r===ae.P||n===ae.A&&r===ae.L?u.isTrue(this._matrix[$.INTERIOR][$.INTERIOR])&&u.isTrue(this._matrix[$.EXTERIOR][$.INTERIOR]):n===ae.L&&r===ae.L&&this._matrix[$.INTERIOR][$.INTERIOR]===0}},{key:"interfaces_",get:function(){return[w]}}],[{key:"constructor_",value:function(){if(this._matrix=null,arguments.length===0)this._matrix=Array(3).fill().map((function(){return Array(3)})),this.setAll(ae.FALSE);else if(arguments.length===1){if(typeof arguments[0]=="string"){var n=arguments[0];u.constructor_.call(this),this.set(n)}else if(arguments[0]instanceof u){var r=arguments[0];u.constructor_.call(this),this._matrix[$.INTERIOR][$.INTERIOR]=r._matrix[$.INTERIOR][$.INTERIOR],this._matrix[$.INTERIOR][$.BOUNDARY]=r._matrix[$.INTERIOR][$.BOUNDARY],this._matrix[$.INTERIOR][$.EXTERIOR]=r._matrix[$.INTERIOR][$.EXTERIOR],this._matrix[$.BOUNDARY][$.INTERIOR]=r._matrix[$.BOUNDARY][$.INTERIOR],this._matrix[$.BOUNDARY][$.BOUNDARY]=r._matrix[$.BOUNDARY][$.BOUNDARY],this._matrix[$.BOUNDARY][$.EXTERIOR]=r._matrix[$.BOUNDARY][$.EXTERIOR],this._matrix[$.EXTERIOR][$.INTERIOR]=r._matrix[$.EXTERIOR][$.INTERIOR],this._matrix[$.EXTERIOR][$.BOUNDARY]=r._matrix[$.EXTERIOR][$.BOUNDARY],this._matrix[$.EXTERIOR][$.EXTERIOR]=r._matrix[$.EXTERIOR][$.EXTERIOR]}}}},{key:"matches",value:function(){if(Number.isInteger(arguments[0])&&typeof arguments[1]=="string"){var n=arguments[0],r=arguments[1];return r===ae.SYM_DONTCARE||r===ae.SYM_TRUE&&(n>=0||n===ae.TRUE)||r===ae.SYM_FALSE&&n===ae.FALSE||r===ae.SYM_P&&n===ae.P||r===ae.SYM_L&&n===ae.L||r===ae.SYM_A&&n===ae.A}if(typeof arguments[0]=="string"&&typeof arguments[1]=="string"){var a=arguments[1];return new u(arguments[0]).matches(a)}}},{key:"isTrue",value:function(n){return n>=0||n===ae.TRUE}}])})(),Op=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"size",value:function(){return this._size}},{key:"addAll",value:function(n){return n===null||n.length===0?null:(this.ensureCapacity(this._size+n.length),It.arraycopy(n,0,this._data,this._size,n.length),void(this._size+=n.length))}},{key:"ensureCapacity",value:function(n){if(n<=this._data.length)return null;var r=Math.max(n,2*this._data.length);this._data=xn.copyOf(this._data,r)}},{key:"toArray",value:function(){var n=new Array(this._size).fill(null);return It.arraycopy(this._data,0,n,0,this._size),n}},{key:"add",value:function(n){this.ensureCapacity(this._size+1),this._data[this._size]=n,++this._size}}],[{key:"constructor_",value:function(){if(this._data=null,this._size=0,arguments.length===0)u.constructor_.call(this,10);else if(arguments.length===1){var n=arguments[0];this._data=new Array(n).fill(null)}}}])})(),Tp=(function(){function u(){o(this,u)}return c(u,[{key:"getChainStartIndices",value:function(n){var r=0,a=new Op(Math.trunc(n.length/2));a.add(r);do{var f=this.findChainEnd(n,r);a.add(f),r=f}while(r<n.length-1);return a.toArray()}},{key:"findChainEnd",value:function(n,r){for(var a=ht.quadrant(n[r],n[r+1]),f=r+1;f<n.length&&ht.quadrant(n[f-1],n[f])===a;)f++;return f-1}},{key:"OLDgetChainStartIndices",value:function(n){var r=0,a=new me;a.add(r);do{var f=this.findChainEnd(n,r);a.add(f),r=f}while(r<n.length-1);return u.toIntArray(a)}}],[{key:"toIntArray",value:function(n){for(var r=new Array(n.size()).fill(null),a=0;a<r.length;a++)r[a]=n.get(a).intValue();return r}}])})(),Rp=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"getCoordinates",value:function(){return this.pts}},{key:"getMaxX",value:function(u){var n=this.pts[this.startIndex[u]].x,r=this.pts[this.startIndex[u+1]].x;return n>r?n:r}},{key:"getMinX",value:function(u){var n=this.pts[this.startIndex[u]].x,r=this.pts[this.startIndex[u+1]].x;return n<r?n:r}},{key:"computeIntersectsForChain",value:function(){if(arguments.length===4){var u=arguments[0],n=arguments[1],r=arguments[2],a=arguments[3];this.computeIntersectsForChain(this.startIndex[u],this.startIndex[u+1],n,n.startIndex[r],n.startIndex[r+1],a)}else if(arguments.length===6){var f=arguments[0],m=arguments[1],p=arguments[2],I=arguments[3],T=arguments[4],U=arguments[5];if(m-f==1&&T-I==1)return U.addIntersections(this.e,f,p.e,I),null;if(!this.overlaps(f,m,p,I,T))return null;var J=Math.trunc((f+m)/2),Q=Math.trunc((I+T)/2);f<J&&(I<Q&&this.computeIntersectsForChain(f,J,p,I,Q,U),Q<T&&this.computeIntersectsForChain(f,J,p,Q,T,U)),J<m&&(I<Q&&this.computeIntersectsForChain(J,m,p,I,Q,U),Q<T&&this.computeIntersectsForChain(J,m,p,Q,T,U))}}},{key:"overlaps",value:function(u,n,r,a,f){return le.intersects(this.pts[u],this.pts[n],r.pts[a],r.pts[f])}},{key:"getStartIndexes",value:function(){return this.startIndex}},{key:"computeIntersects",value:function(u,n){for(var r=0;r<this.startIndex.length-1;r++)for(var a=0;a<u.startIndex.length-1;a++)this.computeIntersectsForChain(r,u,a,n)}}],[{key:"constructor_",value:function(){this.e=null,this.pts=null,this.startIndex=null;var u=arguments[0];this.e=u,this.pts=u.getCoordinates();var n=new Tp;this.startIndex=n.getChainStartIndices(this.pts)}}])})(),Jc=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"getDepth",value:function(n,r){return this._depth[n][r]}},{key:"setDepth",value:function(n,r,a){this._depth[n][r]=a}},{key:"isNull",value:function(){if(arguments.length===0){for(var n=0;n<2;n++)for(var r=0;r<3;r++)if(this._depth[n][r]!==u.NULL_VALUE)return!1;return!0}if(arguments.length===1){var a=arguments[0];return this._depth[a][1]===u.NULL_VALUE}if(arguments.length===2){var f=arguments[0],m=arguments[1];return this._depth[f][m]===u.NULL_VALUE}}},{key:"normalize",value:function(){for(var n=0;n<2;n++)if(!this.isNull(n)){var r=this._depth[n][1];this._depth[n][2]<r&&(r=this._depth[n][2]),r<0&&(r=0);for(var a=1;a<3;a++){var f=0;this._depth[n][a]>r&&(f=1),this._depth[n][a]=f}}}},{key:"getDelta",value:function(n){return this._depth[n][ie.RIGHT]-this._depth[n][ie.LEFT]}},{key:"getLocation",value:function(n,r){return this._depth[n][r]<=0?$.EXTERIOR:$.INTERIOR}},{key:"toString",value:function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]}},{key:"add",value:function(){if(arguments.length===1)for(var n=arguments[0],r=0;r<2;r++)for(var a=1;a<3;a++){var f=n.getLocation(r,a);f!==$.EXTERIOR&&f!==$.INTERIOR||(this.isNull(r,a)?this._depth[r][a]=u.depthAtLocation(f):this._depth[r][a]+=u.depthAtLocation(f))}else if(arguments.length===3){var m=arguments[0],p=arguments[1];arguments[2]===$.INTERIOR&&this._depth[m][p]++}}}],[{key:"constructor_",value:function(){this._depth=Array(2).fill().map((function(){return Array(3)}));for(var n=0;n<2;n++)for(var r=0;r<3;r++)this._depth[n][r]=u.NULL_VALUE}},{key:"depthAtLocation",value:function(n){return n===$.EXTERIOR?0:n===$.INTERIOR?1:u.NULL_VALUE}}])})();Jc.NULL_VALUE=-1;var Qc=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"getDepth",value:function(){return this._depth}},{key:"getCollapsedEdge",value:function(){var r=new Array(2).fill(null);return r[0]=this.pts[0],r[1]=this.pts[1],new n(r,Mt.toLineLabel(this._label))}},{key:"isIsolated",value:function(){return this._isIsolated}},{key:"getCoordinates",value:function(){return this.pts}},{key:"setIsolated",value:function(r){this._isIsolated=r}},{key:"setName",value:function(r){this._name=r}},{key:"equals",value:function(r){if(!(r instanceof n))return!1;var a=r;if(this.pts.length!==a.pts.length)return!1;for(var f=!0,m=!0,p=this.pts.length,I=0;I<this.pts.length;I++)if(this.pts[I].equals2D(a.pts[I])||(f=!1),this.pts[I].equals2D(a.pts[--p])||(m=!1),!f&&!m)return!1;return!0}},{key:"getCoordinate",value:function(){if(arguments.length===0)return this.pts.length>0?this.pts[0]:null;if(arguments.length===1){var r=arguments[0];return this.pts[r]}}},{key:"print",value:function(r){r.print("edge "+this._name+": "),r.print("LINESTRING (");for(var a=0;a<this.pts.length;a++)a>0&&r.print(","),r.print(this.pts[a].x+" "+this.pts[a].y);r.print(") "+this._label+" "+this._depthDelta)}},{key:"computeIM",value:function(r){n.updateIM(this._label,r)}},{key:"isCollapsed",value:function(){return!!this._label.isArea()&&this.pts.length===3&&!!this.pts[0].equals(this.pts[2])}},{key:"isClosed",value:function(){return this.pts[0].equals(this.pts[this.pts.length-1])}},{key:"getMaximumSegmentIndex",value:function(){return this.pts.length-1}},{key:"getDepthDelta",value:function(){return this._depthDelta}},{key:"getNumPoints",value:function(){return this.pts.length}},{key:"printReverse",value:function(r){r.print("edge "+this._name+": ");for(var a=this.pts.length-1;a>=0;a--)r.print(this.pts[a]+" ");r.println("")}},{key:"getMonotoneChainEdge",value:function(){return this._mce===null&&(this._mce=new Rp(this)),this._mce}},{key:"getEnvelope",value:function(){if(this._env===null){this._env=new le;for(var r=0;r<this.pts.length;r++)this._env.expandToInclude(this.pts[r])}return this._env}},{key:"addIntersection",value:function(r,a,f,m){var p=new W(r.getIntersection(m)),I=a,T=r.getEdgeDistance(f,m),U=I+1;if(U<this.pts.length){var J=this.pts[U];p.equals2D(J)&&(I=U,T=0)}this.eiList.add(p,I,T)}},{key:"toString",value:function(){var r=new Zi;r.append("edge "+this._name+": "),r.append("LINESTRING (");for(var a=0;a<this.pts.length;a++)a>0&&r.append(","),r.append(this.pts[a].x+" "+this.pts[a].y);return r.append(") "+this._label+" "+this._depthDelta),r.toString()}},{key:"isPointwiseEqual",value:function(r){if(this.pts.length!==r.pts.length)return!1;for(var a=0;a<this.pts.length;a++)if(!this.pts[a].equals2D(r.pts[a]))return!1;return!0}},{key:"setDepthDelta",value:function(r){this._depthDelta=r}},{key:"getEdgeIntersectionList",value:function(){return this.eiList}},{key:"addIntersections",value:function(r,a,f){for(var m=0;m<r.getIntersectionNum();m++)this.addIntersection(r,a,f,m)}}],[{key:"constructor_",value:function(){if(this.pts=null,this._env=null,this.eiList=new bp(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Jc,this._depthDelta=0,arguments.length===1){var r=arguments[0];n.constructor_.call(this,r,null)}else if(arguments.length===2){var a=arguments[0],f=arguments[1];this.pts=a,this._label=f}}},{key:"updateIM",value:function(){if(!(arguments.length===2&&arguments[1]instanceof Cp&&arguments[0]instanceof Mt))return M(n,"updateIM",this).apply(this,arguments);var r=arguments[0],a=arguments[1];a.setAtLeastIfValid(r.getLocation(0,ie.ON),r.getLocation(1,ie.ON),1),r.isArea()&&(a.setAtLeastIfValid(r.getLocation(0,ie.LEFT),r.getLocation(1,ie.LEFT),2),a.setAtLeastIfValid(r.getLocation(0,ie.RIGHT),r.getLocation(1,ie.RIGHT),2))}}])})(Oc),jc=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"setWorkingPrecisionModel",value:function(n){this._workingPrecisionModel=n}},{key:"insertUniqueEdge",value:function(n){var r=this._edgeList.findEqualEdge(n);if(r!==null){var a=r.getLabel(),f=n.getLabel();r.isPointwiseEqual(n)||(f=new Mt(n.getLabel())).flip(),a.merge(f);var m=u.depthDelta(f),p=r.getDepthDelta()+m;r.setDepthDelta(p)}else this._edgeList.add(n),n.setDepthDelta(u.depthDelta(n.getLabel()))}},{key:"buildSubgraphs",value:function(n,r){for(var a=new me,f=n.iterator();f.hasNext();){var m=f.next(),p=m.getRightmostCoordinate(),I=new Hc(a).getDepth(p);m.computeDepth(I),m.findResultEdges(),a.add(m),r.add(m.getDirectedEdges(),m.getNodes())}}},{key:"createSubgraphs",value:function(n){for(var r=new me,a=n.getNodes().iterator();a.hasNext();){var f=a.next();if(!f.isVisited()){var m=new Bm;m.create(f),r.add(m)}}return Zn.sort(r,Zn.reverseOrder()),r}},{key:"createEmptyResultGeometry",value:function(){return this._geomFact.createPolygon()}},{key:"getNoder",value:function(n){if(this._workingNoder!==null)return this._workingNoder;var r=new Oo,a=new kn;return a.setPrecisionModel(n),r.setSegmentIntersector(new Pp(a)),r}},{key:"buffer",value:function(n,r){var a=this._workingPrecisionModel;a===null&&(a=n.getPrecisionModel()),this._geomFact=n.getFactory();var f=new pp(a,this._bufParams),m=new xp(n,r,f).getCurves();if(m.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(m,a),this._graph=new qc(new Mp),this._graph.addEdges(this._edgeList.getEdges());var p=this.createSubgraphs(this._graph),I=new sp(this._geomFact);this.buildSubgraphs(p,I);var T=I.getPolygons();return T.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(T)}},{key:"computeNodedEdges",value:function(n,r){var a=this.getNoder(r);a.computeNodes(n);for(var f=a.getNodedSubstrings().iterator();f.hasNext();){var m=f.next(),p=m.getCoordinates();if(p.length!==2||!p[0].equals2D(p[1])){var I=m.getData(),T=new Qc(m.getCoordinates(),new Mt(I));this.insertUniqueEdge(T)}}}},{key:"setNoder",value:function(n){this._workingNoder=n}}],[{key:"constructor_",value:function(){this._bufParams=null,this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new Sp;var n=arguments[0];this._bufParams=n}},{key:"depthDelta",value:function(n){var r=n.getLocation(0,ie.LEFT),a=n.getLocation(0,ie.RIGHT);return r===$.INTERIOR&&a===$.EXTERIOR?1:r===$.EXTERIOR&&a===$.INTERIOR?-1:0}},{key:"convertSegStrings",value:function(n){for(var r=new Hn,a=new me;n.hasNext();){var f=n.next(),m=r.createLineString(f.getCoordinates());a.add(m)}return r.buildGeometry(a)}}])})(),Ap=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"rescale",value:function(){if(Ie(arguments[0],Me))for(var n=arguments[0].iterator();n.hasNext();){var r=n.next();this.rescale(r.getCoordinates())}else if(arguments[0]instanceof Array){for(var a=arguments[0],f=0;f<a.length;f++)a[f].x=a[f].x/this._scaleFactor+this._offsetX,a[f].y=a[f].y/this._scaleFactor+this._offsetY;a.length===2&&a[0].equals2D(a[1])&&It.out.println(a)}}},{key:"scale",value:function(){if(Ie(arguments[0],Me)){for(var n=arguments[0],r=new me(n.size()),a=n.iterator();a.hasNext();){var f=a.next();r.add(new In(this.scale(f.getCoordinates()),f.getData()))}return r}if(arguments[0]instanceof Array){for(var m=arguments[0],p=new Array(m.length).fill(null),I=0;I<m.length;I++)p[I]=new W(Math.round((m[I].x-this._offsetX)*this._scaleFactor),Math.round((m[I].y-this._offsetY)*this._scaleFactor),m[I].getZ());return et.removeRepeatedPoints(p)}}},{key:"isIntegerPrecision",value:function(){return this._scaleFactor===1}},{key:"getNodedSubstrings",value:function(){var n=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(n),n}},{key:"computeNodes",value:function(n){var r=n;this._isScaled&&(r=this.scale(n)),this._noder.computeNodes(r)}},{key:"interfaces_",get:function(){return[Co]}}],[{key:"constructor_",value:function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,arguments.length===2){var n=arguments[0],r=arguments[1];u.constructor_.call(this,n,r,0,0)}else if(arguments.length===4){var a=arguments[0],f=arguments[1];this._noder=a,this._scaleFactor=f,this._isScaled=!this.isIntegerPrecision()}}}])})(),eh=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"checkEndPtVertexIntersections",value:function(){if(arguments.length===0)for(var n=this._segStrings.iterator();n.hasNext();){var r=n.next().getCoordinates();this.checkEndPtVertexIntersections(r[0],this._segStrings),this.checkEndPtVertexIntersections(r[r.length-1],this._segStrings)}else if(arguments.length===2){for(var a=arguments[0],f=arguments[1].iterator();f.hasNext();)for(var m=f.next().getCoordinates(),p=1;p<m.length-1;p++)if(m[p].equals(a))throw new K("found endpt/interior pt intersection at index "+p+" :pt "+a)}}},{key:"checkInteriorIntersections",value:function(){if(arguments.length===0)for(var n=this._segStrings.iterator();n.hasNext();)for(var r=n.next(),a=this._segStrings.iterator();a.hasNext();){var f=a.next();this.checkInteriorIntersections(r,f)}else if(arguments.length===2)for(var m=arguments[0],p=arguments[1],I=m.getCoordinates(),T=p.getCoordinates(),U=0;U<I.length-1;U++)for(var J=0;J<T.length-1;J++)this.checkInteriorIntersections(m,U,p,J);else if(arguments.length===4){var Q=arguments[0],ne=arguments[1],ce=arguments[2],fe=arguments[3];if(Q===ce&&ne===fe)return null;var de=Q.getCoordinates()[ne],Re=Q.getCoordinates()[ne+1],be=ce.getCoordinates()[fe],Ye=ce.getCoordinates()[fe+1];if(this._li.computeIntersection(de,Re,be,Ye),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,de,Re)||this.hasInteriorIntersection(this._li,be,Ye)))throw new K("found non-noded intersection at "+de+"-"+Re+" and "+be+"-"+Ye)}}},{key:"checkValid",value:function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()}},{key:"checkCollapses",value:function(){if(arguments.length===0)for(var n=this._segStrings.iterator();n.hasNext();){var r=n.next();this.checkCollapses(r)}else if(arguments.length===1)for(var a=arguments[0].getCoordinates(),f=0;f<a.length-2;f++)this.checkCollapse(a[f],a[f+1],a[f+2])}},{key:"hasInteriorIntersection",value:function(n,r,a){for(var f=0;f<n.getIntersectionNum();f++){var m=n.getIntersection(f);if(!m.equals(r)&&!m.equals(a))return!0}return!1}},{key:"checkCollapse",value:function(n,r,a){if(n.equals(a))throw new K("found non-noded collapse at "+u.fact.createLineString([n,r,a]))}}],[{key:"constructor_",value:function(){this._li=new kn,this._segStrings=null;var n=arguments[0];this._segStrings=n}}])})();eh.fact=new Hn;var Ro=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"intersectsScaled",value:function(n,r){var a=Math.min(n.x,r.x),f=Math.max(n.x,r.x),m=Math.min(n.y,r.y),p=Math.max(n.y,r.y),I=this._maxx<a||this._minx>f||this._maxy<m||this._miny>p;if(I)return!1;var T=this.intersectsToleranceSquare(n,r);return j.isTrue(!(I&&T),"Found bad envelope test"),T}},{key:"initCorners",value:function(n){var r=.5;this._minx=n.x-r,this._maxx=n.x+r,this._miny=n.y-r,this._maxy=n.y+r,this._corner[0]=new W(this._maxx,this._maxy),this._corner[1]=new W(this._minx,this._maxy),this._corner[2]=new W(this._minx,this._miny),this._corner[3]=new W(this._maxx,this._miny)}},{key:"intersects",value:function(n,r){return this._scaleFactor===1?this.intersectsScaled(n,r):(this.copyScaled(n,this._p0Scaled),this.copyScaled(r,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))}},{key:"scale",value:function(n){return Math.round(n*this._scaleFactor)}},{key:"getCoordinate",value:function(){return this._originalPt}},{key:"copyScaled",value:function(n,r){r.x=this.scale(n.x),r.y=this.scale(n.y)}},{key:"getSafeEnvelope",value:function(){if(this._safeEnv===null){var n=u.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new le(this._originalPt.x-n,this._originalPt.x+n,this._originalPt.y-n,this._originalPt.y+n)}return this._safeEnv}},{key:"intersectsPixelClosure",value:function(n,r){return this._li.computeIntersection(n,r,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,r,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,r,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,r,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))}},{key:"intersectsToleranceSquare",value:function(n,r){var a=!1,f=!1;return this._li.computeIntersection(n,r,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(n,r,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(a=!0),this._li.computeIntersection(n,r,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(f=!0),this._li.computeIntersection(n,r,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!a||!f)||!!n.equals(this._pt)||!!r.equals(this._pt))))}},{key:"addSnappedNode",value:function(n,r){var a=n.getCoordinate(r),f=n.getCoordinate(r+1);return!!this.intersects(a,f)&&(n.addIntersection(this.getCoordinate(),r),!0)}}],[{key:"constructor_",value: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 n=arguments[0],r=arguments[1],a=arguments[2];if(this._originalPt=n,this._pt=n,this._scaleFactor=r,this._li=a,r<=0)throw new C("Scale factor must be non-zero");r!==1&&(this._pt=new W(this.scale(n.x),this.scale(n.y)),this._p0Scaled=new W,this._p1Scaled=new W),this.initCorners(this._pt)}}])})();Ro.SAFE_ENV_EXPANSION_FACTOR=.75;var Dp=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"select",value:function(){if(arguments.length!==1){if(arguments.length===2){var u=arguments[1];arguments[0].getLineSegment(u,this.selectedSegment),this.select(this.selectedSegment)}}}}],[{key:"constructor_",value:function(){this.selectedSegment=new pt}}])})(),th=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"snap",value:function(){if(arguments.length===1){var u=arguments[0];return this.snap(u,null,-1)}if(arguments.length===3){var n=arguments[0],r=arguments[1],a=arguments[2],f=n.getSafeEnvelope(),m=new nh(n,r,a);return this._index.query(f,new((function(){return c((function p(){o(this,p)}),[{key:"interfaces_",get:function(){return[Gc]}},{key:"visitItem",value:function(p){p.select(f,m)}}])})())),m.isNodeAdded()}}}],[{key:"constructor_",value:function(){this._index=null;var u=arguments[0];this._index=u}}])})(),nh=(function(u){function n(){var r;return o(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return v(n,u),c(n,[{key:"isNodeAdded",value:function(){return this._isNodeAdded}},{key:"select",value:function(){if(!(arguments.length===2&&Number.isInteger(arguments[1])&&arguments[0]instanceof zc))return M(n,"select",this,1).apply(this,arguments);var r=arguments[1],a=arguments[0].getContext();if(this._parentEdge===a&&(r===this._hotPixelVertexIndex||r+1===this._hotPixelVertexIndex))return null;this._isNodeAdded|=this._hotPixel.addSnappedNode(a,r)}}],[{key:"constructor_",value:function(){this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var r=arguments[0],a=arguments[1],f=arguments[2];this._hotPixel=r,this._parentEdge=a,this._hotPixelVertexIndex=f}}])})(Dp);th.HotPixelSnapAction=nh;var Fp=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"processIntersections",value:function(u,n,r,a){if(u===r&&n===a)return null;var f=u.getCoordinates()[n],m=u.getCoordinates()[n+1],p=r.getCoordinates()[a],I=r.getCoordinates()[a+1];if(this._li.computeIntersection(f,m,p,I),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var T=0;T<this._li.getIntersectionNum();T++)this._interiorIntersections.add(this._li.getIntersection(T));u.addIntersections(this._li,n,0),r.addIntersections(this._li,a,1)}}},{key:"isDone",value:function(){return!1}},{key:"getInteriorIntersections",value:function(){return this._interiorIntersections}},{key:"interfaces_",get:function(){return[Kc]}}],[{key:"constructor_",value:function(){this._li=null,this._interiorIntersections=null;var u=arguments[0];this._li=u,this._interiorIntersections=new me}}])})(),qp=(function(){return c((function u(){o(this,u),u.constructor_.apply(this,arguments)}),[{key:"checkCorrectness",value:function(u){var n=In.getNodedSubstrings(u),r=new eh(n);try{r.checkValid()}catch(a){if(!(a instanceof b))throw a;a.printStackTrace()}}},{key:"getNodedSubstrings",value:function(){return In.getNodedSubstrings(this._nodedSegStrings)}},{key:"snapRound",value:function(u,n){var r=this.findInteriorIntersections(u,n);this.computeIntersectionSnaps(r),this.computeVertexSnaps(u)}},{key:"findInteriorIntersections",value:function(u,n){var r=new Fp(n);return this._noder.setSegmentIntersector(r),this._noder.computeNodes(u),r.getInteriorIntersections()}},{key:"computeVertexSnaps",value:function(){if(Ie(arguments[0],Me))for(var u=arguments[0].iterator();u.hasNext();){var n=u.next();this.computeVertexSnaps(n)}else if(arguments[0]instanceof In)for(var r=arguments[0],a=r.getCoordinates(),f=0;f<a.length;f++){var m=new Ro(a[f],this._scaleFactor,this._li);this._pointSnapper.snap(m,r,f)&&r.addIntersection(a[f],f)}}},{key:"computeNodes",value:function(u){this._nodedSegStrings=u,this._noder=new Oo,this._pointSnapper=new th(this._noder.getIndex()),this.snapRound(u,this._li)}},{key:"computeIntersectionSnaps",value:function(u){for(var n=u.iterator();n.hasNext();){var r=n.next(),a=new Ro(r,this._scaleFactor,this._li);this._pointSnapper.snap(a)}}},{key:"interfaces_",get:function(){return[Co]}}],[{key:"constructor_",value:function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var u=arguments[0];this._pm=u,this._li=new kn,this._li.setPrecisionModel(u),this._scaleFactor=u.getScale()}}])})(),Jn=(function(){function u(){o(this,u),u.constructor_.apply(this,arguments)}return c(u,[{key:"bufferFixedPrecision",value:function(n){var r=new Ap(new qp(new bt(1)),n.getScale()),a=new jc(this._bufParams);a.setWorkingPrecisionModel(n),a.setNoder(r),this._resultGeometry=a.buffer(this._argGeom,this._distance)}},{key:"bufferReducedPrecision",value:function(){if(arguments.length===0){for(var n=u.MAX_PRECISION_DIGITS;n>=0;n--){try{this.bufferReducedPrecision(n)}catch(m){if(!(m instanceof Qt))throw m;this._saveException=m}if(this._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var r=arguments[0],a=u.precisionScaleFactor(this._argGeom,this._distance,r),f=new bt(a);this.bufferFixedPrecision(f)}}},{key:"computeGeometry",value:function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var n=this._argGeom.getFactory().getPrecisionModel();n.getType()===bt.FIXED?this.bufferFixedPrecision(n):this.bufferReducedPrecision()}},{key:"setQuadrantSegments",value:function(n){this._bufParams.setQuadrantSegments(n)}},{key:"bufferOriginalPrecision",value:function(){try{var n=new jc(this._bufParams);this._resultGeometry=n.buffer(this._argGeom,this._distance)}catch(r){if(!(r instanceof K))throw r;this._saveException=r}}},{key:"getResultGeometry",value:function(n){return this._distance=n,this.computeGeometry(),this._resultGeometry}},{key:"setEndCapStyle",value:function(n){this._bufParams.setEndCapStyle(n)}}],[{key:"constructor_",value:function(){if(this._argGeom=null,this._distance=null,this._bufParams=new S,this._resultGeometry=null,this._saveException=null,arguments.length===1){var n=arguments[0];this._argGeom=n}else if(arguments.length===2){var r=arguments[0],a=arguments[1];this._argGeom=r,this._bufParams=a}}},{key:"bufferOp",value:function(){if(arguments.length===2){var n=arguments[1];return new u(arguments[0]).getResultGeometry(n)}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof oe&&typeof arguments[1]=="number"){var r=arguments[1],a=arguments[2],f=new u(arguments[0]);return f.setQuadrantSegments(a),f.getResultGeometry(r)}if(arguments[2]instanceof S&&arguments[0]instanceof oe&&typeof arguments[1]=="number"){var m=arguments[1];return new u(arguments[0],arguments[2]).getResultGeometry(m)}}else if(arguments.length===4){var p=arguments[1],I=arguments[2],T=arguments[3],U=new u(arguments[0]);return U.setQuadrantSegments(I),U.setEndCapStyle(T),U.getResultGeometry(p)}}},{key:"precisionScaleFactor",value:function(n,r,a){var f=n.getEnvelopeInternal(),m=Tr.max(Math.abs(f.getMaxX()),Math.abs(f.getMaxY()),Math.abs(f.getMinX()),Math.abs(f.getMinY()))+2*(r>0?r:0),p=a-Math.trunc(Math.log(m)/Math.log(10)+1);return Math.pow(10,p)}}])})();Jn.CAP_ROUND=S.CAP_ROUND,Jn.CAP_BUTT=S.CAP_FLAT,Jn.CAP_FLAT=S.CAP_FLAT,Jn.CAP_SQUARE=S.CAP_SQUARE,Jn.MAX_PRECISION_DIGITS=12;var Bp=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],rh=(function(){return c((function u(n){o(this,u),this.geometryFactory=n||new Hn}),[{key:"read",value:function(u){var n,r=(n=typeof u=="string"?JSON.parse(u):u).type;if(!Pt[r])throw new Error("Unknown GeoJSON type: "+n.type);return Bp.indexOf(r)!==-1?Pt[r].call(this,n.coordinates):r==="GeometryCollection"?Pt[r].call(this,n.geometries):Pt[r].call(this,n)}},{key:"write",value:function(u){var n=u.getGeometryType();if(!Xt[n])throw new Error("Geometry is not supported");return Xt[n].call(this,u)}}])})(),Pt={Feature:function(u){var n={};for(var r in u)n[r]=u[r];if(u.geometry){var a=u.geometry.type;if(!Pt[a])throw new Error("Unknown GeoJSON type: "+u.type);n.geometry=this.read(u.geometry)}return u.bbox&&(n.bbox=Pt.bbox.call(this,u.bbox)),n},FeatureCollection:function(u){var n={};if(u.features){n.features=[];for(var r=0;r<u.features.length;++r)n.features.push(this.read(u.features[r]))}return u.bbox&&(n.bbox=this.parse.bbox.call(this,u.bbox)),n},coordinates:function(u){for(var n=[],r=0;r<u.length;++r){var a=u[r];n.push(l(W,R(a)))}return n},bbox:function(u){return this.geometryFactory.createLinearRing([new W(u[0],u[1]),new W(u[2],u[1]),new W(u[2],u[3]),new W(u[0],u[3]),new W(u[0],u[1])])},Point:function(u){var n=l(W,R(u));return this.geometryFactory.createPoint(n)},MultiPoint:function(u){for(var n=[],r=0;r<u.length;++r)n.push(Pt.Point.call(this,u[r]));return this.geometryFactory.createMultiPoint(n)},LineString:function(u){var n=Pt.coordinates.call(this,u);return this.geometryFactory.createLineString(n)},MultiLineString:function(u){for(var n=[],r=0;r<u.length;++r)n.push(Pt.LineString.call(this,u[r]));return this.geometryFactory.createMultiLineString(n)},Polygon:function(u){for(var n=Pt.coordinates.call(this,u[0]),r=this.geometryFactory.createLinearRing(n),a=[],f=1;f<u.length;++f){var m=u[f],p=Pt.coordinates.call(this,m),I=this.geometryFactory.createLinearRing(p);a.push(I)}return this.geometryFactory.createPolygon(r,a)},MultiPolygon:function(u){for(var n=[],r=0;r<u.length;++r){var a=u[r];n.push(Pt.Polygon.call(this,a))}return this.geometryFactory.createMultiPolygon(n)},GeometryCollection:function(u){for(var n=[],r=0;r<u.length;++r){var a=u[r];n.push(this.read(a))}return this.geometryFactory.createGeometryCollection(n)}},Xt={coordinate:function(u){var n=[u.x,u.y];return u.z&&n.push(u.z),u.m&&n.push(u.m),n},Point:function(u){return{type:"Point",coordinates:Xt.coordinate.call(this,u.getCoordinate())}},MultiPoint:function(u){for(var n=[],r=0;r<u._geometries.length;++r){var a=u._geometries[r],f=Xt.Point.call(this,a);n.push(f.coordinates)}return{type:"MultiPoint",coordinates:n}},LineString:function(u){for(var n=[],r=u.getCoordinates(),a=0;a<r.length;++a){var f=r[a];n.push(Xt.coordinate.call(this,f))}return{type:"LineString",coordinates:n}},MultiLineString:function(u){for(var n=[],r=0;r<u._geometries.length;++r){var a=u._geometries[r],f=Xt.LineString.call(this,a);n.push(f.coordinates)}return{type:"MultiLineString",coordinates:n}},Polygon:function(u){var n=[],r=Xt.LineString.call(this,u._shell);n.push(r.coordinates);for(var a=0;a<u._holes.length;++a){var f=u._holes[a],m=Xt.LineString.call(this,f);n.push(m.coordinates)}return{type:"Polygon",coordinates:n}},MultiPolygon:function(u){for(var n=[],r=0;r<u._geometries.length;++r){var a=u._geometries[r],f=Xt.Polygon.call(this,a);n.push(f.coordinates)}return{type:"MultiPolygon",coordinates:n}},GeometryCollection:function(u){for(var n=[],r=0;r<u._geometries.length;++r){var a=u._geometries[r],f=a.getGeometryType();n.push(Xt[f].call(this,a))}return{type:"GeometryCollection",geometries:n}}};return{BufferOp:Jn,GeoJSONReader:(function(){return c((function u(n){o(this,u),this.parser=new rh(n||new Hn)}),[{key:"read",value:function(u){return this.parser.read(u)}}])})(),GeoJSONWriter:(function(){return c((function u(){o(this,u),this.parser=new rh(this.geometryFactory)}),[{key:"write",value:function(u){return this.parser.write(u)}}])})()}}))})(ei)),ei.exports}var jf=Qf();const eg=gr(jf);function sn(){return new ti}function ti(){this.reset()}ti.prototype={constructor:ti,reset:function(){this.s=this.t=0},add:function(t){Ba(ni,t,this.t),Ba(this,ni.s,this.s),this.s?this.t+=ni.t:this.s=ni.t},valueOf:function(){return this.s}};var ni=new ti;function Ba(t,e,i){var s=t.s=e+i,o=s-e,l=s-o;t.t=e-l+(i-o)}var ze=1e-6,Ae=Math.PI,At=Ae/2,Ga=Ae/4,Dt=Ae*2,on=180/Ae,xt=Ae/180,tt=Math.abs,tg=Math.atan,Rn=Math.atan2,Ve=Math.cos,He=Math.sin,An=Math.sqrt;function Ya(t){return t>1?0:t<-1?Ae:Math.acos(t)}function yn(t){return t>1?At:t<-1?-At:Math.asin(t)}function vr(){}function ri(t,e){t&&Xa.hasOwnProperty(t.type)&&Xa[t.type](t,e)}var za={Feature:function(t,e){ri(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,o=i.length;++s<o;)ri(i[s].geometry,e)}},Xa={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 i=t.coordinates,s=-1,o=i.length;++s<o;)t=i[s],e.point(t[0],t[1],t[2])},LineString:function(t,e){Is(t.coordinates,e,0)},MultiLineString:function(t,e){for(var i=t.coordinates,s=-1,o=i.length;++s<o;)Is(i[s],e,0)},Polygon:function(t,e){Ua(t.coordinates,e)},MultiPolygon:function(t,e){for(var i=t.coordinates,s=-1,o=i.length;++s<o;)Ua(i[s],e)},GeometryCollection:function(t,e){for(var i=t.geometries,s=-1,o=i.length;++s<o;)ri(i[s],e)}};function Is(t,e,i){var s=-1,o=t.length-i,l;for(e.lineStart();++s<o;)l=t[s],e.point(l[0],l[1],l[2]);e.lineEnd()}function Ua(t,e){var i=-1,s=t.length;for(e.polygonStart();++i<s;)Is(t[i],e,1);e.polygonEnd()}function ng(t,e){t&&za.hasOwnProperty(t.type)?za[t.type](t,e):ri(t,e)}sn(),sn();function Ns(t){return[Rn(t[1],t[0]),yn(t[2])]}function Dn(t){var e=t[0],i=t[1],s=Ve(i);return[s*Ve(e),s*He(e),He(i)]}function ii(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function si(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 Ms(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function oi(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Ss(t){var e=An(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}sn();function Va(t,e){function i(s,o){return s=t(s,o),e(s[0],s[1])}return t.invert&&e.invert&&(i.invert=function(s,o){return s=e.invert(s,o),s&&t.invert(s[0],s[1])}),i}function Ps(t,e){return[t>Ae?t-Dt:t<-Ae?t+Dt:t,e]}Ps.invert=Ps;function rg(t,e,i){return(t%=Dt)?e||i?Va($a(t),Za(e,i)):$a(t):e||i?Za(e,i):Ps}function Ha(t){return function(e,i){return e+=t,[e>Ae?e-Dt:e<-Ae?e+Dt:e,i]}}function $a(t){var e=Ha(t);return e.invert=Ha(-t),e}function Za(t,e){var i=Ve(t),s=He(t),o=Ve(e),l=He(e);function h(c,g){var d=Ve(g),y=Ve(c)*d,v=He(c)*d,_=He(g),E=_*i+y*s;return[Rn(v*o-E*l,y*i-_*s),yn(E*o+v*l)]}return h.invert=function(c,g){var d=Ve(g),y=Ve(c)*d,v=He(c)*d,_=He(g),E=_*o-v*l;return[Rn(v*o+_*l,y*i+E*s),yn(E*i-y*s)]},h}function ig(t,e,i,s,o,l){if(i){var h=Ve(e),c=He(e),g=s*i;o==null?(o=e+s*Dt,l=e-g/2):(o=Wa(h,o),l=Wa(h,l),(s>0?o<l:o>l)&&(o+=s*Dt));for(var d,y=o;s>0?y>l:y<l;y-=g)d=Ns([h,-c*Ve(y),-c*He(y)]),t.point(d[0],d[1])}}function Wa(t,e){e=Dn(e),e[0]-=t,Ss(e);var i=Ya(-e[1]);return((-e[2]<0?-i:i)+Dt-ze)%Dt}function Ka(){var t=[],e;return{point:function(i,s){e.push([i,s])},lineStart:function(){t.push(e=[])},lineEnd:vr,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var i=t;return t=[],e=null,i}}}function sg(t,e,i,s,o,l){var h=t[0],c=t[1],g=e[0],d=e[1],y=0,v=1,_=g-h,E=d-c,M;if(M=i-h,!(!_&&M>0)){if(M/=_,_<0){if(M<y)return;M<v&&(v=M)}else if(_>0){if(M>v)return;M>y&&(y=M)}if(M=o-h,!(!_&&M<0)){if(M/=_,_<0){if(M>v)return;M>y&&(y=M)}else if(_>0){if(M<y)return;M<v&&(v=M)}if(M=s-c,!(!E&&M>0)){if(M/=E,E<0){if(M<y)return;M<v&&(v=M)}else if(E>0){if(M>v)return;M>y&&(y=M)}if(M=l-c,!(!E&&M<0)){if(M/=E,E<0){if(M>v)return;M>y&&(y=M)}else if(E>0){if(M<y)return;M<v&&(v=M)}return y>0&&(t[0]=h+y*_,t[1]=c+y*E),v<1&&(e[0]=h+v*_,e[1]=c+v*E),!0}}}}}function ai(t,e){return tt(t[0]-e[0])<ze&&tt(t[1]-e[1])<ze}function ui(t,e,i,s){this.x=t,this.z=e,this.o=i,this.e=s,this.v=!1,this.n=this.p=null}function Ja(t,e,i,s,o){var l=[],h=[],c,g;if(t.forEach(function(M){if(!((R=M.length-1)<=0)){var R,Y=M[0],H=M[R],x;if(ai(Y,H)){for(o.lineStart(),c=0;c<R;++c)o.point((Y=M[c])[0],Y[1]);o.lineEnd();return}l.push(x=new ui(Y,M,null,!0)),h.push(x.o=new ui(Y,null,x,!1)),l.push(x=new ui(H,M,null,!1)),h.push(x.o=new ui(H,null,x,!0))}}),!!l.length){for(h.sort(e),Qa(l),Qa(h),c=0,g=h.length;c<g;++c)h[c].e=i=!i;for(var d=l[0],y,v;;){for(var _=d,E=!0;_.v;)if((_=_.n)===d)return;y=_.z,o.lineStart();do{if(_.v=_.o.v=!0,_.e){if(E)for(c=0,g=y.length;c<g;++c)o.point((v=y[c])[0],v[1]);else s(_.x,_.n.x,1,o);_=_.n}else{if(E)for(y=_.p.z,c=y.length-1;c>=0;--c)o.point((v=y[c])[0],v[1]);else s(_.x,_.p.x,-1,o);_=_.p}_=_.o,y=_.z,E=!E}while(!_.v);o.lineEnd()}}}function Qa(t){if(e=t.length){for(var e,i=0,s=t[0],o;++i<e;)s.n=o=t[i],o.p=s,s=o;s.n=o=t[0],o.p=s}}function ja(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function og(t){return t.length===1&&(t=ag(t)),{left:function(e,i,s,o){for(s==null&&(s=0),o==null&&(o=e.length);s<o;){var l=s+o>>>1;t(e[l],i)<0?s=l+1:o=l}return s},right:function(e,i,s,o){for(s==null&&(s=0),o==null&&(o=e.length);s<o;){var l=s+o>>>1;t(e[l],i)>0?o=l:s=l+1}return s}}}function ag(t){return function(e,i){return ja(t(e),i)}}og(ja);function eu(t){for(var e=t.length,i,s=-1,o=0,l,h;++s<e;)o+=t[s].length;for(l=new Array(o);--e>=0;)for(h=t[e],i=h.length;--i>=0;)l[--o]=h[i];return l}var yr=1e9,li=-yr;function ug(t,e,i,s){function o(d,y){return t<=d&&d<=i&&e<=y&&y<=s}function l(d,y,v,_){var E=0,M=0;if(d==null||(E=h(d,v))!==(M=h(y,v))||g(d,y)<0^v>0)do _.point(E===0||E===3?t:i,E>1?s:e);while((E=(E+v+4)%4)!==M);else _.point(y[0],y[1])}function h(d,y){return tt(d[0]-t)<ze?y>0?0:3:tt(d[0]-i)<ze?y>0?2:1:tt(d[1]-e)<ze?y>0?1:0:y>0?3:2}function c(d,y){return g(d.x,y.x)}function g(d,y){var v=h(d,1),_=h(y,1);return v!==_?v-_:v===0?y[1]-d[1]:v===1?d[0]-y[0]:v===2?d[1]-y[1]:y[0]-d[0]}return function(d){var y=d,v=Ka(),_,E,M,R,Y,H,x,S,b,C,A,q={point:w,lineStart:F,lineEnd:X,polygonStart:L,polygonEnd:D};function w(V,k){o(V,k)&&y.point(V,k)}function N(){for(var V=0,k=0,O=E.length;k<O;++k)for(var P=E[k],G=1,B=P.length,Z=P[0],K,ee,j=Z[0],te=Z[1];G<B;++G)K=j,ee=te,Z=P[G],j=Z[0],te=Z[1],ee<=s?te>s&&(j-K)*(s-ee)>(te-ee)*(t-K)&&++V:te<=s&&(j-K)*(s-ee)<(te-ee)*(t-K)&&--V;return V}function L(){y=v,_=[],E=[],A=!0}function D(){var V=N(),k=A&&V,O=(_=eu(_)).length;(k||O)&&(d.polygonStart(),k&&(d.lineStart(),l(null,null,1,d),d.lineEnd()),O&&Ja(_,c,V,l,d),d.polygonEnd()),y=d,_=E=M=null}function F(){q.point=z,E&&E.push(M=[]),C=!0,b=!1,x=S=NaN}function X(){_&&(z(R,Y),H&&b&&v.rejoin(),_.push(v.result())),q.point=w,b&&y.lineEnd()}function z(V,k){var O=o(V,k);if(E&&M.push([V,k]),C)R=V,Y=k,H=O,C=!1,O&&(y.lineStart(),y.point(V,k));else if(O&&b)y.point(V,k);else{var P=[x=Math.max(li,Math.min(yr,x)),S=Math.max(li,Math.min(yr,S))],G=[V=Math.max(li,Math.min(yr,V)),k=Math.max(li,Math.min(yr,k))];sg(P,G,t,e,i,s)?(b||(y.lineStart(),y.point(P[0],P[1])),y.point(G[0],G[1]),O||y.lineEnd(),A=!1):O&&(y.lineStart(),y.point(V,k),A=!1)}x=V,S=k,b=O}return q}}var Ls=sn();function lg(t,e){var i=e[0],s=e[1],o=[He(i),-Ve(i),0],l=0,h=0;Ls.reset();for(var c=0,g=t.length;c<g;++c)if(y=(d=t[c]).length)for(var d,y,v=d[y-1],_=v[0],E=v[1]/2+Ga,M=He(E),R=Ve(E),Y=0;Y<y;++Y,_=x,M=b,R=C,v=H){var H=d[Y],x=H[0],S=H[1]/2+Ga,b=He(S),C=Ve(S),A=x-_,q=A>=0?1:-1,w=q*A,N=w>Ae,L=M*b;if(Ls.add(Rn(L*q*He(w),R*C+L*Ve(w))),l+=N?A+q*Dt:A,N^_>=i^x>=i){var D=si(Dn(v),Dn(H));Ss(D);var F=si(o,D);Ss(F);var X=(N^A>=0?-1:1)*yn(F[2]);(s>X||s===X&&(D[0]||D[1]))&&(h+=N^A>=0?1:-1)}}return(l<-ze||l<ze&&Ls<-ze)^h&1}sn();function tu(t){return t}sn(),sn();var Fn=1/0,ci=Fn,mr=-Fn,hi=mr,nu={point:cg,lineStart:vr,lineEnd:vr,polygonStart:vr,polygonEnd:vr,result:function(){var t=[[Fn,ci],[mr,hi]];return mr=hi=-(ci=Fn=1/0),t}};function cg(t,e){t<Fn&&(Fn=t),t>mr&&(mr=t),e<ci&&(ci=e),e>hi&&(hi=e)}sn();function ru(t,e,i,s){return function(o,l){var h=e(l),c=o.invert(s[0],s[1]),g=Ka(),d=e(g),y=!1,v,_,E,M={point:R,lineStart:H,lineEnd:x,polygonStart:function(){M.point=S,M.lineStart=b,M.lineEnd=C,_=[],v=[]},polygonEnd:function(){M.point=R,M.lineStart=H,M.lineEnd=x,_=eu(_);var A=lg(v,c);_.length?(y||(l.polygonStart(),y=!0),Ja(_,fg,A,i,l)):A&&(y||(l.polygonStart(),y=!0),l.lineStart(),i(null,null,1,l),l.lineEnd()),y&&(l.polygonEnd(),y=!1),_=v=null},sphere:function(){l.polygonStart(),l.lineStart(),i(null,null,1,l),l.lineEnd(),l.polygonEnd()}};function R(A,q){var w=o(A,q);t(A=w[0],q=w[1])&&l.point(A,q)}function Y(A,q){var w=o(A,q);h.point(w[0],w[1])}function H(){M.point=Y,h.lineStart()}function x(){M.point=R,h.lineEnd()}function S(A,q){E.push([A,q]);var w=o(A,q);d.point(w[0],w[1])}function b(){d.lineStart(),E=[]}function C(){S(E[0][0],E[0][1]),d.lineEnd();var A=d.clean(),q=g.result(),w,N=q.length,L,D,F;if(E.pop(),v.push(E),E=null,!!N){if(A&1){if(D=q[0],(L=D.length-1)>0){for(y||(l.polygonStart(),y=!0),l.lineStart(),w=0;w<L;++w)l.point((F=D[w])[0],F[1]);l.lineEnd()}return}N>1&&A&2&&q.push(q.pop().concat(q.shift())),_.push(q.filter(hg))}}return M}}function hg(t){return t.length>1}function fg(t,e){return((t=t.x)[0]<0?t[1]-At-ze:At-t[1])-((e=e.x)[0]<0?e[1]-At-ze:At-e[1])}const iu=ru(function(){return!0},gg,vg,[-Ae,-At]);function gg(t){var e=NaN,i=NaN,s=NaN,o;return{lineStart:function(){t.lineStart(),o=1},point:function(l,h){var c=l>0?Ae:-Ae,g=tt(l-e);tt(g-Ae)<ze?(t.point(e,i=(i+h)/2>0?At:-At),t.point(s,i),t.lineEnd(),t.lineStart(),t.point(c,i),t.point(l,i),o=0):s!==c&&g>=Ae&&(tt(e-s)<ze&&(e-=s*ze),tt(l-c)<ze&&(l-=c*ze),i=dg(e,i,l,h),t.point(s,i),t.lineEnd(),t.lineStart(),t.point(c,i),o=0),t.point(e=l,i=h),s=c},lineEnd:function(){t.lineEnd(),e=i=NaN},clean:function(){return 2-o}}}function dg(t,e,i,s){var o,l,h=He(t-i);return tt(h)>ze?tg((He(e)*(l=Ve(s))*He(i)-He(s)*(o=Ve(e))*He(t))/(o*l*h)):(e+s)/2}function vg(t,e,i,s){var o;if(t==null)o=i*At,s.point(-Ae,o),s.point(0,o),s.point(Ae,o),s.point(Ae,0),s.point(Ae,-o),s.point(0,-o),s.point(-Ae,-o),s.point(-Ae,0),s.point(-Ae,o);else if(tt(t[0]-e[0])>ze){var l=t[0]<e[0]?Ae:-Ae;o=i*l/2,s.point(-l,o),s.point(0,o),s.point(l,o)}else s.point(e[0],e[1])}function yg(t,e){var i=Ve(t),s=i>0,o=tt(i)>ze;function l(y,v,_,E){ig(E,t,e,_,y,v)}function h(y,v){return Ve(y)*Ve(v)>i}function c(y){var v,_,E,M,R;return{lineStart:function(){M=E=!1,R=1},point:function(Y,H){var x=[Y,H],S,b=h(Y,H),C=s?b?0:d(Y,H):b?d(Y+(Y<0?Ae:-Ae),H):0;if(!v&&(M=E=b)&&y.lineStart(),b!==E&&(S=g(v,x),(!S||ai(v,S)||ai(x,S))&&(x[0]+=ze,x[1]+=ze,b=h(x[0],x[1]))),b!==E)R=0,b?(y.lineStart(),S=g(x,v),y.point(S[0],S[1])):(S=g(v,x),y.point(S[0],S[1]),y.lineEnd()),v=S;else if(o&&v&&s^b){var A;!(C&_)&&(A=g(x,v,!0))&&(R=0,s?(y.lineStart(),y.point(A[0][0],A[0][1]),y.point(A[1][0],A[1][1]),y.lineEnd()):(y.point(A[1][0],A[1][1]),y.lineEnd(),y.lineStart(),y.point(A[0][0],A[0][1])))}b&&(!v||!ai(v,x))&&y.point(x[0],x[1]),v=x,E=b,_=C},lineEnd:function(){E&&y.lineEnd(),v=null},clean:function(){return R|(M&&E)<<1}}}function g(y,v,_){var E=Dn(y),M=Dn(v),R=[1,0,0],Y=si(E,M),H=ii(Y,Y),x=Y[0],S=H-x*x;if(!S)return!_&&y;var b=i*H/S,C=-i*x/S,A=si(R,Y),q=oi(R,b),w=oi(Y,C);Ms(q,w);var N=A,L=ii(q,N),D=ii(N,N),F=L*L-D*(ii(q,q)-1);if(!(F<0)){var X=An(F),z=oi(N,(-L-X)/D);if(Ms(z,q),z=Ns(z),!_)return z;var V=y[0],k=v[0],O=y[1],P=v[1],G;k<V&&(G=V,V=k,k=G);var B=k-V,Z=tt(B-Ae)<ze,K=Z||B<ze;if(!Z&&P<O&&(G=O,O=P,P=G),K?Z?O+P>0^z[1]<(tt(z[0]-V)<ze?O:P):O<=z[1]&&z[1]<=P:B>Ae^(V<=z[0]&&z[0]<=k)){var ee=oi(N,(-L+X)/D);return Ms(ee,q),[z,Ns(ee)]}}}function d(y,v){var _=s?t:Ae-t,E=0;return y<-_?E|=1:y>_&&(E|=2),v<-_?E|=4:v>_&&(E|=8),E}return ru(h,c,l,s?[0,-t]:[-Ae,t-Ae])}function su(t){return function(e){var i=new bs;for(var s in t)i[s]=t[s];return i.stream=e,i}}function bs(){}bs.prototype={constructor:bs,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()}};function ou(t,e,i){var s=e[1][0]-e[0][0],o=e[1][1]-e[0][1],l=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),l!=null&&t.clipExtent(null),ng(i,t.stream(nu));var h=nu.result(),c=Math.min(s/(h[1][0]-h[0][0]),o/(h[1][1]-h[0][1])),g=+e[0][0]+(s-c*(h[1][0]+h[0][0]))/2,d=+e[0][1]+(o-c*(h[1][1]+h[0][1]))/2;return l!=null&&t.clipExtent(l),t.scale(c*150).translate([g,d])}function mg(t,e,i){return ou(t,[[0,0],e],i)}var au=16,pg=Ve(30*xt);function uu(t,e){return+e?xg(t,e):_g(t)}function _g(t){return su({point:function(e,i){e=t(e,i),this.stream.point(e[0],e[1])}})}function xg(t,e){function i(s,o,l,h,c,g,d,y,v,_,E,M,R,Y){var H=d-s,x=y-o,S=H*H+x*x;if(S>4*e&&R--){var b=h+_,C=c+E,A=g+M,q=An(b*b+C*C+A*A),w=yn(A/=q),N=tt(tt(A)-1)<ze||tt(l-v)<ze?(l+v)/2:Rn(C,b),L=t(N,w),D=L[0],F=L[1],X=D-s,z=F-o,V=x*X-H*z;(V*V/S>e||tt((H*X+x*z)/S-.5)>.3||h*_+c*E+g*M<pg)&&(i(s,o,l,h,c,g,D,F,N,b/=q,C/=q,A,R,Y),Y.point(D,F),i(D,F,N,b,C,A,d,y,v,_,E,M,R,Y))}}return function(s){var o,l,h,c,g,d,y,v,_,E,M,R,Y={point:H,lineStart:x,lineEnd:b,polygonStart:function(){s.polygonStart(),Y.lineStart=C},polygonEnd:function(){s.polygonEnd(),Y.lineStart=x}};function H(w,N){w=t(w,N),s.point(w[0],w[1])}function x(){v=NaN,Y.point=S,s.lineStart()}function S(w,N){var L=Dn([w,N]),D=t(w,N);i(v,_,y,E,M,R,v=D[0],_=D[1],y=w,E=L[0],M=L[1],R=L[2],au,s),s.point(v,_)}function b(){Y.point=H,s.lineEnd()}function C(){x(),Y.point=A,Y.lineEnd=q}function A(w,N){S(o=w,N),l=v,h=_,c=E,g=M,d=R,Y.point=S}function q(){i(v,_,y,E,M,R,l,h,o,c,g,d,au,s),Y.lineEnd=b,b()}return Y}}var Eg=su({point:function(t,e){this.stream.point(t*xt,e*xt)}});function wg(t){return kg(function(){return t})()}function kg(t){var e,i=150,s=480,o=250,l,h,c=0,g=0,d=0,y=0,v=0,_,E,M=null,R=iu,Y=null,H,x,S,b=tu,C=.5,A=uu(D,C),q,w;function N(z){return z=E(z[0]*xt,z[1]*xt),[z[0]*i+l,h-z[1]*i]}function L(z){return z=E.invert((z[0]-l)/i,(h-z[1])/i),z&&[z[0]*on,z[1]*on]}function D(z,V){return z=e(z,V),[z[0]*i+l,h-z[1]*i]}N.stream=function(z){return q&&w===z?q:q=Eg(R(_,A(b(w=z))))},N.clipAngle=function(z){return arguments.length?(R=+z?yg(M=z*xt,6*xt):(M=null,iu),X()):M*on},N.clipExtent=function(z){return arguments.length?(b=z==null?(Y=H=x=S=null,tu):ug(Y=+z[0][0],H=+z[0][1],x=+z[1][0],S=+z[1][1]),X()):Y==null?null:[[Y,H],[x,S]]},N.scale=function(z){return arguments.length?(i=+z,F()):i},N.translate=function(z){return arguments.length?(s=+z[0],o=+z[1],F()):[s,o]},N.center=function(z){return arguments.length?(c=z[0]%360*xt,g=z[1]%360*xt,F()):[c*on,g*on]},N.rotate=function(z){return arguments.length?(d=z[0]%360*xt,y=z[1]%360*xt,v=z.length>2?z[2]%360*xt:0,F()):[d*on,y*on,v*on]},N.precision=function(z){return arguments.length?(A=uu(D,C=z*z),X()):An(C)},N.fitExtent=function(z,V){return ou(N,z,V)},N.fitSize=function(z,V){return mg(N,z,V)};function F(){E=Va(_=rg(d,y,v),e);var z=e(c,g);return l=s-z[0]*i,h=o+z[1]*i,X()}function X(){return q=w=null,N}return function(){return e=t.apply(this,arguments),N.invert=e.invert&&L,F()}}function lu(t){return function(e,i){var s=Ve(e),o=Ve(i),l=t(s*o);return[l*o*He(e),l*He(i)]}}function cu(t){return function(e,i){var s=An(e*e+i*i),o=t(s),l=He(o),h=Ve(o);return[Rn(e*l,s*h),yn(s&&i*l/s)]}}var Ig=lu(function(t){return An(2/(1+t))});Ig.invert=cu(function(t){return 2*yn(t/2)});var hu=lu(function(t){return(t=Ya(t))&&t/He(t)});hu.invert=cu(function(t){return t});function Ng(){return wg(hu).scale(79.4188).clipAngle(180-.001)}function fu(t,e){return[t,e]}fu.invert=fu;var{BufferOp:Mg,GeoJSONReader:Sg,GeoJSONWriter:Pg}=eg;function Lg(t,e,i){i=i||{};var s=i.units||"kilometers",o=i.steps||8;if(!t)throw new Error("geojson is required");if(typeof i!="object")throw new Error("options must be an object");if(typeof o!="number")throw new Error("steps must be an number");if(e===void 0)throw new Error("radius is required");if(o<=0)throw new Error("steps must be greater than 0");var l=[];switch(t.type){case"GeometryCollection":return rt(t,function(h){var c=fi(h,e,s,o);c&&l.push(c)}),he(l);case"FeatureCollection":return Le(t,function(h){var c=fi(h,e,s,o);c&&Le(c,function(g){g&&l.push(g)})}),he(l)}return fi(t,e,s,o)}function fi(t,e,i,s){var o=t.properties||{},l=t.type==="Feature"?t.geometry:t;if(l.type==="GeometryCollection"){var h=[];return rt(t,function(R){var Y=fi(R,e,i,s);Y&&h.push(Y)}),he(h)}var c=bg(l),g={type:l.type,coordinates:du(l.coordinates,c)},d=new Sg,y=d.read(g),v=er(Mn(e,i),"meters"),_=Mg.bufferOp(y,v,s),E=new Pg;if(_=E.write(_),!gu(_.coordinates)){var M={type:_.type,coordinates:vu(_.coordinates,c)};return We(M,o)}}function gu(t){return Array.isArray(t[0])?gu(t[0]):isNaN(t[0])}function du(t,e){return typeof t[0]!="object"?e(t):t.map(function(i){return du(i,e)})}function vu(t,e){return typeof t[0]!="object"?e.invert(t):t.map(function(i){return vu(i,e)})}function bg(t){var e=jr(t).geometry.coordinates,i=[-e[0],-e[1]];return Ng().rotate(i).scale(Ke)}function Cs(t,e={}){let i=0,s=0,o=0;return rt(t,function(l,h,c){let g=e.weight?c?.[e.weight]:void 0;if(g=g??1,!Je(g))throw new Error("weight value must be a number for feature index "+h);g=Number(g),g>0&&Xe(l,function(d){i+=d[0]*g,s+=d[1]*g,o+=g})}),_e([i/o,s/o],e.properties,e)}function Zt(t,e={}){let i=0,s=0,o=0;return Xe(t,function(l){i+=l[0],s+=l[1],o++},!0),_e([i/o,s/o],e.properties)}function Cg(t,e={}){if(e=e||{},!Ce(e))throw new Error("options is invalid");var i=e.counter||10;if(!Je(i))throw new Error("counter must be a number");var s=e.weight,o=Cs(t,{weight:e.weight}),l=he([]);Le(t,function(c){var g;l.features.push(Zt(c,{properties:{weight:(g=c.properties)==null?void 0:g[s]}}))});const h={tolerance:e.tolerance,medianCandidates:[]};return yu(o.geometry.coordinates,[0,0],l,h,i)}function yu(t,e,i,s,o){var l=s.tolerance||.001,h=0,c=0,g=0,d=0;if(Le(i,function(_){var E,M=(E=_.properties)==null?void 0:E.weight,R=M??1;if(R=Number(R),!Je(R))throw new Error("weight value must be a number");if(R>0){d+=1;var Y=R*Be(_,t);Y===0&&(Y=1);var H=R/Y;h+=_.geometry.coordinates[0]*H,c+=_.geometry.coordinates[1]*H,g+=H}}),d<1)throw new Error("no features to measure");var y=h/g,v=c/g;return d===1||o===0||Math.abs(y-e[0])<l&&Math.abs(v-e[1])<l?_e([y,v],{medianCandidates:s.medianCandidates}):(s.medianCandidates.push([y,v]),yu([y,v],t,i,s,o-1))}var gi={exports:{}},di={exports:{}},Og=di.exports,mu;function Tg(){return mu||(mu=1,(function(t,e){(function(i,s){t.exports=s()})(Og,function(){function i(x,S,b,C,A){(function q(w,N,L,D,F){for(;D>L;){if(D-L>600){var X=D-L+1,z=N-L+1,V=Math.log(X),k=.5*Math.exp(2*V/3),O=.5*Math.sqrt(V*k*(X-k)/X)*(z-X/2<0?-1:1),P=Math.max(L,Math.floor(N-z*k/X+O)),G=Math.min(D,Math.floor(N+(X-z)*k/X+O));q(w,N,P,G,F)}var B=w[N],Z=L,K=D;for(s(w,L,N),F(w[D],B)>0&&s(w,L,D);Z<K;){for(s(w,Z,K),Z++,K--;F(w[Z],B)<0;)Z++;for(;F(w[K],B)>0;)K--}F(w[L],B)===0?s(w,L,K):s(w,++K,D),K<=N&&(L=K+1),N<=K&&(D=K-1)}})(x,S,b||0,C||x.length-1,A||o)}function s(x,S,b){var C=x[S];x[S]=x[b],x[b]=C}function o(x,S){return x<S?-1:x>S?1:0}var l=function(x){x===void 0&&(x=9),this._maxEntries=Math.max(4,x),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function h(x,S,b){if(!b)return S.indexOf(x);for(var C=0;C<S.length;C++)if(b(x,S[C]))return C;return-1}function c(x,S){g(x,0,x.children.length,S,x)}function g(x,S,b,C,A){A||(A=Y(null)),A.minX=1/0,A.minY=1/0,A.maxX=-1/0,A.maxY=-1/0;for(var q=S;q<b;q++){var w=x.children[q];d(A,x.leaf?C(w):w)}return A}function d(x,S){return x.minX=Math.min(x.minX,S.minX),x.minY=Math.min(x.minY,S.minY),x.maxX=Math.max(x.maxX,S.maxX),x.maxY=Math.max(x.maxY,S.maxY),x}function y(x,S){return x.minX-S.minX}function v(x,S){return x.minY-S.minY}function _(x){return(x.maxX-x.minX)*(x.maxY-x.minY)}function E(x){return x.maxX-x.minX+(x.maxY-x.minY)}function M(x,S){return x.minX<=S.minX&&x.minY<=S.minY&&S.maxX<=x.maxX&&S.maxY<=x.maxY}function R(x,S){return S.minX<=x.maxX&&S.minY<=x.maxY&&S.maxX>=x.minX&&S.maxY>=x.minY}function Y(x){return{children:x,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function H(x,S,b,C,A){for(var q=[S,b];q.length;)if(!((b=q.pop())-(S=q.pop())<=C)){var w=S+Math.ceil((b-S)/C/2)*C;i(x,w,S,b,A),q.push(S,w,w,b)}}return l.prototype.all=function(){return this._all(this.data,[])},l.prototype.search=function(x){var S=this.data,b=[];if(!R(x,S))return b;for(var C=this.toBBox,A=[];S;){for(var q=0;q<S.children.length;q++){var w=S.children[q],N=S.leaf?C(w):w;R(x,N)&&(S.leaf?b.push(w):M(x,N)?this._all(w,b):A.push(w))}S=A.pop()}return b},l.prototype.collides=function(x){var S=this.data;if(!R(x,S))return!1;for(var b=[];S;){for(var C=0;C<S.children.length;C++){var A=S.children[C],q=S.leaf?this.toBBox(A):A;if(R(x,q)){if(S.leaf||M(x,q))return!0;b.push(A)}}S=b.pop()}return!1},l.prototype.load=function(x){if(!x||!x.length)return this;if(x.length<this._minEntries){for(var S=0;S<x.length;S++)this.insert(x[S]);return this}var b=this._build(x.slice(),0,x.length-1,0);if(this.data.children.length)if(this.data.height===b.height)this._splitRoot(this.data,b);else{if(this.data.height<b.height){var C=this.data;this.data=b,b=C}this._insert(b,this.data.height-b.height-1,!0)}else this.data=b;return this},l.prototype.insert=function(x){return x&&this._insert(x,this.data.height-1),this},l.prototype.clear=function(){return this.data=Y([]),this},l.prototype.remove=function(x,S){if(!x)return this;for(var b,C,A,q=this.data,w=this.toBBox(x),N=[],L=[];q||N.length;){if(q||(q=N.pop(),C=N[N.length-1],b=L.pop(),A=!0),q.leaf){var D=h(x,q.children,S);if(D!==-1)return q.children.splice(D,1),N.push(q),this._condense(N),this}A||q.leaf||!M(q,w)?C?(b++,q=C.children[b],A=!1):q=null:(N.push(q),L.push(b),b=0,C=q,q=q.children[0])}return this},l.prototype.toBBox=function(x){return x},l.prototype.compareMinX=function(x,S){return x.minX-S.minX},l.prototype.compareMinY=function(x,S){return x.minY-S.minY},l.prototype.toJSON=function(){return this.data},l.prototype.fromJSON=function(x){return this.data=x,this},l.prototype._all=function(x,S){for(var b=[];x;)x.leaf?S.push.apply(S,x.children):b.push.apply(b,x.children),x=b.pop();return S},l.prototype._build=function(x,S,b,C){var A,q=b-S+1,w=this._maxEntries;if(q<=w)return c(A=Y(x.slice(S,b+1)),this.toBBox),A;C||(C=Math.ceil(Math.log(q)/Math.log(w)),w=Math.ceil(q/Math.pow(w,C-1))),(A=Y([])).leaf=!1,A.height=C;var N=Math.ceil(q/w),L=N*Math.ceil(Math.sqrt(w));H(x,S,b,L,this.compareMinX);for(var D=S;D<=b;D+=L){var F=Math.min(D+L-1,b);H(x,D,F,N,this.compareMinY);for(var X=D;X<=F;X+=N){var z=Math.min(X+N-1,F);A.children.push(this._build(x,X,z,C-1))}}return c(A,this.toBBox),A},l.prototype._chooseSubtree=function(x,S,b,C){for(;C.push(S),!S.leaf&&C.length-1!==b;){for(var A=1/0,q=1/0,w=void 0,N=0;N<S.children.length;N++){var L=S.children[N],D=_(L),F=(X=x,z=L,(Math.max(z.maxX,X.maxX)-Math.min(z.minX,X.minX))*(Math.max(z.maxY,X.maxY)-Math.min(z.minY,X.minY))-D);F<q?(q=F,A=D<A?D:A,w=L):F===q&&D<A&&(A=D,w=L)}S=w||S.children[0]}var X,z;return S},l.prototype._insert=function(x,S,b){var C=b?x:this.toBBox(x),A=[],q=this._chooseSubtree(C,this.data,S,A);for(q.children.push(x),d(q,C);S>=0&&A[S].children.length>this._maxEntries;)this._split(A,S),S--;this._adjustParentBBoxes(C,A,S)},l.prototype._split=function(x,S){var b=x[S],C=b.children.length,A=this._minEntries;this._chooseSplitAxis(b,A,C);var q=this._chooseSplitIndex(b,A,C),w=Y(b.children.splice(q,b.children.length-q));w.height=b.height,w.leaf=b.leaf,c(b,this.toBBox),c(w,this.toBBox),S?x[S-1].children.push(w):this._splitRoot(b,w)},l.prototype._splitRoot=function(x,S){this.data=Y([x,S]),this.data.height=x.height+1,this.data.leaf=!1,c(this.data,this.toBBox)},l.prototype._chooseSplitIndex=function(x,S,b){for(var C,A,q,w,N,L,D,F=1/0,X=1/0,z=S;z<=b-S;z++){var V=g(x,0,z,this.toBBox),k=g(x,z,b,this.toBBox),O=(A=V,q=k,w=void 0,N=void 0,L=void 0,D=void 0,w=Math.max(A.minX,q.minX),N=Math.max(A.minY,q.minY),L=Math.min(A.maxX,q.maxX),D=Math.min(A.maxY,q.maxY),Math.max(0,L-w)*Math.max(0,D-N)),P=_(V)+_(k);O<F?(F=O,C=z,X=P<X?P:X):O===F&&P<X&&(X=P,C=z)}return C||b-S},l.prototype._chooseSplitAxis=function(x,S,b){var C=x.leaf?this.compareMinX:y,A=x.leaf?this.compareMinY:v;this._allDistMargin(x,S,b,C)<this._allDistMargin(x,S,b,A)&&x.children.sort(C)},l.prototype._allDistMargin=function(x,S,b,C){x.children.sort(C);for(var A=this.toBBox,q=g(x,0,S,A),w=g(x,b-S,b,A),N=E(q)+E(w),L=S;L<b-S;L++){var D=x.children[L];d(q,x.leaf?A(D):D),N+=E(q)}for(var F=b-S-1;F>=S;F--){var X=x.children[F];d(w,x.leaf?A(X):X),N+=E(w)}return N},l.prototype._adjustParentBBoxes=function(x,S,b){for(var C=b;C>=0;C--)d(S[C],x)},l.prototype._condense=function(x){for(var S=x.length-1,b=void 0;S>=0;S--)x[S].children.length===0?S>0?(b=x[S-1].children).splice(b.indexOf(x[S]),1):this.clear():c(x[S],this.toBBox)},l})})(di)),di.exports}class Rg{constructor(e=[],i=Ag){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],i=this.data.pop();return this.length--,this.length>0&&(this.data[0]=i,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:i,compare:s}=this,o=i[e];for(;e>0;){const l=e-1>>1,h=i[l];if(s(o,h)>=0)break;i[e]=h,e=l}i[e]=o}_down(e){const{data:i,compare:s}=this,o=this.length>>1,l=i[e];for(;e<o;){let h=(e<<1)+1,c=i[h];const g=h+1;if(g<this.length&&s(i[g],c)<0&&(h=g,c=i[g]),s(c,l)>=0)break;i[e]=c,e=h}i[e]=l}}function Ag(t,e){return t<e?-1:t>e?1:0}const Dg=Rf(Object.freeze(Object.defineProperty({__proto__:null,default:Rg},Symbol.toStringTag,{value:"Module"})));var pr={exports:{}},Os,pu;function Fg(){return pu||(pu=1,Os=function(e,i,s,o){var l=e[0],h=e[1],c=!1;s===void 0&&(s=0),o===void 0&&(o=i.length);for(var g=(o-s)/2,d=0,y=g-1;d<g;y=d++){var v=i[s+d*2+0],_=i[s+d*2+1],E=i[s+y*2+0],M=i[s+y*2+1],R=_>h!=M>h&&l<(E-v)*(h-_)/(M-_)+v;R&&(c=!c)}return c}),Os}var Ts,_u;function qg(){return _u||(_u=1,Ts=function(e,i,s,o){var l=e[0],h=e[1],c=!1;s===void 0&&(s=0),o===void 0&&(o=i.length);for(var g=o-s,d=0,y=g-1;d<g;y=d++){var v=i[d+s][0],_=i[d+s][1],E=i[y+s][0],M=i[y+s][1],R=_>h!=M>h&&l<(E-v)*(h-_)/(M-_)+v;R&&(c=!c)}return c}),Ts}var xu;function Bg(){if(xu)return pr.exports;xu=1;var t=Fg(),e=qg();return pr.exports=function(s,o,l,h){return o.length>0&&Array.isArray(o[0])?e(s,o,l,h):t(s,o,l,h)},pr.exports.nested=e,pr.exports.flat=t,pr.exports}var _r={exports:{}},Gg=_r.exports,Eu;function Yg(){return Eu||(Eu=1,(function(t,e){(function(i,s){s(e)})(Gg,function(i){const o=33306690738754706e-32;function l(R,Y,H,x,S){let b,C,A,q,w=Y[0],N=x[0],L=0,D=0;N>w==N>-w?(b=w,w=Y[++L]):(b=N,N=x[++D]);let F=0;if(L<R&&D<H)for(N>w==N>-w?(A=b-((C=w+b)-w),w=Y[++L]):(A=b-((C=N+b)-N),N=x[++D]),b=C,A!==0&&(S[F++]=A);L<R&&D<H;)N>w==N>-w?(A=b-((C=b+w)-(q=C-b))+(w-q),w=Y[++L]):(A=b-((C=b+N)-(q=C-b))+(N-q),N=x[++D]),b=C,A!==0&&(S[F++]=A);for(;L<R;)A=b-((C=b+w)-(q=C-b))+(w-q),w=Y[++L],b=C,A!==0&&(S[F++]=A);for(;D<H;)A=b-((C=b+N)-(q=C-b))+(N-q),N=x[++D],b=C,A!==0&&(S[F++]=A);return b===0&&F!==0||(S[F++]=b),F}function h(R){return new Float64Array(R)}const c=33306690738754716e-32,g=22204460492503146e-32,d=11093356479670487e-47,y=h(4),v=h(8),_=h(12),E=h(16),M=h(4);i.orient2d=function(R,Y,H,x,S,b){const C=(Y-b)*(H-S),A=(R-S)*(x-b),q=C-A;if(C===0||A===0||C>0!=A>0)return q;const w=Math.abs(C+A);return Math.abs(q)>=c*w?q:-(function(N,L,D,F,X,z,V){let k,O,P,G,B,Z,K,ee,j,te,re,se,W,ge,le,oe,$,Me;const Se=N-X,ue=D-X,ke=L-z,ct=F-z;B=(le=(ee=Se-(K=(Z=134217729*Se)-(Z-Se)))*(te=ct-(j=(Z=134217729*ct)-(Z-ct)))-((ge=Se*ct)-K*j-ee*j-K*te))-(re=le-($=(ee=ke-(K=(Z=134217729*ke)-(Z-ke)))*(te=ue-(j=(Z=134217729*ue)-(Z-ue)))-((oe=ke*ue)-K*j-ee*j-K*te))),y[0]=le-(re+B)+(B-$),B=(W=ge-((se=ge+re)-(B=se-ge))+(re-B))-(re=W-oe),y[1]=W-(re+B)+(B-oe),B=(Me=se+re)-se,y[2]=se-(Me-B)+(re-B),y[3]=Me;let Bt=(function(yo,Ie){let ln=Ie[0];for(let cn=1;cn<yo;cn++)ln+=Ie[cn];return ln})(4,y),ie=g*V;if(Bt>=ie||-Bt>=ie||(k=N-(Se+(B=N-Se))+(B-X),P=D-(ue+(B=D-ue))+(B-X),O=L-(ke+(B=L-ke))+(B-z),G=F-(ct+(B=F-ct))+(B-z),k===0&&O===0&&P===0&&G===0)||(ie=d*V+o*Math.abs(Bt),(Bt+=Se*G+ct*k-(ke*P+ue*O))>=ie||-Bt>=ie))return Bt;B=(le=(ee=k-(K=(Z=134217729*k)-(Z-k)))*(te=ct-(j=(Z=134217729*ct)-(Z-ct)))-((ge=k*ct)-K*j-ee*j-K*te))-(re=le-($=(ee=O-(K=(Z=134217729*O)-(Z-O)))*(te=ue-(j=(Z=134217729*ue)-(Z-ue)))-((oe=O*ue)-K*j-ee*j-K*te))),M[0]=le-(re+B)+(B-$),B=(W=ge-((se=ge+re)-(B=se-ge))+(re-B))-(re=W-oe),M[1]=W-(re+B)+(B-oe),B=(Me=se+re)-se,M[2]=se-(Me-B)+(re-B),M[3]=Me;const Yi=l(4,y,4,M,v);B=(le=(ee=Se-(K=(Z=134217729*Se)-(Z-Se)))*(te=G-(j=(Z=134217729*G)-(Z-G)))-((ge=Se*G)-K*j-ee*j-K*te))-(re=le-($=(ee=ke-(K=(Z=134217729*ke)-(Z-ke)))*(te=P-(j=(Z=134217729*P)-(Z-P)))-((oe=ke*P)-K*j-ee*j-K*te))),M[0]=le-(re+B)+(B-$),B=(W=ge-((se=ge+re)-(B=se-ge))+(re-B))-(re=W-oe),M[1]=W-(re+B)+(B-oe),B=(Me=se+re)-se,M[2]=se-(Me-B)+(re-B),M[3]=Me;const zi=l(Yi,v,4,M,_);B=(le=(ee=k-(K=(Z=134217729*k)-(Z-k)))*(te=G-(j=(Z=134217729*G)-(Z-G)))-((ge=k*G)-K*j-ee*j-K*te))-(re=le-($=(ee=O-(K=(Z=134217729*O)-(Z-O)))*(te=P-(j=(Z=134217729*P)-(Z-P)))-((oe=O*P)-K*j-ee*j-K*te))),M[0]=le-(re+B)+(B-$),B=(W=ge-((se=ge+re)-(B=se-ge))+(re-B))-(re=W-oe),M[1]=W-(re+B)+(B-oe),B=(Me=se+re)-se,M[2]=se-(Me-B)+(re-B),M[3]=Me;const Jt=l(zi,_,4,M,E);return E[Jt-1]})(R,Y,H,x,S,b,w)},i.orient2dfast=function(R,Y,H,x,S,b){return(Y-b)*(H-S)-(R-S)*(x-b)},Object.defineProperty(i,"__esModule",{value:!0})})})(_r,_r.exports)),_r.exports}var wu;function zg(){if(wu)return gi.exports;wu=1;var t=Tg(),e=Dg,i=Bg(),s=Yg().orient2d;e.default&&(e=e.default),gi.exports=o,gi.exports.default=o;function o(b,C,A){C=Math.max(0,C===void 0?2:C),A=A||0;var q=E(b),w=new t(16);w.toBBox=function(K){return{minX:K[0],minY:K[1],maxX:K[0],maxY:K[1]}},w.compareMinX=function(K,ee){return K[0]-ee[0]},w.compareMinY=function(K,ee){return K[1]-ee[1]},w.load(b);for(var N=[],L=0,D;L<q.length;L++){var F=q[L];w.remove(F),D=M(F,D),N.push(D)}var X=new t(16);for(L=0;L<N.length;L++)X.insert(_(N[L]));for(var z=C*C,V=A*A;N.length;){var k=N.shift(),O=k.p,P=k.next.p,G=R(O,P);if(!(G<V)){var B=G/z;F=l(w,k.prev.p,O,P,k.next.next.p,B,X),F&&Math.min(R(F,O),R(F,P))<=B&&(N.push(k),N.push(M(F,k)),w.remove(F),X.remove(k),X.insert(_(k)),X.insert(_(k.next)))}}k=D;var Z=[];do Z.push(k.p),k=k.next;while(k!==D);return Z.push(k.p),Z}function l(b,C,A,q,w,N,L){for(var D=new e([],h),F=b.data;F;){for(var X=0;X<F.children.length;X++){var z=F.children[X],V=F.leaf?Y(z,A,q):c(A,q,z);V>N||D.push({node:z,dist:V})}for(;D.length&&!D.peek().node.children;){var k=D.pop(),O=k.node,P=Y(O,C,A),G=Y(O,q,w);if(k.dist<P&&k.dist<G&&d(A,O,L)&&d(q,O,L))return O}F=D.pop(),F&&(F=F.node)}return null}function h(b,C){return b.dist-C.dist}function c(b,C,A){if(g(b,A)||g(C,A))return 0;var q=H(b[0],b[1],C[0],C[1],A.minX,A.minY,A.maxX,A.minY);if(q===0)return 0;var w=H(b[0],b[1],C[0],C[1],A.minX,A.minY,A.minX,A.maxY);if(w===0)return 0;var N=H(b[0],b[1],C[0],C[1],A.maxX,A.minY,A.maxX,A.maxY);if(N===0)return 0;var L=H(b[0],b[1],C[0],C[1],A.minX,A.maxY,A.maxX,A.maxY);return L===0?0:Math.min(q,w,N,L)}function g(b,C){return b[0]>=C.minX&&b[0]<=C.maxX&&b[1]>=C.minY&&b[1]<=C.maxY}function d(b,C,A){for(var q=Math.min(b[0],C[0]),w=Math.min(b[1],C[1]),N=Math.max(b[0],C[0]),L=Math.max(b[1],C[1]),D=A.search({minX:q,minY:w,maxX:N,maxY:L}),F=0;F<D.length;F++)if(v(D[F].p,D[F].next.p,b,C))return!1;return!0}function y(b,C,A){return s(b[0],b[1],C[0],C[1],A[0],A[1])}function v(b,C,A,q){return b!==q&&C!==A&&y(b,C,A)>0!=y(b,C,q)>0&&y(A,q,b)>0!=y(A,q,C)>0}function _(b){var C=b.p,A=b.next.p;return b.minX=Math.min(C[0],A[0]),b.minY=Math.min(C[1],A[1]),b.maxX=Math.max(C[0],A[0]),b.maxY=Math.max(C[1],A[1]),b}function E(b){for(var C=b[0],A=b[0],q=b[0],w=b[0],N=0;N<b.length;N++){var L=b[N];L[0]<C[0]&&(C=L),L[0]>q[0]&&(q=L),L[1]<A[1]&&(A=L),L[1]>w[1]&&(w=L)}var D=[C,A,q,w],F=D.slice();for(N=0;N<b.length;N++)i(b[N],D)||F.push(b[N]);return S(F)}function M(b,C){var A={p:b,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return C?(A.next=C.next,A.prev=C,C.next.prev=A,C.next=A):(A.prev=A,A.next=A),A}function R(b,C){var A=b[0]-C[0],q=b[1]-C[1];return A*A+q*q}function Y(b,C,A){var q=C[0],w=C[1],N=A[0]-q,L=A[1]-w;if(N!==0||L!==0){var D=((b[0]-q)*N+(b[1]-w)*L)/(N*N+L*L);D>1?(q=A[0],w=A[1]):D>0&&(q+=N*D,w+=L*D)}return N=b[0]-q,L=b[1]-w,N*N+L*L}function H(b,C,A,q,w,N,L,D){var F=A-b,X=q-C,z=L-w,V=D-N,k=b-w,O=C-N,P=F*F+X*X,G=F*z+X*V,B=z*z+V*V,Z=F*k+X*O,K=z*k+V*O,ee=P*B-G*G,j,te,re,se,W=ee,ge=ee;ee===0?(te=0,W=1,se=K,ge=B):(te=G*K-B*Z,se=P*K-G*Z,te<0?(te=0,se=K,ge=B):te>W&&(te=W,se=K+G,ge=B)),se<0?(se=0,-Z<0?te=0:-Z>P?te=W:(te=-Z,W=P)):se>ge&&(se=ge,-Z+G<0?te=0:-Z+G>P?te=W:(te=-Z+G,W=P)),j=te===0?0:te/W,re=se===0?0:se/ge;var le=(1-j)*b+j*A,oe=(1-j)*C+j*q,$=(1-re)*w+re*L,Me=(1-re)*N+re*D,Se=$-le,ue=Me-oe;return Se*Se+ue*ue}function x(b,C){return b[0]===C[0]?b[1]-C[1]:b[0]-C[0]}function S(b){b.sort(x);for(var C=[],A=0;A<b.length;A++){for(;C.length>=2&&y(C[C.length-2],C[C.length-1],b[A])<=0;)C.pop();C.push(b[A])}for(var q=[],w=b.length-1;w>=0;w--){for(;q.length>=2&&y(q[q.length-2],q[q.length-1],b[w])<=0;)q.pop();q.push(b[w])}return q.pop(),C.pop(),C.concat(q)}return gi.exports}var Xg=zg();const Ug=gr(Xg);function ku(t,e={}){e.concavity=e.concavity||1/0;const i=[];if(Xe(t,o=>{i.push([o[0],o[1]])}),!i.length)return null;const s=Ug(i,e.concavity);return s.length>3?ye([s]):null}function Iu(t,e={}){switch(gt(t)){case"Point":return _e(Oe(t),e.properties);case"Polygon":var i=[];Xe(t,function(b){i.push(b)});var s=Zt(t,{properties:e.properties}),o=s.geometry.coordinates,l=0,h=0,c=0,g,d,y,v,_,E,M,R,Y=i.map(function(b){return[b[0]-o[0],b[1]-o[1]]});for(g=0;g<i.length-1;g++)d=Y[g],v=d[0],E=d[1],y=Y[g+1],_=y[0],M=y[1],R=v*M-_*E,c+=R,l+=(v+_)*R,h+=(E+M)*R;if(c===0)return s;var H=c*.5,x=1/(6*H);return _e([o[0]+x*l,o[1]+x*h],e.properties);default:var S=ku(t);return S?Iu(S,{properties:e.properties}):Zt(t,{properties:e.properties})}}function Rs(t,e,i={}){const s=i.steps||64,o=i.properties?i.properties:!Array.isArray(t)&&t.type==="Feature"&&t.properties?t.properties:{},l=[];for(let h=0;h<s;h++)l.push(rn(t,e,h*-360/s,i).geometry.coordinates);return l.push(l[0]),ye([l],o)}function je(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return Nu(t);case"FeatureCollection":return Vg(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return As(t);default:throw new Error("unknown GeoJSON type")}}function Nu(t){const e={type:"Feature"};return Object.keys(t).forEach(i=>{switch(i){case"type":case"properties":case"geometry":return;default:e[i]=t[i]}}),e.properties=vi(t.properties),t.geometry==null?e.geometry=null:e.geometry=As(t.geometry),e}function vi(t){const e={};return t&&Object.keys(t).forEach(i=>{const s=t[i];typeof s=="object"?s===null?e[i]=null:Array.isArray(s)?e[i]=s.map(o=>o):e[i]=vi(s):e[i]=s}),e}function Vg(t){const e={type:"FeatureCollection"};return Object.keys(t).forEach(i=>{switch(i){case"type":case"features":return;default:e[i]=t[i]}}),e.features=t.features.map(i=>Nu(i)),e}function As(t){const e={type:t.type};return t.bbox&&(e.bbox=t.bbox),t.type==="GeometryCollection"?(e.geometries=t.geometries.map(i=>As(i)),e):(e.coordinates=Mu(t.coordinates),e)}function Mu(t){const e=t;return typeof e[0]!="object"?e.slice():e.map(i=>Mu(i))}function Su(t,e){if(!t)throw new Error("geojson is required");if(t.type!=="FeatureCollection")throw new Error("geojson must be a FeatureCollection");if(e==null)throw new Error("filter is required");var i=[];return Le(t,function(s){yi(s.properties,e)&&i.push(s)}),he(i)}function Ds(t,e,i){if(!t)throw new Error("geojson is required");if(t.type!=="FeatureCollection")throw new Error("geojson must be a FeatureCollection");if(e==null)throw new Error("property is required");for(var s=Fs(t,e),o=Object.keys(s),l=0;l<o.length;l++){for(var h=o[l],c=s[h],g=[],d=0;d<c.length;d++)g.push(t.features[c[d]]);i(he(g),h,l)}}function Pu(t,e,i,s){var o=s;return Ds(t,e,function(l,h,c){c===0&&s===void 0?o=l:o=i(o,l,h,c)}),o}function Fs(t,e){var i={};return Le(t,function(s,o){var l=s.properties||{};if(Object.prototype.hasOwnProperty.call(l,String(e))){var h=l[e];Object.prototype.hasOwnProperty.call(i,h)?i[h].push(o):i[h]=[o]}}),i}function yi(t,e){if(t===void 0)return!1;var i=typeof e;if(i==="number"||i==="string")return Object.prototype.hasOwnProperty.call(t,e);if(Array.isArray(e)){for(var s=0;s<e.length;s++)if(!yi(t,e[s]))return!1;return!0}else return qs(t,e)}function qs(t,e){for(var i=Object.keys(e),s=0;s<i.length;s++){var o=i[s];if(t[o]!==e[o])return!1}return!0}function Lu(t,e){if(!e)return{};if(!e.length)return{};for(var i={},s=0;s<e.length;s++){var o=e[s];Object.prototype.hasOwnProperty.call(t,o)&&(i[o]=t[o])}return i}const Hg=Object.freeze(Object.defineProperty({__proto__:null,applyFilter:yi,clusterEach:Ds,clusterReduce:Pu,createBins:Fs,filterProperties:Lu,getCluster:Su,propertiesContainsFilter:qs},Symbol.toStringTag,{value:"Module"}));function $g(t,e,i={}){i.mutate!==!0&&(t=je(t));const s=i.minPoints||3,o=Vr(e,i.units);var l=new dt(t.features.length),h=t.features.map(E=>!1),c=t.features.map(E=>!1),g=t.features.map(E=>!1),d=t.features.map(E=>-1);l.load(t.features.map((E,M)=>{var[R,Y]=E.geometry.coordinates;return{minX:R,minY:Y,maxX:R,maxY:Y,index:M}}));const y=E=>{const M=t.features[E],[R,Y]=M.geometry.coordinates,H=Math.max(Y-o,-90),x=Math.min(Y+o,90),S=(function(){return H<0&&x>0?o:Math.abs(H)<Math.abs(x)?o/Math.cos(Ze(x)):o/Math.cos(Ze(H))})(),b=Math.max(R-S,-360),C=Math.min(R+S,360),A={minX:b,minY:H,maxX:C,maxY:x};return l.search(A).filter(q=>{const w=q.index,N=t.features[w];return Be(M,N,{units:"kilometers"})<=e})},v=(E,M)=>{for(var R=0;R<M.length;R++){var Y=M[R];const H=Y.index;if(!h[H]){h[H]=!0;const x=y(H);x.length>=s&&M.push(...x)}c[H]||(c[H]=!0,d[H]=E)}};var _=0;return t.features.forEach((E,M)=>{if(h[M])return;const R=y(M);if(R.length>=s){const Y=_;_++,h[M]=!0,v(Y,R)}else g[M]=!0}),t.features.forEach((E,M)=>{var R=t.features[M];R.properties||(R.properties={}),d[M]>=0?(R.properties.dbscan=g[M]?"edge":"core",R.properties.cluster=d[M]):R.properties.dbscan="noise"}),t}var Bs,bu;function Cu(){return bu||(bu=1,Bs={eudist:function(e,i,s){for(var o=e.length,l=0,h=0;h<o;h++){var c=(e[h]||0)-(i[h]||0);l+=c*c}return s?Math.sqrt(l):l},mandist:function(e,i,s){for(var o=e.length,l=0,h=0;h<o;h++)l+=Math.abs((e[h]||0)-(i[h]||0));return s?Math.sqrt(l):l},dist:function(e,i,s){var o=Math.abs(e-i);return s?o:o*o}}),Bs}var Gs,Ou;function Zg(){if(Ou)return Gs;Ou=1;var t=Cu(),e=t.eudist,i=t.dist;return Gs={kmrand:function(o,l){for(var h={},c=[],g=l<<2,d=o.length,y=o[0].length>0;c.length<l&&g-- >0;){var v=o[Math.floor(Math.random()*d)],_=y?v.join("_"):""+v;h[_]||(h[_]=!0,c.push(v))}if(c.length<l)throw new Error("Error initializating clusters");return c},kmpp:function(o,l){var h=o[0].length?e:i,c=[],g=o.length,d=o[0].length>0,y=o[Math.floor(Math.random()*g)];for(d?y.join("_"):""+y,c.push(y);c.length<l;){for(var v=[],_=c.length,E=0,M=[],R=0;R<g;R++){for(var Y=1/0,H=0;H<_;H++){var x=h(o[R],c[H]);x<=Y&&(Y=x)}v[R]=Y}for(var S=0;S<g;S++)E+=v[S];for(var b=0;b<g;b++)M[b]={i:b,v:o[b],pr:v[b]/E,cs:0};M.sort(function(w,N){return w.pr-N.pr}),M[0].cs=M[0].pr;for(var C=1;C<g;C++)M[C].cs=M[C-1].cs+M[C].pr;for(var A=Math.random(),q=0;q<g-1&&M[q++].cs<A;);c.push(M[q-1].v)}return c}},Gs}var Ys,Tu;function Wg(){if(Tu)return Ys;Tu=1;var t=Cu(),e=Zg(),i=t.eudist;t.mandist,t.dist;var s=e.kmrand,o=e.kmpp,l=1e4;function h(g,d,y){y=y||[];for(var v=0;v<g;v++)y[v]=d;return y}function c(g,d,y,v){var _=[],E=[],M=[],R=[],Y=!1,H=v||l,x=g.length,S=g[0].length,b=S>0,C=[];if(y)y=="kmrand"?_=s(g,d):y=="kmpp"?_=o(g,d):_=y;else for(var A={};_.length<d;){var q=Math.floor(Math.random()*x);A[q]||(A[q]=!0,_.push(g[q]))}do{h(d,0,C);for(var w=0;w<x;w++){for(var N=1/0,L=0,D=0;D<d;D++){var R=b?i(g[w],_[D]):Math.abs(g[w]-_[D]);R<=N&&(N=R,L=D)}M[w]=L,C[L]++}for(var F=[],E=[],X=0;X<d;X++)F[X]=b?h(S,0,F[X]):0,E[X]=_[X];if(b){for(var z=0;z<d;z++)_[z]=[];for(var V=0;V<x;V++)for(var k=M[V],O=F[k],P=g[V],G=0;G<S;G++)O[G]+=P[G];Y=!0;for(var B=0;B<d;B++){for(var Z=_[B],K=F[B],ee=E[B],j=C[B],te=0;te<S;te++)Z[te]=K[te]/j||0;if(Y){for(var re=0;re<S;re++)if(ee[re]!=Z[re]){Y=!1;break}}}}else{for(var se=0;se<x;se++){var W=M[se];F[W]+=g[se]}for(var ge=0;ge<d;ge++)_[ge]=F[ge]/C[ge]||0;Y=!0;for(var le=0;le<d;le++)if(E[le]!=_[le]){Y=!1;break}}Y=Y||--H<=0}while(!Y);return{it:l-H,k:d,idxs:M,centroids:_}}return Ys=c,Ys}var Kg=Wg();const Jg=gr(Kg);function Qg(t,e={}){var i=t.features.length;e.numberOfClusters=e.numberOfClusters||Math.round(Math.sqrt(i/2)),e.numberOfClusters>i&&(e.numberOfClusters=i),e.mutate!==!0&&(t=je(t));var s=rr(t),o=s.slice(0,e.numberOfClusters),l=Jg(s,e.numberOfClusters,o),h={};return l.centroids.forEach(function(c,g){h[g]=c}),Le(t,function(c,g){var d=l.idxs[g];c.properties.cluster=d,c.properties.centroid=h[d]}),t}function jg(t,e,i,s){var o=new dt(6),l=e.features.map(function(h){var c;return{minX:h.geometry.coordinates[0],minY:h.geometry.coordinates[1],maxX:h.geometry.coordinates[0],maxY:h.geometry.coordinates[1],property:(c=h.properties)==null?void 0:c[i]}});return o.load(l),t.features.forEach(function(h){h.properties||(h.properties={});var c=Fe(h),g=o.search({minX:c[0],minY:c[1],maxX:c[2],maxY:c[3]}),d=[];g.forEach(function(y){xe([y.minX,y.minY],h)&&d.push(y.property)}),h.properties[s]=d}),t}function ed(t){var e={MultiPoint:{coordinates:[],properties:[]},MultiLineString:{coordinates:[],properties:[]},MultiPolygon:{coordinates:[],properties:[]}};return Le(t,i=>{var s;switch((s=i.geometry)==null?void 0:s.type){case"Point":e.MultiPoint.coordinates.push(i.geometry.coordinates),e.MultiPoint.properties.push(i.properties);break;case"MultiPoint":e.MultiPoint.coordinates.push(...i.geometry.coordinates),e.MultiPoint.properties.push(i.properties);break;case"LineString":e.MultiLineString.coordinates.push(i.geometry.coordinates),e.MultiLineString.properties.push(i.properties);break;case"MultiLineString":e.MultiLineString.coordinates.push(...i.geometry.coordinates),e.MultiLineString.properties.push(i.properties);break;case"Polygon":e.MultiPolygon.coordinates.push(i.geometry.coordinates),e.MultiPolygon.properties.push(i.properties);break;case"MultiPolygon":e.MultiPolygon.coordinates.push(...i.geometry.coordinates),e.MultiPolygon.properties.push(i.properties);break}}),he(Object.keys(e).filter(function(i){return e[i].coordinates.length}).sort().map(function(i){var s={type:i,coordinates:e[i].coordinates},o={collectedProperties:e[i].properties};return We(s,o)}))}function Ru(t,e){let i=!1;return he(rd(t.features.map(s=>{const o={x:s.geometry.coordinates[0],y:s.geometry.coordinates[1]};return e?o.z=s.properties[e]:s.geometry.coordinates.length===3&&(i=!0,o.z=s.geometry.coordinates[2]),o})).map(s=>{const o=[s.a.x,s.a.y],l=[s.b.x,s.b.y],h=[s.c.x,s.c.y];let c={};return i?(o.push(s.a.z),l.push(s.b.z),h.push(s.c.z)):c={a:s.a.z,b:s.b.z,c:s.c.z},ye([[o,l,h,o]],c)}))}var Au=class{constructor(t,e,i){this.a=t,this.b=e,this.c=i;const s=e.x-t.x,o=e.y-t.y,l=i.x-t.x,h=i.y-t.y,c=s*(t.x+e.x)+o*(t.y+e.y),g=l*(t.x+i.x)+h*(t.y+i.y),d=2*(s*(i.y-e.y)-o*(i.x-e.x));let y,v;this.x=(h*c-o*g)/d,this.y=(s*g-l*c)/d,y=this.x-t.x,v=this.y-t.y,this.r=y*y+v*v}};function td(t,e){return e.x-t.x}function nd(t){let e=t.length,i,s,o,l,h;e:for(;e;)for(s=t[--e],i=t[--e],o=e;o;)if(h=t[--o],l=t[--o],i===l&&s===h||i===h&&s===l){t.splice(e,2),t.splice(o,2),e-=2;continue e}}function rd(t){if(t.length<3)return[];t.sort(td);let e=t.length-1;const i=t[e].x,s=t[0].x;let o=t[e].y,l=o;const h=1e-12;let c,g,d,y,v,_;for(;e--;)t[e].y<o&&(o=t[e].y),t[e].y>l&&(l=t[e].y);let E=s-i,M=l-o;const R=E>M?E:M,Y=(s+i)*.5,H=(l+o)*.5,x=[new Au({__sentinel:!0,x:Y-20*R,y:H-R},{__sentinel:!0,x:Y,y:H+20*R},{__sentinel:!0,x:Y+20*R,y:H-R})],S=[],b=[];let C;for(e=t.length;e--;){for(b.length=0,C=x.length;C--;){if(E=t[e].x-x[C].x,E>0&&E*E>x[C].r){S.push(x[C]),x.splice(C,1);continue}M=t[e].y-x[C].y,!(E*E+M*M>x[C].r)&&(b.push(x[C].a,x[C].b,x[C].b,x[C].c,x[C].c,x[C].a),x.splice(C,1))}for(nd(b),C=b.length;C;)g=b[--C],c=b[--C],d=t[e],y=g.x-c.x,v=g.y-c.y,_=2*(y*(d.y-g.y)-v*(d.x-g.x)),Math.abs(_)>h&&x.push(new Au(c,g,d))}for(Array.prototype.push.apply(S,x),e=S.length;e--;)(S[e].a.__sentinel||S[e].b.__sentinel||S[e].c.__sentinel)&&S.splice(e,1);return S}function id(t){return t}function sd(t){if(t==null)return id;var e,i,s=t.scale[0],o=t.scale[1],l=t.translate[0],h=t.translate[1];return function(c,g){g||(e=i=0);var d=2,y=c.length,v=new Array(y);for(v[0]=(e+=c[0])*s+l,v[1]=(i+=c[1])*o+h;d<y;)v[d]=c[d],++d;return v}}function od(t,e){for(var i,s=t.length,o=s-e;o<--s;)i=t[o],t[o++]=t[s],t[s]=i}function Du(t,e){var i=sd(t.transform),s=t.arcs;function o(y,v){v.length&&v.pop();for(var _=s[y<0?~y:y],E=0,M=_.length;E<M;++E)v.push(i(_[E],E));y<0&&od(v,M)}function l(y){return i(y)}function h(y){for(var v=[],_=0,E=y.length;_<E;++_)o(y[_],v);return v.length<2&&v.push(v[0]),v}function c(y){for(var v=h(y);v.length<4;)v.push(v[0]);return v}function g(y){return y.map(c)}function d(y){var v=y.type,_;switch(v){case"GeometryCollection":return{type:v,geometries:y.geometries.map(d)};case"Point":_=l(y.coordinates);break;case"MultiPoint":_=y.coordinates.map(l);break;case"LineString":_=h(y.arcs);break;case"MultiLineString":_=y.arcs.map(h);break;case"Polygon":_=g(y.arcs);break;case"MultiPolygon":_=y.arcs.map(g);break;default:return null}return{type:v,coordinates:_}}return d(e)}function ad(t,e){var i={},s={},o={},l=[],h=-1;e.forEach(function(d,y){var v=t.arcs[d<0?~d:d],_;v.length<3&&!v[1][0]&&!v[1][1]&&(_=e[++h],e[h]=d,e[y]=_)}),e.forEach(function(d){var y=c(d),v=y[0],_=y[1],E,M;if(E=o[v])if(delete o[E.end],E.push(d),E.end=_,M=s[_]){delete s[M.start];var R=M===E?E:E.concat(M);s[R.start=E.start]=o[R.end=M.end]=R}else s[E.start]=o[E.end]=E;else if(E=s[_])if(delete s[E.start],E.unshift(d),E.start=v,M=o[v]){delete o[M.end];var Y=M===E?E:M.concat(E);s[Y.start=M.start]=o[Y.end=E.end]=Y}else s[E.start]=o[E.end]=E;else E=[d],s[E.start=v]=o[E.end=_]=E});function c(d){var y=t.arcs[d<0?~d:d],v=y[0],_;return t.transform?(_=[0,0],y.forEach(function(E){_[0]+=E[0],_[1]+=E[1]})):_=y[y.length-1],d<0?[_,v]:[v,_]}function g(d,y){for(var v in d){var _=d[v];delete y[_.start],delete _.start,delete _.end,_.forEach(function(E){i[E<0?~E:E]=1}),l.push(_)}}return g(o,s),g(s,o),e.forEach(function(d){i[d<0?~d:d]||l.push([d])}),l}function ud(t){for(var e=-1,i=t.length,s,o=t[i-1],l=0;++e<i;)s=o,o=t[e],l+=s[0]*o[1]-s[1]*o[0];return Math.abs(l)}function ld(t){return Du(t,cd.apply(this,arguments))}function cd(t,e){var i={},s=[],o=[];e.forEach(l);function l(g){switch(g.type){case"GeometryCollection":g.geometries.forEach(l);break;case"Polygon":h(g.arcs);break;case"MultiPolygon":g.arcs.forEach(h);break}}function h(g){g.forEach(function(d){d.forEach(function(y){(i[y=y<0?~y:y]||(i[y]=[])).push(g)})}),s.push(g)}function c(g){return ud(Du(t,{type:"Polygon",arcs:[g]}).coordinates[0])}return s.forEach(function(g){if(!g._){var d=[],y=[g];for(g._=1,o.push(d);g=y.pop();)d.push(g),g.forEach(function(v){v.forEach(function(_){i[_<0?~_:_].forEach(function(E){E._||(E._=1,y.push(E))})})})}}),s.forEach(function(g){delete g._}),{type:"MultiPolygon",arcs:o.map(function(g){var d=[],y;if(g.forEach(function(R){R.forEach(function(Y){Y.forEach(function(H){i[H<0?~H:H].length<2&&d.push(H)})})}),d=ad(t,d),(y=d.length)>1)for(var v=1,_=c(d[0]),E,M;v<y;++v)(E=c(d[v]))>_&&(M=d[0],d[0]=d[v],d[v]=M,_=E);return d}).filter(function(g){return g.length>0})}}var zs=Object.prototype.hasOwnProperty;function hd(t){var e=1/0,i=1/0,s=-1/0,o=-1/0;function l(v){v!=null&&zs.call(h,v.type)&&h[v.type](v)}var h={GeometryCollection:function(v){v.geometries.forEach(l)},Point:function(v){c(v.coordinates)},MultiPoint:function(v){v.coordinates.forEach(c)},LineString:function(v){g(v.arcs)},MultiLineString:function(v){v.arcs.forEach(g)},Polygon:function(v){v.arcs.forEach(g)},MultiPolygon:function(v){v.arcs.forEach(d)}};function c(v){var _=v[0],E=v[1];_<e&&(e=_),_>s&&(s=_),E<i&&(i=E),E>o&&(o=E)}function g(v){v.forEach(c)}function d(v){v.forEach(g)}for(var y in t)l(t[y]);return s>=e&&o>=i?[e,i,s,o]:void 0}function fd(t,e,i,s,o){arguments.length===3&&(s=Array,o=null);for(var l=new s(t=1<<Math.max(4,Math.ceil(Math.log(t)/Math.LN2))),h=t-1,c=0;c<t;++c)l[c]=o;function g(v){for(var _=e(v)&h,E=l[_],M=0;E!=o;){if(i(E,v))return!0;if(++M>=t)throw new Error("full hashset");E=l[_=_+1&h]}return l[_]=v,!0}function d(v){for(var _=e(v)&h,E=l[_],M=0;E!=o;){if(i(E,v))return!0;if(++M>=t)break;E=l[_=_+1&h]}return!1}function y(){for(var v=[],_=0,E=l.length;_<E;++_){var M=l[_];M!=o&&v.push(M)}return v}return{add:g,has:d,values:y}}function Xs(t,e,i,s,o,l){arguments.length===3&&(s=l=Array,o=null);for(var h=new s(t=1<<Math.max(4,Math.ceil(Math.log(t)/Math.LN2))),c=new l(t),g=t-1,d=0;d<t;++d)h[d]=o;function y(M,R){for(var Y=e(M)&g,H=h[Y],x=0;H!=o;){if(i(H,M))return c[Y]=R;if(++x>=t)throw new Error("full hashmap");H=h[Y=Y+1&g]}return h[Y]=M,c[Y]=R,R}function v(M,R){for(var Y=e(M)&g,H=h[Y],x=0;H!=o;){if(i(H,M))return c[Y];if(++x>=t)throw new Error("full hashmap");H=h[Y=Y+1&g]}return h[Y]=M,c[Y]=R,R}function _(M,R){for(var Y=e(M)&g,H=h[Y],x=0;H!=o;){if(i(H,M))return c[Y];if(++x>=t)break;H=h[Y=Y+1&g]}return R}function E(){for(var M=[],R=0,Y=h.length;R<Y;++R){var H=h[R];H!=o&&M.push(H)}return M}return{set:y,maybeSet:v,get:_,keys:E}}function mn(t,e){return t[0]===e[0]&&t[1]===e[1]}var Fu=new ArrayBuffer(16),qu=new Float64Array(Fu),mi=new Uint32Array(Fu);function Us(t){qu[0]=t[0],qu[1]=t[1];var e=mi[0]^mi[1];return e=e<<5^e>>7^mi[2]^mi[3],e&2147483647}function gd(t){var e=t.coordinates,i=t.lines,s=t.rings,o=A(),l=new Int32Array(e.length),h=new Int32Array(e.length),c=new Int32Array(e.length),g=new Int8Array(e.length),d=0,y,v,_,E,M;for(y=0,v=e.length;y<v;++y)l[y]=h[y]=c[y]=-1;for(y=0,v=i.length;y<v;++y){var R=i[y],Y=R[0],H=R[1];for(E=o[Y],M=o[++Y],++d,g[E]=1;++Y<=H;)C(y,_=E,E=M,M=o[Y]);++d,g[M]=1}for(y=0,v=e.length;y<v;++y)l[y]=-1;for(y=0,v=s.length;y<v;++y){var x=s[y],S=x[0]+1,b=x[1];for(_=o[b-1],E=o[S-1],M=o[S],C(y,_,E,M);++S<=b;)C(y,_=E,E=M,M=o[S])}function C(D,F,X,z){if(l[X]!==D){l[X]=D;var V=h[X];if(V>=0){var k=c[X];(V!==F||k!==z)&&(V!==z||k!==F)&&(++d,g[X]=1)}else h[X]=F,c[X]=z}}function A(){for(var D=Xs(e.length*1.4,q,w,Int32Array,-1,Int32Array),F=new Int32Array(e.length),X=0,z=e.length;X<z;++X)F[X]=D.maybeSet(X,X);return F}function q(D){return Us(e[D])}function w(D,F){return mn(e[D],e[F])}l=h=c=null;var N=fd(d*1.4,Us,mn),L;for(y=0,v=e.length;y<v;++y)g[L=o[y]]&&N.add(e[L]);return N}function dd(t){var e=gd(t),i=t.coordinates,s=t.lines,o=t.rings,l,h,c;for(h=0,c=s.length;h<c;++h)for(var g=s[h],d=g[0],y=g[1];++d<y;)e.has(i[d])&&(l={0:d,1:g[1]},g[1]=d,g=g.next=l);for(h=0,c=o.length;h<c;++h)for(var v=o[h],_=v[0],E=_,M=v[1],R=e.has(i[_]);++E<M;)e.has(i[E])&&(R?(l={0:E,1:v[1]},v[1]=E,v=v.next=l):(vd(i,_,M,M-E),i[M]=i[_],R=!0,E=_));return t}function vd(t,e,i,s){Vs(t,e,i),Vs(t,e,e+s),Vs(t,e+s,i)}function Vs(t,e,i){for(var s=e+(i---e>>1),o;e<s;++e,--i)o=t[e],t[e]=t[i],t[i]=o}function yd(t){var e=t.coordinates,i=t.lines,s,o=t.rings,l,h=i.length+o.length,c,g;for(delete t.lines,delete t.rings,c=0,g=i.length;c<g;++c)for(s=i[c];s=s.next;)++h;for(c=0,g=o.length;c<g;++c)for(l=o[c];l=l.next;)++h;var d=Xs(h*2*1.4,Us,mn),y=t.arcs=[];for(c=0,g=i.length;c<g;++c){s=i[c];do v(s);while(s=s.next)}for(c=0,g=o.length;c<g;++c)if(l=o[c],l.next)do v(l);while(l=l.next);else _(l);function v(x){var S,b,C,A,q,w,N,L;if(C=d.get(S=e[x[0]])){for(N=0,L=C.length;N<L;++N)if(A=C[N],E(A,x)){x[0]=A[0],x[1]=A[1];return}}if(q=d.get(b=e[x[1]])){for(N=0,L=q.length;N<L;++N)if(w=q[N],M(w,x)){x[1]=w[0],x[0]=w[1];return}}C?C.push(x):d.set(S,[x]),q?q.push(x):d.set(b,[x]),y.push(x)}function _(x){var S,b,C,A,q;if(b=d.get(S=e[x[0]]))for(A=0,q=b.length;A<q;++A){if(C=b[A],R(C,x)){x[0]=C[0],x[1]=C[1];return}if(Y(C,x)){x[0]=C[1],x[1]=C[0];return}}if(b=d.get(S=e[x[0]+H(x)]))for(A=0,q=b.length;A<q;++A){if(C=b[A],R(C,x)){x[0]=C[0],x[1]=C[1];return}if(Y(C,x)){x[0]=C[1],x[1]=C[0];return}}b?b.push(x):d.set(S,[x]),y.push(x)}function E(x,S){var b=x[0],C=S[0],A=x[1],q=S[1];if(b-A!==C-q)return!1;for(;b<=A;++b,++C)if(!mn(e[b],e[C]))return!1;return!0}function M(x,S){var b=x[0],C=S[0],A=x[1],q=S[1];if(b-A!==C-q)return!1;for(;b<=A;++b,--q)if(!mn(e[b],e[q]))return!1;return!0}function R(x,S){var b=x[0],C=S[0],A=x[1],q=S[1],w=A-b;if(w!==q-C)return!1;for(var N=H(x),L=H(S),D=0;D<w;++D)if(!mn(e[b+(D+N)%w],e[C+(D+L)%w]))return!1;return!0}function Y(x,S){var b=x[0],C=S[0],A=x[1],q=S[1],w=A-b;if(w!==q-C)return!1;for(var N=H(x),L=w-H(S),D=0;D<w;++D)if(!mn(e[b+(D+N)%w],e[q-(D+L)%w]))return!1;return!0}function H(x){for(var S=x[0],b=x[1],C=S,A=C,q=e[C];++C<b;){var w=e[C];(w[0]<q[0]||w[0]===q[0]&&w[1]<q[1])&&(A=C,q=w)}return A-S}return t}function md(t){var e=-1,i=[],s=[],o=[];function l(v){v&&zs.call(h,v.type)&&h[v.type](v)}var h={GeometryCollection:function(v){v.geometries.forEach(l)},LineString:function(v){v.arcs=c(v.arcs)},MultiLineString:function(v){v.arcs=v.arcs.map(c)},Polygon:function(v){v.arcs=v.arcs.map(g)},MultiPolygon:function(v){v.arcs=v.arcs.map(d)}};function c(v){for(var _=0,E=v.length;_<E;++_)o[++e]=v[_];var M={0:e-E+1,1:e};return i.push(M),M}function g(v){for(var _=0,E=v.length;_<E;++_)o[++e]=v[_];var M={0:e-E+1,1:e};return s.push(M),M}function d(v){return v.map(g)}for(var y in t)l(t[y]);return{type:"Topology",coordinates:o,lines:i,rings:s,objects:t}}function pd(t){var e={},i;for(i in t)e[i]=_d(t[i]);return e}function _d(t){return t==null?{type:null}:(t.type==="FeatureCollection"?xd:t.type==="Feature"?Bu:Hs)(t)}function xd(t){var e={type:"GeometryCollection",geometries:t.features.map(Bu)};return t.bbox!=null&&(e.bbox=t.bbox),e}function Bu(t){var e=Hs(t.geometry),i;t.id!=null&&(e.id=t.id),t.bbox!=null&&(e.bbox=t.bbox);for(i in t.properties){e.properties=t.properties;break}return e}function Hs(t){if(t==null)return{type:null};var e=t.type==="GeometryCollection"?{type:"GeometryCollection",geometries:t.geometries.map(Hs)}:t.type==="Point"||t.type==="MultiPoint"?{type:t.type,coordinates:t.coordinates}:{type:t.type,arcs:t.coordinates};return t.bbox!=null&&(e.bbox=t.bbox),e}function Ed(t,e){var i=hd(t=pd(t)),s=yd(dd(md(t))),o=s.coordinates,l=Xs(s.arcs.length*1.4,wd,kd);t=s.objects,s.bbox=i,s.arcs=s.arcs.map(function(v,_){return l.set(v,_),o.slice(v[0],v[1]+1)}),delete s.coordinates,o=null;function h(v){v&&zs.call(c,v.type)&&c[v.type](v)}var c={GeometryCollection:function(v){v.geometries.forEach(h)},LineString:function(v){v.arcs=g(v.arcs)},MultiLineString:function(v){v.arcs=v.arcs.map(g)},Polygon:function(v){v.arcs=v.arcs.map(g)},MultiPolygon:function(v){v.arcs=v.arcs.map(d)}};function g(v){var _=[];do{var E=l.get(v);_.push(v[0]<v[1]?E:~E)}while(v=v.next);return _}function d(v){return v.map(g)}for(var y in t)h(t[y]);return s}function wd(t){var e=t[0],i=t[1],s;return i<e&&(s=e,e=i,i=s),e+31*i}function kd(t,e){var i=t[0],s=t[1],o=e[0],l=e[1],h;return s<i&&(h=i,i=s,s=h),l<o&&(h=o,o=l,l=h),i===o&&s===l}function Id(t,e={}){if(e=e||{},!Ce(e))throw new Error("options is invalid");const i=e.mutate;if(gt(t)!=="FeatureCollection")throw new Error("geojson must be a FeatureCollection");if(!t.features.length)throw new Error("geojson is empty");(i===!1||i===void 0)&&(t=je(t));const s=[],o=ls(t,(l,h)=>{const c=Nd(l,h);return c||(s.push(l),h)});return o&&s.push(o),s.length?s.length===1?s[0]:tn(s.map(l=>l.coordinates)):null}function pi(t){return t[0].toString()+","+t[1].toString()}function Nd(t,e){const i=t.geometry.coordinates,s=e.geometry.coordinates,o=pi(i[0]),l=pi(i[i.length-1]),h=pi(s[0]),c=pi(s[s.length-1]);let g;if(o===c)g=s.concat(i.slice(1));else if(h===l)g=i.concat(s.slice(1));else if(o===h)g=i.slice(1).reverse().concat(s);else if(l===c)g=i.concat(s.reverse().slice(1));else return null;return Pe(g)}function Md(t,e={}){if(gt(t)!=="FeatureCollection")throw new Error("geojson must be a FeatureCollection");if(!t.features.length)throw new Error("geojson is empty");(e.mutate===!1||e.mutate===void 0)&&(t=je(t));const i=[];Qe(t,l=>{i.push(l.geometry)});const s=Ed({geoms:es(i).geometry});return ld(s,s.objects.geoms.geometries)}function Sd(t,e={}){if(e=e||{},!Ce(e))throw new Error("options is invalid");const i=e.mutate;if(gt(t)!=="FeatureCollection")throw new Error("geojson must be a FeatureCollection");if(!t.features.length)throw new Error("geojson is empty");(i===!1||i===void 0)&&(t=je(t));const s=Pd(t);if(!s)throw new Error("geojson must be homogenous");const o=t;switch(s){case"LineString":return Id(o,e);case"Polygon":return Md(o,e);default:throw new Error(s+" is not supported")}}function Pd(t){const e={};Qe(t,s=>{e[s.geometry.type]=!0});const i=Object.keys(e);return i.length===1?i[0]:null}function Ld(t,e={}){const i=e.maxEdge||1/0,s=bd(t),o=Ru(s);if(o.features=o.features.filter(h=>{const c=h.geometry.coordinates[0][0],g=h.geometry.coordinates[0][1],d=h.geometry.coordinates[0][2],y=Be(c,g,e),v=Be(g,d,e),_=Be(c,d,e);return y<=i&&v<=i&&_<=i}),o.features.length<1)return null;const l=Sd(o);return l.coordinates.length===1&&(l.coordinates=l.coordinates[0],l.type="Polygon"),We(l)}function bd(t){const e=[],i={};return Le(t,s=>{if(!s.geometry)return;const o=s.geometry.coordinates.join("-");Object.prototype.hasOwnProperty.call(i,o)||(e.push(s),i[o]=!0)}),he(e)}var Cd=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,$s=Math.ceil,Et=Math.floor,vt="[BigNumber Error] ",Gu=vt+"Number primitive has more than 15 significant digits: ",Lt=1e14,Ne=14,Zs=9007199254740991,Ws=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],an=1e7,nt=1e9;function Yu(t){var e,i,s,o=x.prototype={constructor:x,toString:null,valueOf:null},l=new x(1),h=20,c=4,g=-7,d=21,y=-1e7,v=1e7,_=!1,E=1,M=0,R={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},Y="0123456789abcdefghijklmnopqrstuvwxyz",H=!0;function x(w,N){var L,D,F,X,z,V,k,O,P=this;if(!(P instanceof x))return new x(w,N);if(N==null){if(w&&w._isBigNumber===!0){P.s=w.s,!w.c||w.e>v?P.c=P.e=null:w.e<y?P.c=[P.e=0]:(P.e=w.e,P.c=w.c.slice());return}if((V=typeof w=="number")&&w*0==0){if(P.s=1/w<0?(w=-w,-1):1,w===~~w){for(X=0,z=w;z>=10;z/=10,X++);X>v?P.c=P.e=null:(P.e=X,P.c=[w]);return}O=String(w)}else{if(!Cd.test(O=String(w)))return s(P,O,V);P.s=O.charCodeAt(0)==45?(O=O.slice(1),-1):1}(X=O.indexOf("."))>-1&&(O=O.replace(".","")),(z=O.search(/e/i))>0?(X<0&&(X=z),X+=+O.slice(z+1),O=O.substring(0,z)):X<0&&(X=O.length)}else{if($e(N,2,Y.length,"Base"),N==10&&H)return P=new x(w),A(P,h+P.e+1,c);if(O=String(w),V=typeof w=="number"){if(w*0!=0)return s(P,O,V,N);if(P.s=1/w<0?(O=O.slice(1),-1):1,x.DEBUG&&O.replace(/^0\.0*|\./,"").length>15)throw Error(Gu+w)}else P.s=O.charCodeAt(0)===45?(O=O.slice(1),-1):1;for(L=Y.slice(0,N),X=z=0,k=O.length;z<k;z++)if(L.indexOf(D=O.charAt(z))<0){if(D=="."){if(z>X){X=k;continue}}else if(!F&&(O==O.toUpperCase()&&(O=O.toLowerCase())||O==O.toLowerCase()&&(O=O.toUpperCase()))){F=!0,z=-1,X=0;continue}return s(P,String(w),V,N)}V=!1,O=i(O,N,10,P.s),(X=O.indexOf("."))>-1?O=O.replace(".",""):X=O.length}for(z=0;O.charCodeAt(z)===48;z++);for(k=O.length;O.charCodeAt(--k)===48;);if(O=O.slice(z,++k)){if(k-=z,V&&x.DEBUG&&k>15&&(w>Zs||w!==Et(w)))throw Error(Gu+P.s*w);if((X=X-z-1)>v)P.c=P.e=null;else if(X<y)P.c=[P.e=0];else{if(P.e=X,P.c=[],z=(X+1)%Ne,X<0&&(z+=Ne),z<k){for(z&&P.c.push(+O.slice(0,z)),k-=Ne;z<k;)P.c.push(+O.slice(z,z+=Ne));z=Ne-(O=O.slice(z)).length}else z-=k;for(;z--;O+="0");P.c.push(+O)}}else P.c=[P.e=0]}x.clone=Yu,x.ROUND_UP=0,x.ROUND_DOWN=1,x.ROUND_CEIL=2,x.ROUND_FLOOR=3,x.ROUND_HALF_UP=4,x.ROUND_HALF_DOWN=5,x.ROUND_HALF_EVEN=6,x.ROUND_HALF_CEIL=7,x.ROUND_HALF_FLOOR=8,x.EUCLID=9,x.config=x.set=function(w){var N,L;if(w!=null)if(typeof w=="object"){if(w.hasOwnProperty(N="DECIMAL_PLACES")&&(L=w[N],$e(L,0,nt,N),h=L),w.hasOwnProperty(N="ROUNDING_MODE")&&(L=w[N],$e(L,0,8,N),c=L),w.hasOwnProperty(N="EXPONENTIAL_AT")&&(L=w[N],L&&L.pop?($e(L[0],-nt,0,N),$e(L[1],0,nt,N),g=L[0],d=L[1]):($e(L,-nt,nt,N),g=-(d=L<0?-L:L))),w.hasOwnProperty(N="RANGE"))if(L=w[N],L&&L.pop)$e(L[0],-nt,-1,N),$e(L[1],1,nt,N),y=L[0],v=L[1];else if($e(L,-nt,nt,N),L)y=-(v=L<0?-L:L);else throw Error(vt+N+" cannot be zero: "+L);if(w.hasOwnProperty(N="CRYPTO"))if(L=w[N],L===!!L)if(L)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))_=L;else throw _=!L,Error(vt+"crypto unavailable");else _=L;else throw Error(vt+N+" not true or false: "+L);if(w.hasOwnProperty(N="MODULO_MODE")&&(L=w[N],$e(L,0,9,N),E=L),w.hasOwnProperty(N="POW_PRECISION")&&(L=w[N],$e(L,0,nt,N),M=L),w.hasOwnProperty(N="FORMAT"))if(L=w[N],typeof L=="object")R=L;else throw Error(vt+N+" not an object: "+L);if(w.hasOwnProperty(N="ALPHABET"))if(L=w[N],typeof L=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(L))H=L.slice(0,10)=="0123456789",Y=L;else throw Error(vt+N+" invalid: "+L)}else throw Error(vt+"Object expected: "+w);return{DECIMAL_PLACES:h,ROUNDING_MODE:c,EXPONENTIAL_AT:[g,d],RANGE:[y,v],CRYPTO:_,MODULO_MODE:E,POW_PRECISION:M,FORMAT:R,ALPHABET:Y}},x.isBigNumber=function(w){if(!w||w._isBigNumber!==!0)return!1;if(!x.DEBUG)return!0;var N,L,D=w.c,F=w.e,X=w.s;e:if({}.toString.call(D)=="[object Array]"){if((X===1||X===-1)&&F>=-nt&&F<=nt&&F===Et(F)){if(D[0]===0){if(F===0&&D.length===1)return!0;break e}if(N=(F+1)%Ne,N<1&&(N+=Ne),String(D[0]).length==N){for(N=0;N<D.length;N++)if(L=D[N],L<0||L>=Lt||L!==Et(L))break e;if(L!==0)return!0}}}else if(D===null&&F===null&&(X===null||X===1||X===-1))return!0;throw Error(vt+"Invalid BigNumber: "+w)},x.maximum=x.max=function(){return b(arguments,-1)},x.minimum=x.min=function(){return b(arguments,1)},x.random=(function(){var w=9007199254740992,N=Math.random()*w&2097151?function(){return Et(Math.random()*w)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(L){var D,F,X,z,V,k=0,O=[],P=new x(l);if(L==null?L=h:$e(L,0,nt),z=$s(L/Ne),_)if(crypto.getRandomValues){for(D=crypto.getRandomValues(new Uint32Array(z*=2));k<z;)V=D[k]*131072+(D[k+1]>>>11),V>=9e15?(F=crypto.getRandomValues(new Uint32Array(2)),D[k]=F[0],D[k+1]=F[1]):(O.push(V%1e14),k+=2);k=z/2}else if(crypto.randomBytes){for(D=crypto.randomBytes(z*=7);k<z;)V=(D[k]&31)*281474976710656+D[k+1]*1099511627776+D[k+2]*4294967296+D[k+3]*16777216+(D[k+4]<<16)+(D[k+5]<<8)+D[k+6],V>=9e15?crypto.randomBytes(7).copy(D,k):(O.push(V%1e14),k+=7);k=z/7}else throw _=!1,Error(vt+"crypto unavailable");if(!_)for(;k<z;)V=N(),V<9e15&&(O[k++]=V%1e14);for(z=O[--k],L%=Ne,z&&L&&(V=Ws[Ne-L],O[k]=Et(z/V)*V);O[k]===0;O.pop(),k--);if(k<0)O=[X=0];else{for(X=-1;O[0]===0;O.splice(0,1),X-=Ne);for(k=1,V=O[0];V>=10;V/=10,k++);k<Ne&&(X-=Ne-k)}return P.e=X,P.c=O,P}})(),x.sum=function(){for(var w=1,N=arguments,L=new x(N[0]);w<N.length;)L=L.plus(N[w++]);return L},i=(function(){var w="0123456789";function N(L,D,F,X){for(var z,V=[0],k,O=0,P=L.length;O<P;){for(k=V.length;k--;V[k]*=D);for(V[0]+=X.indexOf(L.charAt(O++)),z=0;z<V.length;z++)V[z]>F-1&&(V[z+1]==null&&(V[z+1]=0),V[z+1]+=V[z]/F|0,V[z]%=F)}return V.reverse()}return function(L,D,F,X,z){var V,k,O,P,G,B,Z,K,ee=L.indexOf("."),j=h,te=c;for(ee>=0&&(P=M,M=0,L=L.replace(".",""),K=new x(D),B=K.pow(L.length-ee),M=P,K.c=N(Wt(kt(B.c),B.e,"0"),10,F,w),K.e=K.c.length),Z=N(L,D,F,z?(V=Y,w):(V=w,Y)),O=P=Z.length;Z[--P]==0;Z.pop());if(!Z[0])return V.charAt(0);if(ee<0?--O:(B.c=Z,B.e=O,B.s=X,B=e(B,K,j,te,F),Z=B.c,G=B.r,O=B.e),k=O+j+1,ee=Z[k],P=F/2,G=G||k<0||Z[k+1]!=null,G=te<4?(ee!=null||G)&&(te==0||te==(B.s<0?3:2)):ee>P||ee==P&&(te==4||G||te==6&&Z[k-1]&1||te==(B.s<0?8:7)),k<1||!Z[0])L=G?Wt(V.charAt(1),-j,V.charAt(0)):V.charAt(0);else{if(Z.length=k,G)for(--F;++Z[--k]>F;)Z[k]=0,k||(++O,Z=[1].concat(Z));for(P=Z.length;!Z[--P];);for(ee=0,L="";ee<=P;L+=V.charAt(Z[ee++]));L=Wt(L,O,V.charAt(0))}return L}})(),e=(function(){function w(D,F,X){var z,V,k,O,P=0,G=D.length,B=F%an,Z=F/an|0;for(D=D.slice();G--;)k=D[G]%an,O=D[G]/an|0,z=Z*k+O*B,V=B*k+z%an*an+P,P=(V/X|0)+(z/an|0)+Z*O,D[G]=V%X;return P&&(D=[P].concat(D)),D}function N(D,F,X,z){var V,k;if(X!=z)k=X>z?1:-1;else for(V=k=0;V<X;V++)if(D[V]!=F[V]){k=D[V]>F[V]?1:-1;break}return k}function L(D,F,X,z){for(var V=0;X--;)D[X]-=V,V=D[X]<F[X]?1:0,D[X]=V*z+D[X]-F[X];for(;!D[0]&&D.length>1;D.splice(0,1));}return function(D,F,X,z,V){var k,O,P,G,B,Z,K,ee,j,te,re,se,W,ge,le,oe,$,Me=D.s==F.s?1:-1,Se=D.c,ue=F.c;if(!Se||!Se[0]||!ue||!ue[0])return new x(!D.s||!F.s||(Se?ue&&Se[0]==ue[0]:!ue)?NaN:Se&&Se[0]==0||!ue?Me*0:Me/0);for(ee=new x(Me),j=ee.c=[],O=D.e-F.e,Me=X+O+1,V||(V=Lt,O=wt(D.e/Ne)-wt(F.e/Ne),Me=Me/Ne|0),P=0;ue[P]==(Se[P]||0);P++);if(ue[P]>(Se[P]||0)&&O--,Me<0)j.push(1),G=!0;else{for(ge=Se.length,oe=ue.length,P=0,Me+=2,B=Et(V/(ue[0]+1)),B>1&&(ue=w(ue,B,V),Se=w(Se,B,V),oe=ue.length,ge=Se.length),W=oe,te=Se.slice(0,oe),re=te.length;re<oe;te[re++]=0);$=ue.slice(),$=[0].concat($),le=ue[0],ue[1]>=V/2&&le++;do{if(B=0,k=N(ue,te,oe,re),k<0){if(se=te[0],oe!=re&&(se=se*V+(te[1]||0)),B=Et(se/le),B>1)for(B>=V&&(B=V-1),Z=w(ue,B,V),K=Z.length,re=te.length;N(Z,te,K,re)==1;)B--,L(Z,oe<K?$:ue,K,V),K=Z.length,k=1;else B==0&&(k=B=1),Z=ue.slice(),K=Z.length;if(K<re&&(Z=[0].concat(Z)),L(te,Z,re,V),re=te.length,k==-1)for(;N(ue,te,oe,re)<1;)B++,L(te,oe<re?$:ue,re,V),re=te.length}else k===0&&(B++,te=[0]);j[P++]=B,te[0]?te[re++]=Se[W]||0:(te=[Se[W]],re=1)}while((W++<ge||te[0]!=null)&&Me--);G=te[0]!=null,j[0]||j.splice(0,1)}if(V==Lt){for(P=1,Me=j[0];Me>=10;Me/=10,P++);A(ee,X+(ee.e=P+O*Ne-1)+1,z,G)}else ee.e=O,ee.r=+G;return ee}})();function S(w,N,L,D){var F,X,z,V,k;if(L==null?L=c:$e(L,0,8),!w.c)return w.toString();if(F=w.c[0],z=w.e,N==null)k=kt(w.c),k=D==1||D==2&&(z<=g||z>=d)?xi(k,z):Wt(k,z,"0");else if(w=A(new x(w),N,L),X=w.e,k=kt(w.c),V=k.length,D==1||D==2&&(N<=X||X<=g)){for(;V<N;k+="0",V++);k=xi(k,X)}else if(N-=z+(D===2&&X>z),k=Wt(k,X,"0"),X+1>V){if(--N>0)for(k+=".";N--;k+="0");}else if(N+=X-V,N>0)for(X+1==V&&(k+=".");N--;k+="0");return w.s<0&&F?"-"+k:k}function b(w,N){for(var L,D,F=1,X=new x(w[0]);F<w.length;F++)D=new x(w[F]),(!D.s||(L=pn(X,D))===N||L===0&&X.s===N)&&(X=D);return X}function C(w,N,L){for(var D=1,F=N.length;!N[--F];N.pop());for(F=N[0];F>=10;F/=10,D++);return(L=D+L*Ne-1)>v?w.c=w.e=null:L<y?w.c=[w.e=0]:(w.e=L,w.c=N),w}s=(function(){var w=/^(-?)0([xbo])(?=\w[\w.]*$)/i,N=/^([^.]+)\.$/,L=/^\.([^.]+)$/,D=/^-?(Infinity|NaN)$/,F=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(X,z,V,k){var O,P=V?z:z.replace(F,"");if(D.test(P))X.s=isNaN(P)?null:P<0?-1:1;else{if(!V&&(P=P.replace(w,function(G,B,Z){return O=(Z=Z.toLowerCase())=="x"?16:Z=="b"?2:8,!k||k==O?B:G}),k&&(O=k,P=P.replace(N,"$1").replace(L,"0.$1")),z!=P))return new x(P,O);if(x.DEBUG)throw Error(vt+"Not a"+(k?" base "+k:"")+" number: "+z);X.s=null}X.c=X.e=null}})();function A(w,N,L,D){var F,X,z,V,k,O,P,G=w.c,B=Ws;if(G){e:{for(F=1,V=G[0];V>=10;V/=10,F++);if(X=N-F,X<0)X+=Ne,z=N,k=G[O=0],P=Et(k/B[F-z-1]%10);else if(O=$s((X+1)/Ne),O>=G.length)if(D){for(;G.length<=O;G.push(0));k=P=0,F=1,X%=Ne,z=X-Ne+1}else break e;else{for(k=V=G[O],F=1;V>=10;V/=10,F++);X%=Ne,z=X-Ne+F,P=z<0?0:Et(k/B[F-z-1]%10)}if(D=D||N<0||G[O+1]!=null||(z<0?k:k%B[F-z-1]),D=L<4?(P||D)&&(L==0||L==(w.s<0?3:2)):P>5||P==5&&(L==4||D||L==6&&(X>0?z>0?k/B[F-z]:0:G[O-1])%10&1||L==(w.s<0?8:7)),N<1||!G[0])return G.length=0,D?(N-=w.e+1,G[0]=B[(Ne-N%Ne)%Ne],w.e=-N||0):G[0]=w.e=0,w;if(X==0?(G.length=O,V=1,O--):(G.length=O+1,V=B[Ne-X],G[O]=z>0?Et(k/B[F-z]%B[z])*V:0),D)for(;;)if(O==0){for(X=1,z=G[0];z>=10;z/=10,X++);for(z=G[0]+=V,V=1;z>=10;z/=10,V++);X!=V&&(w.e++,G[0]==Lt&&(G[0]=1));break}else{if(G[O]+=V,G[O]!=Lt)break;G[O--]=0,V=1}for(X=G.length;G[--X]===0;G.pop());}w.e>v?w.c=w.e=null:w.e<y&&(w.c=[w.e=0])}return w}function q(w){var N,L=w.e;return L===null?w.toString():(N=kt(w.c),N=L<=g||L>=d?xi(N,L):Wt(N,L,"0"),w.s<0?"-"+N:N)}return o.absoluteValue=o.abs=function(){var w=new x(this);return w.s<0&&(w.s=1),w},o.comparedTo=function(w,N){return pn(this,new x(w,N))},o.decimalPlaces=o.dp=function(w,N){var L,D,F,X=this;if(w!=null)return $e(w,0,nt),N==null?N=c:$e(N,0,8),A(new x(X),w+X.e+1,N);if(!(L=X.c))return null;if(D=((F=L.length-1)-wt(this.e/Ne))*Ne,F=L[F])for(;F%10==0;F/=10,D--);return D<0&&(D=0),D},o.dividedBy=o.div=function(w,N){return e(this,new x(w,N),h,c)},o.dividedToIntegerBy=o.idiv=function(w,N){return e(this,new x(w,N),0,1)},o.exponentiatedBy=o.pow=function(w,N){var L,D,F,X,z,V,k,O,P,G=this;if(w=new x(w),w.c&&!w.isInteger())throw Error(vt+"Exponent not an integer: "+q(w));if(N!=null&&(N=new x(N)),V=w.e>14,!G.c||!G.c[0]||G.c[0]==1&&!G.e&&G.c.length==1||!w.c||!w.c[0])return P=new x(Math.pow(+q(G),V?w.s*(2-_i(w)):+q(w))),N?P.mod(N):P;if(k=w.s<0,N){if(N.c?!N.c[0]:!N.s)return new x(NaN);D=!k&&G.isInteger()&&N.isInteger(),D&&(G=G.mod(N))}else{if(w.e>9&&(G.e>0||G.e<-1||(G.e==0?G.c[0]>1||V&&G.c[1]>=24e7:G.c[0]<8e13||V&&G.c[0]<=9999975e7)))return X=G.s<0&&_i(w)?-0:0,G.e>-1&&(X=1/X),new x(k?1/X:X);M&&(X=$s(M/Ne+2))}for(V?(L=new x(.5),k&&(w.s=1),O=_i(w)):(F=Math.abs(+q(w)),O=F%2),P=new x(l);;){if(O){if(P=P.times(G),!P.c)break;X?P.c.length>X&&(P.c.length=X):D&&(P=P.mod(N))}if(F){if(F=Et(F/2),F===0)break;O=F%2}else if(w=w.times(L),A(w,w.e+1,1),w.e>14)O=_i(w);else{if(F=+q(w),F===0)break;O=F%2}G=G.times(G),X?G.c&&G.c.length>X&&(G.c.length=X):D&&(G=G.mod(N))}return D?P:(k&&(P=l.div(P)),N?P.mod(N):X?A(P,M,c,z):P)},o.integerValue=function(w){var N=new x(this);return w==null?w=c:$e(w,0,8),A(N,N.e+1,w)},o.isEqualTo=o.eq=function(w,N){return pn(this,new x(w,N))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(w,N){return pn(this,new x(w,N))>0},o.isGreaterThanOrEqualTo=o.gte=function(w,N){return(N=pn(this,new x(w,N)))===1||N===0},o.isInteger=function(){return!!this.c&&wt(this.e/Ne)>this.c.length-2},o.isLessThan=o.lt=function(w,N){return pn(this,new x(w,N))<0},o.isLessThanOrEqualTo=o.lte=function(w,N){return(N=pn(this,new x(w,N)))===-1||N===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(w,N){var L,D,F,X,z=this,V=z.s;if(w=new x(w,N),N=w.s,!V||!N)return new x(NaN);if(V!=N)return w.s=-N,z.plus(w);var k=z.e/Ne,O=w.e/Ne,P=z.c,G=w.c;if(!k||!O){if(!P||!G)return P?(w.s=-N,w):new x(G?z:NaN);if(!P[0]||!G[0])return G[0]?(w.s=-N,w):new x(P[0]?z:c==3?-0:0)}if(k=wt(k),O=wt(O),P=P.slice(),V=k-O){for((X=V<0)?(V=-V,F=P):(O=k,F=G),F.reverse(),N=V;N--;F.push(0));F.reverse()}else for(D=(X=(V=P.length)<(N=G.length))?V:N,V=N=0;N<D;N++)if(P[N]!=G[N]){X=P[N]<G[N];break}if(X&&(F=P,P=G,G=F,w.s=-w.s),N=(D=G.length)-(L=P.length),N>0)for(;N--;P[L++]=0);for(N=Lt-1;D>V;){if(P[--D]<G[D]){for(L=D;L&&!P[--L];P[L]=N);--P[L],P[D]+=Lt}P[D]-=G[D]}for(;P[0]==0;P.splice(0,1),--O);return P[0]?C(w,P,O):(w.s=c==3?-1:1,w.c=[w.e=0],w)},o.modulo=o.mod=function(w,N){var L,D,F=this;return w=new x(w,N),!F.c||!w.s||w.c&&!w.c[0]?new x(NaN):!w.c||F.c&&!F.c[0]?new x(F):(E==9?(D=w.s,w.s=1,L=e(F,w,0,3),w.s=D,L.s*=D):L=e(F,w,0,E),w=F.minus(L.times(w)),!w.c[0]&&E==1&&(w.s=F.s),w)},o.multipliedBy=o.times=function(w,N){var L,D,F,X,z,V,k,O,P,G,B,Z,K,ee,j,te=this,re=te.c,se=(w=new x(w,N)).c;if(!re||!se||!re[0]||!se[0])return!te.s||!w.s||re&&!re[0]&&!se||se&&!se[0]&&!re?w.c=w.e=w.s=null:(w.s*=te.s,!re||!se?w.c=w.e=null:(w.c=[0],w.e=0)),w;for(D=wt(te.e/Ne)+wt(w.e/Ne),w.s*=te.s,k=re.length,G=se.length,k<G&&(K=re,re=se,se=K,F=k,k=G,G=F),F=k+G,K=[];F--;K.push(0));for(ee=Lt,j=an,F=G;--F>=0;){for(L=0,B=se[F]%j,Z=se[F]/j|0,z=k,X=F+z;X>F;)O=re[--z]%j,P=re[z]/j|0,V=Z*O+P*B,O=B*O+V%j*j+K[X]+L,L=(O/ee|0)+(V/j|0)+Z*P,K[X--]=O%ee;K[X]=L}return L?++D:K.splice(0,1),C(w,K,D)},o.negated=function(){var w=new x(this);return w.s=-w.s||null,w},o.plus=function(w,N){var L,D=this,F=D.s;if(w=new x(w,N),N=w.s,!F||!N)return new x(NaN);if(F!=N)return w.s=-N,D.minus(w);var X=D.e/Ne,z=w.e/Ne,V=D.c,k=w.c;if(!X||!z){if(!V||!k)return new x(F/0);if(!V[0]||!k[0])return k[0]?w:new x(V[0]?D:F*0)}if(X=wt(X),z=wt(z),V=V.slice(),F=X-z){for(F>0?(z=X,L=k):(F=-F,L=V),L.reverse();F--;L.push(0));L.reverse()}for(F=V.length,N=k.length,F-N<0&&(L=k,k=V,V=L,N=F),F=0;N;)F=(V[--N]=V[N]+k[N]+F)/Lt|0,V[N]=Lt===V[N]?0:V[N]%Lt;return F&&(V=[F].concat(V),++z),C(w,V,z)},o.precision=o.sd=function(w,N){var L,D,F,X=this;if(w!=null&&w!==!!w)return $e(w,1,nt),N==null?N=c:$e(N,0,8),A(new x(X),w,N);if(!(L=X.c))return null;if(F=L.length-1,D=F*Ne+1,F=L[F]){for(;F%10==0;F/=10,D--);for(F=L[0];F>=10;F/=10,D++);}return w&&X.e+1>D&&(D=X.e+1),D},o.shiftedBy=function(w){return $e(w,-Zs,Zs),this.times("1e"+w)},o.squareRoot=o.sqrt=function(){var w,N,L,D,F,X=this,z=X.c,V=X.s,k=X.e,O=h+4,P=new x("0.5");if(V!==1||!z||!z[0])return new x(!V||V<0&&(!z||z[0])?NaN:z?X:1/0);if(V=Math.sqrt(+q(X)),V==0||V==1/0?(N=kt(z),(N.length+k)%2==0&&(N+="0"),V=Math.sqrt(+N),k=wt((k+1)/2)-(k<0||k%2),V==1/0?N="5e"+k:(N=V.toExponential(),N=N.slice(0,N.indexOf("e")+1)+k),L=new x(N)):L=new x(V+""),L.c[0]){for(k=L.e,V=k+O,V<3&&(V=0);;)if(F=L,L=P.times(F.plus(e(X,F,O,1))),kt(F.c).slice(0,V)===(N=kt(L.c)).slice(0,V))if(L.e<k&&--V,N=N.slice(V-3,V+1),N=="9999"||!D&&N=="4999"){if(!D&&(A(F,F.e+h+2,0),F.times(F).eq(X))){L=F;break}O+=4,V+=4,D=1}else{(!+N||!+N.slice(1)&&N.charAt(0)=="5")&&(A(L,L.e+h+2,1),w=!L.times(L).eq(X));break}}return A(L,L.e+h+1,c,w)},o.toExponential=function(w,N){return w!=null&&($e(w,0,nt),w++),S(this,w,N,1)},o.toFixed=function(w,N){return w!=null&&($e(w,0,nt),w=w+this.e+1),S(this,w,N)},o.toFormat=function(w,N,L){var D,F=this;if(L==null)w!=null&&N&&typeof N=="object"?(L=N,N=null):w&&typeof w=="object"?(L=w,w=N=null):L=R;else if(typeof L!="object")throw Error(vt+"Argument not an object: "+L);if(D=F.toFixed(w,N),F.c){var X,z=D.split("."),V=+L.groupSize,k=+L.secondaryGroupSize,O=L.groupSeparator||"",P=z[0],G=z[1],B=F.s<0,Z=B?P.slice(1):P,K=Z.length;if(k&&(X=V,V=k,k=X,K-=X),V>0&&K>0){for(X=K%V||V,P=Z.substr(0,X);X<K;X+=V)P+=O+Z.substr(X,V);k>0&&(P+=O+Z.slice(X)),B&&(P="-"+P)}D=G?P+(L.decimalSeparator||"")+((k=+L.fractionGroupSize)?G.replace(new RegExp("\\d{"+k+"}\\B","g"),"$&"+(L.fractionGroupSeparator||"")):G):P}return(L.prefix||"")+D+(L.suffix||"")},o.toFraction=function(w){var N,L,D,F,X,z,V,k,O,P,G,B,Z=this,K=Z.c;if(w!=null&&(V=new x(w),!V.isInteger()&&(V.c||V.s!==1)||V.lt(l)))throw Error(vt+"Argument "+(V.isInteger()?"out of range: ":"not an integer: ")+q(V));if(!K)return new x(Z);for(N=new x(l),O=L=new x(l),D=k=new x(l),B=kt(K),X=N.e=B.length-Z.e-1,N.c[0]=Ws[(z=X%Ne)<0?Ne+z:z],w=!w||V.comparedTo(N)>0?X>0?N:O:V,z=v,v=1/0,V=new x(B),k.c[0]=0;P=e(V,N,0,1),F=L.plus(P.times(D)),F.comparedTo(w)!=1;)L=D,D=F,O=k.plus(P.times(F=O)),k=F,N=V.minus(P.times(F=N)),V=F;return F=e(w.minus(L),D,0,1),k=k.plus(F.times(O)),L=L.plus(F.times(D)),k.s=O.s=Z.s,X=X*2,G=e(O,D,X,c).minus(Z).abs().comparedTo(e(k,L,X,c).minus(Z).abs())<1?[O,D]:[k,L],v=z,G},o.toNumber=function(){return+q(this)},o.toPrecision=function(w,N){return w!=null&&$e(w,1,nt),S(this,w,N,2)},o.toString=function(w){var N,L=this,D=L.s,F=L.e;return F===null?D?(N="Infinity",D<0&&(N="-"+N)):N="NaN":(w==null?N=F<=g||F>=d?xi(kt(L.c),F):Wt(kt(L.c),F,"0"):w===10&&H?(L=A(new x(L),h+F+1,c),N=Wt(kt(L.c),L.e,"0")):($e(w,2,Y.length,"Base"),N=i(Wt(kt(L.c),F,"0"),10,w,D,!0)),D<0&&L.c[0]&&(N="-"+N)),N},o.valueOf=o.toJSON=function(){return q(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,t!=null&&x.set(t),x}function wt(t){var e=t|0;return t>0||t===e?e:e-1}function kt(t){for(var e,i,s=1,o=t.length,l=t[0]+"";s<o;){for(e=t[s++]+"",i=Ne-e.length;i--;e="0"+e);l+=e}for(o=l.length;l.charCodeAt(--o)===48;);return l.slice(0,o+1||1)}function pn(t,e){var i,s,o=t.c,l=e.c,h=t.s,c=e.s,g=t.e,d=e.e;if(!h||!c)return null;if(i=o&&!o[0],s=l&&!l[0],i||s)return i?s?0:-c:h;if(h!=c)return h;if(i=h<0,s=g==d,!o||!l)return s?0:!o^i?1:-1;if(!s)return g>d^i?1:-1;for(c=(g=o.length)<(d=l.length)?g:d,h=0;h<c;h++)if(o[h]!=l[h])return o[h]>l[h]^i?1:-1;return g==d?0:g>d^i?1:-1}function $e(t,e,i,s){if(t<e||t>i||t!==Et(t))throw Error(vt+(s||"Argument")+(typeof t=="number"?t<e||t>i?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function _i(t){var e=t.c.length-1;return wt(t.e/Ne)==e&&t.c[e]%2!=0}function xi(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function Wt(t,e,i){var s,o;if(e<0){for(o=i+".";++e;o+=i);t=o+t}else if(s=t.length,++e>s){for(o=i,e-=s;--e;o+=i);t+=o}else e<s&&(t=t.slice(0,e)+"."+t.slice(e));return t}var Ft=Yu(),Od=class{key;left=null;right=null;constructor(t){this.key=t}},xr=class extends Od{constructor(t){super(t)}},Td=class{size=0;modificationCount=0;splayCount=0;splay(t){const e=this.root;if(e==null)return this.compare(t,t),-1;let i=null,s=null,o=null,l=null,h=e;const c=this.compare;let g;for(;;)if(g=c(h.key,t),g>0){let d=h.left;if(d==null||(g=c(d.key,t),g>0&&(h.left=d.right,d.right=h,h=d,d=h.left,d==null)))break;i==null?s=h:i.left=h,i=h,h=d}else if(g<0){let d=h.right;if(d==null||(g=c(d.key,t),g<0&&(h.right=d.left,d.left=h,h=d,d=h.right,d==null)))break;o==null?l=h:o.right=h,o=h,h=d}else break;return o!=null&&(o.right=h.left,h.left=l),i!=null&&(i.left=h.right,h.right=s),this.root!==h&&(this.root=h,this.splayCount++),g}splayMin(t){let e=t,i=e.left;for(;i!=null;){const s=i;e.left=s.right,s.right=e,e=s,i=e.left}return e}splayMax(t){let e=t,i=e.right;for(;i!=null;){const s=i;e.right=s.left,s.left=e,e=s,i=e.right}return e}_delete(t){if(this.root==null||this.splay(t)!=0)return null;let i=this.root;const s=i,o=i.left;if(this.size--,o==null)this.root=i.right;else{const l=i.right;i=this.splayMax(o),i.right=l,this.root=i}return this.modificationCount++,s}addNewRoot(t,e){this.size++,this.modificationCount++;const i=this.root;if(i==null){this.root=t;return}e<0?(t.left=i,t.right=i.right,i.right=null):(t.right=i,t.left=i.left,i.left=null),this.root=t}_first(){const t=this.root;return t==null?null:(this.root=this.splayMin(t),this.root)}_last(){const t=this.root;return t==null?null:(this.root=this.splayMax(t),this.root)}clear(){this.root=null,this.size=0,this.modificationCount++}has(t){return this.validKey(t)&&this.splay(t)==0}defaultCompare(){return(t,e)=>t<e?-1:t>e?1:0}wrap(){return{getRoot:()=>this.root,setRoot:t=>{this.root=t},getSize:()=>this.size,getModificationCount:()=>this.modificationCount,getSplayCount:()=>this.splayCount,setSplayCount:t=>{this.splayCount=t},splay:t=>this.splay(t),has:t=>this.has(t)}}},Ei=class zr extends Td{root=null;compare;validKey;constructor(e,i){super(),this.compare=e??this.defaultCompare(),this.validKey=i??(s=>s!=null&&s!=null)}delete(e){return this.validKey(e)?this._delete(e)!=null:!1}deleteAll(e){for(const i of e)this.delete(i)}forEach(e){const i=this[Symbol.iterator]();let s;for(;s=i.next(),!s.done;)e(s.value,s.value,this)}add(e){const i=this.splay(e);return i!=0&&this.addNewRoot(new xr(e),i),this}addAndReturn(e){const i=this.splay(e);return i!=0&&this.addNewRoot(new xr(e),i),this.root.key}addAll(e){for(const i of e)this.add(i)}isEmpty(){return this.root==null}isNotEmpty(){return this.root!=null}single(){if(this.size==0)throw"Bad state: No element";if(this.size>1)throw"Bad state: Too many element";return this.root.key}first(){if(this.size==0)throw"Bad state: No element";return this._first().key}last(){if(this.size==0)throw"Bad state: No element";return this._last().key}lastBefore(e){if(e==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(e)<0)return this.root.key;let s=this.root.left;if(s==null)return null;let o=s.right;for(;o!=null;)s=o,o=s.right;return s.key}firstAfter(e){if(e==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(e)>0)return this.root.key;let s=this.root.right;if(s==null)return null;let o=s.left;for(;o!=null;)s=o,o=s.left;return s.key}retainAll(e){const i=new zr(this.compare,this.validKey),s=this.modificationCount;for(const o of e){if(s!=this.modificationCount)throw"Concurrent modification during iteration.";this.validKey(o)&&this.splay(o)==0&&i.add(this.root.key)}i.size!=this.size&&(this.root=i.root,this.size=i.size,this.modificationCount++)}lookup(e){return!this.validKey(e)||this.splay(e)!=0?null:this.root.key}intersection(e){const i=new zr(this.compare,this.validKey);for(const s of this)e.has(s)&&i.add(s);return i}difference(e){const i=new zr(this.compare,this.validKey);for(const s of this)e.has(s)||i.add(s);return i}union(e){const i=this.clone();return i.addAll(e),i}clone(){const e=new zr(this.compare,this.validKey);return e.size=this.size,e.root=this.copyNode(this.root),e}copyNode(e){if(e==null)return null;function i(o,l){let h,c;do{if(h=o.left,c=o.right,h!=null){const g=new xr(h.key);l.left=g,i(h,g)}if(c!=null){const g=new xr(c.key);l.right=g,o=c,l=g}}while(c!=null)}const s=new xr(e.key);return i(e,s),s}toSet(){return this.clone()}entries(){return new Ad(this.wrap())}keys(){return this[Symbol.iterator]()}values(){return this[Symbol.iterator]()}[Symbol.iterator](){return new Rd(this.wrap())}[Symbol.toStringTag]="[object Set]"},zu=class{tree;path=new Array;modificationCount=null;splayCount;constructor(t){this.tree=t,this.splayCount=t.getSplayCount()}[Symbol.iterator](){return this}next(){return this.moveNext()?{done:!1,value:this.current()}:{done:!0,value:null}}current(){if(!this.path.length)return null;const t=this.path[this.path.length-1];return this.getValue(t)}rebuildPath(t){this.path.splice(0,this.path.length),this.tree.splay(t),this.path.push(this.tree.getRoot()),this.splayCount=this.tree.getSplayCount()}findLeftMostDescendent(t){for(;t!=null;)this.path.push(t),t=t.left}moveNext(){if(this.modificationCount!=this.tree.getModificationCount()){if(this.modificationCount==null){this.modificationCount=this.tree.getModificationCount();let i=this.tree.getRoot();for(;i!=null;)this.path.push(i),i=i.left;return this.path.length>0}throw"Concurrent modification during iteration."}if(!this.path.length)return!1;this.splayCount!=this.tree.getSplayCount()&&this.rebuildPath(this.path[this.path.length-1].key);let t=this.path[this.path.length-1],e=t.right;if(e!=null){for(;e!=null;)this.path.push(e),e=e.left;return!0}for(this.path.pop();this.path.length&&this.path[this.path.length-1].right===t;)t=this.path.pop();return this.path.length>0}},Rd=class extends zu{getValue(t){return t.key}},Ad=class extends zu{getValue(t){return[t.key,t.key]}},Xu=t=>()=>t,Ks=t=>{const e=t?(i,s)=>s.minus(i).abs().isLessThanOrEqualTo(t):Xu(!1);return(i,s)=>e(i,s)?0:i.comparedTo(s)};function Dd(t){const e=t?(i,s,o,l,h)=>i.exponentiatedBy(2).isLessThanOrEqualTo(l.minus(s).exponentiatedBy(2).plus(h.minus(o).exponentiatedBy(2)).times(t)):Xu(!1);return(i,s,o)=>{const l=i.x,h=i.y,c=o.x,g=o.y,d=h.minus(g).times(s.x.minus(c)).minus(l.minus(c).times(s.y.minus(g)));return e(d,l,h,c,g)?0:d.comparedTo(0)}}var Fd=t=>t,qd=t=>{if(t){const e=new Ei(Ks(t)),i=new Ei(Ks(t)),s=(l,h)=>h.addAndReturn(l),o=l=>({x:s(l.x,e),y:s(l.y,i)});return o({x:new Ft(0),y:new Ft(0)}),o}return Fd},Js=t=>({set:e=>{Kt=Js(e)},reset:()=>Js(t),compare:Ks(t),snap:qd(t),orient:Dd(t)}),Kt=Js(),Er=(t,e)=>t.ll.x.isLessThanOrEqualTo(e.x)&&e.x.isLessThanOrEqualTo(t.ur.x)&&t.ll.y.isLessThanOrEqualTo(e.y)&&e.y.isLessThanOrEqualTo(t.ur.y),Qs=(t,e)=>{if(e.ur.x.isLessThan(t.ll.x)||t.ur.x.isLessThan(e.ll.x)||e.ur.y.isLessThan(t.ll.y)||t.ur.y.isLessThan(e.ll.y))return null;const i=t.ll.x.isLessThan(e.ll.x)?e.ll.x:t.ll.x,s=t.ur.x.isLessThan(e.ur.x)?t.ur.x:e.ur.x,o=t.ll.y.isLessThan(e.ll.y)?e.ll.y:t.ll.y,l=t.ur.y.isLessThan(e.ur.y)?t.ur.y:e.ur.y;return{ll:{x:i,y:o},ur:{x:s,y:l}}},wi=(t,e)=>t.x.times(e.y).minus(t.y.times(e.x)),Uu=(t,e)=>t.x.times(e.x).plus(t.y.times(e.y)),ki=t=>Uu(t,t).sqrt(),Bd=(t,e,i)=>{const s={x:e.x.minus(t.x),y:e.y.minus(t.y)},o={x:i.x.minus(t.x),y:i.y.minus(t.y)};return wi(o,s).div(ki(o)).div(ki(s))},Gd=(t,e,i)=>{const s={x:e.x.minus(t.x),y:e.y.minus(t.y)},o={x:i.x.minus(t.x),y:i.y.minus(t.y)};return Uu(o,s).div(ki(o)).div(ki(s))},Vu=(t,e,i)=>e.y.isZero()?null:{x:t.x.plus(e.x.div(e.y).times(i.minus(t.y))),y:i},Hu=(t,e,i)=>e.x.isZero()?null:{x:i,y:t.y.plus(e.y.div(e.x).times(i.minus(t.x)))},Yd=(t,e,i,s)=>{if(e.x.isZero())return Hu(i,s,t.x);if(s.x.isZero())return Hu(t,e,i.x);if(e.y.isZero())return Vu(i,s,t.y);if(s.y.isZero())return Vu(t,e,i.y);const o=wi(e,s);if(o.isZero())return null;const l={x:i.x.minus(t.x),y:i.y.minus(t.y)},h=wi(l,e).div(o),c=wi(l,s).div(o),g=t.x.plus(c.times(e.x)),d=i.x.plus(h.times(s.x)),y=t.y.plus(c.times(e.y)),v=i.y.plus(h.times(s.y)),_=g.plus(d).div(2),E=y.plus(v).div(2);return{x:_,y:E}},qt=class ch{point;isLeft;segment;otherSE;consumedBy;static compare(e,i){const s=ch.comparePoints(e.point,i.point);return s!==0?s:(e.point!==i.point&&e.link(i),e.isLeft!==i.isLeft?e.isLeft?1:-1:Ii.compare(e.segment,i.segment))}static comparePoints(e,i){return e.x.isLessThan(i.x)?-1:e.x.isGreaterThan(i.x)?1:e.y.isLessThan(i.y)?-1:e.y.isGreaterThan(i.y)?1:0}constructor(e,i){e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=i}link(e){if(e.point===this.point)throw new Error("Tried to link already linked events");const i=e.point.events;for(let s=0,o=i.length;s<o;s++){const l=i[s];this.point.events.push(l),l.point=this.point}this.checkForConsuming()}checkForConsuming(){const e=this.point.events.length;for(let i=0;i<e;i++){const s=this.point.events[i];if(s.segment.consumedBy===void 0)for(let o=i+1;o<e;o++){const l=this.point.events[o];l.consumedBy===void 0&&s.otherSE.point.events===l.otherSE.point.events&&s.segment.consume(l.segment)}}}getAvailableLinkedEvents(){const e=[];for(let i=0,s=this.point.events.length;i<s;i++){const o=this.point.events[i];o!==this&&!o.segment.ringOut&&o.segment.isInResult()&&e.push(o)}return e}getLeftmostComparator(e){const i=new Map,s=o=>{const l=o.otherSE;i.set(o,{sine:Bd(this.point,e.point,l.point),cosine:Gd(this.point,e.point,l.point)})};return(o,l)=>{i.has(o)||s(o),i.has(l)||s(l);const{sine:h,cosine:c}=i.get(o),{sine:g,cosine:d}=i.get(l);return h.isGreaterThanOrEqualTo(0)&&g.isGreaterThanOrEqualTo(0)?c.isLessThan(d)?1:c.isGreaterThan(d)?-1:0:h.isLessThan(0)&&g.isLessThan(0)?c.isLessThan(d)?-1:c.isGreaterThan(d)?1:0:g.isLessThan(h)?-1:g.isGreaterThan(h)?1:0}}},zd=class Fo{events;poly;_isExteriorRing;_enclosingRing;static factory(e){const i=[];for(let s=0,o=e.length;s<o;s++){const l=e[s];if(!l.isInResult()||l.ringOut)continue;let h=null,c=l.leftSE,g=l.rightSE;const d=[c],y=c.point,v=[];for(;h=c,c=g,d.push(c),c.point!==y;)for(;;){const _=c.getAvailableLinkedEvents();if(_.length===0){const R=d[0].point,Y=d[d.length-1].point;throw new Error(`Unable to complete output ring starting at [${R.x}, ${R.y}]. Last matching segment found ends at [${Y.x}, ${Y.y}].`)}if(_.length===1){g=_[0].otherSE;break}let E=null;for(let R=0,Y=v.length;R<Y;R++)if(v[R].point===c.point){E=R;break}if(E!==null){const R=v.splice(E)[0],Y=d.splice(R.index);Y.unshift(Y[0].otherSE),i.push(new Fo(Y.reverse()));continue}v.push({index:d.length,point:c.point});const M=c.getLeftmostComparator(h);g=_.sort(M)[0].otherSE;break}i.push(new Fo(d))}return i}constructor(e){this.events=e;for(let i=0,s=e.length;i<s;i++)e[i].segment.ringOut=this;this.poly=null}getGeom(){let e=this.events[0].point;const i=[e];for(let d=1,y=this.events.length-1;d<y;d++){const v=this.events[d].point,_=this.events[d+1].point;Kt.orient(v,e,_)!==0&&(i.push(v),e=v)}if(i.length===1)return null;const s=i[0],o=i[1];Kt.orient(s,e,o)===0&&i.shift(),i.push(i[0]);const l=this.isExteriorRing()?1:-1,h=this.isExteriorRing()?0:i.length-1,c=this.isExteriorRing()?i.length:-1,g=[];for(let d=h;d!=c;d+=l)g.push([i[d].x.toNumber(),i[d].y.toNumber()]);return g}isExteriorRing(){if(this._isExteriorRing===void 0){const e=this.enclosingRing();this._isExteriorRing=e?!e.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let e=this.events[0];for(let o=1,l=this.events.length;o<l;o++){const h=this.events[o];qt.compare(e,h)>0&&(e=h)}let i=e.segment.prevInResult(),s=i?i.prevInResult():null;for(;;){if(!i)return null;if(!s)return i.ringOut;if(s.ringOut!==i.ringOut)return s.ringOut?.enclosingRing()!==i.ringOut?i.ringOut:i.ringOut?.enclosingRing();i=s.prevInResult(),s=i?i.prevInResult():null}}},$u=class{exteriorRing;interiorRings;constructor(t){this.exteriorRing=t,t.poly=this,this.interiorRings=[]}addInterior(t){this.interiorRings.push(t),t.poly=this}getGeom(){const t=this.exteriorRing.getGeom();if(t===null)return null;const e=[t];for(let i=0,s=this.interiorRings.length;i<s;i++){const o=this.interiorRings[i].getGeom();o!==null&&e.push(o)}return e}},Xd=class{rings;polys;constructor(t){this.rings=t,this.polys=this._composePolys(t)}getGeom(){const t=[];for(let e=0,i=this.polys.length;e<i;e++){const s=this.polys[e].getGeom();s!==null&&t.push(s)}return t}_composePolys(t){const e=[];for(let i=0,s=t.length;i<s;i++){const o=t[i];if(!o.poly)if(o.isExteriorRing())e.push(new $u(o));else{const l=o.enclosingRing();l?.poly||e.push(new $u(l)),l?.poly?.addInterior(o)}}return e}},Ud=class{queue;tree;segments;constructor(t,e=Ii.compare){this.queue=t,this.tree=new Ei(e),this.segments=[]}process(t){const e=t.segment,i=[];if(t.consumedBy)return t.isLeft?this.queue.delete(t.otherSE):this.tree.delete(e),i;t.isLeft&&this.tree.add(e);let s=e,o=e;do s=this.tree.lastBefore(s);while(s!=null&&s.consumedBy!=null);do o=this.tree.firstAfter(o);while(o!=null&&o.consumedBy!=null);if(t.isLeft){let l=null;if(s){const c=s.getIntersection(e);if(c!==null&&(e.isAnEndpoint(c)||(l=c),!s.isAnEndpoint(c))){const g=this._splitSafely(s,c);for(let d=0,y=g.length;d<y;d++)i.push(g[d])}}let h=null;if(o){const c=o.getIntersection(e);if(c!==null&&(e.isAnEndpoint(c)||(h=c),!o.isAnEndpoint(c))){const g=this._splitSafely(o,c);for(let d=0,y=g.length;d<y;d++)i.push(g[d])}}if(l!==null||h!==null){let c=null;l===null?c=h:h===null?c=l:c=qt.comparePoints(l,h)<=0?l:h,this.queue.delete(e.rightSE),i.push(e.rightSE);const g=e.split(c);for(let d=0,y=g.length;d<y;d++)i.push(g[d])}i.length>0?(this.tree.delete(e),i.push(t)):(this.segments.push(e),e.prev=s)}else{if(s&&o){const l=s.getIntersection(o);if(l!==null){if(!s.isAnEndpoint(l)){const h=this._splitSafely(s,l);for(let c=0,g=h.length;c<g;c++)i.push(h[c])}if(!o.isAnEndpoint(l)){const h=this._splitSafely(o,l);for(let c=0,g=h.length;c<g;c++)i.push(h[c])}}}this.tree.delete(e)}return i}_splitSafely(t,e){this.tree.delete(t);const i=t.rightSE;this.queue.delete(i);const s=t.split(e);return s.push(i),t.consumedBy===void 0&&this.tree.add(t),s}},Vd=class{type;numMultiPolys;run(t,e,i){wr.type=t;const s=[new Wu(e,!0)];for(let d=0,y=i.length;d<y;d++)s.push(new Wu(i[d],!1));if(wr.numMultiPolys=s.length,wr.type==="difference"){const d=s[0];let y=1;for(;y<s.length;)Qs(s[y].bbox,d.bbox)!==null?y++:s.splice(y,1)}if(wr.type==="intersection")for(let d=0,y=s.length;d<y;d++){const v=s[d];for(let _=d+1,E=s.length;_<E;_++)if(Qs(v.bbox,s[_].bbox)===null)return[]}const o=new Ei(qt.compare);for(let d=0,y=s.length;d<y;d++){const v=s[d].getSweepEvents();for(let _=0,E=v.length;_<E;_++)o.add(v[_])}const l=new Ud(o);let h=null;for(o.size!=0&&(h=o.first(),o.delete(h));h;){const d=l.process(h);for(let y=0,v=d.length;y<v;y++){const _=d[y];_.consumedBy===void 0&&o.add(_)}o.size!=0?(h=o.first(),o.delete(h)):h=null}Kt.reset();const c=zd.factory(l.segments);return new Xd(c).getGeom()}},wr=new Vd,qn=wr,Hd=0,Ii=class ji{id;leftSE;rightSE;rings;windings;ringOut;consumedBy;prev;_prevInResult;_beforeState;_afterState;_isInResult;static compare(e,i){const s=e.leftSE.point.x,o=i.leftSE.point.x,l=e.rightSE.point.x,h=i.rightSE.point.x;if(h.isLessThan(s))return 1;if(l.isLessThan(o))return-1;const c=e.leftSE.point.y,g=i.leftSE.point.y,d=e.rightSE.point.y,y=i.rightSE.point.y;if(s.isLessThan(o)){if(g.isLessThan(c)&&g.isLessThan(d))return 1;if(g.isGreaterThan(c)&&g.isGreaterThan(d))return-1;const v=e.comparePoint(i.leftSE.point);if(v<0)return 1;if(v>0)return-1;const _=i.comparePoint(e.rightSE.point);return _!==0?_:-1}if(s.isGreaterThan(o)){if(c.isLessThan(g)&&c.isLessThan(y))return-1;if(c.isGreaterThan(g)&&c.isGreaterThan(y))return 1;const v=i.comparePoint(e.leftSE.point);if(v!==0)return v;const _=e.comparePoint(i.rightSE.point);return _<0?1:_>0?-1:1}if(c.isLessThan(g))return-1;if(c.isGreaterThan(g))return 1;if(l.isLessThan(h)){const v=i.comparePoint(e.rightSE.point);if(v!==0)return v}if(l.isGreaterThan(h)){const v=e.comparePoint(i.rightSE.point);if(v<0)return 1;if(v>0)return-1}if(!l.eq(h)){const v=d.minus(c),_=l.minus(s),E=y.minus(g),M=h.minus(o);if(v.isGreaterThan(_)&&E.isLessThan(M))return 1;if(v.isLessThan(_)&&E.isGreaterThan(M))return-1}return l.isGreaterThan(h)?1:l.isLessThan(h)||d.isLessThan(y)?-1:d.isGreaterThan(y)?1:e.id<i.id?-1:e.id>i.id?1:0}constructor(e,i,s,o){this.id=++Hd,this.leftSE=e,e.segment=this,e.otherSE=i,this.rightSE=i,i.segment=this,i.otherSE=e,this.rings=s,this.windings=o}static fromRing(e,i,s){let o,l,h;const c=qt.comparePoints(e,i);if(c<0)o=e,l=i,h=1;else if(c>0)o=i,l=e,h=-1;else throw new Error(`Tried to create degenerate segment at [${e.x}, ${e.y}]`);const g=new qt(o,!0),d=new qt(l,!1);return new ji(g,d,[s],[h])}replaceRightSE(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const e=this.leftSE.point.y,i=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:e.isLessThan(i)?e:i},ur:{x:this.rightSE.point.x,y:e.isGreaterThan(i)?e:i}}}vector(){return{x:this.rightSE.point.x.minus(this.leftSE.point.x),y:this.rightSE.point.y.minus(this.leftSE.point.y)}}isAnEndpoint(e){return e.x.eq(this.leftSE.point.x)&&e.y.eq(this.leftSE.point.y)||e.x.eq(this.rightSE.point.x)&&e.y.eq(this.rightSE.point.y)}comparePoint(e){return Kt.orient(this.leftSE.point,e,this.rightSE.point)}getIntersection(e){const i=this.bbox(),s=e.bbox(),o=Qs(i,s);if(o===null)return null;const l=this.leftSE.point,h=this.rightSE.point,c=e.leftSE.point,g=e.rightSE.point,d=Er(i,c)&&this.comparePoint(c)===0,y=Er(s,l)&&e.comparePoint(l)===0,v=Er(i,g)&&this.comparePoint(g)===0,_=Er(s,h)&&e.comparePoint(h)===0;if(y&&d)return _&&!v?h:!_&&v?g:null;if(y)return v&&l.x.eq(g.x)&&l.y.eq(g.y)?null:l;if(d)return _&&h.x.eq(c.x)&&h.y.eq(c.y)?null:c;if(_&&v)return null;if(_)return h;if(v)return g;const E=Yd(l,this.vector(),c,e.vector());return E===null||!Er(o,E)?null:Kt.snap(E)}split(e){const i=[],s=e.events!==void 0,o=new qt(e,!0),l=new qt(e,!1),h=this.rightSE;this.replaceRightSE(l),i.push(l),i.push(o);const c=new ji(o,h,this.rings.slice(),this.windings.slice());return qt.comparePoints(c.leftSE.point,c.rightSE.point)>0&&c.swapEvents(),qt.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),s&&(o.checkForConsuming(),l.checkForConsuming()),i}swapEvents(){const e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let i=0,s=this.windings.length;i<s;i++)this.windings[i]*=-1}consume(e){let i=this,s=e;for(;i.consumedBy;)i=i.consumedBy;for(;s.consumedBy;)s=s.consumedBy;const o=ji.compare(i,s);if(o!==0){if(o>0){const l=i;i=s,s=l}if(i.prev===s){const l=i;i=s,s=l}for(let l=0,h=s.rings.length;l<h;l++){const c=s.rings[l],g=s.windings[l],d=i.rings.indexOf(c);d===-1?(i.rings.push(c),i.windings.push(g)):i.windings[d]+=g}s.rings=null,s.windings=null,s.consumedBy=i,s.leftSE.consumedBy=i.leftSE,s.rightSE.consumedBy=i.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{const e=this.prev.consumedBy||this.prev;this._beforeState=e.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;const e=this.beforeState();this._afterState={rings:e.rings.slice(0),windings:e.windings.slice(0),multiPolys:[]};const i=this._afterState.rings,s=this._afterState.windings,o=this._afterState.multiPolys;for(let c=0,g=this.rings.length;c<g;c++){const d=this.rings[c],y=this.windings[c],v=i.indexOf(d);v===-1?(i.push(d),s.push(y)):s[v]+=y}const l=[],h=[];for(let c=0,g=i.length;c<g;c++){if(s[c]===0)continue;const d=i[c],y=d.poly;if(h.indexOf(y)===-1)if(d.isExterior)l.push(y);else{h.indexOf(y)===-1&&h.push(y);const v=l.indexOf(d.poly);v!==-1&&l.splice(v,1)}}for(let c=0,g=l.length;c<g;c++){const d=l[c].multiPoly;o.indexOf(d)===-1&&o.push(d)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;const e=this.beforeState().multiPolys,i=this.afterState().multiPolys;switch(qn.type){case"union":{const s=e.length===0,o=i.length===0;this._isInResult=s!==o;break}case"intersection":{let s,o;e.length<i.length?(s=e.length,o=i.length):(s=i.length,o=e.length),this._isInResult=o===qn.numMultiPolys&&s<o;break}case"xor":{const s=Math.abs(e.length-i.length);this._isInResult=s%2===1;break}case"difference":{const s=o=>o.length===1&&o[0].isSubject;this._isInResult=s(e)!==s(i);break}}return this._isInResult}},Zu=class{poly;isExterior;segments;bbox;constructor(t,e,i){if(!Array.isArray(t)||t.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=e,this.isExterior=i,this.segments=[],typeof t[0][0]!="number"||typeof t[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const s=Kt.snap({x:new Ft(t[0][0]),y:new Ft(t[0][1])});this.bbox={ll:{x:s.x,y:s.y},ur:{x:s.x,y:s.y}};let o=s;for(let l=1,h=t.length;l<h;l++){if(typeof t[l][0]!="number"||typeof t[l][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const c=Kt.snap({x:new Ft(t[l][0]),y:new Ft(t[l][1])});c.x.eq(o.x)&&c.y.eq(o.y)||(this.segments.push(Ii.fromRing(o,c,this)),c.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=c.x),c.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=c.y),c.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=c.x),c.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=c.y),o=c)}(!s.x.eq(o.x)||!s.y.eq(o.y))&&this.segments.push(Ii.fromRing(o,s,this))}getSweepEvents(){const t=[];for(let e=0,i=this.segments.length;e<i;e++){const s=this.segments[e];t.push(s.leftSE),t.push(s.rightSE)}return t}},$d=class{multiPoly;exteriorRing;interiorRings;bbox;constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Zu(t[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let i=1,s=t.length;i<s;i++){const o=new Zu(t[i],this,!1);o.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=e}getSweepEvents(){const t=this.exteriorRing.getSweepEvents();for(let e=0,i=this.interiorRings.length;e<i;e++){const s=this.interiorRings[e].getSweepEvents();for(let o=0,l=s.length;o<l;o++)t.push(s[o])}return t}},Wu=class{isSubject;polys;bbox;constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof t[0][0][0]=="number"&&(t=[t])}catch{}this.polys=[],this.bbox={ll:{x:new Ft(Number.POSITIVE_INFINITY),y:new Ft(Number.POSITIVE_INFINITY)},ur:{x:new Ft(Number.NEGATIVE_INFINITY),y:new Ft(Number.NEGATIVE_INFINITY)}};for(let i=0,s=t.length;i<s;i++){const o=new $d(t[i],this);o.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=e}getSweepEvents(){const t=[];for(let e=0,i=this.polys.length;e<i;e++){const s=this.polys[e].getSweepEvents();for(let o=0,l=s.length;o<l;o++)t.push(s[o])}return t}},un=(t,...e)=>qn.run("union",t,e),Ku=(t,...e)=>qn.run("intersection",t,e),Zd=(t,...e)=>qn.run("xor",t,e),Ju=(t,...e)=>qn.run("difference",t,e),Wd=Kt.set;const Kd=Object.freeze(Object.defineProperty({__proto__:null,difference:Ju,intersection:Ku,setPrecision:Wd,union:un,xor:Zd},Symbol.toStringTag,{value:"Module"}));function Jd(t){const e=[];if(rt(t,o=>{e.push(o.coordinates)}),e.length<2)throw new Error("Must have at least two features");const i=t.features[0].properties||{},s=Ju(e[0],...e.slice(1));return s.length===0?null:s.length===1?ye(s[0],i):ft(s,i)}function js(t){if(!t)throw new Error("geojson is required");var e=[];return Qe(t,function(i){e.push(i)}),he(e)}function Qd(t,e={}){if(e=e||{},!Ce(e))throw new Error("options is invalid");const{propertyName:i}=e;Ut(t,"Polygon","dissolve");const s=[];if(i){const o={};Le(t,function(h){h.properties&&(Object.prototype.hasOwnProperty.call(o,h.properties[i])||(o[h.properties[i]]=[]),o[h.properties[i]].push(h))});const l=Object.keys(o);for(let h=0;h<l.length;h++){const c=ft(un.apply(null,o[l[h]].map(function(g){return g.geometry.coordinates})));c&&c.properties&&(c.properties[i]=l[h],s.push(c))}}else return js(ft(un.apply(null,t.features.map(function(o){return o.geometry.coordinates}))));return js(he(s))}function jd(t,e,i=2){const s=Oe(t),o=Oe(e),l=s[0]-o[0],h=s[1]-o[1];return i===1?Math.abs(l)+Math.abs(h):Math.pow(Math.pow(l,i)+Math.pow(h,i),1/i)}function Qu(t,e){var i,s;e=e||{};const o=e.threshold||1e4,l=e.p||2,h=(i=e.binary)!=null?i:!1,c=e.alpha||-1,g=(s=e.standardization)!=null?s:!1,d=[];Le(t,v=>{d.push(Zt(v))});const y=[];for(let v=0;v<d.length;v++)y[v]=[];for(let v=0;v<d.length;v++)for(let _=v;_<d.length;_++){v===_&&(y[v][_]=0);const E=jd(d[v],d[_],l);y[v][_]=E,y[_][v]=E}for(let v=0;v<d.length;v++)for(let _=0;_<d.length;_++){const E=y[v][_];E!==0&&(h?E<=o?y[v][_]=1:y[v][_]=0:E<=o?y[v][_]=Math.pow(E,c):y[v][_]=0)}if(g)for(let v=0;v<d.length;v++){const _=y[v].reduce((E,M)=>E+M,0);for(let E=0;E<d.length;E++)y[v][E]=y[v][E]/_}return y}function Bn(t,e,i={}){const s=Oe(t),o=Oe(e);o[0]+=o[0]-s[0]>180?-360:s[0]-o[0]>180?360:0;const l=ev(s,o);return fn(l,"meters",i.units)}function ev(t,e,i){i=i===void 0?Ke:Number(i);const s=i,o=t[1]*Math.PI/180,l=e[1]*Math.PI/180,h=l-o;let c=Math.abs(e[0]-t[0])*Math.PI/180;c>Math.PI&&(c-=2*Math.PI);const g=Math.log(Math.tan(l/2+Math.PI/4)/Math.tan(o/2+Math.PI/4)),d=Math.abs(g)>1e-11?h/g:Math.cos(o);return Math.sqrt(h*h+d*d*c*c)*s}function Ni(t,e,i,s={}){const o=e<0;let l=fn(Math.abs(e),s.units,"meters");o&&(l=-Math.abs(l));const h=Oe(t),c=tv(h,l,i);return c[0]+=c[0]-h[0]>180?-360:h[0]-c[0]>180?360:0,_e(c,s.properties)}function tv(t,e,i,s){s=s===void 0?Ke:Number(s);const o=e/s,l=t[0]*Math.PI/180,h=Ze(t[1]),c=Ze(i),g=o*Math.cos(c);let d=h+g;Math.abs(d)>Math.PI/2&&(d=d>0?Math.PI-d:-Math.PI-d);const y=Math.log(Math.tan(d/2+Math.PI/4)/Math.tan(h/2+Math.PI/4)),v=Math.abs(y)>1e-11?g/y:Math.cos(h),_=o*Math.sin(c)/v;return[((l+_)*180/Math.PI+540)%360-180,d*180/Math.PI]}function ju(t,e,i){if(i=i||{},!Ce(i))throw new Error("options is invalid");const s=i.pivot,o=i.mutate;if(!t)throw new Error("geojson is required");if(e==null||isNaN(e))throw new Error("angle is required");if(e===0)return t;const l=s??Zt(t);return(o===!1||o===void 0)&&(t=je(t)),Xe(t,function(h){const g=gn(l,h)+e,d=Bn(l,h),y=ve(Ni(l,d,g));h[0]=y[0],h[1]=y[1]}),t}function el(t,e,i,s){s=s||{};let o=s.steps||64;const l=s.units||"kilometers";let h=s.angle||0;const c=s.pivot||t,g=s.properties||{};if(!t)throw new Error("center is required");if(!e)throw new Error("xSemiAxis is required");if(!i)throw new Error("ySemiAxis is required");if(!Ce(s))throw new Error("options must be an object");if(!Je(o))throw new Error("steps must be a number");if(!Je(h))throw new Error("angle must be a number");const d=Oe(ju(_e(Oe(t)),h,{pivot:c}));h=-90+h,o=Math.ceil(o/4);let y=[],v=[];const _=e,E=i,M=E,R=(_-E)/(Math.PI/2),Y=(_+E)*Math.PI/4,H=.5,x=o;let S=0,b=0;for(let A=0;A<o;A++)b+=S,R===0?S=Y/x/M:S=(-(R*b+M)+Math.sqrt(Math.pow(R*b+M,2)-4*(H*R)*-(Y/x)))/(2*(H*R)),b!=0&&y.push(b);v.push(0);for(let A=0;A<y.length;A++)v.push(y[A]);v.push(Math.PI/2);for(let A=0;A<y.length;A++)v.push(Math.PI-y[y.length-A-1]);v.push(Math.PI);for(let A=0;A<y.length;A++)v.push(Math.PI+y[A]);v.push(3*Math.PI/2);for(let A=0;A<y.length;A++)v.push(2*Math.PI-y[y.length-A-1]);v.push(0);const C=[];for(const A of v){const q=Math.atan2(E*Math.sin(A),_*Math.cos(A)),w=Math.sqrt(Math.pow(_,2)*Math.pow(E,2)/(Math.pow(_*Math.sin(q),2)+Math.pow(E*Math.cos(q),2)));C.push(rn(d,w,h+Tt(q),{units:l}).geometry.coordinates)}return ye([C],g)}function tl(t){return sr(Fe(t))}function Mi(t){const e=[];return t.type==="FeatureCollection"?Le(t,function(i){Xe(i,function(s){e.push(_e(s,i.properties))})}):t.type==="Feature"?Xe(t,function(i){e.push(_e(i,t.properties))}):Xe(t,function(i){e.push(_e(i))}),he(e)}function nv(t,e){var i;if(e=e||{},!Ce(e))throw new Error("options is invalid");const s=(i=e.mutate)!=null?i:!1;if(!t)throw new Error("geojson is required");return(s===!1||s===void 0)&&(t=je(t)),Xe(t,function(o){var l=o[0],h=o[1];o[0]=h,o[1]=l}),t}var nl=Math.PI/180,rl=180/Math.PI,kr=function(t,e){this.lon=t,this.lat=e,this.x=nl*t,this.y=nl*e};kr.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)},kr.prototype.antipode=function(){var t=-1*this.lat,e=this.lon<0?180+this.lon:(180-this.lon)*-1;return new kr(e,t)};var il=function(){this.coords=[],this.length=0};il.prototype.move_to=function(t){this.length++,this.coords.push(t)};var eo=function(t){this.properties=t||{},this.geometries=[]};eo.prototype.json=function(){if(this.geometries.length<=0)return{geometry:{type:"LineString",coordinates:null},type:"Feature",properties:this.properties};if(this.geometries.length===1)return{geometry:{type:"LineString",coordinates:this.geometries[0].coords},type:"Feature",properties:this.properties};for(var t=[],e=0;e<this.geometries.length;e++)t.push(this.geometries[e].coords);return{geometry:{type:"MultiLineString",coordinates:t},type:"Feature",properties:this.properties}},eo.prototype.wkt=function(){for(var t="",e="LINESTRING(",i=function(l){e+=l[0]+" "+l[1]+","},s=0;s<this.geometries.length;s++){if(this.geometries[s].coords.length===0)return"LINESTRING(empty)";var o=this.geometries[s].coords;o.forEach(i),t+=e.substring(0,e.length-1)+")"}return t};var to=function(t,e,i){if(!t||t.x===void 0||t.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");if(!e||e.x===void 0||e.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");this.start=new kr(t.x,t.y),this.end=new kr(e.x,e.y),this.properties=i||{};var s=this.start.x-this.end.x,o=this.start.y-this.end.y,l=Math.pow(Math.sin(o/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(s/2),2);if(this.g=2*Math.asin(Math.sqrt(l)),this.g===Math.PI)throw new Error("it appears "+this.start.view()+" and "+this.end.view()+" are 'antipodal', e.g diametrically opposite, thus there is no single route but rather infinite");if(isNaN(this.g))throw new Error("could not calculate great circle between "+t+" and "+e)};to.prototype.interpolate=function(t){var e=Math.sin((1-t)*this.g)/Math.sin(this.g),i=Math.sin(t*this.g)/Math.sin(this.g),s=e*Math.cos(this.start.y)*Math.cos(this.start.x)+i*Math.cos(this.end.y)*Math.cos(this.end.x),o=e*Math.cos(this.start.y)*Math.sin(this.start.x)+i*Math.cos(this.end.y)*Math.sin(this.end.x),l=e*Math.sin(this.start.y)+i*Math.sin(this.end.y),h=rl*Math.atan2(l,Math.sqrt(Math.pow(s,2)+Math.pow(o,2))),c=rl*Math.atan2(o,s);return[c,h]},to.prototype.Arc=function(t,e){var i=[];if(!t||t<=2)i.push([this.start.lon,this.start.lat]),i.push([this.end.lon,this.end.lat]);else for(var s=1/(t-1),o=0;o<t;++o){var l=s*o,h=this.interpolate(l);i.push(h)}for(var c=!1,g=0,d=e&&e.offset?e.offset:10,y=180-d,v=-180+d,_=360-d,E=1;E<i.length;++E){var M=i[E-1][0],R=i[E][0],Y=Math.abs(R-M);Y>_&&(R>y&&M<v||M>y&&R<v)?c=!0:Y>g&&(g=Y)}var H=[];if(c&&g<d){var x=[];H.push(x);for(var S=0;S<i.length;++S){var b=parseFloat(i[S][0]);if(S>0&&Math.abs(b-i[S-1][0])>_){var C=parseFloat(i[S-1][0]),A=parseFloat(i[S-1][1]),q=parseFloat(i[S][0]),w=parseFloat(i[S][1]);if(C>-180&&C<v&&q===180&&S+1<i.length&&i[S-1][0]>-180&&i[S-1][0]<v){x.push([-180,i[S][1]]),S++,x.push([i[S][0],i[S][1]]);continue}else if(C>y&&C<180&&q===-180&&S+1<i.length&&i[S-1][0]>y&&i[S-1][0]<180){x.push([180,i[S][1]]),S++,x.push([i[S][0],i[S][1]]);continue}if(C<v&&q>y){var N=C;C=q,q=N;var L=A;A=w,w=L}if(C>y&&q<v&&(q+=360),C<=180&&q>=180&&C<q){var D=(180-C)/(q-C),F=D*w+(1-D)*A;x.push([i[S-1][0]>y?180:-180,F]),x=[],x.push([i[S-1][0]>y?-180:180,F]),H.push(x)}else x=[],H.push(x);x.push([b,i[S][1]])}else x.push([i[S][0],i[S][1]])}}else{var X=[];H.push(X);for(var z=0;z<i.length;++z)X.push([i[z][0],i[z][1]])}for(var V=new eo(this.properties),k=0;k<H.length;++k){var O=new il;V.geometries.push(O);for(var P=H[k],G=0;G<P.length;++G)O.move_to(P[G])}return V};function rv(t,e,i){if(i=i||{},typeof i!="object")throw new Error("options is invalid");var s=i.properties,o=i.npoints,l=i.offset;if(t=Oe(t),e=Oe(e),s=s||{},o=o||100,t[0]===e[0]&&t[1]===e[1]){const g=Array(o);return g.fill([t[0],t[1]]),Pe(g,s)}l=l||10;var h=new to({x:t[0],y:t[1]},{x:e[0],y:e[1]},s),c=h.Arc(o,{offset:l});return c.json()}function Ir(t,e={}){const i=[];if(rt(t,o=>{i.push(o.coordinates)}),i.length<2)throw new Error("Must specify at least 2 geometries");const s=Ku(i[0],...i.slice(1));return s.length===0?null:s.length===1?ye(s[0],e.properties):ft(s,e.properties)}function sl(t,e,i={}){const s=JSON.stringify(i.properties||{}),[o,l,h,c]=t,g=(l+c)/2,d=(o+h)/2,v=e*2/Be([o,g],[h,g],i)*(h-o),E=e*2/Be([d,l],[d,c],i)*(c-l),M=v/2,R=M*2,Y=Math.sqrt(3)/2*E,H=h-o,x=c-l,S=3/4*R,b=Y,C=(H-R)/(R-M/2),A=Math.floor(C),q=(A*S-M/2-H)/2-M/2+S/2,w=Math.floor((x-Y)/Y);let N=(x-w*Y)/2;const L=w*Y-x>Y/2;L&&(N-=Y/4);const D=[],F=[];for(let z=0;z<6;z++){const V=2*Math.PI/6*z;D.push(Math.cos(V)),F.push(Math.sin(V))}const X=[];for(let z=0;z<=A;z++)for(let V=0;V<=w;V++){const k=z%2===1;if(V===0&&k||V===0&&L)continue;const O=z*S+o-q;let P=V*b+l+N;if(k&&(P-=Y/2),i.triangles===!0)sv([O,P],v/2,E/2,JSON.parse(s),D,F).forEach(function(G){i.mask?Ir(he([i.mask,G]))&&X.push(G):X.push(G)});else{const G=iv([O,P],v/2,E/2,JSON.parse(s),D,F);i.mask?Ir(he([i.mask,G]))&&X.push(G):X.push(G)}}return he(X)}function iv(t,e,i,s,o,l){const h=[];for(let c=0;c<6;c++){const g=t[0]+e*o[c],d=t[1]+i*l[c];h.push([g,d])}return h.push(h[0].slice()),ye([h],s)}function sv(t,e,i,s,o,l){const h=[];for(let c=0;c<6;c++){const g=[];g.push(t),g.push([t[0]+e*o[c],t[1]+i*l[c]]),g.push([t[0]+e*o[(c+1)%6],t[1]+i*l[(c+1)%6]]),g.push(t),h.push(ye([g],s))}return h}function ol(t,e,i={}){i.mask&&!i.units&&(i.units="kilometers");for(var s=[],o=t[0],l=t[1],h=t[2],c=t[3],g=e/Be([o,l],[h,l],i),d=g*(h-o),y=e/Be([o,l],[o,c],i),v=y*(c-l),_=h-o,E=c-l,M=Math.floor(_/d),R=Math.floor(E/v),Y=(_-M*d)/2,H=(E-R*v)/2,x=o+Y;x<=h;){for(var S=l+H;S<=c;){var b=_e([x,S],i.properties);i.mask?Aa(b,i.mask)&&s.push(b):s.push(b),S+=v}x+=d}return he(s)}function al(t,e,i,s={}){const o=[],l=t[0],h=t[1],c=t[2],g=t[3],d=c-l,y=fn(e,s.units,"degrees"),v=g-h,_=fn(i,s.units,"degrees"),E=Math.floor(Math.abs(d)/y),M=Math.floor(Math.abs(v)/_),R=(d-E*y)/2,Y=(v-M*_)/2;let H=l+R;for(let x=0;x<E;x++){let S=h+Y;for(let b=0;b<M;b++){const C=ye([[[H,S],[H,S+_],[H+y,S+_],[H+y,S],[H,S]]],s.properties);s.mask?Ea(s.mask,C)&&o.push(C):o.push(C),S+=_}H+=y}return he(o)}function no(t,e,i={}){return al(t,e,e,i)}function ul(t,e,i={}){for(var s=[],o=e/Be([t[0],t[1]],[t[2],t[1]],i),l=o*(t[2]-t[0]),h=e/Be([t[0],t[1]],[t[0],t[3]],i),c=h*(t[3]-t[1]),g=0,d=t[0];d<=t[2];){for(var y=0,v=t[1];v<=t[3];){var _=null,E=null;g%2===0&&y%2===0?(_=ye([[[d,v],[d,v+c],[d+l,v],[d,v]]],i.properties),E=ye([[[d,v+c],[d+l,v+c],[d+l,v],[d,v+c]]],i.properties)):g%2===0&&y%2===1?(_=ye([[[d,v],[d+l,v+c],[d+l,v],[d,v]]],i.properties),E=ye([[[d,v],[d,v+c],[d+l,v+c],[d,v]]],i.properties)):y%2===0&&g%2===1?(_=ye([[[d,v],[d,v+c],[d+l,v+c],[d,v]]],i.properties),E=ye([[[d,v],[d+l,v+c],[d+l,v],[d,v]]],i.properties)):y%2===1&&g%2===1&&(_=ye([[[d,v],[d,v+c],[d+l,v],[d,v]]],i.properties),E=ye([[[d,v+c],[d+l,v+c],[d+l,v],[d,v+c]]],i.properties)),i.mask?(Ir(he([i.mask,_]))&&s.push(_),Ir(he([i.mask,E]))&&s.push(E)):(s.push(_),s.push(E)),v+=c,y++}g++,d+=l}return he(s)}function ov(t,e,i){if(i=i||{},typeof i!="object")throw new Error("options is invalid");var s=i.gridType,o=i.property,l=i.weight,h=i.bbox;if(!t)throw new Error("points is required");if(Ut(t,"Point","input must contain Points"),!e)throw new Error("cellSize is required");if(l!==void 0&&typeof l!="number")throw new Error("weight must be a number");o=o||"elevation",s=s||"square",l=l||1,h=h??Fe(t),tr(h);var c;switch(s){case"point":case"points":c=ol(h,e,i);break;case"square":case"squares":c=no(h,e,i);break;case"hex":case"hexes":c=sl(h,e,i);break;case"triangle":case"triangles":c=ul(h,e,i);break;default:throw new Error("invalid gridType")}var g=[];return Le(c,function(d){var y=0,v=0;Le(t,function(E){var M=s==="point"?d:Zt(d),R=Be(M,E,i),Y;if(o!==void 0&&(Y=E.properties[o]),Y===void 0&&(Y=E.geometry.coordinates[2]),Y===void 0)throw new Error("zValue is missing");R===0&&(y=Y);var H=1/Math.pow(R,l);v+=H,y+=H*Y});var _=je(d);_.properties[o]=y/v,g.push(_)}),he(g)}var av=Object.defineProperty,ll=Object.getOwnPropertySymbols,uv=Object.prototype.hasOwnProperty,lv=Object.prototype.propertyIsEnumerable,cl=(t,e,i)=>e in t?av(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,hl=(t,e)=>{for(var i in e||(e={}))uv.call(e,i)&&cl(t,i,e[i]);if(ll)for(var i of ll(e))lv.call(e,i)&&cl(t,i,e[i]);return t};function cv(t,e){if(e=e||{},!Ce(e))throw new Error("options is invalid");var i=e.zProperty||"elevation",s=e.flip,o=e.flags;Ut(t,"Point","input must contain Points");for(var l=hv(t,s),h=[],c=0;c<l.length;c++){for(var g=l[c],d=[],y=0;y<g.length;y++){var v=g[y];v.properties[i]?d.push(v.properties[i]):d.push(0),o===!0&&(v.properties.matrixPosition=[c,y])}h.push(d)}return h}function hv(t,e){var i={};Le(t,function(l){var h=ve(l)[1];i[h]||(i[h]=[]),i[h].push(l)});var s=Object.keys(i).map(function(l){var h=i[l],c=h.sort(function(g,d){return ve(g)[0]-ve(d)[0]});return c}),o=s.sort(function(l,h){return e?ve(l[0])[1]-ve(h[0])[1]:ve(h[0])[1]-ve(l[0])[1]});return o}function fv(t,e,i){if(i=i||{},!Ce(i))throw new Error("options is invalid");const s=i.zProperty||"elevation",o=i.commonProperties||{},l=i.breaksProperties||[];if(Ut(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(!Ce(o))throw new Error("commonProperties is not an Object");if(!Array.isArray(l))throw new Error("breaksProperties is not an Array");const h=cv(t,{zProperty:s,flip:!0}),c=h[0].length;if(h.length<2||c<2)throw new Error("Matrix of points must be at least 2x2");for(let y=1;y<h.length;y++)if(h[y].length!==c)throw new Error("Matrix of points is not uniform in the x dimension");let g=gv(h,e,s);g=vv(g,h,t);const d=g.map((y,v)=>{if(l[v]&&!Ce(l[v]))throw new Error("Each mappedProperty is required to be an Object");const _=hl(hl({},o),l[v]);return _[s]=y[s],ft(y.groupedRings,_)});return he(d)}function gv(t,e,i){const s=[];let o;for(let l=1;l<e.length;l++){l===1&&(o=fl(t,+e[0]));const h=+e[l],c=+e[l-1],g=fl(t,h),d=g.map(E=>E.map(M=>[M[0],M[1]]).reverse()),y=dv(o.concat(d),t),v=yv(y),_=mv(v);if(_.length===0&&t[0][0]<h&&t[0][0]>=c){const E=t[0].length,M=t.length;_.push([[[0,0],[E-1,0],[E-1,M-1],[0,M-1],[0,0]]])}s.push({groupedRings:_,[i]:c+"-"+h}),o=g}return s}function fl(t,e){const i=[],s=t[0].length,o=t.length;for(let h=0;h<o-1;h++)for(let c=0;c<s-1;c++){const g=t[h+1][c+1],d=t[h][c+1],y=t[h][c],v=t[h+1][c];switch((v>=e?8:0)|(g>=e?4:0)|(d>=e?2:0)|(y>=e?1:0)){case 0:continue;case 1:i.push([[c+l(y,d),h],[c,h+l(y,v)]]);break;case 2:i.push([[c+1,h+l(d,g)],[c+l(y,d),h]]);break;case 3:i.push([[c+1,h+l(d,g)],[c,h+l(y,v)]]);break;case 4:i.push([[c+l(v,g),h+1],[c+1,h+l(d,g)]]);break;case 5:{(v+g+d+y)/4>=e?i.push([[c+l(v,g),h+1],[c,h+l(y,v)]],[[c+l(y,d),h],[c+1,h+l(d,g)]]):i.push([[c+l(v,g),h+1],[c+1,h+l(d,g)]],[[c+l(y,d),h],[c,h+l(y,v)]]);break}case 6:i.push([[c+l(v,g),h+1],[c+l(y,d),h]]);break;case 7:i.push([[c+l(v,g),h+1],[c,h+l(y,v)]]);break;case 8:i.push([[c,h+l(y,v)],[c+l(v,g),h+1]]);break;case 9:i.push([[c+l(y,d),h],[c+l(v,g),h+1]]);break;case 10:{(v+g+d+y)/4>=e?i.push([[c,h+l(y,v)],[c+l(y,d),h]],[[c+1,h+l(d,g)],[c+l(v,g),h+1]]):i.push([[c,h+l(y,v)],[c+l(v,g),h+1]],[[c+1,h+l(d,g)],[c+l(y,d),h]]);break}case 11:i.push([[c+1,h+l(d,g)],[c+l(v,g),h+1]]);break;case 12:i.push([[c,h+l(y,v)],[c+1,h+l(d,g)]]);break;case 13:i.push([[c+l(y,d),h],[c+1,h+l(d,g)]]);break;case 14:i.push([[c,h+l(y,v)],[c+l(y,d),h]]);break;case 15:continue}}return i;function l(h,c){if(h===c)return .5;let g=(e-h)/(c-h);return g>1?1:g<0?0:g}}function dv(t,e){const i=e.length,s=e[0].length,o=[],l=[];for(;t.length>0;){const h=[...t.shift()];o.push(h);let c;do{c=!1;for(let g=0;g<t.length;g++){const d=t[g];if(d[0][0]===h[h.length-1][0]&&d[0][1]===h[h.length-1][1]){c=!0,h.push(d[1]),t.splice(g,1);break}if(d[1][0]===h[0][0]&&d[1][1]===h[0][1]){c=!0,h.unshift(d[0]),t.splice(g,1);break}}}while(c)}for(;o.length>0;){const h=o[0];if(h[0][0]===h[h.length-1][0]&&h[0][1]===h[h.length-1][1]){l.push(h),o.shift();continue}const c=h[h.length-1];let g,d;if(c[0]===0&&c[1]!==0)g=Si(o,y=>y[0][0]===0&&y[0][1]<c[1],(y,v)=>v[0][1]-y[0][1]),d=[0,0];else if(c[1]===0&&c[0]!==s-1)g=Si(o,y=>y[0][1]===0&&y[0][0]>c[0],(y,v)=>y[0][0]-v[0][0]),d=[s-1,0];else if(c[0]===s-1&&c[1]!==i-1)g=Si(o,y=>y[0][0]===s-1&&y[0][1]>c[1],(y,v)=>y[0][1]-v[0][1]),d=[s-1,i-1];else if(c[1]===i-1&&c[0]!==0)g=Si(o,y=>y[0][1]===i-1&&y[0][0]<c[0],(y,v)=>v[0][0]-y[0][0]),d=[0,i-1];else throw new Error("Contour not closed but is not along an edge");if(g===-1)h.push(d);else if(g===0)h.push([h[0][0],h[0][1]]),l.push(h),o.shift();else{const y=o[g];o.splice(g,1);for(const v of y)h.push(v)}}for(let h=0;h<l.length;h++)l[h].length<4&&(l.splice(h,1),h--);return l}function vv(t,e,i){const s=Fe(i),o=s[2]-s[0],l=s[3]-s[1],h=s[0],c=s[1],g=e[0].length-1,d=e.length-1,y=o/g,v=l/d;return t.map(function(_){return _.groupedRings=_.groupedRings.map(function(E){return E.map(function(M){return M.map(R=>[R[0]*y+h,R[1]*v+c])})}),_})}function yv(t){const e=t.map(function(i){return{ring:i,area:ir(ye([i]))}});return e.sort(function(i,s){return s.area-i.area}),e.map(function(i){return i.ring})}function mv(t){const e=t.map(s=>({lrCoordinates:s,grouped:!1})),i=[];for(;!pv(e);)for(let s=0;s<e.length;s++)if(!e[s].grouped){const o=[];o.push(e[s].lrCoordinates),e[s].grouped=!0;const l=ye([e[s].lrCoordinates]);e:for(let h=s+1;h<e.length;h++)if(!e[h].grouped){const c=ye([e[h].lrCoordinates]);if(gl(c,l)){for(let g=1;g<o.length;g++)if(gl(c,ye([o[g]])))continue e;o.push(e[h].lrCoordinates),e[h].grouped=!0}}i.push(o)}return i}function gl(t,e){const i=Mi(t);for(let s=0;s<i.features.length;s++)if(!xe(i.features[s],e))return!1;return!0}function pv(t){for(let e=0;e<t.length;e++)if(t[e].grouped===!1)return!1;return!0}function Si(t,e,i){let s=-1;for(let o=0;o<t.length;o++)e(t[o])&&(s===-1||i(t[s],t[o])>0)&&(s=o);return s}var _v=Object.defineProperty,dl=Object.getOwnPropertySymbols,xv=Object.prototype.hasOwnProperty,Ev=Object.prototype.propertyIsEnumerable,vl=(t,e,i)=>e in t?_v(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,yl=(t,e)=>{for(var i in e||(e={}))xv.call(e,i)&&vl(t,i,e[i]);if(dl)for(var i of dl(e))Ev.call(e,i)&&vl(t,i,e[i]);return t};function wv(t,e){if(e=e||{},!Ce(e))throw new Error("options is invalid");var i=e.zProperty||"elevation",s=e.flip,o=e.flags;Ut(t,"Point","input must contain Points");for(var l=kv(t,s),h=[],c=0;c<l.length;c++){for(var g=l[c],d=[],y=0;y<g.length;y++){var v=g[y];v.properties[i]?d.push(v.properties[i]):d.push(0),o===!0&&(v.properties.matrixPosition=[c,y])}h.push(d)}return h}function kv(t,e){var i={};Le(t,function(l){var h=ve(l)[1];i[h]||(i[h]=[]),i[h].push(l)});var s=Object.keys(i).map(function(l){var h=i[l],c=h.sort(function(g,d){return ve(g)[0]-ve(d)[0]});return c}),o=s.sort(function(l,h){return e?ve(l[0])[1]-ve(h[0])[1]:ve(h[0])[1]-ve(l[0])[1]});return o}function Iv(t,e,i){if(i=i||{},!Ce(i))throw new Error("options is invalid");const s=i.zProperty||"elevation",o=i.commonProperties||{},l=i.breaksProperties||[];if(Ut(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(!Ce(o))throw new Error("commonProperties must be an Object");if(!Array.isArray(l))throw new Error("breaksProperties must be an Array");const h=wv(t,{zProperty:s,flip:!0}),c=h[0].length;if(h.length<2||c<2)throw new Error("Matrix of points must be at least 2x2");for(let y=1;y<h.length;y++)if(h[y].length!==c)throw new Error("Matrix of points is not uniform in the x dimension");const g=Nv(h,e,s,o,l),d=Sv(g,h,t);return he(d)}function Nv(t,e,i,s,o){const l=[];for(let h=0;h<e.length;h++){const c=+e[h],g=yl(yl({},s),o[h]);g[i]=c;const d=tn(Mv(t,c),g);l.push(d)}return l}function Mv(t,e){const i=[],s=t.length,o=t[0].length;for(let c=0;c<s-1;c++)for(let g=0;g<o-1;g++){const d=t[c+1][g+1],y=t[c][g+1],v=t[c][g],_=t[c+1][g];switch((_>=e?8:0)|(d>=e?4:0)|(y>=e?2:0)|(v>=e?1:0)){case 0:continue;case 1:i.push([[g+h(v,y),c],[g,c+h(v,_)]]);break;case 2:i.push([[g+1,c+h(y,d)],[g+h(v,y),c]]);break;case 3:i.push([[g+1,c+h(y,d)],[g,c+h(v,_)]]);break;case 4:i.push([[g+h(_,d),c+1],[g+1,c+h(y,d)]]);break;case 5:{(_+d+y+v)/4>=e?i.push([[g+h(_,d),c+1],[g,c+h(v,_)]],[[g+h(v,y),c],[g+1,c+h(y,d)]]):i.push([[g+h(_,d),c+1],[g+1,c+h(y,d)]],[[g+h(v,y),c],[g,c+h(v,_)]]);break}case 6:i.push([[g+h(_,d),c+1],[g+h(v,y),c]]);break;case 7:i.push([[g+h(_,d),c+1],[g,c+h(v,_)]]);break;case 8:i.push([[g,c+h(v,_)],[g+h(_,d),c+1]]);break;case 9:i.push([[g+h(v,y),c],[g+h(_,d),c+1]]);break;case 10:{(_+d+y+v)/4>=e?i.push([[g,c+h(v,_)],[g+h(v,y),c]],[[g+1,c+h(y,d)],[g+h(_,d),c+1]]):i.push([[g,c+h(v,_)],[g+h(_,d),c+1]],[[g+1,c+h(y,d)],[g+h(v,y),c]]);break}case 11:i.push([[g+1,c+h(y,d)],[g+h(_,d),c+1]]);break;case 12:i.push([[g,c+h(v,_)],[g+1,c+h(y,d)]]);break;case 13:i.push([[g+h(v,y),c],[g+1,c+h(y,d)]]);break;case 14:i.push([[g,c+h(v,_)],[g+h(v,y),c]]);break;case 15:continue}}const l=[];for(;i.length>0;){const c=[...i.shift()];l.push(c);let g;do{g=!1;for(let d=0;d<i.length;d++){const y=i[d];if(y[0][0]===c[c.length-1][0]&&y[0][1]===c[c.length-1][1]){g=!0,c.push(y[1]),i.splice(d,1);break}if(y[1][0]===c[0][0]&&y[1][1]===c[0][1]){g=!0,c.unshift(y[0]),i.splice(d,1);break}}}while(g)}return l;function h(c,g){if(c===g)return .5;let d=(e-c)/(g-c);return d>1?1:d<0?0:d}}function Sv(t,e,i){const s=Fe(i),o=s[2]-s[0],l=s[3]-s[1],h=s[0],c=s[1],g=e[0].length-1,d=e.length-1,y=o/g,v=l/d,_=E=>{E[0]=E[0]*y+h,E[1]=E[1]*v+c};return t.forEach(E=>{Xe(E,_)}),t}function Pv(t){let e,i;const s={type:"FeatureCollection",features:[]};if(t.type==="Feature"?i=t.geometry:i=t,i.type==="LineString")e=[i.coordinates];else if(i.type==="MultiLineString")e=i.coordinates;else if(i.type==="MultiPolygon")e=[].concat(...i.coordinates);else if(i.type==="Polygon")e=i.coordinates;else throw new Error("Input must be a LineString, MultiLineString, Polygon, or MultiPolygon Feature or Geometry");return e.forEach(o=>{e.forEach(l=>{for(let h=0;h<o.length-1;h++)for(let c=h;c<l.length-1;c++){if(o===l&&(Math.abs(h-c)===1||h===0&&c===o.length-2&&o[h][0]===o[o.length-1][0]&&o[h][1]===o[o.length-1][1]))continue;const g=Lv(o[h][0],o[h][1],o[h+1][0],o[h+1][1],l[c][0],l[c][1],l[c+1][0],l[c+1][1]);g&&s.features.push(_e([g[0],g[1]]))}})}),s}function Lv(t,e,i,s,o,l,h,c){let g,d,y,v,_;const E={x:null,y:null,onLine1:!1,onLine2:!1};return g=(c-l)*(i-t)-(h-o)*(s-e),g===0?E.x!==null&&E.y!==null?E:!1:(d=e-l,y=t-o,v=(h-o)*d-(c-l)*y,_=(i-t)*d-(s-e)*y,d=v/g,y=_/g,E.x=t+d*(i-t),E.y=e+d*(s-e),d>=0&&d<=1&&(E.onLine1=!0),y>=0&&y<=1&&(E.onLine2=!0),E.onLine1&&E.onLine2?[E.x,E.y]:!1)}function ml(t,e={}){return as(t,(i,s)=>{const o=s.geometry.coordinates;return i+Be(o[0],o[1],e)},0)}function pl(t,e,i,s,o={}){const l=o.steps||64,h=_l(i),c=_l(s),g=!Array.isArray(t)&&t.type==="Feature"?t.properties:{};if(h===c)return Pe(Rs(t,e,o).geometry.coordinates[0],g);const d=h,y=h<c?c:c+360;let v=d;const _=[];let E=0;const M=(y-d)/l;for(;v<=y;)_.push(rn(t,e,v,o).geometry.coordinates),E++,v=d+E*M;return Pe(_,g)}function _l(t){let e=t%360;return e<0&&(e+=360),e}function xl(t,e,i,s){if(s=s||{},!Ce(s))throw new Error("options is invalid");var o,l=[];if(t.type==="Feature")o=t.geometry.coordinates;else if(t.type==="LineString")o=t.coordinates;else throw new Error("input must be a LineString Feature or Geometry");for(var h=o.length,c=0,g,d,y,v=0;v<o.length&&!(e>=c&&v===o.length-1);v++){if(c>e&&l.length===0){if(g=e-c,!g)return l.push(o[v]),Pe(l);d=nn(o[v],o[v-1])-180,y=rn(o[v],g,d,s),l.push(y.geometry.coordinates)}if(c>=i)return g=i-c,g?(d=nn(o[v],o[v-1])-180,y=rn(o[v],g,d,s),l.push(y.geometry.coordinates),Pe(l)):(l.push(o[v]),Pe(l));if(c>=e&&l.push(o[v]),v===o.length-1)return Pe(l);c+=Be(o[v],o[v+1],s)}if(c<e&&o.length===h)throw new Error("Start position is beyond line");var _=o[o.length-1];return Pe([_,_])}function bv(t,e,i){if(i=i||{},!Ce(i))throw new Error("options is invalid");var s=i.units,o=i.reverse;if(!t)throw new Error("geojson is required");if(e<=0)throw new Error("segmentLength must be greater than 0");var l=[];return Qe(t,function(h){o&&(h.geometry.coordinates=h.geometry.coordinates.reverse()),Cv(h,e,s,function(c){l.push(c)})}),he(l)}function Cv(t,e,i,s){var o=ml(t,{units:i});if(o<=e)return s(t);var l=o/e;Number.isInteger(l)||(l=Math.floor(l)+1);for(var h=0;h<l;h++){var c=xl(t,e*h,e*(h+1),{units:i});s(c,h)}}function Pi(t){var e=t[0],i=t[1];return[i[0]-e[0],i[1]-e[1]]}function ro(t,e){return t[0]*e[1]-e[0]*t[1]}function Ov(t,e){return[t[0]+e[0],t[1]+e[1]]}function Tv(t,e){return[t[0]-e[0],t[1]-e[1]]}function Rv(t,e){return[t*e[0],t*e[1]]}function Av(t,e){var i=t[0],s=Pi(t),o=e[0],l=Pi(e),h=ro(s,l),c=Tv(o,i),g=ro(c,l),d=g/h,y=Ov(i,Rv(d,s));return y}function Dv(t,e){var i=Pi(t),s=Pi(e);return ro(i,s)===0}function Fv(t,e){return Dv(t,e)?!1:Av(t,e)}function qv(t,e,i){if(i=i||{},!Ce(i))throw new Error("options is invalid");var s=i.units;if(!t)throw new Error("geojson is required");if(e==null||isNaN(e))throw new Error("distance is required");var o=gt(t),l=t.properties;switch(o){case"LineString":return El(t,e,s);case"MultiLineString":var h=[];return Qe(t,function(c){h.push(El(c,e,s).geometry.coordinates)}),tn(h,l);default:throw new Error("geometry "+o+" is not supported")}}function El(t,e,i){var s=[],o=Vr(e,i),l=ve(t),h=[];return l.forEach(function(c,g){if(g!==l.length-1){var d=Bv(c,l[g+1],o);if(s.push(d),g>0){var y=s[g-1],v=Fv(d,y);v!==!1&&(y[1]=v,d[0]=v),h.push(y[0]),g===l.length-2&&(h.push(d[0]),h.push(d[1]))}l.length===2&&(h.push(d[0]),h.push(d[1]))}}),Pe(h,t.properties)}function Bv(t,e,i){var s=Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])),o=t[0]+i*(e[1]-t[1])/s,l=e[0]+i*(e[1]-t[1])/s,h=t[1]+i*(t[0]-e[0])/s,c=e[1]+i*(t[0]-e[0])/s;return[[o,h],[l,c]]}function Gv(t,e,i){var s=ve(i);if(gt(i)!=="LineString")throw new Error("line must be a LineString");var o=$t(i,t),l=$t(i,e),h;o.properties.index<=l.properties.index?h=[o,l]:h=[l,o];for(var c=[h[0].geometry.coordinates],g=h[0].properties.index+1;g<h[1].properties.index+1;g++)c.push(s[g]);return c.push(h[1].geometry.coordinates),Pe(c,i.properties)}function wl(t,e){if(e=e??{},!Ce(e))throw new Error("options is invalid");var i=e.precision,s=e.coordinates,o=e.mutate;if(i=i==null||isNaN(i)?6:i,s=s==null||isNaN(s)?3:s,!t)throw new Error("<geojson> is required");if(typeof i!="number")throw new Error("<precision> must be a number");if(typeof s!="number")throw new Error("<coordinates> must be a number");(o===!1||o===void 0)&&(t=JSON.parse(JSON.stringify(t)));var l=Math.pow(10,i);return Xe(t,function(h){Yv(h,l,s)}),t}function Yv(t,e,i){t.length>i&&t.splice(i,t.length);for(var s=0;s<t.length;s++)t[s]=Math.round(t[s]*e)/e;return t}function zv(t,e){if(!t)throw new Error("line is required");if(!e)throw new Error("splitter is required");var i=gt(t),s=gt(e);if(i!=="LineString")throw new Error("line must be LineString");if(s==="FeatureCollection")throw new Error("splitter cannot be a FeatureCollection");if(s==="GeometryCollection")throw new Error("splitter cannot be a GeometryCollection");var o=wl(e,{precision:7});switch(s){case"Point":return io(t,o);case"MultiPoint":return kl(t,o);case"LineString":case"MultiLineString":case"Polygon":case"MultiPolygon":return kl(t,Rt(t,o,{ignoreSelfIntersections:!0}))}}function kl(t,e){var i=[],s=Qr();return Qe(e,function(o){if(i.forEach(function(c,g){c.id=g}),!i.length)i=io(t,o).features,s.load(he(i));else{var l=s.search(o);if(l.features.length){var h=Il(o,l);i=i.filter(function(c){return c.id!==h.id}),s.remove(h),Le(io(h,o),function(c){i.push(c),s.insert(c)})}}}),he(i)}function io(t,e){var i=[],s=ve(t)[0],o=ve(t)[t.geometry.coordinates.length-1];if(so(s,Oe(e))||so(o,Oe(e)))return he([t]);var l=Qr(),h=hr(t);l.load(h);var c=l.search(e);if(!c.features.length)return he([t]);var g=Il(e,c),d=[s],y=ss(h,function(v,_,E){var M=ve(_)[1],R=Oe(e);return E===g.id?(v.push(R),i.push(Pe(v)),so(R,M)?[R]:[R,M]):(v.push(M),v)},d);return y.length>1&&i.push(Pe(y)),he(i)}function Il(t,e){if(!e.features.length)throw new Error("lines must contain features");if(e.features.length===1)return e.features[0];var i,s=1/0;return Le(e,function(o){var l=$t(o,t),h=l.properties.dist;h<s&&(i=o,s=h)}),i}function so(t,e){return t[0]===e[0]&&t[1]===e[1]}function Xv(t,e={}){var i,s,o,l=e.properties,h=(i=e.autoComplete)!=null?i:!0,c=(s=e.orderCoords)!=null?s:!0,g=(o=e.mutate)!=null?o:!1;if(g||(t=je(t)),t.type==="FeatureCollection"){var d=[];return t.features.forEach(function(y){d.push(ve(Nl(y,{},h,c)))}),ft(d,l)}else return Nl(t,l,h,c)}function Nl(t,e,i,s){e=e||(t.type==="Feature"?t.properties:{});var o=qe(t),l=o.coordinates,h=o.type;if(!l.length)throw new Error("line must contain coordinates");switch(h){case"LineString":return i&&(l=Ml(l)),ye([l],e);case"MultiLineString":var c=[],g=0;return l.forEach(function(d){if(i&&(d=Ml(d)),s){var y=Uv(Fe(Pe(d)));y>g?(c.unshift(d),g=y):c.push(d)}else c.push(d)}),ye(c,e);default:throw new Error("geometry type "+h+" is not supported")}}function Ml(t){var e=t[0],i=e[0],s=e[1],o=t[t.length-1],l=o[0],h=o[1];return(i!==l||s!==h)&&t.push(e),t}function Uv(t){var e=t[0],i=t[1],s=t[2],o=t[3];return Math.abs(e-s)*Math.abs(i-o)}function Vv(t,e,i){var s;const o=(s=i?.mutate)!=null?s:!1;let l=e;e&&o===!1&&(l=je(e));const h=$v(l);let c=null;return t.type==="FeatureCollection"?c=Hv(t):t.type==="Feature"?c=oo(un(t.geometry.coordinates)):c=oo(un(t.coordinates)),c.geometry.coordinates.forEach(function(g){h.geometry.coordinates.push(g[0])}),h}function Hv(t){const e=t.features.length===2?un(t.features[0].geometry.coordinates,t.features[1].geometry.coordinates):un.apply(Kd,t.features.map(function(i){return i.geometry.coordinates}));return oo(e)}function oo(t){return ft(t)}function $v(t){let i=[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]];return t&&(t.type==="Feature"?i=t.geometry.coordinates:i=t.coordinates),ye(i)}function Zv(t,e){const i=Be(t,e),s=nn(t,e);return rn(t,i/2,s)}function Wv(t,e){var i,s;const o=e.inputField,l=e.threshold||1e5,h=e.p||2,c=(i=e.binary)!=null?i:!1,g=e.alpha||-1,d=(s=e.standardization)!=null?s:!0,y=Qu(t,{alpha:g,binary:c,p:h,standardization:d,threshold:l}),v=[];Le(t,L=>{const D=L.properties||{};v.push(D[o])});const _=Sl(v),E=Kv(v);let M=0,R=0,Y=0,H=0;const x=y.length;for(let L=0;L<x;L++){let D=0;for(let F=0;F<x;F++)M+=y[L][F]*(v[L]-_)*(v[F]-_),R+=y[L][F],Y+=Math.pow(y[L][F]+y[F][L],2),D+=y[L][F]+y[F][L];H+=Math.pow(D,2)}Y=.5*Y;const S=M/R/E,b=-1/(x-1),C=x*x*Y-x*H+3*(R*R),A=(x-1)*(x+1)*(R*R),q=C/A-b*b,w=Math.sqrt(q),N=(S-b)/w;return{expectedMoranIndex:b,moranIndex:S,stdNorm:w,zNorm:N}}function Sl(t){let e=0;for(const i of t)e+=i;return e/t.length}function Kv(t){const e=Sl(t);let i=0;for(const s of t)i+=Math.pow(s-e,2);return i/t.length}var Jv=Object.defineProperty,Qv=Object.defineProperties,jv=Object.getOwnPropertyDescriptors,Pl=Object.getOwnPropertySymbols,ey=Object.prototype.hasOwnProperty,ty=Object.prototype.propertyIsEnumerable,Ll=(t,e,i)=>e in t?Jv(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,bl=(t,e)=>{for(var i in e||(e={}))ey.call(e,i)&&Ll(t,i,e[i]);if(Pl)for(var i of Pl(e))ty.call(e,i)&&Ll(t,i,e[i]);return t},Cl=(t,e)=>Qv(t,jv(e));function Li(t,e,i={}){if(!t)throw new Error("targetPoint is required");if(!e)throw new Error("points is required");let s=1/0,o=0;Le(e,(h,c)=>{const g=Be(t,h,i);g<s&&(o=c,s=g)});const l=je(e.features[o]);return Cl(bl({},l),{properties:Cl(bl({},l.properties),{featureIndex:o,distanceToPoint:s})})}function ny(t,e){e=e||{};const i=e.studyArea||sr(Fe(t)),s=e.properties||{},o=e.units||"kilometers",l=[];Le(t,v=>{l.push(Zt(v))});const h=l.length,c=l.map((v,_)=>{const E=he(l.filter((M,R)=>R!==_));return Be(v,Li(v,E).geometry.coordinates,{units:o})}).reduce((v,_)=>v+_,0)/h,g=h/ts(ir(i),"meters",o),d=1/(2*Math.sqrt(g)),y=.26136/Math.sqrt(h*g);return s.nearestNeighborAnalysis={units:o,arealUnits:o+"²",observedMeanDistance:c,expectedMeanDistance:d,nearestNeighborIndex:c/d,numberOfPoints:h,zScore:(c-d)/y},i.properties=s,i}function ao(t,e,i={}){var s,o;const l=(s=i.method)!=null?s:"geodesic",h=(o=i.units)!=null?o:"kilometers";if(!t)throw new Error("pt is required");if(Array.isArray(t)?t=_e(t):t.type==="Point"?t=We(t):nr(t,"Point","point"),!e)throw new Error("line is required");Array.isArray(e)?e=Pe(e):e.type==="LineString"?e=We(e):nr(e,"LineString","line");let c=1/0;const g=t.geometry.coordinates;return Vt(e,d=>{if(d){const y=d.geometry.coordinates[0],v=d.geometry.coordinates[1],_=ry(g,y,v,{method:l});_<c&&(c=_)}}),fn(c,"degrees",h)}function ry(t,e,i,s){if(s.method==="geodesic")return $t(Pe([e,i]).geometry,t,{units:"degrees"}).properties.dist;const o=[i[0]-e[0],i[1]-e[1]],l=[t[0]-e[0],t[1]-e[1]],h=Ol(l,o);if(h<=0)return Bn(t,e,{units:"degrees"});const c=Ol(o,o);if(c<=h)return Bn(t,i,{units:"degrees"});const g=h/c,d=[e[0]+g*o[0],e[1]+g*o[1]];return Bn(t,d,{units:"degrees"})}function Ol(t,e){return t[0]*e[0]+t[1]*e[1]}var iy=Object.defineProperty,Tl=Object.getOwnPropertySymbols,sy=Object.prototype.hasOwnProperty,oy=Object.prototype.propertyIsEnumerable,Rl=(t,e,i)=>e in t?iy(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,uo=(t,e)=>{for(var i in e||(e={}))sy.call(e,i)&&Rl(t,i,e[i]);if(Tl)for(var i of Tl(e))oy.call(e,i)&&Rl(t,i,e[i]);return t};function ay(t,e,i={}){const s=i.units,o=i.properties||{},l=uy(t);if(!l.features.length)throw new Error("points must contain features");if(!e)throw new Error("line is required");if(gt(e)!=="LineString")throw new Error("line must be a LineString");let h=1/0,c=null;return Le(l,g=>{const d=ao(g,e,{units:s});d<h&&(h=d,c=g)}),c&&(c.properties=uo(uo(uo({},{dist:h}),c.properties),o)),c}function uy(t){const e=[];switch(t.geometry?t.geometry.type:t.type){case"GeometryCollection":return rt(t,s=>{s.type==="Point"&&e.push({type:"Feature",properties:{},geometry:s})}),{type:"FeatureCollection",features:e};case"FeatureCollection":return t.features=t.features.filter(s=>s.geometry.type==="Point"),t;default:throw new Error("points must be a Point Collection")}}function ly(t,e){const i=Oe(t),l=qe(e).coordinates[0];if(l.length<4)throw new Error("OuterRing of a Polygon must have 4 or more Positions.");const h=e.type==="Feature"&&e.properties||{},c=h.a,g=h.b,d=h.c,y=i[0],v=i[1],_=l[0][0],E=l[0][1],M=c!==void 0?c:l[0][2],R=l[1][0],Y=l[1][1],H=g!==void 0?g:l[1][2],x=l[2][0],S=l[2][1],b=d!==void 0?d:l[2][2];return(b*(y-_)*(v-Y)+M*(y-R)*(v-S)+H*(y-x)*(v-E)-H*(y-_)*(v-S)-b*(y-R)*(v-E)-M*(y-x)*(v-Y))/((y-_)*(v-Y)+(y-R)*(v-S)+(y-x)*(v-E)-(y-_)*(v-S)-(y-R)*(v-E)-(y-x)*(v-Y))}function cy(t){const e=hy(t),i=jr(e);let s=!1,o=0;for(;!s&&o<e.features.length;){const l=e.features[o].geometry;let h,c,g,d,y,v,_=!1;if(l.type==="Point")i.geometry.coordinates[0]===l.coordinates[0]&&i.geometry.coordinates[1]===l.coordinates[1]&&(s=!0);else if(l.type==="MultiPoint"){let E=!1,M=0;for(;!E&&M<l.coordinates.length;)i.geometry.coordinates[0]===l.coordinates[M][0]&&i.geometry.coordinates[1]===l.coordinates[M][1]&&(s=!0,E=!0),M++}else if(l.type==="LineString"){let E=0;for(;!_&&E<l.coordinates.length-1;)h=i.geometry.coordinates[0],c=i.geometry.coordinates[1],g=l.coordinates[E][0],d=l.coordinates[E][1],y=l.coordinates[E+1][0],v=l.coordinates[E+1][1],Al(h,c,g,d,y,v)&&(_=!0,s=!0),E++}else if(l.type==="MultiLineString"){let E=0;for(;E<l.coordinates.length;){_=!1;let M=0;const R=l.coordinates[E];for(;!_&&M<R.length-1;)h=i.geometry.coordinates[0],c=i.geometry.coordinates[1],g=R[M][0],d=R[M][1],y=R[M+1][0],v=R[M+1][1],Al(h,c,g,d,y,v)&&(_=!0,s=!0),M++;E++}}else(l.type==="Polygon"||l.type==="MultiPolygon")&&xe(i,l)&&(s=!0);o++}if(s)return i;{const l=he([]);for(let h=0;h<e.features.length;h++)l.features=l.features.concat(Mi(e.features[h]).features);return _e(Li(i,l).geometry.coordinates)}}function hy(t){return t.type!=="FeatureCollection"?t.type!=="Feature"?he([We(t)]):he([t]):t}function Al(t,e,i,s,o,l){const h=Math.sqrt((o-i)*(o-i)+(l-s)*(l-s)),c=Math.sqrt((t-i)*(t-i)+(e-s)*(e-s)),g=Math.sqrt((o-t)*(o-t)+(l-e)*(l-e));return h===c+g}function Dl(t,e){const i=[];return Le(t,function(s){let o=!1;if(s.geometry.type==="Point")rt(e,function(h){xe(s,h)&&(o=!0)}),o&&i.push(s);else if(s.geometry.type==="MultiPoint"){var l=[];rt(e,function(h){Xe(s,function(c){xe(c,h)&&(o=!0,l.push(c))})}),o&&i.push(jn(l,s.properties))}else throw new Error("Input geometry must be a Point or MultiPoint")}),he(i)}function lo(t,e,i={}){var s,o;const l=(s=i.method)!=null?s:"geodesic",h=(o=i.units)!=null?o:"kilometers";if(!t)throw new Error("point is required");if(!e)throw new Error("polygon or multi-polygon is required");const c=qe(e);if(c.type==="MultiPolygon"){const y=c.coordinates.map(v=>lo(t,ye(v),{method:l,units:h}));return Math.min(...y.map(Math.abs))*(xe(t,e)?-1:1)}if(c.coordinates.length>1){const[y,...v]=c.coordinates.map(E=>lo(t,ye([E]),{method:l,units:h}));if(y>=0)return y;const _=Math.min(...v);return _<0?Math.abs(_):Math.max(_*-1,y)}const g=bn(c);let d=1/0;return Qe(g,y=>{d=Math.min(d,ao(t,y,{method:l,units:h}))}),xe(t,c)?-d:d}function fy(t){return(t>0)-(t<0)||+t}function co(t,e,i){const s=e[0]-t[0],o=e[1]-t[1],l=i[0]-e[0],h=i[1]-e[1];return fy(s*h-l*o)}function gy(t,e){const i=t.geometry.coordinates[0].map(h=>h[0]),s=t.geometry.coordinates[0].map(h=>h[1]),o=e.geometry.coordinates[0].map(h=>h[0]),l=e.geometry.coordinates[0].map(h=>h[1]);return Math.max.apply(null,i)===Math.max.apply(null,o)&&Math.max.apply(null,s)===Math.max.apply(null,l)&&Math.min.apply(null,i)===Math.min.apply(null,o)&&Math.min.apply(null,s)===Math.min.apply(null,l)}function Fl(t,e){return e.geometry.coordinates[0].every(i=>xe(_e(i),t))}function dy(t,e){return t[0]===e[0]&&t[1]===e[1]}var ql=class hh{static buildId(e){return e.join(",")}constructor(e){this.id=hh.buildId(e),this.coordinates=e,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}removeInnerEdge(e){this.innerEdges=this.innerEdges.filter(i=>i.from.id!==e.from.id)}removeOuterEdge(e){this.outerEdges=this.outerEdges.filter(i=>i.to.id!==e.to.id)}addOuterEdge(e){this.outerEdges.push(e),this.outerEdgesSorted=!1}sortOuterEdges(){this.outerEdgesSorted||(this.outerEdges.sort((e,i)=>{const s=e.to,o=i.to;if(s.coordinates[0]-this.coordinates[0]>=0&&o.coordinates[0]-this.coordinates[0]<0)return 1;if(s.coordinates[0]-this.coordinates[0]<0&&o.coordinates[0]-this.coordinates[0]>=0)return-1;if(s.coordinates[0]-this.coordinates[0]===0&&o.coordinates[0]-this.coordinates[0]===0)return s.coordinates[1]-this.coordinates[1]>=0||o.coordinates[1]-this.coordinates[1]>=0?s.coordinates[1]-o.coordinates[1]:o.coordinates[1]-s.coordinates[1];const l=co(this.coordinates,s.coordinates,o.coordinates);if(l<0)return 1;if(l>0)return-1;const h=Math.pow(s.coordinates[0]-this.coordinates[0],2)+Math.pow(s.coordinates[1]-this.coordinates[1],2),c=Math.pow(o.coordinates[0]-this.coordinates[0],2)+Math.pow(o.coordinates[1]-this.coordinates[1],2);return h-c}),this.outerEdgesSorted=!0)}getOuterEdges(){return this.sortOuterEdges(),this.outerEdges}getOuterEdge(e){return this.sortOuterEdges(),this.outerEdges[e]}addInnerEdge(e){this.innerEdges.push(e)}},vy=class fh{getSymetric(){return this.symetric||(this.symetric=new fh(this.to,this.from),this.symetric.symetric=this),this.symetric}constructor(e,i){this.from=e,this.to=i,this.next=void 0,this.label=void 0,this.symetric=void 0,this.ring=void 0,this.from.addOuterEdge(this),this.to.addInnerEdge(this)}deleteEdge(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)}isEqual(e){return this.from.id===e.from.id&&this.to.id===e.to.id}toString(){return`Edge { ${this.from.id} -> ${this.to.id} }`}toLineString(){return Pe([this.from.coordinates,this.to.coordinates])}compareTo(e){return co(e.from.coordinates,e.to.coordinates,this.to.coordinates)}},Bl=class{constructor(){this.edges=[],this.polygon=void 0,this.envelope=void 0}push(t){this.edges.push(t),this.polygon=this.envelope=void 0}get(t){return this.edges[t]}get length(){return this.edges.length}forEach(t){this.edges.forEach(t)}map(t){return this.edges.map(t)}some(t){return this.edges.some(t)}isValid(){return!0}isHole(){const t=this.edges.reduce((o,l,h)=>(l.from.coordinates[1]>this.edges[o].from.coordinates[1]&&(o=h),o),0),e=(t===0?this.length:t)-1,i=(t+1)%this.length,s=co(this.edges[e].from.coordinates,this.edges[t].from.coordinates,this.edges[i].from.coordinates);return s===0?this.edges[e].from.coordinates[0]>this.edges[i].from.coordinates[0]:s>0}toMultiPoint(){return jn(this.edges.map(t=>t.from.coordinates))}toPolygon(){if(this.polygon)return this.polygon;const t=this.edges.map(e=>e.from.coordinates);return t.push(this.edges[0].from.coordinates),this.polygon=ye([t])}getEnvelope(){return this.envelope?this.envelope:this.envelope=tl(this.toPolygon())}static findEdgeRingContaining(t,e){const i=t.getEnvelope();let s,o;return e.forEach(l=>{const h=l.getEnvelope();if(o&&(s=o.getEnvelope()),!gy(h,i)&&Fl(h,i)){const c=t.map(d=>d.from.coordinates);let g;for(const d of c)l.some(y=>dy(d,y.from.coordinates))||(g=d);g&&l.inside(_e(g))&&(!o||Fl(s,h))&&(o=l)}}),o}inside(t){return xe(t,this.toPolygon())}};function yy(t){if(!t)throw new Error("No geojson passed");if(t.type!=="FeatureCollection"&&t.type!=="GeometryCollection"&&t.type!=="MultiLineString"&&t.type!=="LineString"&&t.type!=="Feature")throw new Error(`Invalid input type '${t.type}'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature`)}var my=class gh{static fromGeoJson(e){yy(e);const i=new gh;return Qe(e,s=>{nr(s,"LineString","Graph::fromGeoJson"),rs(s,(o,l)=>{if(o){const h=i.getNode(o),c=i.getNode(l);i.addEdge(h,c)}return l})}),i}getNode(e){const i=ql.buildId(e);let s=this.nodes[i];return s||(s=this.nodes[i]=new ql(e)),s}addEdge(e,i){const s=new vy(e,i),o=s.getSymetric();this.edges.push(s),this.edges.push(o)}constructor(){this.edges=[],this.nodes={}}deleteDangles(){Object.keys(this.nodes).map(e=>this.nodes[e]).forEach(e=>this._removeIfDangle(e))}_removeIfDangle(e){if(e.innerEdges.length<=1){const i=e.getOuterEdges().map(s=>s.to);this.removeNode(e),i.forEach(s=>this._removeIfDangle(s))}}deleteCutEdges(){this._computeNextCWEdges(),this._findLabeledEdgeRings(),this.edges.forEach(e=>{e.label===e.symetric.label&&(this.removeEdge(e.symetric),this.removeEdge(e))})}_computeNextCWEdges(e){typeof e>"u"?Object.keys(this.nodes).forEach(i=>this._computeNextCWEdges(this.nodes[i])):e.getOuterEdges().forEach((i,s)=>{e.getOuterEdge((s===0?e.getOuterEdges().length:s)-1).symetric.next=i})}_computeNextCCWEdges(e,i){const s=e.getOuterEdges();let o,l;for(let h=s.length-1;h>=0;--h){let c=s[h],g=c.symetric,d,y;c.label===i&&(d=c),g.label===i&&(y=g),!(!d||!y)&&(y&&(l=y),d&&(l&&(l.next=d,l=void 0),o||(o=d)))}l&&(l.next=o)}_findLabeledEdgeRings(){const e=[];let i=0;return this.edges.forEach(s=>{if(s.label>=0)return;e.push(s);let o=s;do o.label=i,o=o.next;while(!s.isEqual(o));i++}),e}getEdgeRings(){this._computeNextCWEdges(),this.edges.forEach(i=>{i.label=void 0}),this._findLabeledEdgeRings().forEach(i=>{this._findIntersectionNodes(i).forEach(s=>{this._computeNextCCWEdges(s,i.label)})});const e=[];return this.edges.forEach(i=>{i.ring||e.push(this._findEdgeRing(i))}),e}_findIntersectionNodes(e){const i=[];let s=e;do{let o=0;s.from.getOuterEdges().forEach(l=>{l.label===e.label&&++o}),o>1&&i.push(s.from),s=s.next}while(!e.isEqual(s));return i}_findEdgeRing(e){let i=e;const s=new Bl;do s.push(i),i.ring=s,i=i.next;while(!e.isEqual(i));return s}removeNode(e){e.getOuterEdges().forEach(i=>this.removeEdge(i)),e.innerEdges.forEach(i=>this.removeEdge(i)),delete this.nodes[e.id]}removeEdge(e){this.edges=this.edges.filter(i=>!i.isEqual(e)),e.deleteEdge()}};function py(t){const e=my.fromGeoJson(t);e.deleteDangles(),e.deleteCutEdges();const i=[],s=[];return e.getEdgeRings().filter(o=>o.isValid()).forEach(o=>{o.isHole()?i.push(o):s.push(o)}),i.forEach(o=>{Bl.findEdgeRingContaining(o,s)&&s.push(o)}),he(s.map(o=>o.toPolygon()))}function _y(t,e){e=e||{},e.iterations=e.iterations||1;const{iterations:i}=e,s=[];if(!t)throw new Error("inputPolys is required");return rt(t,function(o,l,h){if(o.type==="Polygon"){let c=[[]];for(let g=0;g<i;g++){let d=[],y=o;g>0&&(y=ye(c).geometry),xy(y,d),c=d.slice(0)}s.push(ye(c,h))}else if(o.type==="MultiPolygon"){let c=[[[]]];for(let g=0;g<i;g++){let d=[],y=o;g>0&&(y=ft(c).geometry),Ey(y,d),c=d.slice(0)}s.push(ft(c,h))}else throw new Error("geometry is invalid, must be Polygon or MultiPolygon")}),he(s)}function xy(t,e){var i,s;Xe(t,function(o,l,h,c,g){if(s!==g)e.push([]);else{var d=i[0],y=i[1],v=o[0],_=o[1];e[g].push([.75*d+.25*v,.75*y+.25*_]),e[g].push([.25*d+.75*v,.25*y+.75*_])}i=o,s=g},!1),e.forEach(function(o){o.push(o[0])})}function Ey(t,e){let i,s,o;Xe(t,function(l,h,c,g,d){if(s!==g)e.push([[]]);else if(o!==d)e[g].push([]);else{var y=i[0],v=i[1],_=l[0],E=l[1];e[g][d].push([.75*y+.25*_,.75*v+.25*E]),e[g][d].push([.25*y+.75*_,.25*v+.75*E])}i=l,s=g,o=d},!1),e.forEach(function(l){l.forEach(function(h){h.push(h[0])})})}function wy(t,e){const i=ve(t),s=ve(e);let o=[],l=[],h;const c=Fe(e);let g=0,d=null;switch(i[0]>c[0]&&i[0]<c[2]&&i[1]>c[1]&&i[1]<c[3]&&(d=Li(t,Mi(e)),g=d.properties.featureIndex),gt(e)){case"Polygon":o=s[0][g],l=s[0][0],d!==null&&d.geometry.coordinates[1]<i[1]&&(l=s[0][g]),h=Nr(s[0][0],s[0][s[0].length-1],i),[o,l]=Gl(s[0],i,h,o,l);break;case"MultiPolygon":for(var v=0,_=0,E=0,M=0;M<s[0].length;M++){v=M;for(var R=!1,Y=0;Y<s[0][M].length;Y++){if(_=Y,E===g){R=!0;break}E++}if(R)break}o=s[0][v][_],l=s[0][v][_],h=Nr(s[0][0][0],s[0][0][s[0][0].length-1],i),s.forEach(function(H){[o,l]=Gl(H[0],i,h,o,l)});break}return he([_e(o),_e(l)])}function Gl(t,e,i,s,o){for(let l=0;l<t.length;l++){const h=t[l];let c=t[l+1];l===t.length-1&&(c=t[0]);const g=Nr(h,c,e);i<=0&&g>0?Iy(e,h,s)||(s=h):i>0&&g<=0&&(ky(e,h,o)||(o=h)),i=g}return[s,o]}function ky(t,e,i){return Nr(t,e,i)>0}function Iy(t,e,i){return Nr(t,e,i)<0}function Nr(t,e,i){return(e[0]-t[0])*(i[1]-t[1])-(i[0]-t[0])*(e[1]-t[1])}function Yl(t,e={}){return Xl(t,"mercator",e)}function zl(t,e={}){return Xl(t,"wgs84",e)}function Xl(t,e,i={}){i=i||{};var s=i.mutate;if(!t)throw new Error("geojson is required");return Array.isArray(t)&&Je(t[0])?t=e==="mercator"?Ul(t):Vl(t):(s!==!0&&(t=je(t)),Xe(t,function(o){var l=e==="mercator"?Ul(o):Vl(o);o[0]=l[0],o[1]=l[1]})),t}function Ul(t){var e=Math.PI/180,i=6378137,s=20037508342789244e-9,o=Math.abs(t[0])<=180?t[0]:t[0]-Ny(t[0])*360,l=[i*o*e,i*Math.log(Math.tan(Math.PI*.25+.5*t[1]*e))];return l[0]>s&&(l[0]=s),l[0]<-s&&(l[0]=-s),l[1]>s&&(l[1]=s),l[1]<-s&&(l[1]=-s),l}function Vl(t){var e=180/Math.PI,i=6378137;return[t[0]*e/i,(Math.PI*.5-2*Math.atan(Math.exp(-t[1]/i)))*e]}function Ny(t){return t<0?-1:t>0?1:0}const My=Object.freeze(Object.defineProperty({__proto__:null,toMercator:Yl,toWgs84:zl},Symbol.toStringTag,{value:"Module"}));function Sy(t,e){e=e||{};const i=e.studyBbox||Fe(t),s=e.confidenceLevel||20,o=t.features,l=o.length,h=ir(sr(i)),c=Math.sqrt(h/l*2),d=no(i,c,{units:"meters"}).features,y={};for(let q=0;q<d.length;q++)y[q]={box:Fe(d[q]),cnt:0};let v=0;for(const q of o)for(const w of Object.keys(y)){const N=y[w].box;if(Ly(Oe(q),N)){y[w].cnt+=1,v+=1;break}}let _=0;for(const q of Object.keys(y)){const w=y[q].cnt;w>_&&(_=w)}const E=[],M=Object.keys(y).length,R=v/M;let Y=0;for(let q=0;q<_+1;q++)Y+=Math.exp(-R)*Math.pow(R,q)/by(q),E.push(Y);const H=[];let x=0;for(let q=0;q<_+1;q++){for(const N of Object.keys(y))y[N].cnt===q&&(x+=1);const w=x/M;H.push(w)}let S=0;for(let q=0;q<_+1;q++){const w=Math.abs(E[q]-H[q]);w>S&&(S=w)}const C=Py[s]/Math.sqrt(M),A={criticalValue:C,isRandom:!0,maxAbsoluteDifference:S,observedDistribution:H};return S>C&&(A.isRandom=!1),A}var Py={20:1.07275,15:1.13795,10:1.22385,5:1.3581,2:1.51743,1:1.62762};function Ly(t,e){return e[0]<=t[0]&&e[1]<=t[1]&&e[2]>=t[0]&&e[3]>=t[1]}function by(t){const e=[];function i(s){return s===0||s===1?1:e[s]>0?e[s]:e[s]=i(s-1)*s}return i(t)}function Hl(t){return Ci(t),bi(t)}function bi(t){return Array.isArray(t)?Jl(t):t&&t.bbox?Jl(t.bbox):[Oy(),Ty()]}function Ci(t){t!=null&&(Array.isArray(t)?tr(t):t.bbox!=null&&tr(t.bbox))}function $l(t,e={}){Ci(e.bbox),t==null&&(t=1);const i=[];for(let s=0;s<t;s++)i.push(_e(bi(e.bbox)));return he(i)}function Zl(t,e={}){Ci(e.bbox),t==null&&(t=1),(e.bbox===void 0||e.bbox===null)&&(e.bbox=[-180,-90,180,90]),(!Je(e.num_vertices)||e.num_vertices===void 0)&&(e.num_vertices=10),(!Je(e.max_radial_length)||e.max_radial_length===void 0)&&(e.max_radial_length=10);const i=Math.abs(e.bbox[0]-e.bbox[2]),s=Math.abs(e.bbox[1]-e.bbox[3]),o=Math.min(i/2,s/2);if(e.max_radial_length>o)throw new Error("max_radial_length is greater than the radius of the bbox");const l=[e.bbox[0]+e.max_radial_length,e.bbox[1]+e.max_radial_length,e.bbox[2]-e.max_radial_length,e.bbox[3]-e.max_radial_length],h=[];for(let c=0;c<t;c++){let g=[];const d=[...Array(e.num_vertices+1)].map(Math.random);d.forEach((y,v,_)=>{_[v]=v>0?y+_[v-1]:y}),d.forEach(y=>{y=y*2*Math.PI/d[d.length-1];const v=Math.random();g.push([v*(e.max_radial_length||10)*Math.sin(y),v*(e.max_radial_length||10)*Math.cos(y)])}),g[g.length-1]=g[0],g=g.reverse().map(Cy(bi(l))),h.push(ye([g]))}return he(h)}function Wl(t,e={}){if(e=e||{},!Ce(e))throw new Error("options is invalid");const i=e.bbox;Ci(i);let s=e.num_vertices,o=e.max_length,l=e.max_rotation;t==null&&(t=1),(!Je(s)||s===void 0||s<2)&&(s=10),(!Je(o)||o===void 0)&&(o=1e-4),(!Je(l)||l===void 0)&&(l=Math.PI/8);const h=[];for(let c=0;c<t;c++){const d=[bi(i)];for(let y=0;y<s-1;y++){const _=(y===0?Math.random()*2*Math.PI:Math.tan((d[y][1]-d[y-1][1])/(d[y][0]-d[y-1][0])))+(Math.random()-.5)*l*2,E=Math.random()*o;d.push([d[y][0]+E*Math.cos(_),d[y][1]+E*Math.sin(_)])}h.push(Pe(d))}return he(h)}function Cy(t){return e=>[e[0]+t[0],e[1]+t[1]]}function Kl(){return Math.random()-.5}function Oy(){return Kl()*360}function Ty(){return Kl()*180}function Jl(t){return[Math.random()*(t[2]-t[0])+t[0],Math.random()*(t[3]-t[1])+t[1]]}const Ry=Object.freeze(Object.defineProperty({__proto__:null,randomLineString:Wl,randomPoint:$l,randomPolygon:Zl,randomPosition:Hl},Symbol.toStringTag,{value:"Module"}));function Ay(t,e={}){var i,s;if(e=e||{},!Ce(e))throw new Error("options is invalid");const o=(i=e.mutate)!=null?i:!1,l=(s=e.reverse)!=null?s:!1;if(!t)throw new Error("<geojson> is required");if(typeof l!="boolean")throw new Error("<reverse> must be a boolean");if(typeof o!="boolean")throw new Error("<mutate> must be a boolean");!o&&t.type!=="Point"&&t.type!=="MultiPoint"&&(t=je(t));const h=[];switch(t.type){case"GeometryCollection":return rt(t,function(c){Oi(c,l)}),t;case"FeatureCollection":return Le(t,function(c){const g=Oi(c,l);Le(g,function(d){h.push(d)})}),he(h)}return Oi(t,l)}function Oi(t,e){switch(t.type==="Feature"?t.geometry.type:t.type){case"GeometryCollection":return rt(t,function(s){Oi(s,e)}),t;case"LineString":return Ql(ve(t),e),t;case"Polygon":return jl(ve(t),e),t;case"MultiLineString":return ve(t).forEach(function(s){Ql(s,e)}),t;case"MultiPolygon":return ve(t).forEach(function(s){jl(s,e)}),t;case"Point":case"MultiPoint":return t}}function Ql(t,e){Hr(t)===e&&t.reverse()}function jl(t,e){Hr(t[0])!==e&&t[0].reverse();for(let i=1;i<t.length;i++)Hr(t[i])===e&&t[i].reverse()}function Dy(t,e){if(!t)throw new Error("fc is required");if(e==null)throw new Error("num is required");if(typeof e!="number")throw new Error("num must be a number");var i=he(Fy(t.features,e));return i}function Fy(t,e){for(var i=t.slice(0),s=t.length,o=s-e,l,h;s-- >o;)h=Math.floor((s+1)*Math.random()),l=i[h],i[h]=i[s],i[s]=l;return i.slice(o)}function qy(t,e,i,s,o={}){if(o=o||{},!Ce(o))throw new Error("options is invalid");const l=o.properties;if(!t)throw new Error("center is required");if(i==null)throw new Error("bearing1 is required");if(s==null)throw new Error("bearing2 is required");if(!e)throw new Error("radius is required");if(typeof o!="object")throw new Error("options must be an object");if(ec(i)===ec(s))return Rs(t,e,o);const h=ve(t),c=pl(t,e,i,s,o),g=[[h]];return Xe(c,function(d){g[0].push(d)}),g[0].push(h),ye(g,l)}function ec(t){let e=t%360;return e<0&&(e+=360),e}function tc(t,e,i){if(i=i||{},!Ce(i))throw new Error("options is invalid");const s=i.origin||"centroid",o=i.mutate||!1;if(!t)throw new Error("geojson required");if(typeof e!="number"||e<=0)throw new Error("invalid factor");const l=Array.isArray(s)||typeof s=="object";return o!==!0&&(t=je(t)),t.type==="FeatureCollection"&&!l?(Le(t,function(h,c){t.features[c]=nc(h,e,s)}),t):nc(t,e,s)}function nc(t,e,i){const s=gt(t)==="Point",o=By(t,i);return e===1||s||(Xe(t,function(l){const h=Bn(o,l),c=gn(o,l),g=h*e,d=ve(Ni(o,g,c));l[0]=d[0],l[1]=d[1],l.length===3&&(l[2]*=e)}),delete t.bbox),t}function By(t,e){if(e==null&&(e="centroid"),Array.isArray(e)||typeof e=="object")return Oe(e);const i=t.bbox?t.bbox:Fe(t,{recompute:!0}),s=i[0],o=i[1],l=i[2],h=i[3];switch(e){case"sw":case"southwest":case"westsouth":case"bottomleft":return _e([s,o]);case"se":case"southeast":case"eastsouth":case"bottomright":return _e([l,o]);case"nw":case"northwest":case"westnorth":case"topleft":return _e([s,h]);case"ne":case"northeast":case"eastnorth":case"topright":return _e([l,h]);case"center":return jr(t);case void 0:case null:case"centroid":return Zt(t);default:throw new Error("invalid origin")}}function rc(t){for(var e=t,i=[];e.parent;)i.unshift(e),e=e.parent;return i}function Gy(){return new ic(function(t){return t.f})}var Ti={search:function(t,e,i,s){var o;t.cleanDirty(),s=s||{};var l=s.heuristic||Ti.heuristics.manhattan,h=(o=s.closest)!=null?o:!1,c=Gy(),g=e;for(e.h=l(e,i),c.push(e);c.size()>0;){var d=c.pop();if(d===i)return rc(d);d.closed=!0;for(var y=t.neighbors(d),v=0,_=y.length;v<_;++v){var E=y[v];if(!(E.closed||E.isWall())){var M=d.g+E.getCost(d),R=E.visited;(!R||M<E.g)&&(E.visited=!0,E.parent=d,E.h=E.h||l(E,i),E.g=M,E.f=E.g+E.h,t.markDirty(E),h&&(E.h<g.h||E.h===g.h&&E.g<g.g)&&(g=E),R?c.rescoreElement(E):c.push(E))}}}return h?rc(g):[]},heuristics:{manhattan:function(t,e){var i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return i+s},diagonal:function(t,e){var i=1,s=Math.sqrt(2),o=Math.abs(e.x-t.x),l=Math.abs(e.y-t.y);return i*(o+l)+(s-2*i)*Math.min(o,l)}},cleanNode:function(t){t.f=0,t.g=0,t.h=0,t.visited=!1,t.closed=!1,t.parent=null}};function Gn(t,e){e=e||{},this.nodes=[],this.diagonal=!!e.diagonal,this.grid=[];for(var i=0;i<t.length;i++){this.grid[i]=[];for(var s=0,o=t[i];s<o.length;s++){var l=new Ri(i,s,o[s]);this.grid[i][s]=l,this.nodes.push(l)}}this.init()}Gn.prototype.init=function(){this.dirtyNodes=[];for(var t=0;t<this.nodes.length;t++)Ti.cleanNode(this.nodes[t])},Gn.prototype.cleanDirty=function(){for(var t=0;t<this.dirtyNodes.length;t++)Ti.cleanNode(this.dirtyNodes[t]);this.dirtyNodes=[]},Gn.prototype.markDirty=function(t){this.dirtyNodes.push(t)},Gn.prototype.neighbors=function(t){var e=[],i=t.x,s=t.y,o=this.grid;return o[i-1]&&o[i-1][s]&&e.push(o[i-1][s]),o[i+1]&&o[i+1][s]&&e.push(o[i+1][s]),o[i]&&o[i][s-1]&&e.push(o[i][s-1]),o[i]&&o[i][s+1]&&e.push(o[i][s+1]),this.diagonal&&(o[i-1]&&o[i-1][s-1]&&e.push(o[i-1][s-1]),o[i+1]&&o[i+1][s-1]&&e.push(o[i+1][s-1]),o[i-1]&&o[i-1][s+1]&&e.push(o[i-1][s+1]),o[i+1]&&o[i+1][s+1]&&e.push(o[i+1][s+1])),e},Gn.prototype.toString=function(){for(var t=[],e=this.grid,i,s,o,l,h=0,c=e.length;h<c;h++){for(i=[],s=e[h],o=0,l=s.length;o<l;o++)i.push(s[o].weight);t.push(i.join(" "))}return t.join(`
8
+ `)};function Ri(t,e,i){this.x=t,this.y=e,this.weight=i}Ri.prototype.toString=function(){return"["+this.x+" "+this.y+"]"},Ri.prototype.getCost=function(t){return t&&t.x!==this.x&&t.y!==this.y?this.weight*1.41421:this.weight},Ri.prototype.isWall=function(){return this.weight===0};function ic(t){this.content=[],this.scoreFunction=t}ic.prototype={push:function(t){this.content.push(t),this.sinkDown(this.content.length-1)},pop:function(){var t=this.content[0],e=this.content.pop();return this.content.length>0&&(this.content[0]=e,this.bubbleUp(0)),t},remove:function(t){var e=this.content.indexOf(t),i=this.content.pop();e!==this.content.length-1&&(this.content[e]=i,this.scoreFunction(i)<this.scoreFunction(t)?this.sinkDown(e):this.bubbleUp(e))},size:function(){return this.content.length},rescoreElement:function(t){this.sinkDown(this.content.indexOf(t))},sinkDown:function(t){for(var e=this.content[t];t>0;){var i=(t+1>>1)-1,s=this.content[i];if(this.scoreFunction(e)<this.scoreFunction(s))this.content[i]=e,this.content[t]=s,t=i;else break}},bubbleUp:function(t){for(var e=this.content.length,i=this.content[t],s=this.scoreFunction(i);;){var o=t+1<<1,l=o-1,h=null,c;if(l<e){var g=this.content[l];c=this.scoreFunction(g),c<s&&(h=l)}if(o<e){var d=this.content[o],y=this.scoreFunction(d);y<(h===null?s:c)&&(h=o)}if(h!==null)this.content[t]=this.content[h],this.content[h]=i,t=h;else break}}};function Yy(t,e,i={}){if(i=i||{},!Ce(i))throw new Error("options is invalid");let s=i.obstacles||he([]),o=i.resolution||100;if(!t)throw new Error("start is required");if(!e)throw new Error("end is required");if(!Je(o)||o<=0)throw new Error("options.resolution must be a number, greater than 0");const l=Oe(t),h=Oe(e);if(t=_e(l),e=_e(h),s.type==="FeatureCollection"){if(s.features.length===0)return Pe([l,h])}else if(s.type==="Feature"&&s.geometry.type==="Polygon")s=he([s]);else if(s.type==="Polygon")s=he([We(qe(s))]);else throw new Error("invalid obstacles");const c=s;c.features.push(t),c.features.push(e);const g=Fe(tc(sr(Fe(c)),1.15)),[d,y,v,_]=g;c.features.pop(),c.features.pop();const E=Be([d,y],[v,y],i)/o,M=(v-d)/E,R=Be([d,y],[d,_],i)/o,Y=(_-y)/R,H=E%1*M/2,x=R%1*Y/2,S=[],b=[];let C,A,q=1/0,w=1/0,N=_-x,L=0;for(;N>=y;){const k=[],O=[];let P=d+H,G=0;for(;P<=v;){const B=_e([P,N]),Z=zy(B,s);k.push(Z?0:1),O.push(P+"|"+N);const K=Be(B,t);!Z&&K<q&&(q=K,C={x:G,y:L});const ee=Be(B,e);!Z&&ee<w&&(w=ee,A={x:G,y:L}),P+=M,G++}b.push(k),S.push(O),N-=Y,L++}const D=new Gn(b,{diagonal:!0}),F=D.grid[C.y][C.x],X=D.grid[A.y][A.x],z=Ti.search(D,F,X),V=[l];return z.forEach(function(k){const O=S[k.x][k.y].split("|");V.push([+O[0],+O[1]])}),V.push(h),dn(Pe(V))}function zy(t,e){for(let i=0;i<e.features.length;i++)if(xe(t,e.features[i]))return!0;return!1}function Xy(t,e){var i=t[0]-e[0],s=t[1]-e[1];return i*i+s*s}function Uy(t,e,i){var s=e[0],o=e[1],l=i[0]-s,h=i[1]-o;if(l!==0||h!==0){var c=((t[0]-s)*l+(t[1]-o)*h)/(l*l+h*h);c>1?(s=i[0],o=i[1]):c>0&&(s+=l*c,o+=h*c)}return l=t[0]-s,h=t[1]-o,l*l+h*h}function Vy(t,e){for(var i=t[0],s=[i],o,l=1,h=t.length;l<h;l++)o=t[l],Xy(o,i)>e&&(s.push(o),i=o);return i!==o&&s.push(o),s}function ho(t,e,i,s,o){for(var l=s,h,c=e+1;c<i;c++){var g=Uy(t[c],t[e],t[i]);g>l&&(h=c,l=g)}l>s&&(h-e>1&&ho(t,e,h,s,o),o.push(t[h]),i-h>1&&ho(t,h,i,s,o))}function Hy(t,e){var i=t.length-1,s=[t[0]];return ho(t,0,i,e,s),s.push(t[i]),s}function Ai(t,e,i){if(t.length<=2)return t;var s=e!==void 0?e*e:1;return t=i?t:Vy(t,s),t=Hy(t,s),t}function $y(t,e={}){var i,s,o;if(e=e??{},!Ce(e))throw new Error("options is invalid");const l=(i=e.tolerance)!=null?i:1,h=(s=e.highQuality)!=null?s:!1,c=(o=e.mutate)!=null?o:!1;if(!t)throw new Error("geojson is required");if(l&&l<0)throw new Error("invalid tolerance");return c!==!0&&(t=je(t)),rt(t,function(g){Zy(g,l,h)}),t}function Zy(t,e,i){const s=t.type;if(s==="Point"||s==="MultiPoint")return t;if(dn(t,{mutate:!0}),s!=="GeometryCollection")switch(s){case"LineString":t.coordinates=Ai(t.coordinates,e,i);break;case"MultiLineString":t.coordinates=t.coordinates.map(o=>Ai(o,e,i));break;case"Polygon":t.coordinates=sc(t.coordinates,e,i);break;case"MultiPolygon":t.coordinates=t.coordinates.map(o=>sc(o,e,i))}return t}function sc(t,e,i){return t.map(function(s){if(s.length<4)throw new Error("invalid polygon");let o=e,l=Ai(s,o,i);for(;!oc(l)&&o>=Number.EPSILON;)o-=o*.01,l=Ai(s,o,i);return oc(l)?((l[l.length-1][0]!==l[0][0]||l[l.length-1][1]!==l[0][1])&&l.push(l[0]),l):s})}function oc(t){return t.length<3?!1:!(t.length===3&&t[2][0]===t[0][0]&&t[2][1]===t[0][1])}function Wy(t){var e=t[0],i=t[1],s=t[2],o=t[3],l=Be(t.slice(0,2),[s,i]),h=Be(t.slice(0,2),[e,o]);if(l>=h){var c=(i+o)/2;return[e,c-(s-e)/2,s,c+(s-e)/2]}else{var g=(e+s)/2;return[g-(o-i)/2,i,g+(o-i)/2,o]}}function Ky(t,e){var i;if(e=e||{},!Ce(e))throw new Error("options is invalid");const s=e.steps||64,o=e.weight,l=e.properties||{};if(!Je(s))throw new Error("steps must be a number");if(!Ce(l))throw new Error("properties must be a number");const h=rr(t).length,c=Cs(t,{weight:o});let g=0,d=0,y=0;Le(t,function(w){var N;const L=o&&((N=w.properties)==null?void 0:N[o])||1,D=ac(ve(w),ve(c));g+=Math.pow(D.x,2)*L,d+=Math.pow(D.y,2)*L,y+=D.x*D.y*L});const v=g-d,_=Math.sqrt(Math.pow(v,2)+4*Math.pow(y,2)),E=2*y,M=Math.atan((v+_)/E),R=M*180/Math.PI;let Y=0,H=0,x=0;Le(t,function(w){var N;const L=o&&((N=w.properties)==null?void 0:N[o])||1,D=ac(ve(w),ve(c));Y+=Math.pow(D.x*Math.cos(M)-D.y*Math.sin(M),2)*L,H+=Math.pow(D.x*Math.sin(M)+D.y*Math.cos(M),2)*L,x+=L});const S=Math.sqrt(2*Y/x),b=Math.sqrt(2*H/x),C=el(c,S,b,{units:"degrees",angle:R,steps:s,properties:l}),A=Dl(t,he([C])),q={meanCenterCoordinates:ve(c),semiMajorAxis:S,semiMinorAxis:b,numberOfFeatures:h,angle:R,percentageWithinEllipse:100*rr(A).length/h};return C.properties=(i=C.properties)!=null?i:{},C.properties.standardDeviationalEllipse=q,C}function ac(t,e){return{x:t[0]-e[0],y:t[1]-e[1]}}function Jy(t,e,i,s){return t=je(t),e=je(e),Le(t,function(o){o.properties||(o.properties={}),Le(e,function(l){o.properties&&l.properties&&o.properties[s]===void 0&&xe(o,l)&&(o.properties[s]=l.properties[i])})}),t}var Di={exports:{}},uc;function Qy(){if(uc)return Di.exports;uc=1,Di.exports=t,Di.exports.default=t;function t(k,O,P){P=P||2;var G=O&&O.length,B=G?O[0]*P:k.length,Z=e(k,0,B,P,!0),K=[];if(!Z||Z.next===Z.prev)return K;var ee,j,te,re,se,W,ge;if(G&&(Z=g(k,O,Z,P)),k.length>80*P){ee=te=k[0],j=re=k[1];for(var le=P;le<B;le+=P)se=k[le],W=k[le+1],se<ee&&(ee=se),W<j&&(j=W),se>te&&(te=se),W>re&&(re=W);ge=Math.max(te-ee,re-j),ge=ge!==0?32767/ge:0}return s(Z,K,P,ee,j,ge,0),K}function e(k,O,P,G,B){var Z,K;if(B===V(k,O,P,G)>0)for(Z=O;Z<P;Z+=G)K=F(Z,k[Z],k[Z+1],K);else for(Z=P-G;Z>=O;Z-=G)K=F(Z,k[Z],k[Z+1],K);return K&&b(K,K.next)&&(X(K),K=K.next),K}function i(k,O){if(!k)return k;O||(O=k);var P=k,G;do if(G=!1,!P.steiner&&(b(P,P.next)||S(P.prev,P,P.next)===0)){if(X(P),P=O=P.prev,P===P.next)break;G=!0}else P=P.next;while(G||P!==O);return O}function s(k,O,P,G,B,Z,K){if(k){!K&&Z&&E(k,G,B,Z);for(var ee=k,j,te;k.prev!==k.next;){if(j=k.prev,te=k.next,Z?l(k,G,B,Z):o(k)){O.push(j.i/P|0),O.push(k.i/P|0),O.push(te.i/P|0),X(k),k=te.next,ee=te.next;continue}if(k=te,k===ee){K?K===1?(k=h(i(k),O,P),s(k,O,P,G,B,Z,2)):K===2&&c(k,O,P,G,B,Z):s(i(k),O,P,G,B,Z,1);break}}}}function o(k){var O=k.prev,P=k,G=k.next;if(S(O,P,G)>=0)return!1;for(var B=O.x,Z=P.x,K=G.x,ee=O.y,j=P.y,te=G.y,re=B<Z?B<K?B:K:Z<K?Z:K,se=ee<j?ee<te?ee:te:j<te?j:te,W=B>Z?B>K?B:K:Z>K?Z:K,ge=ee>j?ee>te?ee:te:j>te?j:te,le=G.next;le!==O;){if(le.x>=re&&le.x<=W&&le.y>=se&&le.y<=ge&&H(B,ee,Z,j,K,te,le.x,le.y)&&S(le.prev,le,le.next)>=0)return!1;le=le.next}return!0}function l(k,O,P,G){var B=k.prev,Z=k,K=k.next;if(S(B,Z,K)>=0)return!1;for(var ee=B.x,j=Z.x,te=K.x,re=B.y,se=Z.y,W=K.y,ge=ee<j?ee<te?ee:te:j<te?j:te,le=re<se?re<W?re:W:se<W?se:W,oe=ee>j?ee>te?ee:te:j>te?j:te,$=re>se?re>W?re:W:se>W?se:W,Me=R(ge,le,O,P,G),Se=R(oe,$,O,P,G),ue=k.prevZ,ke=k.nextZ;ue&&ue.z>=Me&&ke&&ke.z<=Se;){if(ue.x>=ge&&ue.x<=oe&&ue.y>=le&&ue.y<=$&&ue!==B&&ue!==K&&H(ee,re,j,se,te,W,ue.x,ue.y)&&S(ue.prev,ue,ue.next)>=0||(ue=ue.prevZ,ke.x>=ge&&ke.x<=oe&&ke.y>=le&&ke.y<=$&&ke!==B&&ke!==K&&H(ee,re,j,se,te,W,ke.x,ke.y)&&S(ke.prev,ke,ke.next)>=0))return!1;ke=ke.nextZ}for(;ue&&ue.z>=Me;){if(ue.x>=ge&&ue.x<=oe&&ue.y>=le&&ue.y<=$&&ue!==B&&ue!==K&&H(ee,re,j,se,te,W,ue.x,ue.y)&&S(ue.prev,ue,ue.next)>=0)return!1;ue=ue.prevZ}for(;ke&&ke.z<=Se;){if(ke.x>=ge&&ke.x<=oe&&ke.y>=le&&ke.y<=$&&ke!==B&&ke!==K&&H(ee,re,j,se,te,W,ke.x,ke.y)&&S(ke.prev,ke,ke.next)>=0)return!1;ke=ke.nextZ}return!0}function h(k,O,P){var G=k;do{var B=G.prev,Z=G.next.next;!b(B,Z)&&C(B,G,G.next,Z)&&N(B,Z)&&N(Z,B)&&(O.push(B.i/P|0),O.push(G.i/P|0),O.push(Z.i/P|0),X(G),X(G.next),G=k=Z),G=G.next}while(G!==k);return i(G)}function c(k,O,P,G,B,Z){var K=k;do{for(var ee=K.next.next;ee!==K.prev;){if(K.i!==ee.i&&x(K,ee)){var j=D(K,ee);K=i(K,K.next),j=i(j,j.next),s(K,O,P,G,B,Z,0),s(j,O,P,G,B,Z,0);return}ee=ee.next}K=K.next}while(K!==k)}function g(k,O,P,G){var B=[],Z,K,ee,j,te;for(Z=0,K=O.length;Z<K;Z++)ee=O[Z]*G,j=Z<K-1?O[Z+1]*G:k.length,te=e(k,ee,j,G,!1),te===te.next&&(te.steiner=!0),B.push(Y(te));for(B.sort(d),Z=0;Z<B.length;Z++)P=y(B[Z],P);return P}function d(k,O){return k.x-O.x}function y(k,O){var P=v(k,O);if(!P)return O;var G=D(P,k);return i(G,G.next),i(P,P.next)}function v(k,O){var P=O,G=k.x,B=k.y,Z=-1/0,K;do{if(B<=P.y&&B>=P.next.y&&P.next.y!==P.y){var ee=P.x+(B-P.y)*(P.next.x-P.x)/(P.next.y-P.y);if(ee<=G&&ee>Z&&(Z=ee,K=P.x<P.next.x?P:P.next,ee===G))return K}P=P.next}while(P!==O);if(!K)return null;var j=K,te=K.x,re=K.y,se=1/0,W;P=K;do G>=P.x&&P.x>=te&&G!==P.x&&H(B<re?G:Z,B,te,re,B<re?Z:G,B,P.x,P.y)&&(W=Math.abs(B-P.y)/(G-P.x),N(P,k)&&(W<se||W===se&&(P.x>K.x||P.x===K.x&&_(K,P)))&&(K=P,se=W)),P=P.next;while(P!==j);return K}function _(k,O){return S(k.prev,k,O.prev)<0&&S(O.next,k,k.next)<0}function E(k,O,P,G){var B=k;do B.z===0&&(B.z=R(B.x,B.y,O,P,G)),B.prevZ=B.prev,B.nextZ=B.next,B=B.next;while(B!==k);B.prevZ.nextZ=null,B.prevZ=null,M(B)}function M(k){var O,P,G,B,Z,K,ee,j,te=1;do{for(P=k,k=null,Z=null,K=0;P;){for(K++,G=P,ee=0,O=0;O<te&&(ee++,G=G.nextZ,!!G);O++);for(j=te;ee>0||j>0&&G;)ee!==0&&(j===0||!G||P.z<=G.z)?(B=P,P=P.nextZ,ee--):(B=G,G=G.nextZ,j--),Z?Z.nextZ=B:k=B,B.prevZ=Z,Z=B;P=G}Z.nextZ=null,te*=2}while(K>1);return k}function R(k,O,P,G,B){return k=(k-P)*B|0,O=(O-G)*B|0,k=(k|k<<8)&16711935,k=(k|k<<4)&252645135,k=(k|k<<2)&858993459,k=(k|k<<1)&1431655765,O=(O|O<<8)&16711935,O=(O|O<<4)&252645135,O=(O|O<<2)&858993459,O=(O|O<<1)&1431655765,k|O<<1}function Y(k){var O=k,P=k;do(O.x<P.x||O.x===P.x&&O.y<P.y)&&(P=O),O=O.next;while(O!==k);return P}function H(k,O,P,G,B,Z,K,ee){return(B-K)*(O-ee)>=(k-K)*(Z-ee)&&(k-K)*(G-ee)>=(P-K)*(O-ee)&&(P-K)*(Z-ee)>=(B-K)*(G-ee)}function x(k,O){return k.next.i!==O.i&&k.prev.i!==O.i&&!w(k,O)&&(N(k,O)&&N(O,k)&&L(k,O)&&(S(k.prev,k,O.prev)||S(k,O.prev,O))||b(k,O)&&S(k.prev,k,k.next)>0&&S(O.prev,O,O.next)>0)}function S(k,O,P){return(O.y-k.y)*(P.x-O.x)-(O.x-k.x)*(P.y-O.y)}function b(k,O){return k.x===O.x&&k.y===O.y}function C(k,O,P,G){var B=q(S(k,O,P)),Z=q(S(k,O,G)),K=q(S(P,G,k)),ee=q(S(P,G,O));return!!(B!==Z&&K!==ee||B===0&&A(k,P,O)||Z===0&&A(k,G,O)||K===0&&A(P,k,G)||ee===0&&A(P,O,G))}function A(k,O,P){return O.x<=Math.max(k.x,P.x)&&O.x>=Math.min(k.x,P.x)&&O.y<=Math.max(k.y,P.y)&&O.y>=Math.min(k.y,P.y)}function q(k){return k>0?1:k<0?-1:0}function w(k,O){var P=k;do{if(P.i!==k.i&&P.next.i!==k.i&&P.i!==O.i&&P.next.i!==O.i&&C(P,P.next,k,O))return!0;P=P.next}while(P!==k);return!1}function N(k,O){return S(k.prev,k,k.next)<0?S(k,O,k.next)>=0&&S(k,k.prev,O)>=0:S(k,O,k.prev)<0||S(k,k.next,O)<0}function L(k,O){var P=k,G=!1,B=(k.x+O.x)/2,Z=(k.y+O.y)/2;do P.y>Z!=P.next.y>Z&&P.next.y!==P.y&&B<(P.next.x-P.x)*(Z-P.y)/(P.next.y-P.y)+P.x&&(G=!G),P=P.next;while(P!==k);return G}function D(k,O){var P=new z(k.i,k.x,k.y),G=new z(O.i,O.x,O.y),B=k.next,Z=O.prev;return k.next=O,O.prev=k,P.next=B,B.prev=P,G.next=P,P.prev=G,Z.next=G,G.prev=Z,G}function F(k,O,P,G){var B=new z(k,O,P);return G?(B.next=G.next,B.prev=G,G.next.prev=B,G.next=B):(B.prev=B,B.next=B),B}function X(k){k.next.prev=k.prev,k.prev.next=k.next,k.prevZ&&(k.prevZ.nextZ=k.nextZ),k.nextZ&&(k.nextZ.prevZ=k.prevZ)}function z(k,O,P){this.i=k,this.x=O,this.y=P,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}t.deviation=function(k,O,P,G){var B=O&&O.length,Z=B?O[0]*P:k.length,K=Math.abs(V(k,0,Z,P));if(B)for(var ee=0,j=O.length;ee<j;ee++){var te=O[ee]*P,re=ee<j-1?O[ee+1]*P:k.length;K-=Math.abs(V(k,te,re,P))}var se=0;for(ee=0;ee<G.length;ee+=3){var W=G[ee]*P,ge=G[ee+1]*P,le=G[ee+2]*P;se+=Math.abs((k[W]-k[le])*(k[ge+1]-k[W+1])-(k[W]-k[ge])*(k[le+1]-k[W+1]))}return K===0&&se===0?0:Math.abs((se-K)/K)};function V(k,O,P,G){for(var B=0,Z=O,K=P-G;Z<P;Z+=G)B+=(k[K]-k[Z])*(k[Z+1]+k[K+1]),K=Z;return B}return t.flatten=function(k){for(var O=k[0][0].length,P={vertices:[],holes:[],dimensions:O},G=0,B=0;B<k.length;B++){for(var Z=0;Z<k[B].length;Z++)for(var K=0;K<O;K++)P.vertices.push(k[B][Z][K]);B>0&&(G+=k[B-1].length,P.holes.push(G))}return P},Di.exports}var jy=Qy();const em=gr(jy);function tm(t){if(!t.geometry||t.geometry.type!=="Polygon"&&t.geometry.type!=="MultiPolygon")throw new Error("input must be a Polygon or MultiPolygon");const e={type:"FeatureCollection",features:[]};return t.geometry.type==="Polygon"?e.features=lc(t.geometry.coordinates):t.geometry.coordinates.forEach(function(i){e.features=e.features.concat(lc(i))}),e}function lc(t){const e=nm(t),i=2,s=em(e.vertices,e.holes,i),o=[],l=[];s.forEach(function(c,g){const d=s[g];l.push([e.vertices[d*i],e.vertices[d*i+1]])});for(var h=0;h<l.length;h+=3){const c=l.slice(h,h+3);c.push(l[h]),o.push(ye([c]))}return o}function nm(t){const e=t[0][0].length,i={vertices:[],holes:[],dimensions:e};let s=0;for(let o=0;o<t.length;o++){for(let l=0;l<t[o].length;l++)for(let h=0;h<e;h++)i.vertices.push(t[o][l][h]);o>0&&(s+=t[o-1].length,i.holes.push(s))}return i}function rm(t,e,i,s){if(s=s||{},!Ce(s))throw new Error("options is invalid");var o=s.units,l=s.zTranslation,h=s.mutate;if(!t)throw new Error("geojson is required");if(e==null||isNaN(e))throw new Error("distance is required");if(l&&typeof l!="number"&&isNaN(l))throw new Error("zTranslation is not a number");if(l=l!==void 0?l:0,e===0&&l===0)return t;if(i==null||isNaN(i))throw new Error("direction is required");return e<0&&(e=-e,i=i+180),(h===!1||h===void 0)&&(t=je(t)),Xe(t,function(c){var g=ve(Ni(c,e,i,{units:o}));c[0]=g[0],c[1]=g[1],l&&c.length===3&&(c[2]+=l)}),t}function im(t,e={}){const i=[];if(rt(t,o=>{i.push(o.coordinates)}),i.length<2)throw new Error("Must have at least 2 geometries");const s=un(i[0],...i.slice(1));return s.length===0?null:s.length===1?ye(s[0],e.properties):ft(s,e.properties)}function sm(t,e,i){if(t.geometry.type!=="Polygon")throw new Error("The input feature must be a Polygon");i===void 0&&(i=1);var s=t.geometry.coordinates,o=[],l={};if(i){for(var h=[],c=0;c<s.length;c++)for(var g=0;g<s[c].length-1;g++)h.push(Y(c,g));var d=new dt;d.load(h)}for(var y=0;y<s.length;y++)for(var v=0;v<s[y].length-1;v++)if(i){var _=d.search(Y(y,v));_.forEach(function(H){var x=H.ring,S=H.edge;R(y,v,x,S)})}else for(var E=0;E<s.length;E++)for(var M=0;M<s[E].length-1;M++)R(y,v,E,M);return e||(o={type:"Feature",geometry:{type:"MultiPoint",coordinates:o}}),o;function R(H,x,S,b){var C=s[H][x],A=s[H][x+1],q=s[S][b],w=s[S][b+1],N=om(C,A,q,w);if(N!==null){var L,D;if(A[0]!==C[0]?L=(N[0]-C[0])/(A[0]-C[0]):L=(N[1]-C[1])/(A[1]-C[1]),w[0]!==q[0]?D=(N[0]-q[0])/(w[0]-q[0]):D=(N[1]-q[1])/(w[1]-q[1]),!(L>=1||L<=0||D>=1||D<=0)){var F=N,X=!l[F];X&&(l[F]=!0),e?o.push(e(N,H,x,C,A,L,S,b,q,w,D,X)):o.push(N)}}}function Y(H,x){var S=s[H][x],b=s[H][x+1],C,A,q,w;return S[0]<b[0]?(C=S[0],A=b[0]):(C=b[0],A=S[0]),S[1]<b[1]?(q=S[1],w=b[1]):(q=b[1],w=S[1]),{minX:C,minY:q,maxX:A,maxY:w,ring:H,edge:x}}}function om(t,e,i,s){if(Mr(t,i)||Mr(t,s)||Mr(e,i)||Mr(s,i))return null;var o=t[0],l=t[1],h=e[0],c=e[1],g=i[0],d=i[1],y=s[0],v=s[1],_=(o-h)*(d-v)-(l-c)*(g-y);if(_===0)return null;var E=((o*c-l*h)*(g-y)-(o-h)*(g*v-d*y))/_,M=((o*c-l*h)*(d-v)-(l-c)*(g*v-d*y))/_;return[E,M]}function Mr(t,e){if(!t||!e||t.length!==e.length)return!1;for(var i=0,s=t.length;i<s;i++)if(t[i]instanceof Array&&e[i]instanceof Array){if(!Mr(t[i],e[i]))return!1}else if(t[i]!==e[i])return!1;return!0}function am(t){if(t.type!="Feature")throw new Error("The input must a geojson object of type Feature");if(t.geometry===void 0||t.geometry==null)throw new Error("The input must a geojson object with a non-empty geometry");if(t.geometry.type!="Polygon")throw new Error("The input must be a geojson Polygon");for(var e=t.geometry.coordinates.length,i=[],x=0;x<e;x++){var s=t.geometry.coordinates[x];Sr(s[0],s[s.length-1])||s.push(s[0]);for(var o=0;o<s.length-1;o++)i.push(s[o])}if(!lm(i))throw new Error("The input polygon may not have duplicate vertices (except for the first and last vertex of each ring)");var l=i.length,h=sm(t,function(j,te,re,se,W,ge,le,oe,$,Me,Se,ue){return[j,te,re,se,W,ge,le,oe,$,Me,Se,ue]}),c=h.length;if(c==0){for(var q=[],x=0;x<e;x++)q.push(ye([t.geometry.coordinates[x]],{parent:-1,winding:um(t.geometry.coordinates[x])}));var G=he(q);return B(),Z(),G}for(var g=[],d=[],x=0;x<e;x++){g.push([]);for(var o=0;o<t.geometry.coordinates[x].length-1;o++)g[x].push([new cc(t.geometry.coordinates[x][Yn(o+1,t.geometry.coordinates[x].length-1)],1,[x,o],[x,Yn(o+1,t.geometry.coordinates[x].length-1)],void 0)]),d.push(new hc(t.geometry.coordinates[x][o],[x,Yn(o-1,t.geometry.coordinates[x].length-1)],[x,o],void 0,void 0,!1,!0))}for(var x=0;x<c;x++)g[h[x][1]][h[x][2]].push(new cc(h[x][0],h[x][5],[h[x][1],h[x][2]],[h[x][6],h[x][7]],void 0)),h[x][11]&&d.push(new hc(h[x][0],[h[x][1],h[x][2]],[h[x][6],h[x][7]],void 0,void 0,!0,!0));for(var y=d.length,x=0;x<g.length;x++)for(var o=0;o<g[x].length;o++)g[x][o].sort(function(te,re){return te.param<re.param?-1:1});for(var v=[],x=0;x<y;x++)v.push({minX:d[x].coord[0],minY:d[x].coord[1],maxX:d[x].coord[0],maxY:d[x].coord[1],index:x});var _=new dt;_.load(v);for(var x=0;x<g.length;x++)for(var o=0;o<g[x].length;o++)for(var E=0;E<g[x][o].length;E++){var M;E==g[x][o].length-1?M=g[x][Yn(o+1,t.geometry.coordinates[x].length-1)][0].coord:M=g[x][o][E+1].coord;var R=_.search({minX:M[0],minY:M[1],maxX:M[0],maxY:M[1]})[0];g[x][o][E].nxtIsectAlongEdgeIn=R.index}for(var x=0;x<g.length;x++)for(var o=0;o<g[x].length;o++)for(var E=0;E<g[x][o].length;E++){var M=g[x][o][E].coord,R=_.search({minX:M[0],minY:M[1],maxX:M[0],maxY:M[1]})[0],Y=R.index;Y<l?d[Y].nxtIsectAlongRingAndEdge2=g[x][o][E].nxtIsectAlongEdgeIn:Sr(d[Y].ringAndEdge1,g[x][o][E].ringAndEdgeIn)?d[Y].nxtIsectAlongRingAndEdge1=g[x][o][E].nxtIsectAlongEdgeIn:d[Y].nxtIsectAlongRingAndEdge2=g[x][o][E].nxtIsectAlongEdgeIn}for(var H=[],x=0,o=0;o<e;o++){for(var S=x,E=0;E<t.geometry.coordinates[o].length-1;E++)d[x].coord[0]<d[S].coord[0]&&(S=x),x++;for(var b=d[S].nxtIsectAlongRingAndEdge2,E=0;E<d.length;E++)if(d[E].nxtIsectAlongRingAndEdge1==S||d[E].nxtIsectAlongRingAndEdge2==S){var C=E;break}var A=Fi([d[C].coord,d[S].coord,d[b].coord],!0)?1:-1;H.push({isect:S,parent:-1,winding:A})}H.sort(function(ee,j){return d[ee.isect].coord>d[j.isect].coord?-1:1});for(var q=[];H.length>0;){var w=H.pop(),N=w.isect,L=w.parent,D=w.winding,F=q.length,X=[d[N].coord],z=N;if(d[N].ringAndEdge1Walkable)var V=d[N].ringAndEdge1,k=d[N].nxtIsectAlongRingAndEdge1;else var V=d[N].ringAndEdge2,k=d[N].nxtIsectAlongRingAndEdge2;for(;!Sr(d[N].coord,d[k].coord);){X.push(d[k].coord);for(var O=void 0,x=0;x<H.length;x++)if(H[x].isect==k){O=x;break}if(O!=null&&H.splice(O,1),Sr(V,d[k].ringAndEdge1)){if(V=d[k].ringAndEdge2,d[k].ringAndEdge2Walkable=!1,d[k].ringAndEdge1Walkable){var P={isect:k};Fi([d[z].coord,d[k].coord,d[d[k].nxtIsectAlongRingAndEdge2].coord],D==1)?(P.parent=L,P.winding=-D):(P.parent=F,P.winding=D),H.push(P)}z=k,k=d[k].nxtIsectAlongRingAndEdge2}else{if(V=d[k].ringAndEdge1,d[k].ringAndEdge1Walkable=!1,d[k].ringAndEdge2Walkable){var P={isect:k};Fi([d[z].coord,d[k].coord,d[d[k].nxtIsectAlongRingAndEdge1].coord],D==1)?(P.parent=L,P.winding=-D):(P.parent=F,P.winding=D),H.push(P)}z=k,k=d[k].nxtIsectAlongRingAndEdge1}}X.push(d[k].coord),q.push(ye([X],{index:F,parent:L,winding:D,netWinding:void 0}))}var G=he(q);B(),Z();function B(){for(var ee=[],j=0;j<G.features.length;j++)G.features[j].properties.parent==-1&&ee.push(j);if(ee.length>1)for(var j=0;j<ee.length;j++){for(var te=-1,re=1/0,se=0;se<G.features.length;se++)ee[j]!=se&&xe(G.features[ee[j]].geometry.coordinates[0][0],G.features[se],{ignoreBoundary:!0})&&ir(G.features[se])<re&&(te=se);G.features[ee[j]].properties.parent=te}}function Z(){for(var ee=0;ee<G.features.length;ee++)if(G.features[ee].properties.parent==-1){var j=G.features[ee].properties.winding;G.features[ee].properties.netWinding=j,K(ee,j)}}function K(ee,j){for(var te=0;te<G.features.length;te++)if(G.features[te].properties.parent==ee){var re=j+G.features[te].properties.winding;G.features[te].properties.netWinding=re,K(te,re)}}return G}var cc=function(t,e,i,s,o){this.coord=t,this.param=e,this.ringAndEdgeIn=i,this.ringAndEdgeOut=s,this.nxtIsectAlongEdgeIn=o},hc=function(t,e,i,s,o,l,h){this.coord=t,this.ringAndEdge1=e,this.ringAndEdge2=i,this.nxtIsectAlongRingAndEdge1=s,this.nxtIsectAlongRingAndEdge2=o,this.ringAndEdge1Walkable=l,this.ringAndEdge2Walkable=h};function Fi(t,e){if(typeof e>"u"&&(e=!0),t.length!=3)throw new Error("This function requires an array of three points [x,y]");var i=(t[1][0]-t[0][0])*(t[2][1]-t[0][1])-(t[1][1]-t[0][1])*(t[2][0]-t[0][0]);return i>=0==e}function um(t){for(var e=0,i=0;i<t.length-1;i++)t[i][0]<t[e][0]&&(e=i);if(Fi([t[Yn(e-1,t.length-1)],t[e],t[Yn(e+1,t.length-1)]],!0))var s=1;else var s=-1;return s}function Sr(t,e){if(!t||!e||t.length!=e.length)return!1;for(var i=0,s=t.length;i<s;i++)if(t[i]instanceof Array&&e[i]instanceof Array){if(!Sr(t[i],e[i]))return!1}else if(t[i]!=e[i])return!1;return!0}function Yn(t,e){return(t%e+e)%e}function lm(t){for(var e={},i=1,s=0,o=t.length;s<o;++s){if(Object.prototype.hasOwnProperty.call(e,t[s])){i=0;break}e[t[s]]=1}return i}function cm(t){var e=[];return Qe(t,function(i){i.geometry.type==="Polygon"&&Le(am(i),function(s){e.push(ye(s.geometry.coordinates,i.properties))})}),he(e)}function fc(t){return function(){return t}}function hm(t){return t[0]}function fm(t){return t[1]}function qi(){this._=null}function Bi(t){t.U=t.C=t.L=t.R=t.P=t.N=null}qi.prototype={constructor:qi,insert:function(t,e){var i,s,o;if(t){if(e.P=t,e.N=t.N,t.N&&(t.N.P=e),t.N=e,t.R){for(t=t.R;t.L;)t=t.L;t.L=e}else t.R=e;i=t}else this._?(t=gc(this._),e.P=null,e.N=t,t.P=t.L=e,i=t):(e.P=e.N=null,this._=e,i=null);for(e.L=e.R=null,e.U=i,e.C=!0,t=e;i&&i.C;)s=i.U,i===s.L?(o=s.R,o&&o.C?(i.C=o.C=!1,s.C=!0,t=s):(t===i.R&&(Pr(this,i),t=i,i=t.U),i.C=!1,s.C=!0,Lr(this,s))):(o=s.L,o&&o.C?(i.C=o.C=!1,s.C=!0,t=s):(t===i.L&&(Lr(this,i),t=i,i=t.U),i.C=!1,s.C=!0,Pr(this,s))),i=t.U;this._.C=!1},remove:function(t){t.N&&(t.N.P=t.P),t.P&&(t.P.N=t.N),t.N=t.P=null;var e=t.U,i,s=t.L,o=t.R,l,h;if(s?o?l=gc(o):l=s:l=o,e?e.L===t?e.L=l:e.R=l:this._=l,s&&o?(h=l.C,l.C=t.C,l.L=s,s.U=l,l!==o?(e=l.U,l.U=t.U,t=l.R,e.L=t,l.R=o,o.U=l):(l.U=e,e=l,t=l.R)):(h=t.C,t=l),t&&(t.U=e),!h){if(t&&t.C){t.C=!1;return}do{if(t===this._)break;if(t===e.L){if(i=e.R,i.C&&(i.C=!1,e.C=!0,Pr(this,e),i=e.R),i.L&&i.L.C||i.R&&i.R.C){(!i.R||!i.R.C)&&(i.L.C=!1,i.C=!0,Lr(this,i),i=e.R),i.C=e.C,e.C=i.R.C=!1,Pr(this,e),t=this._;break}}else if(i=e.L,i.C&&(i.C=!1,e.C=!0,Lr(this,e),i=e.L),i.L&&i.L.C||i.R&&i.R.C){(!i.L||!i.L.C)&&(i.R.C=!1,i.C=!0,Pr(this,i),i=e.L),i.C=e.C,e.C=i.L.C=!1,Lr(this,e),t=this._;break}i.C=!0,t=e,e=e.U}while(!t.C);t&&(t.C=!1)}}};function Pr(t,e){var i=e,s=e.R,o=i.U;o?o.L===i?o.L=s:o.R=s:t._=s,s.U=o,i.U=s,i.R=s.L,i.R&&(i.R.U=i),s.L=i}function Lr(t,e){var i=e,s=e.L,o=i.U;o?o.L===i?o.L=s:o.R=s:t._=s,s.U=o,i.U=s,i.L=s.R,i.L&&(i.L.U=i),s.R=i}function gc(t){for(;t.L;)t=t.L;return t}function br(t,e,i,s){var o=[null,null],l=at.push(o)-1;return o.left=t,o.right=e,i&&Gi(o,t,e,i),s&&Gi(o,e,t,s),yt[t.index].halfedges.push(l),yt[e.index].halfedges.push(l),o}function Cr(t,e,i){var s=[e,i];return s.left=t,s}function Gi(t,e,i,s){!t[0]&&!t[1]?(t[0]=s,t.left=e,t.right=i):t.left===i?t[1]=s:t[0]=s}function gm(t,e,i,s,o){var l=t[0],h=t[1],c=l[0],g=l[1],d=h[0],y=h[1],v=0,_=1,E=d-c,M=y-g,R;if(R=e-c,!(!E&&R>0)){if(R/=E,E<0){if(R<v)return;R<_&&(_=R)}else if(E>0){if(R>_)return;R>v&&(v=R)}if(R=s-c,!(!E&&R<0)){if(R/=E,E<0){if(R>_)return;R>v&&(v=R)}else if(E>0){if(R<v)return;R<_&&(_=R)}if(R=i-g,!(!M&&R>0)){if(R/=M,M<0){if(R<v)return;R<_&&(_=R)}else if(M>0){if(R>_)return;R>v&&(v=R)}if(R=o-g,!(!M&&R<0)){if(R/=M,M<0){if(R>_)return;R>v&&(v=R)}else if(M>0){if(R<v)return;R<_&&(_=R)}return!(v>0)&&!(_<1)||(v>0&&(t[0]=[c+v*E,g+v*M]),_<1&&(t[1]=[c+_*E,g+_*M])),!0}}}}}function dm(t,e,i,s,o){var l=t[1];if(l)return!0;var h=t[0],c=t.left,g=t.right,d=c[0],y=c[1],v=g[0],_=g[1],E=(d+v)/2,M=(y+_)/2,R,Y;if(_===y){if(E<e||E>=s)return;if(d>v){if(!h)h=[E,i];else if(h[1]>=o)return;l=[E,o]}else{if(!h)h=[E,o];else if(h[1]<i)return;l=[E,i]}}else if(R=(d-v)/(_-y),Y=M-R*E,R<-1||R>1)if(d>v){if(!h)h=[(i-Y)/R,i];else if(h[1]>=o)return;l=[(o-Y)/R,o]}else{if(!h)h=[(o-Y)/R,o];else if(h[1]<i)return;l=[(i-Y)/R,i]}else if(y<_){if(!h)h=[e,R*e+Y];else if(h[0]>=s)return;l=[s,R*s+Y]}else{if(!h)h=[s,R*s+Y];else if(h[0]<e)return;l=[e,R*e+Y]}return t[0]=h,t[1]=l,!0}function vm(t,e,i,s){for(var o=at.length,l;o--;)(!dm(l=at[o],t,e,i,s)||!gm(l,t,e,i,s)||!(Math.abs(l[0][0]-l[1][0])>Ge||Math.abs(l[0][1]-l[1][1])>Ge))&&delete at[o]}function ym(t){return yt[t.index]={site:t,halfedges:[]}}function mm(t,e){var i=t.site,s=e.left,o=e.right;return i===o&&(o=s,s=i),o?Math.atan2(o[1]-s[1],o[0]-s[0]):(i===s?(s=e[1],o=e[0]):(s=e[0],o=e[1]),Math.atan2(s[0]-o[0],o[1]-s[1]))}function dc(t,e){return e[+(e.left!==t.site)]}function pm(t,e){return e[+(e.left===t.site)]}function _m(){for(var t=0,e=yt.length,i,s,o,l;t<e;++t)if((i=yt[t])&&(l=(s=i.halfedges).length)){var h=new Array(l),c=new Array(l);for(o=0;o<l;++o)h[o]=o,c[o]=mm(i,at[s[o]]);for(h.sort(function(g,d){return c[d]-c[g]}),o=0;o<l;++o)c[o]=s[h[o]];for(o=0;o<l;++o)s[o]=c[o]}}function xm(t,e,i,s){var o=yt.length,l,h,c,g,d,y,v,_,E,M,R,Y,H=!0;for(l=0;l<o;++l)if(h=yt[l]){for(c=h.site,d=h.halfedges,g=d.length;g--;)at[d[g]]||d.splice(g,1);for(g=0,y=d.length;g<y;)M=pm(h,at[d[g]]),R=M[0],Y=M[1],v=dc(h,at[d[++g%y]]),_=v[0],E=v[1],(Math.abs(R-_)>Ge||Math.abs(Y-E)>Ge)&&(d.splice(g,0,at.push(Cr(c,M,Math.abs(R-t)<Ge&&s-Y>Ge?[t,Math.abs(_-t)<Ge?E:s]:Math.abs(Y-s)<Ge&&i-R>Ge?[Math.abs(E-s)<Ge?_:i,s]:Math.abs(R-i)<Ge&&Y-e>Ge?[i,Math.abs(_-i)<Ge?E:e]:Math.abs(Y-e)<Ge&&R-t>Ge?[Math.abs(E-e)<Ge?_:t,e]:null))-1),++y);y&&(H=!1)}if(H){var x,S,b,C=1/0;for(l=0,H=null;l<o;++l)(h=yt[l])&&(c=h.site,x=c[0]-t,S=c[1]-e,b=x*x+S*S,b<C&&(C=b,H=h));if(H){var A=[t,e],q=[t,s],w=[i,s],N=[i,e];H.halfedges.push(at.push(Cr(c=H.site,A,q))-1,at.push(Cr(c,q,w))-1,at.push(Cr(c,w,N))-1,at.push(Cr(c,N,A))-1)}}for(l=0;l<o;++l)(h=yt[l])&&(h.halfedges.length||delete yt[l])}var vc=[],fo;function Em(){Bi(this),this.x=this.y=this.arc=this.site=this.cy=null}function zn(t){var e=t.P,i=t.N;if(!(!e||!i)){var s=e.site,o=t.site,l=i.site;if(s!==l){var h=o[0],c=o[1],g=s[0]-h,d=s[1]-c,y=l[0]-h,v=l[1]-c,_=2*(g*v-d*y);if(!(_>=-1e-12)){var E=g*g+d*d,M=y*y+v*v,R=(v*E-d*M)/_,Y=(g*M-y*E)/_,H=vc.pop()||new Em;H.arc=t,H.site=o,H.x=R+h,H.y=(H.cy=Y+c)+Math.sqrt(R*R+Y*Y),t.circle=H;for(var x=null,S=Or._;S;)if(H.y<S.y||H.y===S.y&&H.x<=S.x)if(S.L)S=S.L;else{x=S.P;break}else if(S.R)S=S.R;else{x=S;break}Or.insert(x,H),x||(fo=H)}}}}function Xn(t){var e=t.circle;e&&(e.P||(fo=e.N),Or.remove(e),vc.push(e),Bi(e),t.circle=null)}var yc=[];function wm(){Bi(this),this.edge=this.site=this.circle=null}function mc(t){var e=yc.pop()||new wm;return e.site=t,e}function go(t){Xn(t),Un.remove(t),yc.push(t),Bi(t)}function km(t){var e=t.circle,i=e.x,s=e.cy,o=[i,s],l=t.P,h=t.N,c=[t];go(t);for(var g=l;g.circle&&Math.abs(i-g.circle.x)<Ge&&Math.abs(s-g.circle.cy)<Ge;)l=g.P,c.unshift(g),go(g),g=l;c.unshift(g),Xn(g);for(var d=h;d.circle&&Math.abs(i-d.circle.x)<Ge&&Math.abs(s-d.circle.cy)<Ge;)h=d.N,c.push(d),go(d),d=h;c.push(d),Xn(d);var y=c.length,v;for(v=1;v<y;++v)d=c[v],g=c[v-1],Gi(d.edge,g.site,d.site,o);g=c[0],d=c[y-1],d.edge=br(g.site,d.site,null,o),zn(g),zn(d)}function Im(t){for(var e=t[0],i=t[1],s,o,l,h,c=Un._;c;)if(l=pc(c,i)-e,l>Ge)c=c.L;else if(h=e-Nm(c,i),h>Ge){if(!c.R){s=c;break}c=c.R}else{l>-Ge?(s=c.P,o=c):h>-Ge?(s=c,o=c.N):s=o=c;break}ym(t);var g=mc(t);if(Un.insert(s,g),!(!s&&!o)){if(s===o){Xn(s),o=mc(s.site),Un.insert(g,o),g.edge=o.edge=br(s.site,g.site),zn(s),zn(o);return}if(!o){g.edge=br(s.site,g.site);return}Xn(s),Xn(o);var d=s.site,y=d[0],v=d[1],_=t[0]-y,E=t[1]-v,M=o.site,R=M[0]-y,Y=M[1]-v,H=2*(_*Y-E*R),x=_*_+E*E,S=R*R+Y*Y,b=[(Y*x-E*S)/H+y,(_*S-R*x)/H+v];Gi(o.edge,d,M,b),g.edge=br(d,t,null,b),o.edge=br(t,M,null,b),zn(s),zn(o)}}function pc(t,e){var i=t.site,s=i[0],o=i[1],l=o-e;if(!l)return s;var h=t.P;if(!h)return-1/0;i=h.site;var c=i[0],g=i[1],d=g-e;if(!d)return c;var y=c-s,v=1/l-1/d,_=y/d;return v?(-_+Math.sqrt(_*_-2*v*(y*y/(-2*d)-g+d/2+o-l/2)))/v+s:(s+c)/2}function Nm(t,e){var i=t.N;if(i)return pc(i,e);var s=t.site;return s[1]===e?s[0]:1/0}var Ge=1e-6,Un,yt,Or,at;function Mm(t,e,i){return(t[0]-i[0])*(e[1]-t[1])-(t[0]-e[0])*(i[1]-t[1])}function Sm(t,e){return e[1]-t[1]||e[0]-t[0]}function vo(t,e){var i=t.sort(Sm).pop(),s,o,l;for(at=[],yt=new Array(t.length),Un=new qi,Or=new qi;;)if(l=fo,i&&(!l||i[1]<l.y||i[1]===l.y&&i[0]<l.x))(i[0]!==s||i[1]!==o)&&(Im(i),s=i[0],o=i[1]),i=t.pop();else if(l)km(l.arc);else break;if(_m(),e){var h=+e[0][0],c=+e[0][1],g=+e[1][0],d=+e[1][1];vm(h,c,g,d),xm(h,c,g,d)}this.edges=at,this.cells=yt,Un=Or=at=yt=null}vo.prototype={constructor:vo,polygons:function(){var t=this.edges;return this.cells.map(function(e){var i=e.halfedges.map(function(s){return dc(e,t[s])});return i.data=e.site.data,i})},triangles:function(){var t=[],e=this.edges;return this.cells.forEach(function(i,s){if(c=(l=i.halfedges).length)for(var o=i.site,l,h=-1,c,g,d=e[l[c-1]],y=d.left===o?d.right:d.left;++h<c;)g=y,d=e[l[h]],y=d.left===o?d.right:d.left,g&&y&&s<g.index&&s<y.index&&Mm(o,g,y)<0&&t.push([o.data,g.data,y.data])}),t},links:function(){return this.edges.filter(function(t){return t.right}).map(function(t){return{source:t.left.data,target:t.right.data}})},find:function(t,e,i){for(var s=this,o,l=s._found||0,h=s.cells.length,c;!(c=s.cells[l]);)if(++l>=h)return null;var g=t-c.site[0],d=e-c.site[1],y=g*g+d*d;do c=s.cells[o=l],l=null,c.halfedges.forEach(function(v){var _=s.edges[v],E=_.left;if(!((E===c.site||!E)&&!(E=_.right))){var M=t-E[0],R=e-E[1],Y=M*M+R*R;Y<y&&(y=Y,l=E.index)}});while(l!==null);return s._found=o,i==null||y<=i*i?c.site:null}};function Pm(){var t=hm,e=fm,i=null;function s(o){return new vo(o.map(function(l,h){var c=[Math.round(t(l,h,o)/Ge)*Ge,Math.round(e(l,h,o)/Ge)*Ge];return c.index=h,c.data=l,c}),i)}return s.polygons=function(o){return s(o).polygons()},s.links=function(o){return s(o).links()},s.triangles=function(o){return s(o).triangles()},s.x=function(o){return arguments.length?(t=typeof o=="function"?o:fc(+o),s):t},s.y=function(o){return arguments.length?(e=typeof o=="function"?o:fc(+o),s):e},s.extent=function(o){return arguments.length?(i=o==null?null:[[+o[0][0],+o[0][1]],[+o[1][0],+o[1][1]]],s):i&&[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},s.size=function(o){return arguments.length?(i=o==null?null:[[0,0],[+o[0],+o[1]]],s):i&&[i[1][0]-i[0][0],i[1][1]-i[0][1]]},s}function Lm(t){return t=t.slice(),t.push(t[0]),ye([t])}function bm(t,e){if(e=e||{},!Ce(e))throw new Error("options is invalid");const i=e.bbox||[-180,-85,180,85];if(!t)throw new Error("points is required");if(!Array.isArray(i))throw new Error("bbox is invalid");return Ut(t,"Point","points"),he(Pm().x(s=>s.geometry.coordinates[0]).y(s=>s.geometry.coordinates[1]).extent([[i[0],i[1]],[i[2],i[3]]]).polygons(t.features).map(function(s,o){return Object.assign(Lm(s),{properties:vi(t.features[o].properties)})}))}const Cm=Object.freeze(Object.defineProperty({__proto__:null,along:ph,angle:_h,applyFilter:yi,area:ir,areaFactors:Ur,azimuthToBearing:Uo,bbox:Fe,bboxClip:Nh,bboxPolygon:sr,bearing:nn,bearingToAzimuth:Sn,bezierSpline:Lh,booleanClockwise:Hr,booleanConcave:bh,booleanContains:Yh,booleanCrosses:ha,booleanDisjoint:ds,booleanEqual:vf,booleanIntersects:Ea,booleanOverlap:Ff,booleanParallel:qf,booleanPointInPolygon:xe,booleanPointOnLine:we,booleanTouches:Gf,booleanValid:Yf,booleanWithin:Aa,buffer:Lg,center:jr,centerMean:Cs,centerMedian:Cg,centerOfMass:Iu,centroid:Zt,circle:Rs,cleanCoords:dn,clone:je,cloneProperties:vi,clusterEach:Ds,clusterReduce:Pu,clusters:Hg,clustersDbscan:$g,clustersKmeans:Qg,collect:jg,collectionOf:Ut,combine:ed,concave:Ld,containsNumber:ns,convertArea:ts,convertLength:fn,convex:ku,coordAll:rr,coordEach:Xe,coordReduce:rs,createBins:Fs,degreesToRadians:Ze,destination:rn,difference:Jd,dissolve:Qd,distance:Be,distanceWeight:Qu,earthRadius:Ke,ellipse:el,envelope:tl,explode:Mi,factors:Xr,feature:We,featureCollection:he,featureEach:Le,featureOf:nr,featureReduce:ss,filterProperties:Lu,findPoint:Jo,findSegment:Ko,flatten:js,flattenEach:Qe,flattenReduce:Wo,flip:nv,geojsonRbush:Qr,geojsonType:Ho,geomEach:rt,geomReduce:os,geometry:Bo,geometryCollection:es,getCluster:Su,getCoord:Oe,getCoords:ve,getGeom:qe,getType:gt,greatCircle:rv,helpers:vh,hexGrid:sl,interpolate:ov,intersect:Ir,invariant:yh,isNumber:Je,isObject:Ce,isobands:fv,isolines:Iv,kinks:Pv,length:ml,lengthToDegrees:Vr,lengthToRadians:Mn,lineArc:pl,lineChunk:bv,lineEach:us,lineIntersect:Rt,lineOffset:qv,lineOverlap:ba,lineReduce:ls,lineSegment:hr,lineSlice:Gv,lineSliceAlong:xl,lineSplit:zv,lineString:Pe,lineStrings:zo,lineToPolygon:Xv,mask:Vv,meta:xh,midpoint:Zv,moranIndex:Wv,multiLineString:tn,multiPoint:jn,multiPolygon:ft,nearestNeighborAnalysis:ny,nearestPoint:Li,nearestPointOnLine:$t,nearestPointToLine:ay,planepoint:ly,point:_e,pointGrid:ol,pointOnFeature:cy,pointToLineDistance:ao,pointToPolygonDistance:lo,points:Go,pointsWithinPolygon:Dl,polygon:ye,polygonSmooth:_y,polygonTangents:wy,polygonToLine:bn,polygonize:py,polygons:Yo,projection:My,propEach:is,propReduce:Zo,propertiesContainsFilter:qs,quadratAnalysis:Sy,radiansToDegrees:Tt,radiansToLength:er,random:Ry,randomLineString:Wl,randomPoint:$l,randomPolygon:Zl,randomPosition:Hl,rectangleGrid:al,rewind:Ay,rhumbBearing:gn,rhumbDestination:Ni,rhumbDistance:Bn,round:Xo,sample:Dy,sector:qy,segmentEach:Vt,segmentReduce:as,shortestPath:Yy,simplify:$y,square:Wy,squareGrid:no,standardDeviationalEllipse:Ky,tag:Jy,tesselate:tm,tin:Ru,toMercator:Yl,toWgs84:zl,transformRotate:ju,transformScale:tc,transformTranslate:rm,triangleGrid:ul,truncate:wl,union:im,unkinkPolygon:cm,validateBBox:tr,validateId:Vo,voronoi:bm},Symbol.toStringTag,{value:"Module"})),Om={animation:!1,timeline:!1,baseLayerPicker:!1,geocoder:!1,sceneModePicker:!1,homeButton:!1,fullscreenButton:!1,navigationHelpButton:!1,infoBox:!1,selectionIndicator:!1,vrButton:!1,shadows:!1};class Tm{_debug;constructor(e=!1){this._debug=e}info(...e){this._debug&&console.log("[Gauss]",...e)}error(...e){console.error("[Gauss]",...e)}warn(...e){console.warn("[Gauss]",...e)}setDebug(e){this._debug=e}}class Rm{viewer;logger;constructor(e,i){const{debug:s=!0,...o}=i||{};this.logger=new Tm(s),this.viewer=new qo.Viewer(e,{...Om,...o}),this.logger.info("初始化成功")}destroy(){this.viewer&&this.viewer.destroy()}}const Am="0.1.0";Ot.Cesium=qo,Ot.Viewer=Rm,Ot.turf=Cm,Ot.version=Am,Object.defineProperty(Ot,Symbol.toStringTag,{value:"Module"})}));