kml-utils
Version:
This lib is modified from @mapbox/togeojson and @mapbox/tokml, enhanced with folder capability
1 lines • 128 kB
JavaScript
(()=>{var e={565:(e,t)=>{"use strict";function r(e){var t={type:"Feature"};return Object.keys(e).forEach((function(r){switch(r){case"type":case"properties":case"geometry":return;default:t[r]=e[r]}})),t.properties=n(e.properties),t.geometry=i(e.geometry),t}function n(e){var t={};return e?(Object.keys(e).forEach((function(r){var i=e[r];"object"==typeof i?null===i?t[r]=null:Array.isArray(i)?t[r]=i.map((function(e){return e})):t[r]=n(i):t[r]=i})),t):t}function i(e){var t={type:e.type};return e.bbox&&(t.bbox=e.bbox),"GeometryCollection"===e.type?(t.geometries=e.geometries.map((function(e){return i(e)})),t):(t.coordinates=o(e.coordinates),t)}function o(e){var t=e;return"object"!=typeof t[0]?t.slice():t.map((function(e){return o(e)}))}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if(!e)throw new Error("geojson is required");switch(e.type){case"Feature":return r(e);case"FeatureCollection":return function(e){var t={type:"FeatureCollection"};return Object.keys(e).forEach((function(r){switch(r){case"type":case"features":return;default:t[r]=e[r]}})),t.features=e.features.map((function(e){return r(e)})),t}(e);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return i(e);default:throw new Error("unknown GeoJSON type")}}},102:(e,t)=>{"use strict";function r(e,t,r){void 0===r&&(r={});var n={type:"Feature"};return(0===r.id||r.id)&&(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=t||{},n.geometry=e,n}function n(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}t.rQ=6371008.8,t.Cm={centimeters:100*t.rQ,centimetres:100*t.rQ,degrees:t.rQ/111325,feet:3.28084*t.rQ,inches:39.37*t.rQ,kilometers:t.rQ/1e3,kilometres:t.rQ/1e3,meters:t.rQ,metres:t.rQ,miles:t.rQ/1609.344,millimeters:1e3*t.rQ,millimetres:1e3*t.rQ,nauticalmiles:t.rQ/1852,radians:1,yards:t.rQ/1.0936},t.rQ,t.Wo={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046},t.xm=function(e,t,i){if(void 0===i&&(i={}),!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!n(e[0])||!n(e[1]))throw new Error("coordinates must contain numbers");return r({type:"Point",coordinates:e},t,i)}},540:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(48);function i(e,t,r){if(null!==e)for(var n,o,a,s,u,l,c,f,p=0,h=0,d=e.type,m="FeatureCollection"===d,g="Feature"===d,y=m?e.features.length:1,v=0;v<y;v++){u=(f=!!(c=m?e.features[v].geometry:g?e.geometry:e)&&"GeometryCollection"===c.type)?c.geometries.length:1;for(var b=0;b<u;b++){var w=0,N=0;if(null!==(s=f?c.geometries[b]:c)){l=s.coordinates;var E=s.type;switch(p=!r||"Polygon"!==E&&"MultiPolygon"!==E?0:1,E){case null:break;case"Point":if(!1===t(l,h,v,w,N))return!1;h++,w++;break;case"LineString":case"MultiPoint":for(n=0;n<l.length;n++){if(!1===t(l[n],h,v,w,N))return!1;h++,"MultiPoint"===E&&w++}"LineString"===E&&w++;break;case"Polygon":case"MultiLineString":for(n=0;n<l.length;n++){for(o=0;o<l[n].length-p;o++){if(!1===t(l[n][o],h,v,w,N))return!1;h++}"MultiLineString"===E&&w++,"Polygon"===E&&N++}"Polygon"===E&&w++;break;case"MultiPolygon":for(n=0;n<l.length;n++){for(N=0,o=0;o<l[n].length;o++){for(a=0;a<l[n][o].length-p;a++){if(!1===t(l[n][o][a],h,v,w,N))return!1;h++}N++}w++}break;case"GeometryCollection":for(n=0;n<s.geometries.length;n++)if(!1===i(s.geometries[n],t,r))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function o(e,t){var r;switch(e.type){case"FeatureCollection":for(r=0;r<e.features.length&&!1!==t(e.features[r].properties,r);r++);break;case"Feature":t(e.properties,0)}}function a(e,t){if("Feature"===e.type)t(e,0);else if("FeatureCollection"===e.type)for(var r=0;r<e.features.length&&!1!==t(e.features[r],r);r++);}function s(e,t){var r,n,i,o,a,s,u,l,c,f,p=0,h="FeatureCollection"===e.type,d="Feature"===e.type,m=h?e.features.length:1;for(r=0;r<m;r++){for(s=h?e.features[r].geometry:d?e.geometry:e,l=h?e.features[r].properties:d?e.properties:{},c=h?e.features[r].bbox:d?e.bbox:void 0,f=h?e.features[r].id:d?e.id:void 0,a=(u=!!s&&"GeometryCollection"===s.type)?s.geometries.length:1,i=0;i<a;i++)if(null!==(o=u?s.geometries[i]:s))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===t(o,p,l,c,f))return!1;break;case"GeometryCollection":for(n=0;n<o.geometries.length;n++)if(!1===t(o.geometries[n],p,l,c,f))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===t(null,p,l,c,f))return!1;p++}}function u(e,t){s(e,(function(e,r,i,o,a){var s,u=null===e?null:e.type;switch(u){case null:case"Point":case"LineString":case"Polygon":return!1!==t(n.feature(e,i,{bbox:o,id:a}),r,0)&&void 0}switch(u){case"MultiPoint":s="Point";break;case"MultiLineString":s="LineString";break;case"MultiPolygon":s="Polygon"}for(var l=0;l<e.coordinates.length;l++){var c={type:s,coordinates:e.coordinates[l]};if(!1===t(n.feature(c,i),r,l))return!1}}))}function l(e,t){u(e,(function(e,r,o){var a=0;if(e.geometry){var s=e.geometry.type;if("Point"!==s&&"MultiPoint"!==s){var u,l=0,c=0,f=0;return!1!==i(e,(function(i,s,p,h,d){if(void 0===u||r>l||h>c||d>f)return u=i,l=r,c=h,f=d,void(a=0);var m=n.lineString([u,i],e.properties);if(!1===t(m,r,o,d,a))return!1;a++,u=i}))&&void 0}}}))}function c(e,t){if(!e)throw new Error("geojson is required");u(e,(function(e,r,i){if(null!==e.geometry){var o=e.geometry.type,a=e.geometry.coordinates;switch(o){case"LineString":if(!1===t(e,r,i,0,0))return!1;break;case"Polygon":for(var s=0;s<a.length;s++)if(!1===t(n.lineString(a[s],e.properties),r,i,s))return!1}}}))}t.coordAll=function(e){var t=[];return i(e,(function(e){t.push(e)})),t},t.coordEach=i,t.coordReduce=function(e,t,r,n){var o=r;return i(e,(function(e,n,i,a,s){o=0===n&&void 0===r?e:t(o,e,n,i,a,s)}),n),o},t.featureEach=a,t.featureReduce=function(e,t,r){var n=r;return a(e,(function(e,i){n=0===i&&void 0===r?e:t(n,e,i)})),n},t.findPoint=function(e,t){if(t=t||{},!n.isObject(t))throw new Error("options is invalid");var r,i=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,s=t.coordIndex||0,u=t.properties;switch(e.type){case"FeatureCollection":i<0&&(i=e.features.length+i),u=u||e.features[i].properties,r=e.features[i].geometry;break;case"Feature":u=u||e.properties,r=e.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":r=e;break;default:throw new Error("geojson is invalid")}if(null===r)return null;var l=r.coordinates;switch(r.type){case"Point":return n.point(l,u,t);case"MultiPoint":return o<0&&(o=l.length+o),n.point(l[o],u,t);case"LineString":return s<0&&(s=l.length+s),n.point(l[s],u,t);case"Polygon":return a<0&&(a=l.length+a),s<0&&(s=l[a].length+s),n.point(l[a][s],u,t);case"MultiLineString":return o<0&&(o=l.length+o),s<0&&(s=l[o].length+s),n.point(l[o][s],u,t);case"MultiPolygon":return o<0&&(o=l.length+o),a<0&&(a=l[o].length+a),s<0&&(s=l[o][a].length-s),n.point(l[o][a][s],u,t)}throw new Error("geojson is invalid")},t.findSegment=function(e,t){if(t=t||{},!n.isObject(t))throw new Error("options is invalid");var r,i=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,s=t.segmentIndex||0,u=t.properties;switch(e.type){case"FeatureCollection":i<0&&(i=e.features.length+i),u=u||e.features[i].properties,r=e.features[i].geometry;break;case"Feature":u=u||e.properties,r=e.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":r=e;break;default:throw new Error("geojson is invalid")}if(null===r)return null;var l=r.coordinates;switch(r.type){case"Point":case"MultiPoint":return null;case"LineString":return s<0&&(s=l.length+s-1),n.lineString([l[s],l[s+1]],u,t);case"Polygon":return a<0&&(a=l.length+a),s<0&&(s=l[a].length+s-1),n.lineString([l[a][s],l[a][s+1]],u,t);case"MultiLineString":return o<0&&(o=l.length+o),s<0&&(s=l[o].length+s-1),n.lineString([l[o][s],l[o][s+1]],u,t);case"MultiPolygon":return o<0&&(o=l.length+o),a<0&&(a=l[o].length+a),s<0&&(s=l[o][a].length-s-1),n.lineString([l[o][a][s],l[o][a][s+1]],u,t)}throw new Error("geojson is invalid")},t.flattenEach=u,t.flattenReduce=function(e,t,r){var n=r;return u(e,(function(e,i,o){n=0===i&&0===o&&void 0===r?e:t(n,e,i,o)})),n},t.geomEach=s,t.geomReduce=function(e,t,r){var n=r;return s(e,(function(e,i,o,a,s){n=0===i&&void 0===r?e:t(n,e,i,o,a,s)})),n},t.lineEach=c,t.lineReduce=function(e,t,r){var n=r;return c(e,(function(e,i,o,a){n=0===i&&void 0===r?e:t(n,e,i,o,a)})),n},t.propEach=o,t.propReduce=function(e,t,r){var n=r;return o(e,(function(e,i){n=0===i&&void 0===r?e:t(n,e,i)})),n},t.segmentEach=l,t.segmentReduce=function(e,t,r){var n=r,i=!1;return l(e,(function(e,o,a,s,u){n=!1===i&&void 0===r?e:t(n,e,o,a,s,u),i=!0})),n}},48:(e,t)=>{"use strict";function r(e,t,r){void 0===r&&(r={});var n={type:"Feature"};return(0===r.id||r.id)&&(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=t||{},n.geometry=e,n}function n(e,t,n){if(void 0===n&&(n={}),!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!h(e[0])||!h(e[1]))throw new Error("coordinates must contain numbers");return r({type:"Point",coordinates:e},t,n)}function i(e,t,n){void 0===n&&(n={});for(var i=0,o=e;i<o.length;i++){var a=o[i];if(a.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<a[a.length-1].length;s++)if(a[a.length-1][s]!==a[0][s])throw new Error("First and last Position are not equivalent.")}return r({type:"Polygon",coordinates:e},t,n)}function o(e,t,n){if(void 0===n&&(n={}),e.length<2)throw new Error("coordinates must be an array of two or more positions");return r({type:"LineString",coordinates:e},t,n)}function a(e,t){void 0===t&&(t={});var r={type:"FeatureCollection"};return t.id&&(r.id=t.id),t.bbox&&(r.bbox=t.bbox),r.features=e,r}function s(e,t,n){return void 0===n&&(n={}),r({type:"MultiLineString",coordinates:e},t,n)}function u(e,t,n){return void 0===n&&(n={}),r({type:"MultiPoint",coordinates:e},t,n)}function l(e,t,n){return void 0===n&&(n={}),r({type:"MultiPolygon",coordinates:e},t,n)}function c(e,r){void 0===r&&(r="kilometers");var n=t.factors[r];if(!n)throw new Error(r+" units is invalid");return e*n}function f(e,r){void 0===r&&(r="kilometers");var n=t.factors[r];if(!n)throw new Error(r+" units is invalid");return e/n}function p(e){return e%(2*Math.PI)*180/Math.PI}function h(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.earthRadius=6371008.8,t.factors={centimeters:100*t.earthRadius,centimetres:100*t.earthRadius,degrees:t.earthRadius/111325,feet:3.28084*t.earthRadius,inches:39.37*t.earthRadius,kilometers:t.earthRadius/1e3,kilometres:t.earthRadius/1e3,meters:t.earthRadius,metres:t.earthRadius,miles:t.earthRadius/1609.344,millimeters:1e3*t.earthRadius,millimetres:1e3*t.earthRadius,nauticalmiles:t.earthRadius/1852,radians:1,yards:1.0936*t.earthRadius},t.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/t.earthRadius,yards:1.0936133},t.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046},t.feature=r,t.geometry=function(e,t,r){switch(void 0===r&&(r={}),e){case"Point":return n(t).geometry;case"LineString":return o(t).geometry;case"Polygon":return i(t).geometry;case"MultiPoint":return u(t).geometry;case"MultiLineString":return s(t).geometry;case"MultiPolygon":return l(t).geometry;default:throw new Error(e+" is invalid")}},t.point=n,t.points=function(e,t,r){return void 0===r&&(r={}),a(e.map((function(e){return n(e,t)})),r)},t.polygon=i,t.polygons=function(e,t,r){return void 0===r&&(r={}),a(e.map((function(e){return i(e,t)})),r)},t.lineString=o,t.lineStrings=function(e,t,r){return void 0===r&&(r={}),a(e.map((function(e){return o(e,t)})),r)},t.featureCollection=a,t.multiLineString=s,t.multiPoint=u,t.multiPolygon=l,t.geometryCollection=function(e,t,n){return void 0===n&&(n={}),r({type:"GeometryCollection",geometries:e},t,n)},t.round=function(e,t){if(void 0===t&&(t=0),t&&!(t>=0))throw new Error("precision must be a positive number");var r=Math.pow(10,t||0);return Math.round(e*r)/r},t.radiansToLength=c,t.lengthToRadians=f,t.lengthToDegrees=function(e,t){return p(f(e,t))},t.bearingToAzimuth=function(e){var t=e%360;return t<0&&(t+=360),t},t.radiansToDegrees=p,t.degreesToRadians=function(e){return e%360*Math.PI/180},t.convertLength=function(e,t,r){if(void 0===t&&(t="kilometers"),void 0===r&&(r="kilometers"),!(e>=0))throw new Error("length must be a positive number");return c(f(e,t),r)},t.convertArea=function(e,r,n){if(void 0===r&&(r="meters"),void 0===n&&(n="kilometers"),!(e>=0))throw new Error("area must be a positive number");var i=t.areaFactors[r];if(!i)throw new Error("invalid original units");var o=t.areaFactors[n];if(!o)throw new Error("invalid final units");return e/i*o},t.isNumber=h,t.isObject=function(e){return!!e&&e.constructor===Object},t.validateBBox=function(e){if(!e)throw new Error("bbox is required");if(!Array.isArray(e))throw new Error("bbox must be an Array");if(4!==e.length&&6!==e.length)throw new Error("bbox must be an Array of 4 or 6 numbers");e.forEach((function(e){if(!h(e))throw new Error("bbox must only contain numbers")}))},t.validateId=function(e){if(!e)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof e))throw new Error("id must be a number or a string")}},981:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=r(540),o=r(16),a=n(r(565));function s(e,t,r){void 0===r&&(r={});var n=(r=r||{}).mutate;if(!e)throw new Error("geojson is required");return Array.isArray(e)&&o.isNumber(e[0])?e="mercator"===t?u(e):l(e):(!0!==n&&(e=a.default(e)),i.coordEach(e,(function(e){var r="mercator"===t?u(e):l(e);e[0]=r[0],e[1]=r[1]}))),e}function u(e){var t,r=Math.PI/180,n=6378137,i=20037508.342789244,o=[n*(Math.abs(e[0])<=180?e[0]:e[0]-360*((t=e[0])<0?-1:t>0?1:0))*r,n*Math.log(Math.tan(.25*Math.PI+.5*e[1]*r))];return o[0]>i&&(o[0]=i),o[0]<-i&&(o[0]=-i),o[1]>i&&(o[1]=i),o[1]<-i&&(o[1]=-i),o}function l(e){var t=180/Math.PI,r=6378137;return[e[0]*t/r,(.5*Math.PI-2*Math.atan(Math.exp(-e[1]/r)))*t]}t.toMercator=function(e,t){return void 0===t&&(t={}),s(e,"mercator",t)},t.toWgs84=function(e,t){return void 0===t&&(t={}),s(e,"wgs84",t)}},16:(e,t)=>{"use strict";function r(e,t,r){void 0===r&&(r={});var n={type:"Feature"};return(0===r.id||r.id)&&(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=t||{},n.geometry=e,n}function n(e,t,n){if(void 0===n&&(n={}),!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!h(e[0])||!h(e[1]))throw new Error("coordinates must contain numbers");return r({type:"Point",coordinates:e},t,n)}function i(e,t,n){void 0===n&&(n={});for(var i=0,o=e;i<o.length;i++){var a=o[i];if(a.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<a[a.length-1].length;s++)if(a[a.length-1][s]!==a[0][s])throw new Error("First and last Position are not equivalent.")}return r({type:"Polygon",coordinates:e},t,n)}function o(e,t,n){if(void 0===n&&(n={}),e.length<2)throw new Error("coordinates must be an array of two or more positions");return r({type:"LineString",coordinates:e},t,n)}function a(e,t){void 0===t&&(t={});var r={type:"FeatureCollection"};return t.id&&(r.id=t.id),t.bbox&&(r.bbox=t.bbox),r.features=e,r}function s(e,t,n){return void 0===n&&(n={}),r({type:"MultiLineString",coordinates:e},t,n)}function u(e,t,n){return void 0===n&&(n={}),r({type:"MultiPoint",coordinates:e},t,n)}function l(e,t,n){return void 0===n&&(n={}),r({type:"MultiPolygon",coordinates:e},t,n)}function c(e,r){void 0===r&&(r="kilometers");var n=t.factors[r];if(!n)throw new Error(r+" units is invalid");return e*n}function f(e,r){void 0===r&&(r="kilometers");var n=t.factors[r];if(!n)throw new Error(r+" units is invalid");return e/n}function p(e){return e%(2*Math.PI)*180/Math.PI}function h(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.earthRadius=6371008.8,t.factors={centimeters:100*t.earthRadius,centimetres:100*t.earthRadius,degrees:t.earthRadius/111325,feet:3.28084*t.earthRadius,inches:39.37*t.earthRadius,kilometers:t.earthRadius/1e3,kilometres:t.earthRadius/1e3,meters:t.earthRadius,metres:t.earthRadius,miles:t.earthRadius/1609.344,millimeters:1e3*t.earthRadius,millimetres:1e3*t.earthRadius,nauticalmiles:t.earthRadius/1852,radians:1,yards:1.0936*t.earthRadius},t.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/t.earthRadius,yards:1.0936133},t.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046},t.feature=r,t.geometry=function(e,t,r){switch(void 0===r&&(r={}),e){case"Point":return n(t).geometry;case"LineString":return o(t).geometry;case"Polygon":return i(t).geometry;case"MultiPoint":return u(t).geometry;case"MultiLineString":return s(t).geometry;case"MultiPolygon":return l(t).geometry;default:throw new Error(e+" is invalid")}},t.point=n,t.points=function(e,t,r){return void 0===r&&(r={}),a(e.map((function(e){return n(e,t)})),r)},t.polygon=i,t.polygons=function(e,t,r){return void 0===r&&(r={}),a(e.map((function(e){return i(e,t)})),r)},t.lineString=o,t.lineStrings=function(e,t,r){return void 0===r&&(r={}),a(e.map((function(e){return o(e,t)})),r)},t.featureCollection=a,t.multiLineString=s,t.multiPoint=u,t.multiPolygon=l,t.geometryCollection=function(e,t,n){return void 0===n&&(n={}),r({type:"GeometryCollection",geometries:e},t,n)},t.round=function(e,t){if(void 0===t&&(t=0),t&&!(t>=0))throw new Error("precision must be a positive number");var r=Math.pow(10,t||0);return Math.round(e*r)/r},t.radiansToLength=c,t.lengthToRadians=f,t.lengthToDegrees=function(e,t){return p(f(e,t))},t.bearingToAzimuth=function(e){var t=e%360;return t<0&&(t+=360),t},t.radiansToDegrees=p,t.degreesToRadians=function(e){return e%360*Math.PI/180},t.convertLength=function(e,t,r){if(void 0===t&&(t="kilometers"),void 0===r&&(r="kilometers"),!(e>=0))throw new Error("length must be a positive number");return c(f(e,t),r)},t.convertArea=function(e,r,n){if(void 0===r&&(r="meters"),void 0===n&&(n="kilometers"),!(e>=0))throw new Error("area must be a positive number");var i=t.areaFactors[r];if(!i)throw new Error("invalid original units");var o=t.areaFactors[n];if(!o)throw new Error("invalid final units");return e/i*o},t.isNumber=h,t.isObject=function(e){return!!e&&e.constructor===Object},t.validateBBox=function(e){if(!e)throw new Error("bbox is required");if(!Array.isArray(e))throw new Error("bbox must be an Array");if(4!==e.length&&6!==e.length)throw new Error("bbox must be an Array of 4 or 6 numbers");e.forEach((function(e){if(!h(e))throw new Error("bbox must only contain numbers")}))},t.validateId=function(e){if(!e)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof e))throw new Error("id must be a number or a string")}},442:(e,t,r)=>{var n=r(737);function i(e){return Object.keys(e).length?" "+Object.keys(e).map((function(t){return t+'="'+n(e[t])+'"'})).join(" "):""}e.exports.attr=i,e.exports.tagClose=function(e,t){return"<"+e+i(t)+"/>"},e.exports.tag=function(e,t,r){return(Array.isArray(t)||"string"==typeof t)&&(r=t,t={}),Array.isArray(r)&&(r="\n"+r.map((function(e){return" "+e})).join("\n")+"\n"),"<"+e+i(t)+">"+r+"</"+e+">"}},55:function(e,t,r){!function(t,n){if("object"==typeof e.exports&&(e.exports=n(r(257))),"object"==typeof t.navigator){if(!t.Terraformer)throw new Error("Terraformer.ArcGIS requires the core Terraformer library. https://github.com/esri/Terraformer");t.Terraformer.ArcGIS=n(t.Terraformer)}}(this,(function(e){var t={};function r(e){var t,r,n,i,o=0,a=0,s=[];n=e.match(/((\+|\-)[^\+\-]+)/g),i=parseInt(n[0],32);for(var u=1;u<n.length;u+=2)o=t=parseInt(n[u],32)+o,a=r=parseInt(n[u+1],32)+a,s.push([t/i,r/i]);return s}function n(e){return function(e,t){for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}(e[0],e[e.length-1])||e.push(e[0]),e}function i(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}function o(e){for(var t,r=0,n=0,i=e.length,o=e[n];n<i-1;n++)r+=((t=e[n+1])[0]-o[0])*(t[1]+o[1]),o=t;return r>=0}function a(e){var t=[],r=e.slice(0),i=n(r.shift().slice(0));if(i.length>=4){o(i)||i.reverse(),t.push(i);for(var a=0;a<r.length;a++){var s=n(r[a].slice(0));s.length>=4&&(o(s)&&s.reverse(),t.push(s))}}return t}function s(t,r){var n=e.Tools.arraysIntersectArrays(t,r),i=e.Tools.coordinatesContainPoint(t,r[0]);return!(n||!i)}function u(t,a){var l={};return(a=a||{}).idAttribute=a.idAttribute||void 0,!t.spatialReference||3857!==t.spatialReference.wkid&&102100!==t.spatialReference.wkid||(l.crs=e.MercatorCRS),"number"==typeof t.x&&"number"==typeof t.y&&(l.type="Point",l.coordinates=[t.x,t.y],(t.z||t.m)&&l.coordinates.push(t.z),t.m&&l.coordinates.push(t.m)),t.points&&(l.type="MultiPoint",l.coordinates=t.points.slice(0)),t.paths&&(1===t.paths.length?(l.type="LineString",l.coordinates=t.paths[0].slice(0)):(l.type="MultiLineString",l.coordinates=t.paths.slice(0))),t.rings&&(l=function(t){for(var r,i,a,u=[],l=[],c=0;c<t.length;c++){var f=n(t[c].slice(0));if(!(f.length<4))if(o(f)){var p=[f.slice().reverse()];u.push(p)}else l.push(f.slice().reverse())}for(var h=[];l.length;){a=l.pop();var d=!1;for(r=u.length-1;r>=0;r--)if(s(i=u[r][0],a)){u[r].push(a),d=!0;break}d||h.push(a)}for(;h.length;){a=h.pop();var m=!1;for(r=u.length-1;r>=0;r--)if(i=u[r][0],e.Tools.arraysIntersectArrays(i,a)){u[r].push(a),m=!0;break}m||u.push([a.reverse()])}return 1===u.length?{type:"Polygon",coordinates:u[0]}:{type:"MultiPolygon",coordinates:u}}(t.rings.slice(0))),"number"==typeof t.xmin&&"number"==typeof t.ymin&&"number"==typeof t.xmax&&"number"==typeof t.ymax&&(l.type="Polygon",l.coordinates=[[[t.xmax,t.ymax],[t.xmin,t.ymax],[t.xmin,t.ymin],[t.xmax,t.ymin],[t.xmax,t.ymax]]]),(t.compressedGeometry||t.geometry||t.attributes)&&(l.type="Feature",t.compressedGeometry&&(t.geometry={paths:[r(t.compressedGeometry)]}),l.geometry=t.geometry?u(t.geometry):null,l.properties=t.attributes?i(t.attributes):null,t.attributes&&(l.id=t.attributes[a.idAttribute]||t.attributes.OBJECTID||t.attributes.FID)),new e.Primitive(l)}function l(e,t){var r,n=(t=t||{}).idAttribute||"OBJECTID";r=t.sr?{wkid:t.sr}:e&&e.crs&&"urn:ogc:def:crs:OGC:1.3:CRS84"!=e.crs.properties.name?null:{wkid:4326};var o,s={};switch(e.type){case"Point":s.x=e.coordinates[0],s.y=e.coordinates[1],e.coordinates[2]&&(s.z=e.coordinates[2]),e.coordinates[3]&&(s.m=e.coordinates[3]),s.spatialReference=r;break;case"MultiPoint":s.points=e.coordinates.slice(0),s.spatialReference=r;break;case"LineString":s.paths=[e.coordinates.slice(0)],s.spatialReference=r;break;case"MultiLineString":s.paths=e.coordinates.slice(0),s.spatialReference=r;break;case"Polygon":s.rings=a(e.coordinates.slice(0)),s.spatialReference=r;break;case"MultiPolygon":s.rings=function(e){for(var t=[],r=0;r<e.length;r++)for(var n=a(e[r]),i=n.length-1;i>=0;i--){var o=n[i].slice(0);t.push(o)}return t}(e.coordinates.slice(0)),s.spatialReference=r;break;case"Feature":e.geometry&&(s.geometry=l(e.geometry,t)),s.attributes=e.properties?i(e.properties):{},e.id&&(s.attributes[n]=e.id);break;case"FeatureCollection":for(s=[],o=0;o<e.features.length;o++)s.push(l(e.features[o],t));break;case"GeometryCollection":for(s=[],o=0;o<e.geometries.length;o++)s.push(l(e.geometries[o],t))}return s}return t.parse=u,t.convert=l,t.toGeoJSON=u,t.fromGeoJSON=l,t.parseCompressedGeometry=function(t){return new e.LineString(r(t))},t}))},257:function(e,t){var r;r=function(){"use strict";var e={},t=6378137,r={type:"link",properties:{href:"http://spatialreference.org/ref/sr-org/6928/ogcwkt/",type:"ogcwkt"}};function n(e){return"[object Array]"===Object.prototype.toString.call(e)}function i(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}function o(e){if(e.type)switch(e.type){case"Point":return[e.coordinates[0],e.coordinates[1],e.coordinates[0],e.coordinates[1]];case"MultiPoint":case"LineString":return a(e.coordinates);case"MultiLineString":case"Polygon":return function(e){for(var t=null,r=null,n=null,i=null,o=0;o<e.length;o++)for(var a=e[o],s=0;s<a.length;s++){var u=a[s],l=u[0],c=u[1];(null===t||l<t)&&(t=l),(null===r||l>r)&&(r=l),(null===n||c<n)&&(n=c),(null===i||c>i)&&(i=c)}return[t,n,r,i]}(e.coordinates);case"MultiPolygon":return function(e){for(var t=null,r=null,n=null,i=null,o=0;o<e.length;o++)for(var a=e[o],s=0;s<a.length;s++)for(var u=a[s],l=0;l<u.length;l++){var c=u[l],f=c[0],p=c[1];(null===t||f<t)&&(t=f),(null===r||f>r)&&(r=f),(null===n||p<n)&&(n=p),(null===i||p>i)&&(i=p)}return[t,n,r,i]}(e.coordinates);case"Feature":return e.geometry?o(e.geometry):null;case"FeatureCollection":return function(e){for(var t,r=[],n=e.features.length-1;n>=0;n--)t=o(e.features[n].geometry),r.push([t[0],t[1]]),r.push([t[2],t[3]]);return a(r)}(e);case"GeometryCollection":return function(e){for(var t,r=[],n=e.geometries.length-1;n>=0;n--)t=o(e.geometries[n]),r.push([t[0],t[1]]),r.push([t[2],t[3]]);return a(r)}(e);default:throw new Error("Unknown type: "+e.type)}return null}function a(e){for(var t=null,r=null,n=null,i=null,o=0;o<e.length;o++){var a=e[o],s=a[0],u=a[1];(null===t||s<t)&&(t=s),(null===r||s>r)&&(r=s),(null===n||u<n)&&(n=u),(null===i||u>i)&&(i=u)}return[t,n,r,i]}function s(e){var t=o(e);return{x:t[0],y:t[1],w:Math.abs(t[0]-t[2]),h:Math.abs(t[1]-t[3])}}function u(e){return 57.29577951308232*e}function l(e){return.017453292519943*e}function c(e,t){for(var r=0;r<e.length;r++)"number"==typeof e[r][0]&&(e[r]=t(e[r])),"object"==typeof e[r]&&(e[r]=c(e[r],t));return e}function f(e){var r=e[0],n=e[1];return[u(r/t)-360*Math.floor((u(r/t)+180)/360),u(Math.PI/2-2*Math.atan(Math.exp(-1*n/t)))]}function p(e){var r=e[0],n=Math.max(Math.min(e[1],89.99999),-89.99999);return[l(r)*t,3189068.5*Math.log((1+Math.sin(l(n)))/(1-Math.sin(l(n))))]}function h(e,t,n){if("Point"===e.type)e.coordinates=t(e.coordinates);else if("Feature"===e.type)e.geometry=h(e.geometry,t,!0);else if("FeatureCollection"===e.type)for(var i=0;i<e.features.length;i++)e.features[i]=h(e.features[i],t,!0);else if("GeometryCollection"===e.type)for(var o=0;o<e.geometries.length;o++)e.geometries[o]=h(e.geometries[o],t,!0);else e.coordinates=c(e.coordinates,t);return n||t===p&&(e.crs=r),t===f&&delete e.crs,e}function d(e){return h(e,p)}function m(e){return h(e,f)}function g(e,t){return e[0]>t[0]?-1:e[0]<t[0]?1:e[1]>t[1]?-1:e[1]<t[1]?1:0}function y(e,t,r){return(n=(t[0]-e[0])*(r[1]-e[1])-(r[0]-e[0])*(t[1]-e[1]))<0?-1:n>0?1:0;var n}function v(e,t){var r=t[0]-e[0],n=t[1]-e[1];return r*r+n*n}function b(e,t){var r=t;for(var n in e){var i=y(t,r,e[n]);(-1===i||0===i&&v(t,e[n])>v(t,r))&&(r=e[n])}return r}function w(e){if(0===e.length)return[];if(1===e.length)return e;for(var t=[e.sort(g)[0]],r=0;r<t.length;r++){var n=b(e,t[r]);n!==t[0]&&t.push(n)}return t}function N(e,t){for(var r=!1,n=-1,i=e.length,o=i-1;++n<i;o=n)(e[n][1]<=t[1]&&t[1]<e[o][1]||e[o][1]<=t[1]&&t[1]<e[n][1])&&t[0]<(e[o][0]-e[n][0])*(t[1]-e[n][1])/(e[o][1]-e[n][1])+e[n][0]&&(r=!r);return r}function E(e,t){if(e&&e.length){if(1===e.length)return N(e[0],t);if(N(e[0],t)){for(var r=1;r<e.length;r++)if(N(e[r],t))return!1;return!0}return!1}return!1}function S(e,t,r,n){var i=(n[0]-r[0])*(e[1]-r[1])-(n[1]-r[1])*(e[0]-r[0]),o=(t[0]-e[0])*(e[1]-r[1])-(t[1]-e[1])*(e[0]-r[0]),a=(n[1]-r[1])*(t[0]-e[0])-(n[0]-r[0])*(t[1]-e[1]);if(0!==a){var s=i/a,u=o/a;if(0<=s&&s<=1&&0<=u&&u<=1)return!0}return!1}function x(e){return!isNaN(parseFloat(e))&&isFinite(e)}function T(e,t){if(x(e[0][0])){if(x(t[0][0])){for(var r=0;r<e.length-1;r++)for(var n=0;n<t.length-1;n++)if(S(e[r],e[r+1],t[n],t[n+1]))return!0}else for(var i=0;i<t.length;i++)if(T(e,t[i]))return!0}else for(var o=0;o<e.length;o++)if(T(e[o],t))return!0;return!1}function C(e){for(var t=[],r=0;r<e.length;r++){var n=e[r].slice();!1===A(n[0],n[n.length-1])&&n.push(n[0]),t.push(n)}return t}function A(e,t){for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function M(e,t){if(e.length!==t.length)return!1;for(var r=e.slice().sort(g),n=t.slice().sort(g),i=0;i<r.length;i++){if(r[i].length!==n[i].length)return!1;for(var o=0;o<r.length;o++)if(r[i][o]!==n[i][o])return!1}return!0}var P=["length"];function D(e){if(e)switch(e.type){case"Point":return new I(e);case"MultiPoint":return new k(e);case"LineString":return new R(e);case"MultiLineString":return new O(e);case"Polygon":return new L(e);case"MultiPolygon":return new _(e);case"Feature":return new F(e);case"FeatureCollection":return new U(e);case"GeometryCollection":return new j(e);default:throw new Error("Unknown type: "+e.type)}}function I(e){var t=Array.prototype.slice.call(arguments);if(e&&"Point"===e.type&&e.coordinates)i(this,e);else if(e&&n(e))this.coordinates=e;else{if(!(t.length>=2))throw"Terraformer: invalid input for Terraformer.Point";this.coordinates=t}this.type="Point"}function k(e){if(e&&"MultiPoint"===e.type&&e.coordinates)i(this,e);else{if(!n(e))throw"Terraformer: invalid input for Terraformer.MultiPoint";this.coordinates=e}this.type="MultiPoint"}function R(e){if(e&&"LineString"===e.type&&e.coordinates)i(this,e);else{if(!n(e))throw"Terraformer: invalid input for Terraformer.LineString";this.coordinates=e}this.type="LineString"}function O(e){if(e&&"MultiLineString"===e.type&&e.coordinates)i(this,e);else{if(!n(e))throw"Terraformer: invalid input for Terraformer.MultiLineString";this.coordinates=e}this.type="MultiLineString"}function L(e){if(e&&"Polygon"===e.type&&e.coordinates)i(this,e);else{if(!n(e))throw"Terraformer: invalid input for Terraformer.Polygon";this.coordinates=e}this.type="Polygon"}function _(e){if(e&&"MultiPolygon"===e.type&&e.coordinates)i(this,e);else{if(!n(e))throw"Terraformer: invalid input for Terraformer.MultiPolygon";this.coordinates=e}this.type="MultiPolygon"}function F(e){if(e&&"Feature"===e.type)i(this,e);else{if(!(e&&e.type&&e.coordinates))throw"Terraformer: invalid input for Terraformer.Feature";this.geometry=e}this.type="Feature"}function U(e){if(e&&"FeatureCollection"===e.type&&e.features)i(this,e);else{if(!n(e))throw"Terraformer: invalid input for Terraformer.FeatureCollection";this.features=e}this.type="FeatureCollection"}function j(e){if(e&&"GeometryCollection"===e.type&&e.geometries)i(this,e);else if(n(e))this.geometries=e;else{if(!e.coordinates||!e.type)throw"Terraformer: invalid input for Terraformer.GeometryCollection";this.type="GeometryCollection",this.geometries=[e]}this.type="GeometryCollection"}function G(e,t,r){for(var n=p(e),i=r||64,o={type:"Polygon",coordinates:[[]]},a=1;a<=i;a++){var s=a*(360/i)*Math.PI/180;o.coordinates[0].push([n[0]+t*Math.cos(s),n[1]+t*Math.sin(s)])}return o.coordinates=C(o.coordinates),m(o)}function B(e,t,r){var n=r||64,o=t||250;if(!e||e.length<2||!o||!n)throw new Error("Terraformer: missing parameter for Terraformer.Circle");i(this,new F({type:"Feature",geometry:G(e,o,n),properties:{radius:o,center:e,steps:n}}))}return D.prototype.toMercator=function(){return d(this)},D.prototype.toGeographic=function(){return m(this)},D.prototype.envelope=function(){return s(this)},D.prototype.bbox=function(){return o(this)},D.prototype.convexHull=function(){var e,t,r=[];if("Point"===this.type)return null;if("LineString"===this.type||"MultiPoint"===this.type){if(!(this.coordinates&&this.coordinates.length>=3))return null;r=this.coordinates}else if("Polygon"===this.type||"MultiLineString"===this.type){if(!(this.coordinates&&this.coordinates.length>0))return null;for(e=0;e<this.coordinates.length;e++)r=r.concat(this.coordinates[e]);if(r.length<3)return null}else if("MultiPolygon"===this.type){if(!(this.coordinates&&this.coordinates.length>0))return null;for(e=0;e<this.coordinates.length;e++)for(t=0;t<this.coordinates[e].length;t++)r=r.concat(this.coordinates[e][t]);if(r.length<3)return null}else if("Feature"===this.type)return new D(this.geometry).convexHull();return new L({type:"Polygon",coordinates:C([w(r)])})},D.prototype.toJSON=function(){var e={};for(var t in this)this.hasOwnProperty(t)&&-1===P.indexOf(t)&&(e[t]=this[t]);return e.bbox=o(this),e},D.prototype.contains=function(e){return new D(e).within(this)},D.prototype.within=function(e){var t,r,n;if("Feature"===e.type&&(e=e.geometry),"Point"===e.type&&"Point"===this.type)return A(this.coordinates,e.coordinates);if("MultiLineString"===e.type&&"Point"===this.type)for(t=0;t<e.coordinates.length;t++){var i={type:"LineString",coordinates:e.coordinates[t]};if(this.within(i))return!0}if(("LineString"===e.type||"MultiPoint"===e.type)&&"Point"===this.type)for(t=0;t<e.coordinates.length;t++){if(this.coordinates.length!==e.coordinates[t].length)return!1;if(A(this.coordinates,e.coordinates[t]))return!0}if("Polygon"===e.type){if("Polygon"===this.type){if(e.coordinates.length===this.coordinates.length)for(t=0;t<this.coordinates.length;t++)if(M(this.coordinates[t],e.coordinates[t]))return!0;return!(!this.coordinates.length||!E(e.coordinates,this.coordinates[0][0])||T(C(this.coordinates),C(e.coordinates)))}if("Point"===this.type)return E(e.coordinates,this.coordinates);if("LineString"===this.type||"MultiPoint"===this.type){if(!this.coordinates||0===this.coordinates.length)return!1;for(t=0;t<this.coordinates.length;t++)if(!1===E(e.coordinates,this.coordinates[t]))return!1;return!0}if("MultiLineString"===this.type){for(t=0;t<this.coordinates.length;t++)if(!1===new R(this.coordinates[t]).within(e))return n++,!1;return!0}if("MultiPolygon"===this.type){for(t=0;t<this.coordinates.length;t++)if(!1===new D({type:"Polygon",coordinates:this.coordinates[t]}).within(e))return!1;return!0}}if("MultiPolygon"===e.type){if("Point"===this.type){if(e.coordinates.length)for(t=0;t<e.coordinates.length;t++)if(E(e.coordinates[t],this.coordinates)&&!1===T([this.coordinates],e.coordinates))return!0;return!1}if("Polygon"===this.type){for(t=0;t<this.coordinates.length;t++)if(e.coordinates[t].length===this.coordinates.length)for(r=0;r<this.coordinates.length;r++)if(M(this.coordinates[r],e.coordinates[t][r]))return!0;if(!1===T(this.coordinates,e.coordinates)&&e.coordinates.length){for(t=0;t<e.coordinates.length;t++)n=!1!==E(e.coordinates[t],this.coordinates[0][0]);return n}}else if("LineString"===this.type||"MultiPoint"===this.type)for(t=0;t<e.coordinates.length;t++){var o={type:"Polygon",coordinates:e.coordinates[t]};return!!this.within(o)}else{if("MultiLineString"===this.type){for(t=0;t<this.coordinates.length;t++)if(!1===new R(this.coordinates[t]).within(e))return!1;return!0}if("MultiPolygon"===this.type){for(t=0;t<e.coordinates.length;t++){var a={type:"Polygon",coordinates:e.coordinates[t]};if(!1===this.within(a))return!1}return!0}}}return!1},D.prototype.intersects=function(e){"Feature"===e.type&&(e=e.geometry);var t=new D(e);return!(!this.within(e)&&!t.within(this))||("Point"!==this.type&&"MultiPoint"!==this.type&&"Point"!==e.type&&"MultiPoint"!==e.type?T(this.coordinates,e.coordinates):"Feature"===this.type?new D(this.geometry).intersects(e):(function(){var e=Array.prototype.slice.apply(arguments);void 0!==typeof console&&console.warn&&console.warn.apply(console,e)}("Type "+this.type+" to "+e.type+" intersection is not supported by intersects"),!1))},I.prototype=new D,I.prototype.constructor=I,k.prototype=new D,k.prototype.constructor=k,k.prototype.forEach=function(e){for(var t=0;t<this.coordinates.length;t++)e.apply(this,[this.coordinates[t],t,this.coordinates]);return this},k.prototype.addPoint=function(e){return this.coordinates.push(e),this},k.prototype.insertPoint=function(e,t){return this.coordinates.splice(t,0,e),this},k.prototype.removePoint=function(e){return"number"==typeof e?this.coordinates.splice(e,1):this.coordinates.splice(this.coordinates.indexOf(e),1),this},k.prototype.get=function(e){return new I(this.coordinates[e])},R.prototype=new D,R.prototype.constructor=R,R.prototype.addVertex=function(e){return this.coordinates.push(e),this},R.prototype.insertVertex=function(e,t){return this.coordinates.splice(t,0,e),this},R.prototype.removeVertex=function(e){return this.coordinates.splice(e,1),this},O.prototype=new D,O.prototype.constructor=O,O.prototype.forEach=function(e){for(var t=0;t<this.coordinates.length;t++)e.apply(this,[this.coordinates[t],t,this.coordinates])},O.prototype.get=function(e){return new R(this.coordinates[e])},L.prototype=new D,L.prototype.constructor=L,L.prototype.addVertex=function(e){return this.insertVertex(e,this.coordinates[0].length-1),this},L.prototype.insertVertex=function(e,t){return this.coordinates[0].splice(t,0,e),this},L.prototype.removeVertex=function(e){return this.coordinates[0].splice(e,1),this},L.prototype.close=function(){this.coordinates=C(this.coordinates)},L.prototype.hasHoles=function(){return this.coordinates.length>1},L.prototype.holes=function(){var e=[];if(this.hasHoles())for(var t=1;t<this.coordinates.length;t++)e.push(new L([this.coordinates[t]]));return e},_.prototype=new D,_.prototype.constructor=_,_.prototype.forEach=function(e){for(var t=0;t<this.coordinates.length;t++)e.apply(this,[this.coordinates[t],t,this.coordinates])},_.prototype.get=function(e){return new L(this.coordinates[e])},_.prototype.close=function(){var e=[];return this.forEach((function(t){e.push(C(t))})),this.coordinates=e,this},F.prototype=new D,F.prototype.constructor=F,U.prototype=new D,U.prototype.constructor=U,U.prototype.forEach=function(e){for(var t=0;t<this.features.length;t++)e.apply(this,[this.features[t],t,this.features])},U.prototype.get=function(e){var t;return this.forEach((function(r){r.id===e&&(t=r)})),new F(t)},j.prototype=new D,j.prototype.constructor=j,j.prototype.forEach=function(e){for(var t=0;t<this.geometries.length;t++)e.apply(this,[this.geometries[t],t,this.geometries])},j.prototype.get=function(e){return new D(this.geometries[e])},B.prototype=new D,B.prototype.constructor=B,B.prototype.recalculate=function(){return this.geometry=G(this.properties.center,this.properties.radius,this.properties.steps),this},B.prototype.center=function(e){return e&&(this.properties.center=e,this.recalculate()),this.properties.center},B.prototype.radius=function(e){return e&&(this.properties.radius=e,this.recalculate()),this.properties.radius},B.prototype.steps=function(e){return e&&(this.properties.steps=e,this.recalculate()),this.properties.steps},B.prototype.toJSON=function(){return D.prototype.toJSON.call(this)},e.Primitive=D,e.Point=I,e.MultiPoint=k,e.LineString=R,e.MultiLineString=O,e.Polygon=L,e.MultiPolygon=_,e.Feature=F,e.FeatureCollection=U,e.GeometryCollection=j,e.Circle=B,e.toMercator=d,e.toGeographic=m,e.Tools={},e.Tools.positionToMercator=p,e.Tools.positionToGeographic=f,e.Tools.applyConverter=h,e.Tools.toMercator=d,e.Tools.toGeographic=m,e.Tools.createCircle=G,e.Tools.calculateBounds=o,e.Tools.calculateEnvelope=s,e.Tools.coordinatesContainPoint=N,e.Tools.polygonContainsPoint=E,e.Tools.arraysIntersectArrays=T,e.Tools.coordinatesContainPoint=N,e.Tools.coordinatesEqual=M,e.Tools.convexHull=w,e.Tools.isConvex=function(e){for(var t,r=0;r<e.length-3;r++){var n=e[r],i=e[r+1],o=e[r+2],a=[i[0]-n[0],i[1]-n[1]],s=o[0]*a[1]-o[1]*a[0]+a[0]*n[1]-a[1]*n[0];if(0===r)t=s<0;else if(t&&s>0||!t&&s<0)return!1}return!0},e.MercatorCRS=r,e.GeographicCRS={type:"link",properties:{href:"http://spatialreference.org/ref/epsg/4326/ogcwkt/",type:"ogcwkt"}},e},"object"==typeof e.exports&&(e.exports=r()),"object"==typeof window&&(this.Terraformer=r())},737:e=>{(e.exports=function e(t,r){var n;if(null!=t)return r=(r||"").replace(/[^&"<>\']/g,""),n="([&\"<>'])".replace(new RegExp("["+r+"]","g"),""),t.replace(new RegExp(n,"g"),(function(t,r){return e.map[r]}))}).map={">":">","<":"<","'":"'",'"':""","&":"&"}},596:(e,t)=>{"use strict";function r(e,t){return void 0===t&&(t=Object),t&&"function"==typeof t.freeze?t.freeze(e):e}var n=r({HTML:"text/html",isHTML:function(e){return e===n.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),i=r({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===i.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});t.freeze=r,t.MIME_TYPE=n,t.NAMESPACE=i},346:(e,t,r)=>{var n=r(596),i=r(905),o=r(809),a=r(80),s=i.DOMImplementation,u=n.NAMESPACE,l=a.ParseError,c=a.XMLReader;function f(e){return e.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function p(e){this.options=e||{locator:{}}}function h(){this.cdata=!1}function d(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function m(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function g(e,t,r){return"string"==typeof e?e.substr(t,r):e.length>=t+r||t?new java.lang.String(e,t,r)+"":e}function y(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}p.prototype.parseFromString=function(e,t){var r=this.options,n=new c,i=r.domBuilder||new h,a=r.errorHandler,s=r.locator,l=r.xmlns||{},p=/\/x?html?$/.test(t),d=p?o.HTML_ENTITIES:o.XML_ENTITIES;s&&i.setDocumentLocator(s),n.errorHandler=function(e,t,r){if(!e){if(t instanceof h)return t;e=t}var n={},i=e instanceof Function;function o(t){var o=e[t];!o&&i&&(o=2==e.length?function(r){e(t,r)}:e),n[t]=o&&function(e){o("[xmldom "+t+"]\t"+e+m(r))}||function(){}}return r=r||{},o("warning"),o("error"),o("fatalError"),n}(a,i,s),n.domBuilder=r.domBuilder||i,p&&(l[""]=u.HTML),l.xml=l.xml||u.XML;var g=r.normalizeLineEndings||f;return e&&"string"==typeof e?n.parse(g(e),l,d):n.errorHandler.error("invalid doc source"),i.doc},h.prototype={startDocument:function(){this.doc=(new s).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,r,n){var i=this.doc,o=i.createElementNS(e,r||t),a=n.length;y(this,o),this.currentElement=o,this.locator&&d(this.locator,o);for(var s=0;s<a;s++){e=n.getURI(s);var u=n.getValue(s),l=(r=n.getQName(s),i.createAttributeNS(e,r));this.locator&&d(n.getLocator(s),l),l.value=l.nodeValue=u,o.setAttributeNode(l)}},endElement:function(e,t,r){var n=this.currentElement;n.tagName,this.currentElement=n.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var r=this.doc.createProcessingInstruction(e,t);this.locator&&d(this.locator,r),y(this,r)},ignorableWhitespace:function(e,t,r){},characters:function(e,t,r){if(e=g.apply(this,arguments)){if(this.cdata)var n=this.doc.createCDATASection(e);else n=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(e)&&this.doc.appendChild(n),this.locator&&d(this.locator,n)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,r){e=g.apply(this,arguments);var n=this.doc.createComment(e);this.locator&&d(this.locator,n),y(this,n)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,r){var n=this.doc.implementation;if(n&&n.createDocumentType){var i=n.createDocumentType(e,t,r);this.locator&&d(this.locator,i),y(this,i),this.doc.doctype=i}},warning:function(e){console.warn("[xmldom warning]\t"+e,m(this.locator))},error:function(e){console.error("[xmldom error]\t"+e,m(this.locator))},fatalError:function(e){throw new l(e,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,(function(e){h.prototype[e]=function(){return null}})),t.DOMParser=p},905:(e,t,r)=>{var n=r(596).NAMESPACE;function i(e){return""!==e}function o(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function a(e){if(!e)return[];var t=function(e){return e?e.split(/[\t\n\f\r ]+/).filter(i):[]}(e);return Object.keys(t.reduce(o,{}))}function s(e,t){for(var r in e)t[r]=e[r]}function u(e,t){var r=e.prototype;if(!(r instanceof t)){function n(){}n.prototype=t.prototype,s(r,n=new n),e.prototype=r=n}r.constructor!=e&&("function"!=typeof e&&console.error("unknown Class:"+e),r.constructor=e)}var l={},c=l.ELEMENT_NODE=1,f=l.ATTRIBUTE_NODE=2,p=l.TEXT_NODE=3,h=l.CDATA_SECTION_NODE=4,d=l.ENTITY_REFERENCE_NODE=5,m=l.ENTITY_NODE=6,g=l.PROCESSING_INSTRUCTION_NODE=7,y=l.COMMENT_NODE=8,v=l.DOCUMENT_NODE=9,b=l.DOCUMENT_TYPE_NODE=10,w=l.DOCUMENT_FRAGMENT_NODE=11,N=l.NOTATION_NODE=12,E={},S={},x=(E.INDEX_SIZE_ERR=(S[1]="Index size error",1),E.DOMSTRING_SIZE_ERR=(S[2]="DOMString size error",2),E.HIERARCHY_REQUEST_ERR=(S[3]="Hierarchy request error",3)),T=(E.WRONG_DOCUMENT_ERR=(S[4]="Wrong document",4),E.INVALID_CHARACTER_ERR=(S[5]="Invalid character",5),E.NO_DATA_ALLOWED_ERR=(S[6]="No data allowed",6),E.NO_MODIFICATION_ALLOWED_ERR=(S[7]="No modification allowed",7),E.NOT_FOUND_ERR=(S[8]="Not found",8)),C=(E.NOT_SUPPORTED_ERR=(S[9]="Not supported",9),E.INUSE_ATTRIBUTE_ERR=(S[10]="Attribute in use",10));function A(e,t){if(t instanceof Error)var r=t;else r=this,Error.call(this,S[e]),this.message=S[e],Error.captureStackTrace&&Error.captureStackTrace(this,A);return r.code=e,t&&(this.message=this.message+": "+t),r}function M(){}function P(e,t){this._node=e,this._refresh=t,D(this)}function D(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!=t){var r=e._refresh(e._node);le(e,"length",r.length),s(r,e),e._inc=t}}function I(){}function k(e,t){for(var r=e.length;r--;)if(e[r]===t)return r}function R(e,t,r,i){if(i?t[k(t,i)]=r:t[t.length++]=r,e){r.ownerElement=e;var o=e.ownerDocument;o&&(i&&G(o,e,i),function(e,t,r){e&&e._inc++,r.namespaceURI===n.XMLNS&&(t._nsMap[r.prefix?r.localName:""]=r.value)}(o,e,r))}}function O(e,t,r){var n=k(t,r);if(!(n>=0))throw A(T,new Error(e.tagName+"@"+r));for(var i=t.length-1;n<i;)t[n]=t[++n];if(t.length=i,e){var o=e.ownerDocument;o&&(G(o,e,r),r.ownerElement=null)}}function L(){}function _(){}function F(e){return("<"==e?"<":">"==e&&">")||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function U(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(U(e,t))return!0}while(e=e.nextSibling)}function j(){}function G(e,t,r,i){e&&e._inc++,r.namespaceURI===n.XMLNS&&delete t._nsMap[r.prefix?r.localName:""]}function B(e,t,r){if(e&&e._inc){e._inc++;var n=t.childNodes;if(r)n[n.length++]=r;else{for(var i=t.firstChild,o=0;i;)n[o++]=i,i=i.nextSibling;n.length=o,delete n[n.length]}}}function H(e,t){var r=t.previousSibling,n=t.nextSibling;return r?r.nextSibling=n:e.firstChild=n,n?n.previousSibling=r:e.lastChild=r,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,B(e.ownerDocument,e),t}function V(e,t,r){var n=t.parentNode;if(n&&n.removeChild(t),t.nodeType===w){var i=t.firstChild;if(null==i)return t;var o=t.lastChild}else i=o=t;var a=r?r.previousSibling:e.lastChild;i.previousSibling=a,o.nextSibling=r,a?a.nextSibling=i:e.firstChild=i,null==r?e.lastChild=o:r.previousSibling=o;do{i.parentNode=e}while(i!==o&&(i=i.nextSibling));return B(e.ownerDocument||e,e),t.nodeType==w&&(t.firstChild=t.lastChild=null),t}function $(){this._nsMap={}}function q(){}function z(){}function X(){}function Q(){}function Y(){}function W(){}function J(){}function K(){}function Z(){}function ee(){}function te(){}function re(){}function ne(e,t){var r=[],n=9==this.nodeType&&this.documentElement||this,i=n.prefix,o=n.namespaceURI;if(o&&null==i&&null==(i=n.lookupPrefix(o)))var a=[{namespace:o,prefix:null}];return ae(this,r,e,t,a),r.join("")}function ie(e,t,r){var i=e.prefix||"",o=e.namespaceURI;if(!o)return!1;if("xml"===i&&o===n.XML||o===n.XMLNS)return!1;for(var a=r.length;a--;){var s=r[a];if(s.prefix===i)return s.namespace!==o}return!0}function oe(e,t,r){e.push(" ",t,'="',r.replace(/[<&"\t\n\r]/g,F),'"')}function ae(e,t,r,i,o){if(o||(o=[]),i){if(!(e=i(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case c:var a=e.attributes,s=a.length,u=e.firstChild,l=e.tagName,m=l;if(!(r=n.isHTML(e.namespaceURI)||r)&&!e.prefix&&e.namespaceURI){for(var N,E=0;E<a.length;E++)if("xmlns"===a.item(E).name){N=a.item(E).value;break}if(!N)for(var S=o.length-1;S>=0;S--)if(""===(x=o[S]).prefix&&x.namespace===e.namespaceURI){N=x.namespace;break}if(N!==e.namespaceURI)for(S=o.length-1;S>=0;S--){var x;if((x=o[S]).namespace===e.namespaceURI){x.prefix&&(m=x.prefix+":"+l);break}}}t.push("<",m);for(var T=0;T<s;T++)"xmlns"==(C=a.item(T)).prefix?o.push({prefix:C.localName,namespace:C.value}):"xmlns"==C.nodeName&&o.push({prefix:"",namespace:C.value});for(T=0;T<s;T++){var C,A,M;ie(C=a.item(T),0,o)&&(oe(t,(A=C.prefix||"")?"xmlns:"+A:"xmlns",M=C.namespaceURI),o.push({prefix:A,namespace:M})),ae(C,t,r,i,o)}if(l===m&&ie(e,0,o)&&(oe(t,(A=e.prefix||"")?"xmlns:"+A:"xmlns",M=e.namespaceURI),o.push({prefix:A,namespace:M})),u||r&&!/^(?:meta|link|img|br|hr|input)$/i.test(l)){if(t.push(">"),r&&/^script$/i.test(l))for(;u;)u.data?t.push(u.data):ae(u,t,r,i,o.slice()),u=u.nextSibling;else for(;u;)ae(u,t,r,i,o.slice()),u=u.nextSibling;t.push("</",m,">")}else t.push("/>");return;case v:case w:for(u=e.firstChild;u;)ae(u,t,r,i,o.slice()),u=u.nex