UNPKG

maplibre-gl-measures

Version:

Length and area measurements with linestrings and polygons

1 lines 104 kB
var maplibreGLMeasures;(()=>{var e={4:e=>{var t,r;t={"min/km":{name:{singular:"Minute per kilometre",plural:"Minutes per kilometre"},to_anchor:.06},"s/m":{name:{singular:"Second per metre",plural:"Seconds per metre"},to_anchor:1}},r={"min/mi":{name:{singular:"Minute per mile",plural:"Minutes per mile"},to_anchor:.0113636},"s/ft":{name:{singular:"Second per foot",plural:"Seconds per foot"},to_anchor:1}},e.exports={metric:t,imperial:r,_anchors:{metric:{unit:"s/m",ratio:.3048},imperial:{unit:"s/ft",ratio:1/.3048}}}},17:e=>{"use strict";e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(o=n;0!=o--;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(i=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;0!=o--;){var a=i[o];if(!e(t[a],r[a]))return!1}return!0}return t!=t&&r!=r}},30:(e,t,r)=>{var n=r(813),o=Object.prototype.hasOwnProperty;e.exports=function(e){var t,r=e,i=[];if(!r)return i;if(!n[typeof e])return i;for(t in r)o.call(r,t)&&i.push(t);return i}},41:(e,t,r)=>{var n=r(514),o=(r(177),r(923));e.exports=function(e,t){return arguments.length>2?n(e,17,o(arguments,2),null,t):n(e,1,null,null,t)}},86:e=>{var t;t={A:{name:{singular:"Ampere",plural:"Amperes"},to_anchor:1},mA:{name:{singular:"Milliampere",plural:"Milliamperes"},to_anchor:.001},kA:{name:{singular:"Kiloampere",plural:"Kiloamperes"},to_anchor:1e3}},e.exports={metric:t,_anchors:{metric:{unit:"A",ratio:1}}}},99:e=>{var t;t={Wh:{name:{singular:"Watt-hour",plural:"Watt-hours"},to_anchor:3600},mWh:{name:{singular:"Milliwatt-hour",plural:"Milliwatt-hours"},to_anchor:3.6},kWh:{name:{singular:"Kilowatt-hour",plural:"Kilowatt-hours"},to_anchor:36e5},MWh:{name:{singular:"Megawatt-hour",plural:"Megawatt-hours"},to_anchor:36e8},GWh:{name:{singular:"Gigawatt-hour",plural:"Gigawatt-hours"},to_anchor:36e11},J:{name:{singular:"Joule",plural:"Joules"},to_anchor:1},kJ:{name:{singular:"Kilojoule",plural:"Kilojoules"},to_anchor:1e3}},e.exports={metric:t,_anchors:{metric:{unit:"J",ratio:1}}}},133:e=>{var t;t={ppm:{name:{singular:"Part-per Million",plural:"Parts-per Million"},to_anchor:1},ppb:{name:{singular:"Part-per Billion",plural:"Parts-per Billion"},to_anchor:.001},ppt:{name:{singular:"Part-per Trillion",plural:"Parts-per Trillion"},to_anchor:1e-6},ppq:{name:{singular:"Part-per Quadrillion",plural:"Parts-per Quadrillion"},to_anchor:1e-9}},e.exports={metric:t,imperial:{},_anchors:{metric:{unit:"ppm",ratio:1e-6}}}},157:e=>{var t;t={VA:{name:{singular:"Volt-Ampere",plural:"Volt-Amperes"},to_anchor:1},mVA:{name:{singular:"Millivolt-Ampere",plural:"Millivolt-Amperes"},to_anchor:.001},kVA:{name:{singular:"Kilovolt-Ampere",plural:"Kilovolt-Amperes"},to_anchor:1e3},MVA:{name:{singular:"Megavolt-Ampere",plural:"Megavolt-Amperes"},to_anchor:1e6},GVA:{name:{singular:"Gigavolt-Ampere",plural:"Gigavolt-Amperes"},to_anchor:1e9}},e.exports={metric:t,_anchors:{metric:{unit:"VA",ratio:1}}}},160:e=>{e.exports=function(e){return e}},170:e=>{var t,r;t={lx:{name:{singular:"Lux",plural:"Lux"},to_anchor:1}},r={"ft-cd":{name:{singular:"Foot-candle",plural:"Foot-candles"},to_anchor:1}},e.exports={metric:t,imperial:r,_anchors:{metric:{unit:"lx",ratio:1/10.76391},imperial:{unit:"ft-cd",ratio:10.76391}}}},177:e=>{var t=Object.prototype.toString,r=RegExp("^"+String(t).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$");e.exports=r},183:e=>{var t,r;t={b:{name:{singular:"Bit",plural:"Bits"},to_anchor:1},Kb:{name:{singular:"Kilobit",plural:"Kilobits"},to_anchor:1024},Mb:{name:{singular:"Megabit",plural:"Megabits"},to_anchor:1048576},Gb:{name:{singular:"Gigabit",plural:"Gigabits"},to_anchor:1073741824},Tb:{name:{singular:"Terabit",plural:"Terabits"},to_anchor:1099511627776}},r={B:{name:{singular:"Byte",plural:"Bytes"},to_anchor:1},KB:{name:{singular:"Kilobyte",plural:"Kilobytes"},to_anchor:1024},MB:{name:{singular:"Megabyte",plural:"Megabytes"},to_anchor:1048576},GB:{name:{singular:"Gigabyte",plural:"Gigabytes"},to_anchor:1073741824},TB:{name:{singular:"Terabyte",plural:"Terabytes"},to_anchor:1099511627776}},e.exports={bits:t,bytes:r,_anchors:{bits:{unit:"b",ratio:1/8},bytes:{unit:"B",ratio:8}}}},186:e=>{e.exports=function(e){if(!e||!e.type)return null;var r=t[e.type];return r?"geometry"===r?{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:e}]}:"feature"===r?{type:"FeatureCollection",features:[e]}:"featurecollection"===r?e:void 0:null};var t={Point:"geometry",MultiPoint:"geometry",LineString:"geometry",MultiLineString:"geometry",Polygon:"geometry",MultiPolygon:"geometry",GeometryCollection:"geometry",Feature:"feature",FeatureCollection:"featurecollection"}},237:e=>{var t;t={W:{name:{singular:"Watt",plural:"Watts"},to_anchor:1},mW:{name:{singular:"Milliwatt",plural:"Milliwatts"},to_anchor:.001},kW:{name:{singular:"Kilowatt",plural:"Kilowatts"},to_anchor:1e3},MW:{name:{singular:"Megawatt",plural:"Megawatts"},to_anchor:1e6},GW:{name:{singular:"Gigawatt",plural:"Gigawatts"},to_anchor:1e9}},e.exports={metric:t,_anchors:{metric:{unit:"W",ratio:1}}}},241:e=>{var t;t={mHz:{name:{singular:"millihertz",plural:"millihertz"},to_anchor:.001},Hz:{name:{singular:"hertz",plural:"hertz"},to_anchor:1},kHz:{name:{singular:"kilohertz",plural:"kilohertz"},to_anchor:1e3},MHz:{name:{singular:"megahertz",plural:"megahertz"},to_anchor:1e6},GHz:{name:{singular:"gigahertz",plural:"gigahertz"},to_anchor:1e9},THz:{name:{singular:"terahertz",plural:"terahertz"},to_anchor:1e12},rpm:{name:{singular:"rotation per minute",plural:"rotations per minute"},to_anchor:1/60},"deg/s":{name:{singular:"degree per second",plural:"degrees per second"},to_anchor:1/360},"rad/s":{name:{singular:"radian per second",plural:"radians per second"},to_anchor:1/(2*Math.PI)}},e.exports={metric:t,_anchors:{frequency:{unit:"hz",ratio:1}}}},257:e=>{var t;t={V:{name:{singular:"Volt",plural:"Volts"},to_anchor:1},mV:{name:{singular:"Millivolt",plural:"Millivolts"},to_anchor:.001},kV:{name:{singular:"Kilovolt",plural:"Kilovolts"},to_anchor:1e3}},e.exports={metric:t,_anchors:{metric:{unit:"V",ratio:1}}}},264:e=>{var t,r;t={Pa:{name:{singular:"pascal",plural:"pascals"},to_anchor:.001},kPa:{name:{singular:"kilopascal",plural:"kilopascals"},to_anchor:1},MPa:{name:{singular:"megapascal",plural:"megapascals"},to_anchor:1e3},hPa:{name:{singular:"hectopascal",plural:"hectopascals"},to_anchor:.1},bar:{name:{singular:"bar",plural:"bar"},to_anchor:100},torr:{name:{singular:"torr",plural:"torr"},to_anchor:101325/76e4}},r={psi:{name:{singular:"pound per square inch",plural:"pounds per square inch"},to_anchor:.001},ksi:{name:{singular:"kilopound per square inch",plural:"kilopound per square inch"},to_anchor:1}},e.exports={metric:t,imperial:r,_anchors:{metric:{unit:"kPa",ratio:.00014503768078},imperial:{unit:"psi",ratio:6894.76000045014}}}},315:e=>{var t,r;t={mm:{name:{singular:"Millimeter",plural:"Millimeters"},to_anchor:.001},cm:{name:{singular:"Centimeter",plural:"Centimeters"},to_anchor:.01},m:{name:{singular:"Meter",plural:"Meters"},to_anchor:1},km:{name:{singular:"Kilometer",plural:"Kilometers"},to_anchor:1e3}},r={in:{name:{singular:"Inch",plural:"Inches"},to_anchor:1/12},yd:{name:{singular:"Yard",plural:"Yards"},to_anchor:3},"ft-us":{name:{singular:"US Survey Foot",plural:"US Survey Feet"},to_anchor:1.000002},ft:{name:{singular:"Foot",plural:"Feet"},to_anchor:1},mi:{name:{singular:"Mile",plural:"Miles"},to_anchor:5280}},e.exports={metric:t,imperial:r,_anchors:{metric:{unit:"m",ratio:3.28084},imperial:{unit:"ft",ratio:1/3.28084}}}},445:e=>{var t,r;t={mm3:{name:{singular:"Cubic Millimeter",plural:"Cubic Millimeters"},to_anchor:1e-6},cm3:{name:{singular:"Cubic Centimeter",plural:"Cubic Centimeters"},to_anchor:.001},ml:{name:{singular:"Millilitre",plural:"Millilitres"},to_anchor:.001},cl:{name:{singular:"Centilitre",plural:"Centilitres"},to_anchor:.01},dl:{name:{singular:"Decilitre",plural:"Decilitres"},to_anchor:.1},l:{name:{singular:"Litre",plural:"Litres"},to_anchor:1},kl:{name:{singular:"Kilolitre",plural:"Kilolitres"},to_anchor:1e3},m3:{name:{singular:"Cubic meter",plural:"Cubic meters"},to_anchor:1e3},km3:{name:{singular:"Cubic kilometer",plural:"Cubic kilometers"},to_anchor:1e12},krm:{name:{singular:"Matsked",plural:"Matskedar"},to_anchor:.001},tsk:{name:{singular:"Tesked",plural:"Teskedar"},to_anchor:.005},msk:{name:{singular:"Matsked",plural:"Matskedar"},to_anchor:.015},kkp:{name:{singular:"Kaffekopp",plural:"Kaffekoppar"},to_anchor:.15},glas:{name:{singular:"Glas",plural:"Glas"},to_anchor:.2},kanna:{name:{singular:"Kanna",plural:"Kannor"},to_anchor:2.617}},r={tsp:{name:{singular:"Teaspoon",plural:"Teaspoons"},to_anchor:1/6},Tbs:{name:{singular:"Tablespoon",plural:"Tablespoons"},to_anchor:.5},in3:{name:{singular:"Cubic inch",plural:"Cubic inches"},to_anchor:.55411},"fl-oz":{name:{singular:"Fluid Ounce",plural:"Fluid Ounces"},to_anchor:1},cup:{name:{singular:"Cup",plural:"Cups"},to_anchor:8},pnt:{name:{singular:"Pint",plural:"Pints"},to_anchor:16},qt:{name:{singular:"Quart",plural:"Quarts"},to_anchor:32},gal:{name:{singular:"Gallon",plural:"Gallons"},to_anchor:128},ft3:{name:{singular:"Cubic foot",plural:"Cubic feet"},to_anchor:957.506},yd3:{name:{singular:"Cubic yard",plural:"Cubic yards"},to_anchor:25852.7}},e.exports={metric:t,imperial:r,_anchors:{metric:{unit:"l",ratio:33.8140226},imperial:{unit:"fl-oz",ratio:1/33.8140226}}}},447:(e,t,r)=>{var n=r(889),o=r(618),i=r(813);e.exports=function(e,t,r){var a,s=e,l=s;if(!s)return l;if(!i[typeof s])return l;t=t&&void 0===r?t:n(t,r,3);for(var c=-1,u=i[typeof s]&&o(s),p=u?u.length:0;++c<p;)if(!1===t(s[a=u[c]],a,e))return l;return l}},450:(e,t,r)=>{var n=r(669),o=(r(714),r(177).test(o=Object.create)&&o);function i(e,t){return n(e)?o(e):{}}o||(i=function(){function e(){}return function(t){if(n(t)){e.prototype=t;var o=new e;e.prototype=null}return o||r.g.Object()}}()),e.exports=i},466:e=>{var t;t={ea:{name:{singular:"Each",plural:"Each"},to_anchor:1},dz:{name:{singular:"Dozen",plural:"Dozens"},to_anchor:12}},e.exports={metric:t,imperial:{},_anchors:{metric:{unit:"ea",ratio:1}}}},467:e=>{var t;t={VAR:{name:{singular:"Volt-Ampere Reactive",plural:"Volt-Amperes Reactive"},to_anchor:1},mVAR:{name:{singular:"Millivolt-Ampere Reactive",plural:"Millivolt-Amperes Reactive"},to_anchor:.001},kVAR:{name:{singular:"Kilovolt-Ampere Reactive",plural:"Kilovolt-Amperes Reactive"},to_anchor:1e3},MVAR:{name:{singular:"Megavolt-Ampere Reactive",plural:"Megavolt-Amperes Reactive"},to_anchor:1e6},GVAR:{name:{singular:"Gigavolt-Ampere Reactive",plural:"Gigavolt-Amperes Reactive"},to_anchor:1e9}},e.exports={metric:t,_anchors:{metric:{unit:"VAR",ratio:1}}}},472:e=>{var t;t={rad:{name:{singular:"radian",plural:"radians"},to_anchor:180/Math.PI},deg:{name:{singular:"degree",plural:"degrees"},to_anchor:1},grad:{name:{singular:"gradian",plural:"gradians"},to_anchor:.9},arcmin:{name:{singular:"arcminute",plural:"arcminutes"},to_anchor:1/60},arcsec:{name:{singular:"arcsecond",plural:"arcseconds"},to_anchor:1/3600}},e.exports={metric:t,_anchors:{metric:{unit:"deg",ratio:1}}}},496:e=>{var t,r;t={"m/s":{name:{singular:"Metre per second",plural:"Metres per second"},to_anchor:3.6},"km/h":{name:{singular:"Kilometre per hour",plural:"Kilometres per hour"},to_anchor:1}},r={"m/h":{name:{singular:"Mile per hour",plural:"Miles per hour"},to_anchor:1},knot:{name:{singular:"Knot",plural:"Knots"},to_anchor:1.150779},"ft/s":{name:{singular:"Foot per second",plural:"Feet per second"},to_anchor:.681818}},e.exports={metric:t,imperial:r,_anchors:{metric:{unit:"km/h",ratio:1/1.609344},imperial:{unit:"m/h",ratio:1.609344}}}},503:e=>{var t,r;t={mcg:{name:{singular:"Microgram",plural:"Micrograms"},to_anchor:1e-6},mg:{name:{singular:"Milligram",plural:"Milligrams"},to_anchor:.001},g:{name:{singular:"Gram",plural:"Grams"},to_anchor:1},kg:{name:{singular:"Kilogram",plural:"Kilograms"},to_anchor:1e3},mt:{name:{singular:"Metric Tonne",plural:"Metric Tonnes"},to_anchor:1e6}},r={oz:{name:{singular:"Ounce",plural:"Ounces"},to_anchor:1/16},lb:{name:{singular:"Pound",plural:"Pounds"},to_anchor:1},t:{name:{singular:"Ton",plural:"Tons"},to_anchor:2e3}},e.exports={metric:t,imperial:r,_anchors:{metric:{unit:"g",ratio:1/453.592},imperial:{unit:"lb",ratio:453.592}}}},514:(e,t,r)=>{var n=r(521),o=r(737),i=r(710),a=[].push;e.exports=function e(t,r,s,l,c,u){var p=1&r,h=4&r,d=16&r,m=32&r;if(!(2&r||i(t)))throw new TypeError;d&&!s.length&&(r&=-17,d=s=!1),m&&!l.length&&(r&=-33,m=l=!1);var g=t&&t.__bindData__;return g&&!0!==g?(g=g.slice(),!p||1&g[1]||(g[4]=c),!p&&1&g[1]&&(r|=8),!h||4&g[1]||(g[5]=u),d&&a.apply(g[2]||(g[2]=[]),s),m&&a.apply(g[3]||(g[3]=[]),l),g[1]|=r,e.apply(null,g)):(1==r||17===r?n:o)([t,r,s,l,c,u])}},521:(e,t,r)=>{var n=r(450),o=r(669),i=r(794),a=[].push;e.exports=function(e){var t=e[0],r=e[2],s=e[4];function l(){if(r){var e=r.slice();a.apply(e,arguments)}if(this instanceof l){var i=n(t.prototype),c=t.apply(i,e||arguments);return o(c)?c:i}return t.apply(s,e||arguments)}return i(l,e),l}},586:e=>{var t;t={ns:{name:{singular:"Nanosecond",plural:"Nanoseconds"},to_anchor:1e-9},mu:{name:{singular:"Microsecond",plural:"Microseconds"},to_anchor:1e-6},ms:{name:{singular:"Millisecond",plural:"Milliseconds"},to_anchor:.001},s:{name:{singular:"Second",plural:"Seconds"},to_anchor:1},min:{name:{singular:"Minute",plural:"Minutes"},to_anchor:60},h:{name:{singular:"Hour",plural:"Hours"},to_anchor:3600},d:{name:{singular:"Day",plural:"Days"},to_anchor:86400},week:{name:{singular:"Week",plural:"Weeks"},to_anchor:604800},month:{name:{singular:"Month",plural:"Months"},to_anchor:2629800},year:{name:{singular:"Year",plural:"Years"},to_anchor:31557600}},e.exports={metric:t,_anchors:{metric:{unit:"s",ratio:1}}}},618:(e,t,r)=>{var n=r(669),o=r(177),i=r(30),a=o.test(a=Object.keys)&&a,s=a?function(e){return n(e)?a(e):[]}:i;e.exports=s},628:e=>{e.exports.RADIUS=6378137,e.exports.FLATTENING=1/298.257223563,e.exports.POLAR_RADIUS=6356752.3142},629:e=>{var t,r;t={C:{name:{singular:"degree Celsius",plural:"degrees Celsius"},to_anchor:1,anchor_shift:0},K:{name:{singular:"degree Kelvin",plural:"degrees Kelvin"},to_anchor:1,anchor_shift:273.15}},r={F:{name:{singular:"degree Fahrenheit",plural:"degrees Fahrenheit"},to_anchor:1},R:{name:{singular:"degree Rankine",plural:"degrees Rankine"},to_anchor:1,anchor_shift:459.67}},e.exports={metric:t,imperial:r,_anchors:{metric:{unit:"C",transform:function(e){return e/(5/9)+32}},imperial:{unit:"F",transform:function(e){return 5/9*(e-32)}}}}},666:(e,t,r)=>{var n,o,i=r(618),a=r(796),s={length:r(315),area:r(978),mass:r(503),volume:r(445),each:r(466),temperature:r(629),time:r(586),digital:r(183),partsPer:r(133),speed:r(496),pace:r(4),pressure:r(264),current:r(86),voltage:r(257),power:r(237),reactivePower:r(467),apparentPower:r(157),energy:r(99),reactiveEnergy:r(908),volumeFlowRate:r(875),illuminance:r(170),frequency:r(241),angle:r(472)};(o=function(e,t){this.val=t?e/t:e}).prototype.from=function(e){if(this.destination)throw new Error(".from must be called before .to");return this.origin=this.getUnit(e),this.origin||this.throwUnsupportedUnitError(e),this},o.prototype.to=function(e){if(!this.origin)throw new Error(".to must be called after .from");var t,r;if(this.destination=this.getUnit(e),this.destination||this.throwUnsupportedUnitError(e),this.origin.abbr===this.destination.abbr)return this.val;if(this.destination.measure!=this.origin.measure)throw new Error("Cannot convert incompatible measures of "+this.destination.measure+" and "+this.origin.measure);return t=this.val*this.origin.unit.to_anchor,this.origin.unit.anchor_shift&&(t-=this.origin.unit.anchor_shift),this.origin.system!=this.destination.system&&("function"==typeof(r=s[this.origin.measure]._anchors[this.origin.system].transform)?t=r(t):t*=s[this.origin.measure]._anchors[this.origin.system].ratio),this.destination.unit.anchor_shift&&(t+=this.destination.unit.anchor_shift),t/this.destination.unit.to_anchor},o.prototype.toBest=function(e){if(!this.origin)throw new Error(".toBest must be called after .from");var t;return e=Object.assign({exclude:[],cutOffNumber:1},e),a(this.possibilities(),function(r){var n=this.describe(r);if(-1===e.exclude.indexOf(r)&&n.system===this.origin.system){var o=this.to(r);(!t||o>=e.cutOffNumber&&o<t.val)&&(t={val:o,unit:r,singular:n.singular,plural:n.plural})}}.bind(this)),t},o.prototype.getUnit=function(e){var t;return a(s,(function(r,n){if(a(r,(function(r,o){return"_anchors"!=o&&(a(r,(function(r,i){if(i==e)return t={abbr:e,measure:n,system:o,unit:r},!1})),!t&&void 0)})),t)return!1})),t};var l=function(e){return{abbr:e.abbr,measure:e.measure,system:e.system,singular:e.unit.name.singular,plural:e.unit.name.plural}};o.prototype.describe=function(e){var t=o.prototype.getUnit(e),r=null;try{r=l(t)}catch(t){this.throwUnsupportedUnitError(e)}return r},o.prototype.list=function(e){var t=[];return a(s,(function(r,n){e&&e!==n||a(r,(function(e,r){if("_anchors"==r)return!1;a(e,(function(e,o){t=t.concat(l({abbr:o,measure:n,system:r,unit:e}))}))}))})),t},o.prototype.throwUnsupportedUnitError=function(e){var t=[];throw a(s,(function(e,r){a(e,(function(e,r){if("_anchors"==r)return!1;t=t.concat(i(e))}))})),new Error("Unsupported unit "+e+", use one of: "+t.join(", "))},o.prototype.possibilities=function(e){var t=[];return this.origin||e?(e=e||this.origin.measure,a(s[e],(function(e,r){if("_anchors"==r)return!1;t=t.concat(i(e))}))):a(i(s),(function(e){a(s[e],(function(e,r){if("_anchors"==r)return!1;t=t.concat(i(e))}))})),t},o.prototype.measures=function(){return i(s)},n=function(e){return new o(e)},e.exports=n},669:(e,t,r)=>{var n=r(813);e.exports=function(e){return!(!e||!n[typeof e])}},710:e=>{e.exports=function(e){return"function"==typeof e}},714:e=>{e.exports=function(){}},737:(e,t,r)=>{var n=r(450),o=r(669),i=r(794),a=r(923),s=[].push;e.exports=function e(t){var r=t[0],l=t[1],c=t[2],u=t[3],p=t[4],h=t[5],d=1&l,m=2&l,g=4&l,f=8&l,y=r;function _(){var t=d?p:this;if(c){var i=c.slice();s.apply(i,arguments)}if((u||g)&&(i||(i=a(arguments)),u&&s.apply(i,u),g&&i.length<h))return l|=16,e([r,f?l:-4&l,i,null,p,h]);if(i||(i=arguments),m&&(r=t[y]),this instanceof _){t=n(r.prototype);var v=r.apply(t,i);return o(v)?v:t}return r.apply(t,i)}return i(_,t),_}},778:(e,t,r)=>{var n=r(628);function o(e){var t=0;if(e&&e.length>0){t+=Math.abs(i(e[0]));for(var r=1;r<e.length;r++)t-=Math.abs(i(e[r]))}return t}function i(e){var t,r,o,i,s,l,c=0,u=e.length;if(u>2){for(l=0;l<u;l++)l===u-2?(o=u-2,i=u-1,s=0):l===u-1?(o=u-1,i=0,s=1):(o=l,i=l+1,s=l+2),t=e[o],r=e[i],c+=(a(e[s][0])-a(t[0]))*Math.sin(a(r[1]));c=c*n.RADIUS*n.RADIUS/2}return c}function a(e){return e*Math.PI/180}e.exports.geometry=function e(t){var r,n=0;switch(t.type){case"Polygon":return o(t.coordinates);case"MultiPolygon":for(r=0;r<t.coordinates.length;r++)n+=o(t.coordinates[r]);return n;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0;case"GeometryCollection":for(r=0;r<t.geometries.length;r++)n+=e(t.geometries[r]);return n}},e.exports.ring=i},794:(e,t,r)=>{var n=r(714),o=r(177),i={configurable:!1,enumerable:!1,value:null,writable:!1},a=function(){try{var e={},t=o.test(t=Object.defineProperty)&&t,r=t(e,e,e)&&t}catch(e){}return r}(),s=a?function(e,t){i.value=t,a(e,"__bindData__",i)}:n;e.exports=s},796:(e,t,r)=>{var n=r(889),o=r(447);e.exports=function(e,t,r){var i=-1,a=e?e.length:0;if(t=t&&void 0===r?t:n(t,r,3),"number"==typeof a)for(;++i<a&&!1!==t(e[i],i,e););else o(e,t);return e}},813:e=>{e.exports={boolean:!1,function:!0,object:!0,number:!1,string:!1,undefined:!1}},857:(e,t,r)=>{var n=r(177),o={};o.funcDecomp=!n.test(r.g.WinRTError)&&/\bthis\b/.test((function(){return this})),o.funcNames="string"==typeof Function.name,e.exports=o},875:e=>{var t,r;t={"mm3/s":{name:{singular:"Cubic Millimeter per second",plural:"Cubic Millimeters per second"},to_anchor:1e-6},"cm3/s":{name:{singular:"Cubic Centimeter per second",plural:"Cubic Centimeters per second"},to_anchor:.001},"ml/s":{name:{singular:"Millilitre per second",plural:"Millilitres per second"},to_anchor:.001},"cl/s":{name:{singular:"Centilitre per second",plural:"Centilitres per second"},to_anchor:.01},"dl/s":{name:{singular:"Decilitre per second",plural:"Decilitres per second"},to_anchor:.1},"l/s":{name:{singular:"Litre per second",plural:"Litres per second"},to_anchor:1},"l/min":{name:{singular:"Litre per minute",plural:"Litres per minute"},to_anchor:1/60},"l/h":{name:{singular:"Litre per hour",plural:"Litres per hour"},to_anchor:1/3600},"kl/s":{name:{singular:"Kilolitre per second",plural:"Kilolitres per second"},to_anchor:1e3},"kl/min":{name:{singular:"Kilolitre per minute",plural:"Kilolitres per minute"},to_anchor:50/3},"kl/h":{name:{singular:"Kilolitre per hour",plural:"Kilolitres per hour"},to_anchor:5/18},"m3/s":{name:{singular:"Cubic meter per second",plural:"Cubic meters per second"},to_anchor:1e3},"m3/min":{name:{singular:"Cubic meter per minute",plural:"Cubic meters per minute"},to_anchor:50/3},"m3/h":{name:{singular:"Cubic meter per hour",plural:"Cubic meters per hour"},to_anchor:5/18},"km3/s":{name:{singular:"Cubic kilometer per second",plural:"Cubic kilometers per second"},to_anchor:1e12}},r={"tsp/s":{name:{singular:"Teaspoon per second",plural:"Teaspoons per second"},to_anchor:1/6},"Tbs/s":{name:{singular:"Tablespoon per second",plural:"Tablespoons per second"},to_anchor:.5},"in3/s":{name:{singular:"Cubic inch per second",plural:"Cubic inches per second"},to_anchor:.55411},"in3/min":{name:{singular:"Cubic inch per minute",plural:"Cubic inches per minute"},to_anchor:.55411/60},"in3/h":{name:{singular:"Cubic inch per hour",plural:"Cubic inches per hour"},to_anchor:.55411/3600},"fl-oz/s":{name:{singular:"Fluid Ounce per second",plural:"Fluid Ounces per second"},to_anchor:1},"fl-oz/min":{name:{singular:"Fluid Ounce per minute",plural:"Fluid Ounces per minute"},to_anchor:1/60},"fl-oz/h":{name:{singular:"Fluid Ounce per hour",plural:"Fluid Ounces per hour"},to_anchor:1/3600},"cup/s":{name:{singular:"Cup per second",plural:"Cups per second"},to_anchor:8},"pnt/s":{name:{singular:"Pint per second",plural:"Pints per second"},to_anchor:16},"pnt/min":{name:{singular:"Pint per minute",plural:"Pints per minute"},to_anchor:4/15},"pnt/h":{name:{singular:"Pint per hour",plural:"Pints per hour"},to_anchor:1/225},"qt/s":{name:{singular:"Quart per second",plural:"Quarts per second"},to_anchor:32},"gal/s":{name:{singular:"Gallon per second",plural:"Gallons per second"},to_anchor:128},"gal/min":{name:{singular:"Gallon per minute",plural:"Gallons per minute"},to_anchor:32/15},"gal/h":{name:{singular:"Gallon per hour",plural:"Gallons per hour"},to_anchor:8/225},"ft3/s":{name:{singular:"Cubic foot per second",plural:"Cubic feet per second"},to_anchor:957.506},"ft3/min":{name:{singular:"Cubic foot per minute",plural:"Cubic feet per minute"},to_anchor:957.506/60},"ft3/h":{name:{singular:"Cubic foot per hour",plural:"Cubic feet per hour"},to_anchor:957.506/3600},"yd3/s":{name:{singular:"Cubic yard per second",plural:"Cubic yards per second"},to_anchor:25852.7},"yd3/min":{name:{singular:"Cubic yard per minute",plural:"Cubic yards per minute"},to_anchor:25852.7/60},"yd3/h":{name:{singular:"Cubic yard per hour",plural:"Cubic yards per hour"},to_anchor:25852.7/3600}},e.exports={metric:t,imperial:r,_anchors:{metric:{unit:"l/s",ratio:33.8140227},imperial:{unit:"fl-oz/s",ratio:1/33.8140227}}}},889:(e,t,r)=>{var n=r(41),o=r(160),i=r(794),a=r(857),s=/^\s*function[ \n\r\t]+\w/,l=/\bthis\b/,c=Function.prototype.toString;e.exports=function(e,t,r){if("function"!=typeof e)return o;if(void 0===t||!("prototype"in e))return e;var u=e.__bindData__;if(void 0===u&&(a.funcNames&&(u=!e.name),!(u=u||!a.funcDecomp))){var p=c.call(e);a.funcNames||(u=!s.test(p)),u||(u=l.test(p),i(e,u))}if(!1===u||!0!==u&&1&u[1])return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,o){return e.call(t,r,n,o)};case 4:return function(r,n,o,i){return e.call(t,r,n,o,i)}}return n(e,t)}},908:e=>{var t;t={VARh:{name:{singular:"Volt-Ampere Reactive Hour",plural:"Volt-Amperes Reactive Hour"},to_anchor:1},mVARh:{name:{singular:"Millivolt-Ampere Reactive Hour",plural:"Millivolt-Amperes Reactive Hour"},to_anchor:.001},kVARh:{name:{singular:"Kilovolt-Ampere Reactive Hour",plural:"Kilovolt-Amperes Reactive Hour"},to_anchor:1e3},MVARh:{name:{singular:"Megavolt-Ampere Reactive Hour",plural:"Megavolt-Amperes Reactive Hour"},to_anchor:1e6},GVARh:{name:{singular:"Gigavolt-Ampere Reactive Hour",plural:"Gigavolt-Amperes Reactive Hour"},to_anchor:1e9}},e.exports={metric:t,_anchors:{metric:{unit:"VARh",ratio:1}}}},923:e=>{e.exports=function(e,t,r){t||(t=0),void 0===r&&(r=e?e.length:0);for(var n=-1,o=r-t||0,i=Array(o<0?0:o);++n<o;)i[n]=e[t+n];return i}},978:e=>{var t,r;t={mm2:{name:{singular:"Square Millimeter",plural:"Square Millimeters"},to_anchor:1e-6},cm2:{name:{singular:"Centimeter",plural:"Centimeters"},to_anchor:1e-4},m2:{name:{singular:"Square Meter",plural:"Square Meters"},to_anchor:1},ha:{name:{singular:"Hectare",plural:"Hectares"},to_anchor:1e4},km2:{name:{singular:"Square Kilometer",plural:"Square Kilometers"},to_anchor:1e6}},r={in2:{name:{singular:"Square Inch",plural:"Square Inches"},to_anchor:1/144},yd2:{name:{singular:"Square Yard",plural:"Square Yards"},to_anchor:9},ft2:{name:{singular:"Square Foot",plural:"Square Feet"},to_anchor:1},ac:{name:{singular:"Acre",plural:"Acres"},to_anchor:43560},mi2:{name:{singular:"Square Mile",plural:"Square Miles"},to_anchor:27878400}},e.exports={metric:t,imperial:r,_anchors:{metric:{unit:"m2",ratio:10.7639},imperial:{unit:"ft2",ratio:1/10.7639}}}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";r.r(n),r.d(n,{default:()=>Ft});var e={};r.r(e),r.d(e,{LAT_MAX:()=>C,LAT_MIN:()=>_,LAT_RENDERED_MAX:()=>E,LAT_RENDERED_MIN:()=>v,LNG_MAX:()=>M,LNG_MIN:()=>b,activeStates:()=>f,classes:()=>s,cursors:()=>c,events:()=>d,geojsonTypes:()=>p,interactions:()=>y,meta:()=>g,modes:()=>h,sources:()=>l,types:()=>u,updateActions:()=>m});var t={};r.r(t),r.d(t,{isActiveFeature:()=>_e,isEnterKey:()=>Se,isEscapeKey:()=>Te,isFeature:()=>Ee,isInactiveFeature:()=>ve,isOfMetaType:()=>fe,isShiftDown:()=>Me,isShiftMousedown:()=>ye,isTrue:()=>Ie,isVertex:()=>be,noTarget:()=>Ce});var o={};r.r(o),r.d(o,{CommonSelectors:()=>t,ModeHandler:()=>i,StringSet:()=>L,constrainFeatureMovement:()=>Ve,createMidPoint:()=>Ae,createSupplementaryPoints:()=>Pe,createVertex:()=>Le,doubleClickZoom:()=>we,euclideanDistance:()=>F,featuresAt:()=>P,getFeatureAtAndSetCursors:()=>N,isClick:()=>U,isEventAtCoordinates:()=>We,isTap:()=>B,mapEventToBoundingBox:()=>O,moveFeatures:()=>Ge,sortFeatures:()=>I,stringSetsAreEqual:()=>at,theme:()=>ge,toDenseArray:()=>ae});const i=function(e,t){const r={drag:[],click:[],mousemove:[],mousedown:[],mouseup:[],mouseout:[],keydown:[],keyup:[],touchstart:[],touchmove:[],touchend:[],tap:[]},n={on(e,t,n){if(void 0===r[e])throw new Error(`Invalid event type: ${e}`);r[e].push({selector:t,fn:n})},render(e){t.store.featureChanged(e)}},o=function(e,o){const i=r[e];let a=i.length;for(;a--;){const e=i[a];if(e.selector(o)){e.fn.call(n,o)||t.store.render(),t.ui.updateMapClasses();break}}};return e.start.call(n),{render:e.render,stop(){e.stop&&e.stop()},trash(){e.trash&&(e.trash(),t.store.render())},combineFeatures(){e.combineFeatures&&e.combineFeatures()},uncombineFeatures(){e.uncombineFeatures&&e.uncombineFeatures()},drag(e){o("drag",e)},click(e){o("click",e)},mousemove(e){o("mousemove",e)},mousedown(e){o("mousedown",e)},mouseup(e){o("mouseup",e)},mouseout(e){o("mouseout",e)},keydown(e){o("keydown",e)},keyup(e){o("keyup",e)},touchstart(e){o("touchstart",e)},touchmove(e){o("touchmove",e)},touchend(e){o("touchend",e)},tap(e){o("tap",e)}}};var a=r(778);const s={CANVAS:"mapboxgl-canvas",CONTROL_BASE:"mapboxgl-ctrl",CONTROL_PREFIX:"mapboxgl-ctrl-",CONTROL_BUTTON:"mapbox-gl-draw_ctrl-draw-btn",CONTROL_BUTTON_LINE:"mapbox-gl-draw_line",CONTROL_BUTTON_POLYGON:"mapbox-gl-draw_polygon",CONTROL_BUTTON_POINT:"mapbox-gl-draw_point",CONTROL_BUTTON_TRASH:"mapbox-gl-draw_trash",CONTROL_BUTTON_COMBINE_FEATURES:"mapbox-gl-draw_combine",CONTROL_BUTTON_UNCOMBINE_FEATURES:"mapbox-gl-draw_uncombine",CONTROL_GROUP:"mapboxgl-ctrl-group",ATTRIBUTION:"mapboxgl-ctrl-attrib",ACTIVE_BUTTON:"active",BOX_SELECT:"mapbox-gl-draw_boxselect"},l={HOT:"mapbox-gl-draw-hot",COLD:"mapbox-gl-draw-cold"},c={ADD:"add",MOVE:"move",DRAG:"drag",POINTER:"pointer",NONE:"none"},u={POLYGON:"polygon",LINE:"line_string",POINT:"point"},p={FEATURE:"Feature",POLYGON:"Polygon",LINE_STRING:"LineString",POINT:"Point",FEATURE_COLLECTION:"FeatureCollection",MULTI_PREFIX:"Multi",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon"},h={DRAW_LINE_STRING:"draw_line_string",DRAW_POLYGON:"draw_polygon",DRAW_POINT:"draw_point",SIMPLE_SELECT:"simple_select",DIRECT_SELECT:"direct_select"},d={CREATE:"draw.create",DELETE:"draw.delete",UPDATE:"draw.update",SELECTION_CHANGE:"draw.selectionchange",MODE_CHANGE:"draw.modechange",ACTIONABLE:"draw.actionable",RENDER:"draw.render",COMBINE_FEATURES:"draw.combine",UNCOMBINE_FEATURES:"draw.uncombine"},m={MOVE:"move",CHANGE_PROPERTIES:"change_properties",CHANGE_COORDINATES:"change_coordinates"},g={FEATURE:"feature",MIDPOINT:"midpoint",VERTEX:"vertex"},f={ACTIVE:"true",INACTIVE:"false"},y=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate"],_=-90,v=-85,C=90,E=85,b=-270,M=270,T={Point:0,LineString:1,MultiLineString:1,Polygon:2};function S(e,t){const r=T[e.geometry.type]-T[t.geometry.type];return 0===r&&e.geometry.type===p.POLYGON?e.area-t.area:r}const I=function(e){return e.map((e=>(e.geometry.type===p.POLYGON&&(e.area=a.geometry({type:p.FEATURE,property:{},geometry:e.geometry})),e))).sort(S).map((e=>(delete e.area,e)))},O=function(e,t=0){return[[e.point.x-t,e.point.y-t],[e.point.x+t,e.point.y+t]]};function x(e){if(this._items={},this._nums={},this._length=e?e.length:0,e)for(let t=0,r=e.length;t<r;t++)this.add(e[t]),void 0!==e[t]&&("string"==typeof e[t]?this._items[e[t]]=t:this._nums[e[t]]=t)}x.prototype.add=function(e){return this.has(e)||(this._length++,"string"==typeof e?this._items[e]=this._length:this._nums[e]=this._length),this},x.prototype.delete=function(e){return!1===this.has(e)||(this._length--,delete this._items[e],delete this._nums[e]),this},x.prototype.has=function(e){return!("string"!=typeof e&&"number"!=typeof e||void 0===this._items[e]&&void 0===this._nums[e])},x.prototype.values=function(){const e=[];return Object.keys(this._items).forEach((t=>{e.push({k:t,v:this._items[t]})})),Object.keys(this._nums).forEach((t=>{e.push({k:JSON.parse(t),v:this._nums[t]})})),e.sort(((e,t)=>e.v-t.v)).map((e=>e.k))},x.prototype.clear=function(){return this._length=0,this._items={},this._nums={},this};const L=x,A=[g.FEATURE,g.MIDPOINT,g.VERTEX],P={click:function(e,t,r){return w(e,t,r,r.options.clickBuffer)},touch:function(e,t,r){return w(e,t,r,r.options.touchBuffer)}};function w(e,t,r,n){if(null===r.map)return[];const o=e?O(e,n):t,i={};r.options.styles&&(i.layers=r.options.styles.map((e=>e.id)).filter((e=>null!=r.map.getLayer(e))));const a=r.map.queryRenderedFeatures(o,i).filter((e=>-1!==A.indexOf(e.properties.meta))),s=new L,l=[];return a.forEach((e=>{const t=e.properties.id;s.has(t)||(s.add(t),l.push(e))})),I(l)}function N(e,t){const r=P.click(e,null,t),n={mouse:c.NONE};return r[0]&&(n.mouse=r[0].properties.active===f.ACTIVE?c.MOVE:c.POINTER,n.feature=r[0].properties.meta),-1!==t.events.currentModeName().indexOf("draw")&&(n.mouse=c.ADD),t.ui.queueMapClasses(n),t.ui.updateMapClasses(),r[0]}function F(e,t){const r=e.x-t.x,n=e.y-t.y;return Math.sqrt(r*r+n*n)}const R=4,k=12,D=500;function U(e,t,r={}){const n=null!=r.fineTolerance?r.fineTolerance:R,o=null!=r.grossTolerance?r.grossTolerance:k,i=null!=r.interval?r.interval:D;e.point=e.point||t.point,e.time=e.time||t.time;const a=F(e.point,t.point);return a<n||a<o&&t.time-e.time<i}const V=25,G=250;function B(e,t,r={}){const n=null!=r.tolerance?r.tolerance:V,o=null!=r.interval?r.interval:G;return e.point=e.point||t.point,e.time=e.time||t.time,F(e.point,t.point)<n&&t.time-e.time<o}const K=((e,t=21)=>(r=t)=>{let n="",o=0|r;for(;o--;)n+=e[Math.random()*e.length|0];return n})("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",32);function j(){return K()}const $=function(e,t){this.ctx=e,this.properties=t.properties||{},this.coordinates=t.geometry.coordinates,this.id=t.id||j(),this.type=t.geometry.type};$.prototype.changed=function(){this.ctx.store.featureChanged(this.id)},$.prototype.incomingCoords=function(e){this.setCoordinates(e)},$.prototype.setCoordinates=function(e){this.coordinates=e,this.changed()},$.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.coordinates))},$.prototype.setProperty=function(e,t){this.properties[e]=t},$.prototype.toGeoJSON=function(){return JSON.parse(JSON.stringify({id:this.id,type:p.FEATURE,properties:this.properties,geometry:{coordinates:this.getCoordinates(),type:this.type}}))},$.prototype.internal=function(e){const t={id:this.id,meta:g.FEATURE,"meta:type":this.type,active:f.INACTIVE,mode:e};if(this.ctx.options.userProperties)for(const e in this.properties)t[`user_${e}`]=this.properties[e];return{type:p.FEATURE,properties:t,geometry:{coordinates:this.getCoordinates(),type:this.type}}};const H=$,q=function(e,t){H.call(this,e,t)};(q.prototype=Object.create(H.prototype)).isValid=function(){return"number"==typeof this.coordinates[0]&&"number"==typeof this.coordinates[1]},q.prototype.updateCoordinate=function(e,t,r){this.coordinates=3===arguments.length?[t,r]:[e,t],this.changed()},q.prototype.getCoordinate=function(){return this.getCoordinates()};const J=q,z=function(e,t){H.call(this,e,t)};(z.prototype=Object.create(H.prototype)).isValid=function(){return this.coordinates.length>1},z.prototype.addCoordinate=function(e,t,r){this.changed();const n=parseInt(e,10);this.coordinates.splice(n,0,[t,r])},z.prototype.getCoordinate=function(e){const t=parseInt(e,10);return JSON.parse(JSON.stringify(this.coordinates[t]))},z.prototype.removeCoordinate=function(e){this.changed(),this.coordinates.splice(parseInt(e,10),1)},z.prototype.updateCoordinate=function(e,t,r){const n=parseInt(e,10);this.coordinates[n]=[t,r],this.changed()};const W=z,Z=function(e,t){H.call(this,e,t),this.coordinates=this.coordinates.map((e=>e.slice(0,-1)))};(Z.prototype=Object.create(H.prototype)).isValid=function(){return 0!==this.coordinates.length&&this.coordinates.every((e=>e.length>2))},Z.prototype.incomingCoords=function(e){this.coordinates=e.map((e=>e.slice(0,-1))),this.changed()},Z.prototype.setCoordinates=function(e){this.coordinates=e,this.changed()},Z.prototype.addCoordinate=function(e,t,r){this.changed();const n=e.split(".").map((e=>parseInt(e,10)));this.coordinates[n[0]].splice(n[1],0,[t,r])},Z.prototype.removeCoordinate=function(e){this.changed();const t=e.split(".").map((e=>parseInt(e,10))),r=this.coordinates[t[0]];r&&(r.splice(t[1],1),r.length<3&&this.coordinates.splice(t[0],1))},Z.prototype.getCoordinate=function(e){const t=e.split(".").map((e=>parseInt(e,10))),r=this.coordinates[t[0]];return JSON.parse(JSON.stringify(r[t[1]]))},Z.prototype.getCoordinates=function(){return this.coordinates.map((e=>e.concat([e[0]])))},Z.prototype.updateCoordinate=function(e,t,r){this.changed();const n=e.split("."),o=parseInt(n[0],10),i=parseInt(n[1],10);void 0===this.coordinates[o]&&(this.coordinates[o]=[]),this.coordinates[o][i]=[t,r]};const Y=Z,X={MultiPoint:J,MultiLineString:W,MultiPolygon:Y},Q=(e,t,r,n,o)=>{const i=r.split("."),a=parseInt(i[0],10),s=i[1]?i.slice(1).join("."):null;return e[a][t](s,n,o)},ee=function(e,t){if(H.call(this,e,t),delete this.coordinates,this.model=X[t.geometry.type],void 0===this.model)throw new TypeError(`${t.geometry.type} is not a valid type`);this.features=this._coordinatesToFeatures(t.geometry.coordinates)};(ee.prototype=Object.create(H.prototype))._coordinatesToFeatures=function(e){const t=this.model.bind(this);return e.map((e=>new t(this.ctx,{id:j(),type:p.FEATURE,properties:{},geometry:{coordinates:e,type:this.type.replace("Multi","")}})))},ee.prototype.isValid=function(){return this.features.every((e=>e.isValid()))},ee.prototype.setCoordinates=function(e){this.features=this._coordinatesToFeatures(e),this.changed()},ee.prototype.getCoordinate=function(e){return Q(this.features,"getCoordinate",e)},ee.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.features.map((e=>e.type===p.POLYGON?e.getCoordinates():e.coordinates))))},ee.prototype.updateCoordinate=function(e,t,r){Q(this.features,"updateCoordinate",e,t,r),this.changed()},ee.prototype.addCoordinate=function(e,t,r){Q(this.features,"addCoordinate",e,t,r),this.changed()},ee.prototype.removeCoordinate=function(e){Q(this.features,"removeCoordinate",e),this.changed()},ee.prototype.getFeatures=function(){return this.features};const te=ee;function re(e){this.map=e.map,this.drawConfig=JSON.parse(JSON.stringify(e.options||{})),this._ctx=e}re.prototype.setSelected=function(e){return this._ctx.store.setSelected(e)},re.prototype.setSelectedCoordinates=function(e){this._ctx.store.setSelectedCoordinates(e),e.reduce(((e,t)=>(void 0===e[t.feature_id]&&(e[t.feature_id]=!0,this._ctx.store.get(t.feature_id).changed()),e)),{})},re.prototype.getSelected=function(){return this._ctx.store.getSelected()},re.prototype.getSelectedIds=function(){return this._ctx.store.getSelectedIds()},re.prototype.isSelected=function(e){return this._ctx.store.isSelected(e)},re.prototype.getFeature=function(e){return this._ctx.store.get(e)},re.prototype.select=function(e){return this._ctx.store.select(e)},re.prototype.deselect=function(e){return this._ctx.store.deselect(e)},re.prototype.deleteFeature=function(e,t={}){return this._ctx.store.delete(e,t)},re.prototype.addFeature=function(e,t={}){return this._ctx.store.add(e,t)},re.prototype.clearSelectedFeatures=function(){return this._ctx.store.clearSelected()},re.prototype.clearSelectedCoordinates=function(){return this._ctx.store.clearSelectedCoordinates()},re.prototype.setActionableState=function(e={}){const t={trash:e.trash||!1,combineFeatures:e.combineFeatures||!1,uncombineFeatures:e.uncombineFeatures||!1};return this._ctx.events.actionable(t)},re.prototype.changeMode=function(e,t={},r={}){return this._ctx.events.changeMode(e,t,r)},re.prototype.fire=function(e,t){return this._ctx.events.fire(e,t)},re.prototype.updateUIClasses=function(e){return this._ctx.ui.queueMapClasses(e)},re.prototype.activateUIButton=function(e){return this._ctx.ui.setActiveButton(e)},re.prototype.featuresAt=function(e,t,r="click"){if("click"!==r&&"touch"!==r)throw new Error("invalid buffer type");return P[r](e,t,this._ctx)},re.prototype.newFeature=function(e){const t=e.geometry.type;return t===p.POINT?new J(this._ctx,e):t===p.LINE_STRING?new W(this._ctx,e):t===p.POLYGON?new Y(this._ctx,e):new te(this._ctx,e)},re.prototype.isInstanceOf=function(e,t){if(e===p.POINT)return t instanceof J;if(e===p.LINE_STRING)return t instanceof W;if(e===p.POLYGON)return t instanceof Y;if("MultiFeature"===e)return t instanceof te;throw new Error(`Unknown feature class: ${e}`)},re.prototype.doRender=function(e){return this._ctx.store.featureChanged(e)};const ne=re;re.prototype.onSetup=function(){},re.prototype.onDrag=function(){},re.prototype.onClick=function(){},re.prototype.onMouseMove=function(){},re.prototype.onMouseDown=function(){},re.prototype.onMouseUp=function(){},re.prototype.onMouseOut=function(){},re.prototype.onKeyUp=function(){},re.prototype.onKeyDown=function(){},re.prototype.onTouchStart=function(){},re.prototype.onTouchMove=function(){},re.prototype.onTouchEnd=function(){},re.prototype.onTap=function(){},re.prototype.onStop=function(){},re.prototype.onTrash=function(){},re.prototype.onCombineFeature=function(){},re.prototype.onUncombineFeature=function(){},re.prototype.toDisplayFeatures=function(){throw new Error("You must overwrite toDisplayFeatures")};const oe={drag:"onDrag",click:"onClick",mousemove:"onMouseMove",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseout:"onMouseOut",keyup:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",tap:"onTap"},ie=Object.keys(oe);const ae=function(e){return[].concat(e).filter((e=>void 0!==e))};function se(){const e=this;if(!e.ctx.map||void 0===e.ctx.map.getSource(l.HOT))return s();const t=e.ctx.events.currentModeName();e.ctx.ui.queueMapClasses({mode:t});let r=[],n=[];e.isDirty?n=e.getAllIds():(r=e.getChangedIds().filter((t=>void 0!==e.get(t))),n=e.sources.hot.filter((t=>t.properties.id&&-1===r.indexOf(t.properties.id)&&void 0!==e.get(t.properties.id))).map((e=>e.properties.id))),e.sources.hot=[];const o=e.sources.cold.length;e.sources.cold=e.isDirty?[]:e.sources.cold.filter((e=>{const t=e.properties.id||e.properties.parent;return-1===r.indexOf(t)}));const i=o!==e.sources.cold.length||n.length>0;function a(r,n){const o=e.get(r).internal(t);e.ctx.events.currentModeRender(o,(r=>{r.properties.mode=t,e.sources[n].push(r)}))}function s(){e.isDirty=!1,e.clearChangedIds()}r.forEach((e=>a(e,"hot"))),n.forEach((e=>a(e,"cold"))),i&&e.ctx.map.getSource(l.COLD).setData({type:p.FEATURE_COLLECTION,features:e.sources.cold}),e.ctx.map.getSource(l.HOT).setData({type:p.FEATURE_COLLECTION,features:e.sources.hot}),s()}function le(e){let t;this._features={},this._featureIds=new L,this._selectedFeatureIds=new L,this._selectedCoordinates=[],this._changedFeatureIds=new L,this._emitSelectionChange=!1,this._mapInitialConfig={},this.ctx=e,this.sources={hot:[],cold:[]},this.render=()=>{t||(t=requestAnimationFrame((()=>{t=null,se.call(this),this._emitSelectionChange&&(this.ctx.events.fire(d.SELECTION_CHANGE,{features:this.getSelected().map((e=>e.toGeoJSON())),points:this.getSelectedCoordinates().map((e=>({type:p.FEATURE,properties:{},geometry:{type:p.POINT,coordinates:e.coordinates}})))}),this._emitSelectionChange=!1),this.ctx.events.fire(d.RENDER,{})})))},this.isDirty=!1}function ce(e,t={}){const r=e._selectedCoordinates.filter((t=>e._selectedFeatureIds.has(t.feature_id)));e._selectedCoordinates.length===r.length||t.silent||(e._emitSelectionChange=!0),e._selectedCoordinates=r}le.prototype.createRenderBatch=function(){const e=this.render;let t=0;return this.render=function(){t++},()=>{this.render=e,t>0&&this.render()}},le.prototype.setDirty=function(){return this.isDirty=!0,this},le.prototype.featureCreated=function(e,t={}){if(this._changedFeatureIds.add(e),!0!==(null!=t.silent?t.silent:this.ctx.options.suppressAPIEvents)){const t=this.get(e);this.ctx.events.fire(d.CREATE,{features:[t.toGeoJSON()]})}return this},le.prototype.featureChanged=function(e,t={}){return this._changedFeatureIds.add(e),!0!==(null!=t.silent?t.silent:this.ctx.options.suppressAPIEvents)&&this.ctx.events.fire(d.UPDATE,{action:t.action?t.action:m.CHANGE_COORDINATES,features:[this.get(e).toGeoJSON()]}),this},le.prototype.getChangedIds=function(){return this._changedFeatureIds.values()},le.prototype.clearChangedIds=function(){return this._changedFeatureIds.clear(),this},le.prototype.getAllIds=function(){return this._featureIds.values()},le.prototype.add=function(e,t={}){return this._features[e.id]=e,this._featureIds.add(e.id),this.featureCreated(e.id,{silent:t.silent}),this},le.prototype.delete=function(e,t={}){const r=[];return ae(e).forEach((e=>{this._featureIds.has(e)&&(this._featureIds.delete(e),this._selectedFeatureIds.delete(e),t.silent||-1===r.indexOf(this._features[e])&&r.push(this._features[e].toGeoJSON()),delete this._features[e],this.isDirty=!0)})),r.length&&this.ctx.events.fire(d.DELETE,{features:r}),ce(this,t),this},le.prototype.get=function(e){return this._features[e]},le.prototype.getAll=function(){return Object.keys(this._features).map((e=>this._features[e]))},le.prototype.select=function(e,t={}){return ae(e).forEach((e=>{this._selectedFeatureIds.has(e)||(this._selectedFeatureIds.add(e),this._changedFeatureIds.add(e),t.silent||(this._emitSelectionChange=!0))})),this},le.prototype.deselect=function(e,t={}){return ae(e).forEach((e=>{this._selectedFeatureIds.has(e)&&(this._selectedFeatureIds.delete(e),this._changedFeatureIds.add(e),t.silent||(this._emitSelectionChange=!0))})),ce(this,t),this},le.prototype.clearSelected=function(e={}){return this.deselect(this._selectedFeatureIds.values(),{silent:e.silent}),this},le.prototype.setSelected=function(e,t={}){return e=ae(e),this.deselect(this._selectedFeatureIds.values().filter((t=>-1===e.indexOf(t))),{silent:t.silent}),this.select(e.filter((e=>!this._selectedFeatureIds.has(e))),{silent:t.silent}),this},le.prototype.setSelectedCoordinates=function(e){return this._selectedCoordinates=e,this._emitSelectionChange=!0,this},le.prototype.clearSelectedCoordinates=function(){return this._selectedCoordinates=[],this._emitSelectionChange=!0,this},le.prototype.getSelectedIds=function(){return this._selectedFeatureIds.values()},le.prototype.getSelected=function(){return this.getSelectedIds().map((e=>this.get(e)))},le.prototype.getSelectedCoordinates=function(){return this._selectedCoordinates.map((e=>({coordinates:this.get(e.feature_id).getCoordinate(e.coord_path)})))},le.prototype.isSelected=function(e){return this._selectedFeatureIds.has(e)},le.prototype.setFeatureProperty=function(e,t,r,n={}){this.get(e).setProperty(t,r),this.featureChanged(e,{silent:n.silent,action:m.CHANGE_PROPERTIES})},le.prototype.storeMapConfig=function(){y.forEach((e=>{this.ctx.map[e]&&(this._mapInitialConfig[e]=this.ctx.map[e].isEnabled())}))},le.prototype.restoreMapConfig=function(){Object.keys(this._mapInitialConfig).forEach((e=>{this._mapInitialConfig[e]?this.ctx.map[e].enable():this.ctx.map[e].disable()}))},le.prototype.getInitialConfigValue=function(e){return void 0===this._mapInitialConfig[e]||this._mapInitialConfig[e]};const ue=["mode","feature","mouse"];function pe(e){let t=null,r=null;const n={onRemove(){return e.map.off("load",n.connect),clearInterval(r),n.removeLayers(),e.store.restoreMapConfig(),e.ui.removeButtons(),e.events.removeEventListeners(),e.ui.clearMapClasses(),e.boxZoomInitial&&e.map.boxZoom.enable(),e.map=null,e.container=null,e.store=null,t&&t.parentNode&&t.parentNode.removeChild(t),t=null,this},connect(){e.map.off("load",n.connect),clearInterval(r),n.addLayers(),e.store.storeMapConfig(),e.events.addEventListeners()},onAdd(o){if(e.map=o,e.events=function(e){const t=Object.keys(e.options.modes).reduce(((t,r)=>(t[r]=function(e){const t=Object.keys(e);return function(r,n={}){let o={};const i=t.reduce(((t,r)=>(t[r]=e[r],t)),new ne(r));return{start(){o=i.onSetup(n),ie.forEach((t=>{const r=oe[t];let n=()=>!1;var a;e[r]&&(n=()=>!0),this.on(t,n,(a=r,e=>i[a](o,e)))}))},stop(){i.onStop(o)},trash(){i.onTrash(o)},combineFeatures(){i.onCombineFeatures(o)},uncombineFeatures(){i.onUncombineFeatures(o)},render(e,t){i.toDisplayFeatures(o,e,t)}}}}(e.options.modes[r]),t)),{});let r={},n={};const o={};let a=null,l=null;o.drag=function(t,r){r({point:t.point,time:(new Date).getTime()})?(e.ui.queueMapClasses({mouse:c.DRAG}),l.drag(t)):t.originalEvent.stopPropagation()},o.mousedrag=function(e){o.drag(e,(e=>!U(r,e)))},o.touchdrag=function(e){o.drag(e,(e=>!B(n,e)))},o.mousemove=function(t){if(1===(void 0!==t.originalEvent.buttons?t.originalEvent.buttons:t.originalEvent.which))return o.mousedrag(t);const r=N(t,e);t.featureTarget=r,l.mousemove(t)},o.mousedown=function(t){r={time:(new Date).getTime(),point:t.point};const n=N(t,e);t.featureTarget=n,l.mousedown(t)},o.mouseup=function(t){const n=N(t,e);t.featureTarget=n,U(r,{point:t.point,time:(new Date).getTime()})?l.click(t):l.mouseup(t)},o.mouseout=function(e){l.mouseout(e)},o.touchstart=function(t){if(!e.options.touchEnabled)return;n={time:(new Date).getTime(),point:t.point};const r=P.touch(t,null,e)[0];t.featureTarget=r,l.touchstart(t)},o.touchmove=function(t){if(e.options.touchEnabled)return l.touchmove(t),o.touchdrag(t)},o.touchend=function(t){if(t.originalEvent.preventDefault(),!e.options.touchEnabled)return;const r=P.touch(t,null,e)[0];t.featureTarget=r,B(n,{time:(new Date).getTime(),point:t.point})?l.tap(t):l.touchend(t)};const u=e=>!(8===e||46===e||e>=48&&e<=57);function p(r,n,o={}){l.stop();const s=t[r];if(void 0===s)throw new Error(`${r} is not valid`);a=r;const c=s(e,n);l=i(c,e),o.silent||e.map.fire(d.MODE_CHANGE,{mode:r}),e.store.setDirty(),e.store.render()}o.keydown=function(t){(t.srcElement||t.target).classList.contains(s.CANVAS)&&(8!==t.keyCode&&46!==t.keyCode||!e.options.controls.trash?u(t.keyCode)?l.keydown(t):49===t.keyCode&&e.options.controls.point?p(h.DRAW_POINT):50===t.keyCode&&e.options.controls.line_string?p(h.DRAW_LINE_STRING):51===t.keyCode&&e.options.controls.polygon&&p(h.DRAW_POLYGON):(t.preventDefault(),l.trash()))},o.keyup=function(e){u(e.keyCode)&&l.keyup(e)},o.zoomend=function(){e.store.changeZoom()},o.data=function(t){if("style"===t.dataType){const{setup:t,map:r,options:n,store:o}=e;n.styles.some((e=>r.getLayer(e.id)))||(t.addLayers(),o.setDirt