@defra/interactive-map 0.0.7-alpha → 0.0.9-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/templates/map.njk +2 -2
- package/dist/esm/im-core.js +1 -2
- package/dist/esm/im-shell.js +1 -0
- package/dist/esm/index.js +1 -2
- package/dist/umd/im-core.js +1 -1
- package/dist/umd/index.js +1 -1
- package/docs/api/button-definition.md +104 -3
- package/docs/api.md +21 -1
- package/docs/getting-started.md +78 -8
- package/package.json +31 -24
- package/plugins/beta/datasets/dist/css/index.css +50 -1
- package/plugins/beta/datasets/dist/esm/im-datasets-plugin.js +1 -2
- package/plugins/beta/datasets/dist/esm/index.js +1 -2
- package/plugins/beta/draw-es/dist/esm/im-draw-es-plugin.js +1 -2
- package/plugins/beta/draw-es/dist/esm/index.js +1 -2
- package/plugins/beta/draw-ml/dist/esm/im-draw-ml-plugin.js +1 -1
- package/plugins/beta/draw-ml/dist/esm/index.js +1 -2
- package/plugins/beta/frame/dist/css/index.css +11 -1
- package/plugins/beta/frame/dist/esm/im-frame-plugin.js +1 -1
- package/plugins/beta/frame/dist/esm/index.js +1 -2
- package/plugins/beta/map-styles/dist/css/index.css +79 -1
- package/plugins/beta/map-styles/dist/esm/im-map-styles-plugin.js +1 -1
- package/plugins/beta/map-styles/dist/esm/index.js +1 -2
- package/plugins/beta/scale-bar/dist/esm/im-scale-bar-plugin.js +1 -1
- package/plugins/beta/scale-bar/dist/esm/index.js +1 -2
- package/plugins/beta/use-location/dist/esm/im-use-location-plugin.js +1 -1
- package/plugins/beta/use-location/dist/esm/index.js +1 -2
- package/plugins/beta/use-location/dist/umd/index.js +1 -1
- package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
- package/plugins/interact/dist/esm/index.js +1 -2
- package/plugins/search/dist/esm/im-search-plugin.js +1 -2
- package/plugins/search/dist/esm/index.js +1 -2
- package/plugins/search/src/components/Suggestions/Suggestions.module.scss +1 -1
- package/plugins/search/src/search.scss +1 -1
- package/providers/beta/esri/dist/css/index.css +30 -0
- package/providers/beta/esri/dist/esm/im-esri-provider.js +1 -2
- package/providers/beta/esri/dist/esm/index.js +1 -2
- package/providers/beta/open-names/dist/esm/im-reverse-geocode.js +1 -2
- package/providers/beta/open-names/dist/esm/index.js +1 -2
- package/providers/beta/open-names/src/utils/mapToLocationModel.test.js +61 -0
- package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -2
- package/providers/maplibre/dist/esm/index.js +1 -2
- package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
- package/providers/maplibre/src/appEvents.test.js +44 -0
- package/providers/maplibre/src/index.test.js +60 -0
- package/providers/maplibre/src/mapEvents.test.js +115 -0
- package/providers/maplibre/src/maplibreProvider.test.js +205 -0
- package/providers/maplibre/src/utils/calculateLinearTextSize.test.js +31 -0
- package/providers/maplibre/src/utils/detectWebgl.test.js +63 -0
- package/providers/maplibre/src/utils/highlightFeatures.test.js +126 -0
- package/providers/maplibre/src/utils/labels.js +1 -3
- package/providers/maplibre/src/utils/labels.test.js +231 -0
- package/providers/maplibre/src/utils/maplibreFixes.test.js +66 -0
- package/providers/maplibre/src/utils/queryFeatures.test.js +60 -0
- package/providers/maplibre/src/utils/spatial.js +5 -4
- package/providers/maplibre/src/utils/spatial.test.js +96 -0
- package/rollup.esm.mjs +288 -0
- package/src/App/store/appActionsMap.js +1 -1
- package/src/InteractiveMap/InteractiveMap.js +3 -2
- package/webpack.dev.mjs +9 -1
- package/webpack.prod.mjs +8 -1
- package/webpack.umd.mjs +1 -3
- package/dist/esm/im-core.js.LICENSE.txt +0 -1
- package/dist/esm/index.js.LICENSE.txt +0 -1
- package/plugins/beta/datasets/dist/esm/im-datasets-plugin.js.LICENSE.txt +0 -1
- package/plugins/beta/datasets/dist/esm/index.js.LICENSE.txt +0 -1
- package/plugins/beta/draw-es/dist/esm/im-draw-es-plugin.js.LICENSE.txt +0 -1
- package/plugins/beta/draw-es/dist/esm/index.js.LICENSE.txt +0 -1
- package/plugins/beta/draw-ml/dist/esm/index.js.LICENSE.txt +0 -1
- package/plugins/beta/frame/dist/esm/index.js.LICENSE.txt +0 -1
- package/plugins/beta/map-styles/dist/esm/index.js.LICENSE.txt +0 -1
- package/plugins/beta/scale-bar/dist/esm/index.js.LICENSE.txt +0 -1
- package/plugins/beta/use-location/dist/esm/index.js.LICENSE.txt +0 -1
- package/plugins/interact/dist/esm/index.js.LICENSE.txt +0 -1
- package/plugins/search/dist/esm/im-search-plugin.js.LICENSE.txt +0 -1
- package/plugins/search/dist/esm/index.js.LICENSE.txt +0 -1
- package/providers/beta/esri/dist/css/im-esri-provider.css +0 -1
- package/providers/beta/esri/dist/esm/im-esri-provider.js.LICENSE.txt +0 -1
- package/providers/beta/esri/dist/esm/index.js.LICENSE.txt +0 -1
- package/providers/beta/open-names/dist/esm/im-reverse-geocode.js.LICENSE.txt +0 -1
- package/providers/beta/open-names/dist/esm/index.js.LICENSE.txt +0 -1
- package/providers/maplibre/dist/esm/im-maplibre-framework.js +0 -2
- package/providers/maplibre/dist/esm/im-maplibre-framework.js.LICENSE.txt +0 -4
- package/providers/maplibre/dist/esm/im-maplibre-provider.js.LICENSE.txt +0 -1
- package/providers/maplibre/dist/esm/index.js.LICENSE.txt +0 -1
- package/webpack.esm.mjs +0 -153
|
@@ -1,2 +1 @@
|
|
|
1
|
-
/*! For license information please see im-maplibre-provider.js.LICENSE.txt */
|
|
2
|
-
export const __webpack_esm_id__="im-maplibre-provider";export const __webpack_esm_ids__=["im-maplibre-provider"];export const __webpack_esm_modules__={"./providers/maplibre/src/maplibreProvider.js"(t,e,r){r.d(e,{default:()=>rt}),r.r(e);var n=400,a=["showKeyboardHelp","selectControl","moveLarge","nudgeMap","zoomLarge","nudgeZoom","highlightLabelAtCenter","highlightNextLabel"];function o(t){var e=t.getCanvas();e.removeAttribute("role"),e.setAttribute("tabindex",-1),e.removeAttribute("aria-label"),e.style.display="block"}function i(t){var e=Event.prototype.preventDefault;Event.prototype.preventDefault=function(){if(("touchmove"===this.type||"touchstart"===this.type)&&!this.cancelable){var r=t.getCanvas();if(r&&(this.target===r||r.contains(this.target)))return}e.call(this)}}var l=function(t,e){var r=null,n=function(){for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];clearTimeout(r),r=setTimeout(function(){t.apply(void 0,a)},e)};return n.cancel=function(){r&&(clearTimeout(r),r=null)},n};function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function u(t){var e=t.map,r=t.events,n=t.eventBus,a=t.getCenter,o=t.getZoom,i=t.getBounds,u=t.getResolution,c=[],h=[],f=function(){var t=o();return{center:a(),bounds:i(),resolution:u(),zoom:t,isAtMaxZoom:e.getMaxZoom()<=t,isAtMinZoom:e.getMinZoom()>=t}},p=function(t,e){return n.emit(t,e)},d=function(){return p(r.MAP_LOADED)};e.on("load",d),c.push(["load",d]),e.once("idle",function(){return p(r.MAP_FIRST_IDLE,f())});var y=function(){return p(r.MAP_MOVE_START)};e.on("movestart",y),c.push(["movestart",y]);var g=l(function(){p(r.MAP_MOVE_END,f())},500);e.on("moveend",g),c.push(["moveend",g]),h.push(g);var v,m,b=(v=function(){p(r.MAP_MOVE,f())},m=0,function(){var t=Date.now();t-m>=10&&(m=t,v.apply(void 0,arguments))});e.on("zoom",b),c.push(["zoom",b]),h.push(b);var M=function(){return p(r.MAP_RENDER)};e.on("render",M),c.push(["render",M]);var w=l(function(){p(r.MAP_DATA_CHANGE,f())},500);e.on("styledata",w),c.push(["styledata",w]),h.push(w);var S=function(){return p(r.MAP_STYLE_CHANGE)};e.on("style.load",S),c.push(["style.load",S]);var x=function(t){return p(r.MAP_CLICK,{point:t.point,coords:[t.lngLat.lng,t.lngLat.lat]})};return e.on("click",x),c.push(["click",x]),{remove:function(){h.forEach(function(t){return t.cancel()}),c.forEach(function(t){var r,n,a=(n=2,function(t){if(Array.isArray(t))return t}(r=t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,a,o,i,l=[],s=!0,u=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(r,n)||function(t,e){if(t){if("string"==typeof t)return s(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(t,e):void 0}}(r,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=a[0],i=a[1];return e.off(o,i)})}}}function c(t){var e=t.map,r=t.events,n=t.eventBus,a=function(t){e.setStyle(t.url,{diff:!1})},o=function(t){e.setPixelRatio(t)};return n.on(r.MAP_SET_STYLE,a),n.on(r.MAP_SET_PIXEL_RATIO,o),{remove:function(){n.off(r.MAP_SET_STYLE,a),n.off(r.MAP_SET_PIXEL_RATIO,o)}}}let h=" ";class f{static get separator(){return h}static set separator(t){h=t}static parse(t){if(!isNaN(parseFloat(t))&&isFinite(t))return Number(t);const e=String(t).trim().replace(/^-/,"").replace(/[NSEW]$/i,"").split(/[^0-9.,]+/);if(""==e[e.length-1]&&e.splice(e.length-1),""==e)return NaN;let r=null;switch(e.length){case 3:r=e[0]/1+e[1]/60+e[2]/3600;break;case 2:r=e[0]/1+e[1]/60;break;case 1:r=e[0];break;default:return NaN}return/^-|[WS]$/i.test(t.trim())&&(r=-r),Number(r)}static toDms(t,e="d",r=void 0){if(isNaN(t))return null;if("string"==typeof t&&""==t.trim())return null;if("boolean"==typeof t)return null;if(t==1/0)return null;if(null==t)return null;if(void 0===r)switch(e){case"d":case"deg":r=4;break;case"dm":case"deg+min":r=2;break;case"dms":case"deg+min+sec":r=0;break;default:e="d",r=4}t=Math.abs(t);let n=null,a=null,o=null,i=null;switch(e){default:case"d":case"deg":a=t.toFixed(r),a<100&&(a="0"+a),a<10&&(a="0"+a),n=a+"°";break;case"dm":case"deg+min":a=Math.floor(t),o=(60*t%60).toFixed(r),60==o&&(o=(0).toFixed(r),a++),a=("000"+a).slice(-3),o<10&&(o="0"+o),n=a+"°"+f.separator+o+"′";break;case"dms":case"deg+min+sec":a=Math.floor(t),o=Math.floor(3600*t/60)%60,i=(3600*t%60).toFixed(r),60==i&&(i=(0).toFixed(r),o++),60==o&&(o=0,a++),a=("000"+a).slice(-3),o=("00"+o).slice(-2),i<10&&(i="0"+i),n=a+"°"+f.separator+o+"′"+f.separator+i+"″"}return n}static toLat(t,e,r){const n=f.toDms(f.wrap90(t),e,r);return null===n?"–":n.slice(1)+f.separator+(t<0?"S":"N")}static toLon(t,e,r){const n=f.toDms(f.wrap180(t),e,r);return null===n?"–":n+f.separator+(t<0?"W":"E")}static toBrng(t,e,r){const n=f.toDms(f.wrap360(t),e,r);return null===n?"–":n.replace("360","0")}static fromLocale(t){const e=123456.789.toLocaleString(),r={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(r.thousands,"⁜").replace(r.decimal,".").replace("⁜",",")}static toLocale(t){const e=123456.789.toLocaleString(),r={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(/,([0-9])/,"⁜$1").replace(".",r.decimal).replace("⁜",r.thousands)}static compassPoint(t,e=3){if(![1,2,3].includes(Number(e)))throw new RangeError(`invalid precision ‘${e}’`);t=f.wrap360(t);const r=4*2**(e-1);return["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][Math.round(t*r/360)%r*16/r]}static wrap90(t){if(-90<=t&&t<=90)return t;const e=t;return 1*Math.abs(((e-90)%360+360)%360-180)-90}static wrap180(t){if(-180<=t&&t<=180)return t;const e=360;return((360*t/e-180)%e+e)%e-180}static wrap360(t){if(0<=t&&t<360)return t;const e=360;return(360*t/e%e+e)%e}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};const p=f,d=Math.PI;class y{constructor(t,e){if(isNaN(t))throw new TypeError(`invalid lat ‘${t}’`);if(isNaN(e))throw new TypeError(`invalid lon ‘${e}’`);this._lat=p.wrap90(Number(t)),this._lon=p.wrap180(Number(e))}get lat(){return this._lat}get latitude(){return this._lat}set lat(t){if(this._lat=isNaN(t)?p.wrap90(p.parse(t)):p.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid lat ‘${t}’`)}set latitude(t){if(this._lat=isNaN(t)?p.wrap90(p.parse(t)):p.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid latitude ‘${t}’`)}get lon(){return this._lon}get lng(){return this._lon}get longitude(){return this._lon}set lon(t){if(this._lon=isNaN(t)?p.wrap180(p.parse(t)):p.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lon ‘${t}’`)}set lng(t){if(this._lon=isNaN(t)?p.wrap180(p.parse(t)):p.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lng ‘${t}’`)}set longitude(t){if(this._lon=isNaN(t)?p.wrap180(p.parse(t)):p.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid longitude ‘${t}’`)}static get metresToKm(){return.001}static get metresToMiles(){return 1/1609.344}static get metresToNauticalMiles(){return 1/1852}static parse(...t){if(0==t.length)throw new TypeError("invalid (empty) point");if(null===t[0]||null===t[1])throw new TypeError("invalid (null) point");let e,r;if(2==t.length&&([e,r]=t,e=p.wrap90(p.parse(e)),r=p.wrap180(p.parse(r)),isNaN(e)||isNaN(r)))throw new TypeError(`invalid point ‘${t.toString()}’`);if(1==t.length&&"string"==typeof t[0]&&([e,r]=t[0].split(","),e=p.wrap90(p.parse(e)),r=p.wrap180(p.parse(r)),isNaN(e)||isNaN(r)))throw new TypeError(`invalid point ‘${t[0]}’`);if(1==t.length&&"object"==typeof t[0]){const n=t[0];if("Point"==n.type&&Array.isArray(n.coordinates)?[r,e]=n.coordinates:(null!=n.latitude&&(e=n.latitude),null!=n.lat&&(e=n.lat),null!=n.longitude&&(r=n.longitude),null!=n.lng&&(r=n.lng),null!=n.lon&&(r=n.lon),e=p.wrap90(p.parse(e)),r=p.wrap180(p.parse(r))),isNaN(e)||isNaN(r))throw new TypeError(`invalid point ‘${JSON.stringify(t[0])}’`)}if(isNaN(e)||isNaN(r))throw new TypeError(`invalid point ‘${t.toString()}’`);return new y(e,r)}distanceTo(t,e=6371e3){if(t instanceof y||(t=y.parse(t)),isNaN(e))throw new TypeError(`invalid radius ‘${e}’`);const r=e,n=this.lat.toRadians(),a=this.lon.toRadians(),o=t.lat.toRadians(),i=o-n,l=t.lon.toRadians()-a,s=Math.sin(i/2)*Math.sin(i/2)+Math.cos(n)*Math.cos(o)*Math.sin(l/2)*Math.sin(l/2);return r*(2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s)))}initialBearingTo(t){if(t instanceof y||(t=y.parse(t)),this.equals(t))return NaN;const e=this.lat.toRadians(),r=t.lat.toRadians(),n=(t.lon-this.lon).toRadians(),a=Math.cos(e)*Math.sin(r)-Math.sin(e)*Math.cos(r)*Math.cos(n),o=Math.sin(n)*Math.cos(r),i=Math.atan2(o,a).toDegrees();return p.wrap360(i)}finalBearingTo(t){t instanceof y||(t=y.parse(t));const e=t.initialBearingTo(this)+180;return p.wrap360(e)}midpointTo(t){t instanceof y||(t=y.parse(t));const e=this.lat.toRadians(),r=this.lon.toRadians(),n=t.lat.toRadians(),a=(t.lon-this.lon).toRadians(),o=Math.cos(e),i=Math.sin(e),l={x:o+Math.cos(n)*Math.cos(a),y:0+Math.cos(n)*Math.sin(a),z:i+Math.sin(n)},s=Math.atan2(l.z,Math.sqrt(l.x*l.x+l.y*l.y)),u=r+Math.atan2(l.y,l.x),c=s.toDegrees(),h=u.toDegrees();return new y(c,h)}intermediatePointTo(t,e){if(t instanceof y||(t=y.parse(t)),this.equals(t))return new y(this.lat,this.lon);const r=this.lat.toRadians(),n=this.lon.toRadians(),a=t.lat.toRadians(),o=t.lon.toRadians(),i=a-r,l=o-n,s=Math.sin(i/2)*Math.sin(i/2)+Math.cos(r)*Math.cos(a)*Math.sin(l/2)*Math.sin(l/2),u=2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s)),c=Math.sin((1-e)*u)/Math.sin(u),h=Math.sin(e*u)/Math.sin(u),f=c*Math.cos(r)*Math.cos(n)+h*Math.cos(a)*Math.cos(o),p=c*Math.cos(r)*Math.sin(n)+h*Math.cos(a)*Math.sin(o),d=c*Math.sin(r)+h*Math.sin(a),g=Math.atan2(d,Math.sqrt(f*f+p*p)),v=Math.atan2(p,f),m=g.toDegrees(),b=v.toDegrees();return new y(m,b)}destinationPoint(t,e,r=6371e3){const n=t/r,a=Number(e).toRadians(),o=this.lat.toRadians(),i=this.lon.toRadians(),l=Math.sin(o)*Math.cos(n)+Math.cos(o)*Math.sin(n)*Math.cos(a),s=Math.asin(l),u=Math.sin(a)*Math.sin(n)*Math.cos(o),c=Math.cos(n)-Math.sin(o)*l,h=i+Math.atan2(u,c),f=s.toDegrees(),p=h.toDegrees();return new y(f,p)}static intersection(t,e,r,n){if(t instanceof y||(t=y.parse(t)),r instanceof y||(r=y.parse(r)),isNaN(e))throw new TypeError(`invalid brng1 ‘${e}’`);if(isNaN(n))throw new TypeError(`invalid brng2 ‘${n}’`);const a=t.lat.toRadians(),o=t.lon.toRadians(),i=r.lat.toRadians(),l=r.lon.toRadians(),s=Number(e).toRadians(),u=Number(n).toRadians(),c=i-a,h=l-o,f=2*Math.asin(Math.sqrt(Math.sin(c/2)*Math.sin(c/2)+Math.cos(a)*Math.cos(i)*Math.sin(h/2)*Math.sin(h/2)));if(Math.abs(f)<Number.EPSILON)return new y(t.lat,t.lon);const p=(Math.sin(i)-Math.sin(a)*Math.cos(f))/(Math.sin(f)*Math.cos(a)),g=(Math.sin(a)-Math.sin(i)*Math.cos(f))/(Math.sin(f)*Math.cos(i)),v=Math.acos(Math.min(Math.max(p,-1),1)),m=Math.acos(Math.min(Math.max(g,-1),1)),b=s-(Math.sin(l-o)>0?v:2*d-v),M=(Math.sin(l-o)>0?2*d-m:m)-u;if(0==Math.sin(b)&&0==Math.sin(M))return null;if(Math.sin(b)*Math.sin(M)<0)return null;const w=-Math.cos(b)*Math.cos(M)+Math.sin(b)*Math.sin(M)*Math.cos(f),S=Math.atan2(Math.sin(f)*Math.sin(b)*Math.sin(M),Math.cos(M)+Math.cos(b)*w),x=Math.asin(Math.min(Math.max(Math.sin(a)*Math.cos(S)+Math.cos(a)*Math.sin(S)*Math.cos(s),-1),1)),N=o+Math.atan2(Math.sin(s)*Math.sin(S)*Math.cos(a),Math.cos(S)-Math.sin(a)*Math.sin(x)),P=x.toDegrees(),O=N.toDegrees();return new y(P,O)}crossTrackDistanceTo(t,e,r=6371e3){t instanceof y||(t=y.parse(t)),e instanceof y||(e=y.parse(e));const n=r;if(this.equals(t))return 0;const a=t.distanceTo(this,n)/n,o=t.initialBearingTo(this).toRadians(),i=t.initialBearingTo(e).toRadians();return Math.asin(Math.sin(a)*Math.sin(o-i))*n}alongTrackDistanceTo(t,e,r=6371e3){t instanceof y||(t=y.parse(t)),e instanceof y||(e=y.parse(e));const n=r;if(this.equals(t))return 0;const a=t.distanceTo(this,n)/n,o=t.initialBearingTo(this).toRadians(),i=t.initialBearingTo(e).toRadians(),l=Math.asin(Math.sin(a)*Math.sin(o-i));return Math.acos(Math.cos(a)/Math.abs(Math.cos(l)))*Math.sign(Math.cos(i-o))*n}maxLatitude(t){const e=Number(t).toRadians(),r=this.lat.toRadians();return Math.acos(Math.abs(Math.sin(e)*Math.cos(r))).toDegrees()}static crossingParallels(t,e,r){if(t.equals(e))return null;const n=Number(r).toRadians(),a=t.lat.toRadians(),o=t.lon.toRadians(),i=e.lat.toRadians(),l=e.lon.toRadians()-o,s=Math.sin(a)*Math.cos(i)*Math.cos(n)*Math.sin(l),u=Math.sin(a)*Math.cos(i)*Math.cos(n)*Math.cos(l)-Math.cos(a)*Math.sin(i)*Math.cos(n),c=Math.cos(a)*Math.cos(i)*Math.sin(n)*Math.sin(l);if(c*c>s*s+u*u)return null;const h=Math.atan2(-u,s),f=Math.acos(c/Math.sqrt(s*s+u*u)),d=o+h+f,y=(o+h-f).toDegrees(),g=d.toDegrees();return{lon1:p.wrap180(y),lon2:p.wrap180(g)}}rhumbDistanceTo(t,e=6371e3){t instanceof y||(t=y.parse(t));const r=e,n=this.lat.toRadians(),a=t.lat.toRadians(),o=a-n;let i=Math.abs(t.lon-this.lon).toRadians();Math.abs(i)>d&&(i=i>0?-(2*d-i):2*d+i);const l=Math.log(Math.tan(a/2+d/4)/Math.tan(n/2+d/4)),s=Math.abs(l)>1e-11?o/l:Math.cos(n);return Math.sqrt(o*o+s*s*i*i)*r}rhumbBearingTo(t){if(t instanceof y||(t=y.parse(t)),this.equals(t))return NaN;const e=this.lat.toRadians(),r=t.lat.toRadians();let n=(t.lon-this.lon).toRadians();Math.abs(n)>d&&(n=n>0?-(2*d-n):2*d+n);const a=Math.log(Math.tan(r/2+d/4)/Math.tan(e/2+d/4)),o=Math.atan2(n,a).toDegrees();return p.wrap360(o)}rhumbDestinationPoint(t,e,r=6371e3){const n=this.lat.toRadians(),a=this.lon.toRadians(),o=Number(e).toRadians(),i=t/r,l=i*Math.cos(o);let s=n+l;Math.abs(s)>d/2&&(s=s>0?d-s:-d-s);const u=Math.log(Math.tan(s/2+d/4)/Math.tan(n/2+d/4)),c=Math.abs(u)>1e-11?l/u:Math.cos(n),h=a+i*Math.sin(o)/c,f=s.toDegrees(),p=h.toDegrees();return new y(f,p)}rhumbMidpointTo(t){t instanceof y||(t=y.parse(t));const e=this.lat.toRadians();let r=this.lon.toRadians();const n=t.lat.toRadians(),a=t.lon.toRadians();Math.abs(a-r)>d&&(r+=2*d);const o=(e+n)/2,i=Math.tan(d/4+e/2),l=Math.tan(d/4+n/2),s=Math.tan(d/4+o/2);let u=((a-r)*Math.log(s)+r*Math.log(l)-a*Math.log(i))/Math.log(l/i);isFinite(u)||(u=(r+a)/2);const c=o.toDegrees(),h=u.toDegrees();return new y(c,h)}static areaOf(t,e=6371e3){const r=e,n=t[0].equals(t[t.length-1]);n||t.push(t[0]);const a=t.length-1;let o=0;for(let e=0;e<a;e++){const r=t[e].lat.toRadians(),n=t[e+1].lat.toRadians(),a=(t[e+1].lon-t[e].lon).toRadians();o+=2*Math.atan2(Math.tan(a/2)*(Math.tan(r/2)+Math.tan(n/2)),1+Math.tan(r/2)*Math.tan(n/2))}(function(t){let e=0,r=t[0].initialBearingTo(t[1]);for(let n=0;n<t.length-1;n++){const a=t[n].initialBearingTo(t[n+1]),o=t[n].finalBearingTo(t[n+1]);e+=(a-r+540)%360-180,e+=(o-a+540)%360-180,r=o}return e+=(t[0].initialBearingTo(t[1])-r+540)%360-180,Math.abs(e)<90})(t)&&(o=Math.abs(o)-2*d);const i=Math.abs(o*r*r);return n||t.pop(),i}equals(t){return t instanceof y||(t=y.parse(t)),!(Math.abs(this.lat-t.lat)>Number.EPSILON||Math.abs(this.lon-t.lon)>Number.EPSILON)}toGeoJSON(){return{type:"Point",coordinates:[this.lon,this.lat]}}toString(t="d",e=void 0){if(!["d","dm","dms","n"].includes(t))throw new RangeError(`invalid format ‘${t}’`);return"n"==t?(null==e&&(e=4),`${this.lat.toFixed(e)},${this.lon.toFixed(e)}`):`${p.toLat(this.lat,t,e)}, ${p.toLon(this.lon,t,e)}`}}function g(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,a,o,i,l=[],s=!0,u=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return v(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?v(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var m=function(t,e){var r=g(t,2),n=r[0],a=r[1],o=g(e,2),i=o[0],l=o[1],s=new y(a,n),u=new y(l,i);return s.distanceTo(u)},b=function(t){var e=1609.344,r=t/e;if(r<.5/e)return"".concat(Math.round(t),"m");if(r<10){var n=Number.parseFloat(r.toFixed(1)),a=1===n?"mile":"miles";return"".concat(n," ").concat(a)}var o=Math.round(r),i=1===o?"mile":"miles";return"".concat(o," ").concat(i)};function M(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,a,o,i,l=[],s=!0,u=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return w(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?w(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function S(t){return S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},S(t)}function x(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function N(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?x(Object(r),!0).forEach(function(e){P(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):x(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function P(t,e,r){return(e=function(t){var e=function(t){if("object"!=S(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=S(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==S(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function O(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var E="highlighted-label";function j(t,e){if("number"==typeof t)return t;if(!Array.isArray(t)||"interpolate"!==t[0])return function(t,e){var r=t.stops;if(r.length<2)return r.length>0?r[0][1]:0;for(var n=r[0],a=r[r.length-1],o=1;o<r.length;o++){var i=r[o];if(i[0]>e){a=i,n=r[o-1];break}n=r[o-1],a=i}var l=M(n,2),s=l[0],u=l[1],c=M(a,2),h=c[0],f=c[1];return e<=s?u:e>=h?f:u+(e-s)/(h-s)*(f-u)}(t,e);var r,n=function(t){if(Array.isArray(t))return t}(r=t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(r)||function(t,e){if(t){if("string"==typeof t)return O(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?O(t,e):void 0}}(r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),a=n[2],o=O(n).slice(3);if("zoom"!==a[0])throw new Error("Only zoom-based expressions supported");for(var i=0;i<o.length-2;i+=2){var l=o[i],s=o[i+1],u=o[i+2],c=o[i+3];if(e<=l)return s;if(e<=u)return s+(e-l)/(u-l)*(c-s)}return o[o.length-1]}function A(t,e){if(e.highlightLayerId&&t.getLayer(e.highlightLayerId)){try{t.removeLayer(e.highlightLayerId)}catch(t){}e.highlightLayerId=null,e.highlightedExpr=null}}function T(t,e,r){var n,a,o,i;if(null!=e&&null!==(n=e.feature)&&void 0!==n&&n.layer){A(t,r);var l=e.feature,s=e.layer;r.highlightLayerId="highlight-".concat(s.id);var u=l.id,c=l.type,h=l.properties,f=l.geometry;t.getSource(E).setData({id:u,type:c,properties:h,geometry:f}),r.highlightedExpr=s.layout["text-size"];var p=t.getZoom(),d=(a=s,o=1.5*j(r.highlightedExpr,p),i=r.isDarkStyle?{text:"#ffffff",halo:"#000000"}:{text:"#000000",halo:"#ffffff"},{id:"highlight-".concat(a.id),type:a.type,source:E,layout:N(N({},a.layout),{},{"text-size":o,"text-allow-overlap":!0,"text-ignore-placement":!0,"text-max-angle":90}),paint:N(N({},a.paint),{},{"text-color":i.text,"text-halo-color":i.halo,"text-halo-width":3,"text-halo-blur":1,"text-opacity":1})});t.addLayer(d),t.moveLayer(r.highlightLayerId)}}function R(t){t.getSource(E)||t.addSource(E,{type:"geojson",data:{type:"FeatureCollection",features:[]}})}function L(t){t.getStyle().layers.filter(function(t){var e;return"line"===(null===(e=t.layout)||void 0===e?void 0:e["symbol-placement"])}).forEach(function(e){return t.setLayoutProperty(e.id,"symbol-placement","line-center")})}function _(t,e,r,n){var a={isDarkStyle:"dark"===e,labels:[],currentPixel:null,highlightLayerId:null,highlightedExpr:null};function o(){var e=t.getStyle().layers.filter(function(t){return"symbol"===t.type}),r=t.queryRenderedFeatures({layers:e.map(function(t){return t.id})});a.labels=function(t,e,r){return e.flatMap(function(e){var n,a,o,i,l="string"==typeof(a=null===(n=e.layout)||void 0===n?void 0:n["text-field"])?null===(o=/^{(.+)}$/.exec(a))||void 0===o?void 0:o[1]:Array.isArray(a)?null===(i=a.find(function(t){return Array.isArray(t)&&"get"===t[0]}))||void 0===i?void 0:i[1]:null;return l?r.filter(function(t){var r;return t.layer.id===e.id&&(null===(r=t.properties)||void 0===r?void 0:r[l])}).map(function(r){return function(t,e,r,n){var a=function(t){var e=t.type,r=t.coordinates;if("Point"===e)return r;if("MultiPoint"===e)return r[0];if(e.includes("LineString")){var n="LineString"===e?r:r[0];return[(n[0][0]+n[n.length-1][0])/2,(n[0][1]+n[n.length-1][1])/2]}if(e.includes("Polygon")){var a="Polygon"===e?r[0]:r[0][0],o=a.reduce(function(t,e){return[t[0]+e[0],t[1]+e[1]]},[0,0]);return[o[0]/a.length,o[1]/a.length]}return null}(t.geometry);if(!a)return null;var o=n.project({lng:a[0],lat:a[1]});return{text:t.properties[r],x:o.x,y:o.y,feature:t,layer:e}}(r,e,l,t)}).filter(Boolean):[]})}(t,e,r)}function i(){if(o(),!a.labels.length)return null;var e=t.project(t.getCenter()),r=function(t,e){var r;return null===(r=t.reduce(function(t,r){var n=Math.pow(r.x-e.x,2)+Math.pow(r.y-e.y,2);return!t||n<t.dist?{label:r,dist:n}:t},null))||void 0===r?void 0:r.label}(a.labels,e);return r&&(a.currentPixel={x:r.x,y:r.y}),T(t,r,a),"".concat(r.text," (").concat(r.layer.id,")")}return L(t),R(t),null==n||n.on(r.MAP_SET_STYLE,function(e){t.once("styledata",function(){return t.once("idle",function(){L(t),R(t),a.isDarkStyle="dark"===(null==e?void 0:e.mapColorScheme)})})}),t.on("zoom",function(){if(a.highlightLayerId&&a.highlightedExpr){var e=j(a.highlightedExpr,t.getZoom());t.setLayoutProperty(a.highlightLayerId,"text-size",1.5*e)}}),function(t){t.getStyle().layers.filter(function(t){return"symbol"===t.type}).forEach(function(e){t.setPaintProperty(e.id,"text-opacity",["case",["boolean",["feature-state","highlighted"],!1],0,1])})}(t),{refreshLabels:o,highlightNextLabel:function(e){if(o(),!a.labels.length)return null;if(!a.currentPixel)return i();var r=function(t,e){if(!e.currentPixel)return null;var r=e.labels.map(function(t,e){return{pixel:[t.x,t.y],index:e}}).filter(function(t){return t.pixel[0]!==e.currentPixel.x||t.pixel[1]!==e.currentPixel.y});if(!r.length)return null;var n=r.map(function(t){return t.pixel}),a=function(t,e,r){var n=g(e,2),a=n[0],o=n[1],i=r.filter(function(e){var r=g(e,2),n=r[0],i=r[1];return(n!==a||i!==o)&&function(t,e,r){switch(t){case"ArrowUp":return r<0&&Math.abs(r)>=Math.abs(e);case"ArrowDown":return r>0&&Math.abs(r)>=Math.abs(e);case"ArrowLeft":return e<0&&Math.abs(e)>Math.abs(r);case"ArrowRight":return e>0&&Math.abs(e)>Math.abs(r);default:return!1}}(t,n-a,i-o)});if(!i.length)return r.findIndex(function(t){return t[0]===a&&t[1]===o});var l=-1,s=1/0;return i.forEach(function(t){var e=t[0]-a,n=t[1]-o,i=e*e+n*n;i<s&&(s=i,l=r.indexOf(t))}),l}(t,[e.currentPixel.x,e.currentPixel.y],n);return(null==a||a<0||a>=r.length)&&(a=0),e.labels[r[a].index]}(e,a);return r?(a.currentPixel={x:r.x,y:r.y},T(t,r,a),"".concat(r.text," (").concat(r.layer.id,")")):null},highlightLabelAtCenter:i,clearHighlightedLabel:function(){return A(t,a)}}}function k(t){return k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},k(t)}function D(t){return function(t){if(Array.isArray(t))return B(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||I(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function I(t,e){if(t){if("string"==typeof t)return B(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?B(t,e):void 0}}function B(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function C(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function F(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?C(Object(r),!0).forEach(function(e){$(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):C(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function $(t,e,r){return(e=function(t){var e=function(t){if("object"!=k(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=k(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==k(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var z=function(t,e,r,n,a,o,i){t.getLayer(e)||t.addLayer(F(F({id:e,type:r,source:n},a&&{"source-layer":a}),{},{paint:o})),Object.entries(o).forEach(function(r){var n,a,o=(a=2,function(t){if(Array.isArray(t))return t}(n=r)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,a,o,i,l=[],s=!0,u=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(n,a)||I(n,a)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=o[0],l=o[1];t.setPaintProperty(e,i,l)}),t.setFilter(e,i)};function q(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,a,o,i,l=[],s=!0,u=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Z(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Z(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Z(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var W=function(t,e,r){var n=Math.pow(e.x-r.x,2)+Math.pow(e.y-r.y,2);if(0===n)return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2);var a=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n;return a=Math.max(0,Math.min(1,a)),Math.pow(t.x-(e.x+a*(r.x-e.x)),2)+Math.pow(t.y-(e.y+a*(r.y-e.y)),2)},G=["container","padding","mapStyle","center","zoom","bounds","pixelRatio"];function H(t){return H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},H(t)}function U(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",a=r.toStringTag||"@@toStringTag";function o(r,n,a,o){var s=n&&n.prototype instanceof l?n:l,u=Object.create(s.prototype);return V(u,"_invoke",function(r,n,a){var o,l,s,u=0,c=a||[],h=!1,f={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,r){return o=e,l=0,s=t,f.n=r,i}};function p(r,n){for(l=r,s=n,e=0;!h&&u&&!a&&e<c.length;e++){var a,o=c[e],p=f.p,d=o[2];r>3?(a=d===n)&&(s=o[(l=o[4])?5:(l=3,3)],o[4]=o[5]=t):o[0]<=p&&((a=r<2&&p<o[1])?(l=0,f.v=n,f.n=o[1]):p<d&&(a=r<3||o[0]>n||n>d)&&(o[4]=r,o[5]=n,f.n=d,l=0))}if(a||r>1)return i;throw h=!0,n}return function(a,c,d){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&p(c,d),l=c,s=d;(e=l<2?t:s)||!h;){o||(l?l<3?(l>1&&(f.n=-1),p(l,s)):f.n=s:f.v=s);try{if(u=2,o){if(l||(a="next"),e=o[a]){if(!(e=e.call(o,s)))throw TypeError("iterator result is not an object");if(!e.done)return e;s=e.value,l<2&&(l=0)}else 1===l&&(e=o.return)&&e.call(o),l<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),l=1);o=t}else if((e=(h=f.n<0)?s:r.call(n,f))!==i)break}catch(e){o=t,l=1,s=e}finally{u=1}}return{value:e,done:h}}}(r,a,o),!0),u}var i={};function l(){}function s(){}function u(){}e=Object.getPrototypeOf;var c=[][n]?e(e([][n]())):(V(e={},n,function(){return this}),e),h=u.prototype=l.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,V(t,a,"GeneratorFunction")),t.prototype=Object.create(h),t}return s.prototype=u,V(h,"constructor",u),V(u,"constructor",s),s.displayName="GeneratorFunction",V(u,a,"GeneratorFunction"),V(h),V(h,a,"Generator"),V(h,n,function(){return this}),V(h,"toString",function(){return"[object Generator]"}),(U=function(){return{w:o,m:f}})()}function V(t,e,r,n){var a=Object.defineProperty;try{a({},"",{})}catch(t){a=0}V=function(t,e,r,n){function o(e,r){V(t,e,function(t){return this._invoke(e,r,t)})}e?a?a(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(o("next",0),o("throw",1),o("return",2))},V(t,e,r,n)}function Y(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function J(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Y(Object(r),!0).forEach(function(e){K(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Y(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function K(t,e,r){return(e=et(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function X(t,e){if(null==t)return{};var r,n,a=function(t,e){if(null==t)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)r=o[n],-1===e.indexOf(r)&&{}.propertyIsEnumerable.call(t,r)&&(a[r]=t[r])}return a}function Q(t,e,r,n,a,o,i){try{var l=t[o](i),s=l.value}catch(t){return void r(t)}l.done?e(s):Promise.resolve(s).then(n,a)}function tt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,et(n.key),n)}}function et(t){var e=function(t){if("object"!=H(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=H(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==H(e)?e:e+""}var rt=function(){return t=function t(e){var r=e.mapFramework,n=e.mapProviderConfig,o=void 0===n?{}:n,i=e.events,l=e.eventBus;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.maplibreModule=r,this.events=i,this.eventBus=l,this.capabilities={supportedShortcuts:a,supportsMapSizes:!0},Object.assign(this,o)},e=[{key:"initMap",value:(r=U().m(function t(e){var r,n,a,l,s,h,f,p,d,y,g,v,m=this;return U().w(function(t){for(;;)switch(t.n){case 0:r=e.container,n=e.padding,a=e.mapStyle,l=e.center,s=e.zoom,h=e.bounds,f=e.pixelRatio,p=X(e,G),d=this.maplibreModule.Map,y=this.events,g=this.eventBus,(v=new d(J(J({},p),{},{container:r,style:null==a?void 0:a.url,pixelRatio:f,padding:n,center:l,zoom:s,fadeDuration:0,attributionControl:!1,dragRotate:!1,doubleClickZoom:!1}))).touchZoomRotate.disableRotation(),this.map=v,this.map.setPadding(n),h&&v.fitBounds(h,{duration:0}),i(v),o(v),u({map:v,events:y,eventBus:g,getCenter:this.getCenter.bind(this),getZoom:this.getZoom.bind(this),getBounds:this.getBounds.bind(this),getResolution:this.getResolution.bind(this)}),c({map:v,events:y,eventBus:g}),v.on("load",function(){m.labelNavigator=_(v,null==a?void 0:a.mapColorScheme,y,g)}),this.eventBus.emit(y.MAP_READY,this.getMapAPI());case 1:return t.a(2)}},t,this)}),l=function(){var t=this,e=arguments;return new Promise(function(n,a){var o=r.apply(t,e);function i(t){Q(o,n,a,i,l,"next",t)}function l(t){Q(o,n,a,i,l,"throw",t)}i(void 0)})},function(t){return l.apply(this,arguments)})},{key:"getMapAPI",value:function(){return{map:this.map,crs:this.crs,fitToBounds:this.fitToBounds.bind(this),setView:this.setView.bind(this)}}},{key:"destroyMap",value:function(){var t,e;null===(t=this.mapEvents)||void 0===t||t.remove(),null===(e=this.appEvents)||void 0===e||e.remove(),this.mapEvents=null,this.appEvents=null,this.map.remove()}},{key:"setView",value:function(t){var e=t.center,r=t.zoom;this.map.flyTo({center:e||this.getCenter(),zoom:r||this.getZoom(),duration:n})}},{key:"zoomIn",value:function(t){this.map.easeTo({zoom:this.getZoom()+t,duration:n})}},{key:"zoomOut",value:function(t){this.map.easeTo({zoom:this.getZoom()-t,duration:n})}},{key:"panBy",value:function(t){this.map.panBy(t,{duration:n})}},{key:"fitToBounds",value:function(t){this.map.fitBounds(t,{duration:n})}},{key:"setPadding",value:function(t){this.map.setPadding(t)}},{key:"updateHighlightedFeatures",value:function(t,e){return function(t){var e=t.LngLatBounds,r=t.map,n=t.selectedFeatures,a=t.stylesMap;if(!r)return null;var o=function(t,e){var r={};return null==e||e.forEach(function(e){var n=e.featureId,a=e.layerId,o=e.idProperty,i=e.geometry,l=t.getLayer(a);if(l){var s=l.source;r[s]||(r[s]={ids:new Set,fillIds:new Set,idProperty:o,layerId:a,hasFillGeometry:!1}),!i||"Polygon"!==i.type&&"MultiPolygon"!==i.type||(r[s].hasFillGeometry=!0,r[s].fillIds.add(n)),r[s].ids.add(n)}}),r}(r,n),i=[],l=new Set(Object.keys(o)),s=r._highlightedSources||new Set;return function(t,e,r){e.forEach(function(e){if(!r.has(e)){var n="highlight-".concat(e);["".concat(n,"-fill"),"".concat(n,"-line")].forEach(function(e){t.getLayer(e)&&t.setFilter(e,["==","id",""])})}})}(r,s,l),r._highlightedSources=l,l.forEach(function(t){var e=o[t],n=e.ids,l=e.fillIds,s=e.idProperty,u=e.layerId,c=e.hasFillGeometry,h=r.getLayer(u),f=h.sourceLayer,p=c?"fill":h.type,d="highlight-".concat(t),y=a[u],g=y.stroke,v=y.strokeWidth,m=y.fill,b=s?["get",s]:["id"],M=["in",b,["literal",D(n)]],w=["in",b,["literal",D(l)]],S={"line-color":g,"line-width":v};"fill"===p&&(z(r,"".concat(d,"-fill"),"fill",t,f,{"fill-color":m},w),z(r,"".concat(d,"-line"),"line",t,f,S,M)),"line"===p&&(r.getLayer("".concat(d,"-fill"))&&r.setFilter("".concat(d,"-fill"),["==","id",""]),z(r,"".concat(d,"-line"),"line",t,f,S,M)),i.push.apply(i,D(r.queryRenderedFeatures({layers:[u]}).filter(function(t){var e;return n.has(s?null===(e=t.properties)||void 0===e?void 0:e[s]:t.id)})))}),function(t,e){if(!e.length)return null;var r=new t;return e.forEach(function(t){var e=function(t){return"number"==typeof t[0]?r.extend(t):t.forEach(e)};e(t.geometry.coordinates)}),[r.getWest(),r.getSouth(),r.getEast(),r.getNorth()]}(e,i)}({LngLatBounds:this.maplibreModule.LngLatBounds,map:this.map,selectedFeatures:t,stylesMap:e})}},{key:"highlightNextLabel",value:function(t){var e;return(null===(e=this.labelNavigator)||void 0===e?void 0:e.highlightNextLabel(t))||null}},{key:"highlightLabelAtCenter",value:function(){var t;return(null===(t=this.labelNavigator)||void 0===t?void 0:t.highlightLabelAtCenter())||null}},{key:"clearHighlightedLabel",value:function(){var t;return(null===(t=this.labelNavigator)||void 0===t?void 0:t.clearHighlightedLabel())||null}},{key:"getCenter",value:function(){var t=this.map.getCenter();return[Number(t.lng.toFixed(7)),Number(t.lat.toFixed(7))]}},{key:"getZoom",value:function(){return Number(this.map.getZoom().toFixed(7))}},{key:"getBounds",value:function(){return this.map.getBounds().toArray().flat(1)}},{key:"getFeaturesAtPoint",value:function(t,e){return function(t,e){var r=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).radius,n=void 0===r?10:r,a=[[e.x-n,e.y-n],[e.x+n,e.y+n]],o=t.queryRenderedFeatures(a);if(0===o.length)return[];var i=[];o.forEach(function(t){!1===i.includes(t.layer.id)&&i.push(t.layer.id)});for(var l=new Set,s=[],u=o.length-1;u>=0;u--){var c=o[u],h=void 0===c.id?JSON.stringify(c.properties):c.id;!1===l.has(h)&&(l.add(h),s.push(c))}var f=t.unproject(e),p=[f.lng,f.lat];return s.map(function(r){var n=0,a=r.geometry.type,o=function(t,e,r){var n=r.coordinates,a=r.type,o=1/0,i=function(e){return t.project(e)},l=function(t){for(var r=0;r<t.length-1;r++){var n=W(e,i(t[r]),i(t[r+1]));n<o&&(o=n)}};if("Point"===a){var s=i(n);o=Math.pow(e.x-s.x,2)+Math.pow(e.y-s.y,2)}else"LineString"===a||"MultiPoint"===a?"LineString"===a?l(n):n.forEach(function(t){var r=i(t),n=Math.pow(e.x-r.x,2)+Math.pow(e.y-r.y,2);n<o&&(o=n)}):"Polygon"===a||"MultiLineString"===a?n.forEach(l):"MultiPolygon"===a&&n.forEach(function(t){return t.forEach(l)});return o}(t,e,r.geometry);if(n+=1e6*i.indexOf(r.layer.id),a.includes("Polygon")){var l=("Polygon"===a?[r.geometry.coordinates]:r.geometry.coordinates).some(function(t){return function(t,e){for(var r=q(t,2),n=r[0],a=r[1],o=!1,i=0,l=e.length-1;i<e.length;l=i,i++){var s=q(e[i],2),u=s[0],c=s[1],h=q(e[l],2),f=h[0],p=h[1];c>a!=p>a&&n<(f-u)*(a-c)/(p-c)+u&&(o=!o)}return o}(p,t[0])});!0===l?n-=5e5:n+=1e5}return{f:r,score:n+=o}}).sort(function(t,e){return t.score-e.score}).map(function(t){return t.f})}(this.map,t,e)}},{key:"getAreaDimensions",value:function(){return function(t){var e,r,n,a;if(t&&"function"==typeof t.getWest)e=t.getWest(),r=t.getSouth(),n=t.getEast(),a=t.getNorth();else{if(!Array.isArray(t)||2!==t.length)return"";var o=g(t,2),i=g(o[0],2);e=i[0],r=i[1];var l=g(o[1],2);n=l[0],a=l[1]}var s=m([e,r],[n,r]),u=m([e,r],[e,a]),c=b(s),h=b(u);return"".concat(h," by ").concat(c)}((t=this.maplibreModule.LngLatBounds,e=this.map,r=e.getContainer().getBoundingClientRect(),n=r.width,a=r.height,o=e.getPadding(),i=[o.left,a-o.bottom],l=[n-o.right,o.top],new t(e.unproject(i),e.unproject(l))));var t,e,r,n,a,o,i,l}},{key:"getCardinalMove",value:function(t,e){return function(t,e){var r=g(t,2),n=r[0],a=r[1],o=g(e,2),i=o[0],l=o[1],s=l-a,u=i-n,c=[];if(Math.abs(s)>1e-4){var h=Math.round(m([n,a],[n,l]));c.push("".concat(s>0?"north":"south"," ").concat(b(h)))}if(Math.abs(u)>1e-4){var f=Math.round(m([n,a],[i,a]));c.push("".concat(u>0?"east":"west"," ").concat(b(f)))}return c.join(", ")}(t,e)}},{key:"getResolution",value:function(){return t=this.map.getCenter(),e=this.map.getZoom(),r=t.lat,n=Math.pow(2,e),40075016.686*Math.cos(r*Math.PI/180)/(512*n);var t,e,r,n}},{key:"mapToScreen",value:function(t){return this.map.project(t)}},{key:"screenToMap",value:function(t){var e=this.map.unproject([t.x,t.y]);return[e.lng,e.lat]}}],e&&tt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r,l}()}};
|
|
1
|
+
import t from"@babel/runtime/helpers/defineProperty";import e from"@babel/runtime/helpers/objectWithoutProperties";import a from"@babel/runtime/helpers/asyncToGenerator";var r=400,n=7,i=["showKeyboardHelp","selectControl","moveLarge","nudgeMap","zoomLarge","nudgeZoom","highlightLabelAtCenter","highlightNextLabel"];var o=(t,e)=>{var a=null,r=function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];clearTimeout(a),a=setTimeout(()=>{t(...n)},e)};return r.cancel=()=>{a&&(clearTimeout(a),a=null)},r};function s(t){var{map:e,events:a,eventBus:r,getCenter:n,getZoom:i,getBounds:s,getResolution:l}=t,h=[],u=[],c=()=>{var t=i();return{center:n(),bounds:s(),resolution:l(),zoom:t,isAtMaxZoom:e.getMaxZoom()<=t,isAtMinZoom:e.getMinZoom()>=t}},d=(t,e)=>r.emit(t,e),p=()=>d(a.MAP_LOADED);e.on("load",p),h.push(["load",p]);e.once("idle",()=>d(a.MAP_FIRST_IDLE,c()));var g=()=>d(a.MAP_MOVE_START);e.on("movestart",g),h.push(["movestart",g]);var f=o(()=>{d(a.MAP_MOVE_END,c())},500);e.on("moveend",f),h.push(["moveend",f]),u.push(f);var M,y,m,v=(M=()=>{d(a.MAP_MOVE,c())},y=10,m=0,function(){var t=Date.now();t-m>=y&&(m=t,M(...arguments))});e.on("zoom",v),h.push(["zoom",v]),u.push(v);var b=()=>d(a.MAP_RENDER);e.on("render",b),h.push(["render",b]);var w=o(()=>{d(a.MAP_DATA_CHANGE,c())},500);e.on("styledata",w),h.push(["styledata",w]),u.push(w);var N=()=>d(a.MAP_STYLE_CHANGE);e.on("style.load",N),h.push(["style.load",N]);var x=t=>d(a.MAP_CLICK,{point:t.point,coords:[t.lngLat.lng,t.lngLat.lat]});return e.on("click",x),h.push(["click",x]),{remove(){u.forEach(t=>t.cancel()),h.forEach(t=>{var[a,r]=t;return e.off(a,r)})}}}let l=" ";class h{static get separator(){return l}static set separator(t){l=t}static parse(t){if(!isNaN(parseFloat(t))&&isFinite(t))return Number(t);const e=String(t).trim().replace(/^-/,"").replace(/[NSEW]$/i,"").split(/[^0-9.,]+/);if(""==e[e.length-1]&&e.splice(e.length-1),""==e)return NaN;let a=null;switch(e.length){case 3:a=e[0]/1+e[1]/60+e[2]/3600;break;case 2:a=e[0]/1+e[1]/60;break;case 1:a=e[0];break;default:return NaN}return/^-|[WS]$/i.test(t.trim())&&(a=-a),Number(a)}static toDms(t,e="d",a=void 0){if(isNaN(t))return null;if("string"==typeof t&&""==t.trim())return null;if("boolean"==typeof t)return null;if(t==1/0)return null;if(null==t)return null;if(void 0===a)switch(e){case"d":case"deg":a=4;break;case"dm":case"deg+min":a=2;break;case"dms":case"deg+min+sec":a=0;break;default:e="d",a=4}t=Math.abs(t);let r=null,n=null,i=null,o=null;switch(e){default:case"d":case"deg":n=t.toFixed(a),n<100&&(n="0"+n),n<10&&(n="0"+n),r=n+"°";break;case"dm":case"deg+min":n=Math.floor(t),i=(60*t%60).toFixed(a),60==i&&(i=(0).toFixed(a),n++),n=("000"+n).slice(-3),i<10&&(i="0"+i),r=n+"°"+h.separator+i+"′";break;case"dms":case"deg+min+sec":n=Math.floor(t),i=Math.floor(3600*t/60)%60,o=(3600*t%60).toFixed(a),60==o&&(o=(0).toFixed(a),i++),60==i&&(i=0,n++),n=("000"+n).slice(-3),i=("00"+i).slice(-2),o<10&&(o="0"+o),r=n+"°"+h.separator+i+"′"+h.separator+o+"″"}return r}static toLat(t,e,a){const r=h.toDms(h.wrap90(t),e,a);return null===r?"–":r.slice(1)+h.separator+(t<0?"S":"N")}static toLon(t,e,a){const r=h.toDms(h.wrap180(t),e,a);return null===r?"–":r+h.separator+(t<0?"W":"E")}static toBrng(t,e,a){const r=h.toDms(h.wrap360(t),e,a);return null===r?"–":r.replace("360","0")}static fromLocale(t){const e=123456.789.toLocaleString(),a={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(a.thousands,"⁜").replace(a.decimal,".").replace("⁜",",")}static toLocale(t){const e=123456.789.toLocaleString(),a={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(/,([0-9])/,"⁜$1").replace(".",a.decimal).replace("⁜",a.thousands)}static compassPoint(t,e=3){if(![1,2,3].includes(Number(e)))throw new RangeError(`invalid precision ‘${e}’`);t=h.wrap360(t);const a=4*2**(e-1);return["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][Math.round(t*a/360)%a*16/a]}static wrap90(t){if(-90<=t&&t<=90)return t;const e=t,a=360;return 1*Math.abs(((e-90)%a+a)%a-180)-90}static wrap180(t){if(-180<=t&&t<=180)return t;const e=360;return((360*t/e-180)%e+e)%e-180}static wrap360(t){if(0<=t&&t<360)return t;const e=360;return(360*t/e%e+e)%e}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};const u=Math.PI;class c{constructor(t,e){if(isNaN(t))throw new TypeError(`invalid lat ‘${t}’`);if(isNaN(e))throw new TypeError(`invalid lon ‘${e}’`);this._lat=h.wrap90(Number(t)),this._lon=h.wrap180(Number(e))}get lat(){return this._lat}get latitude(){return this._lat}set lat(t){if(this._lat=isNaN(t)?h.wrap90(h.parse(t)):h.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid lat ‘${t}’`)}set latitude(t){if(this._lat=isNaN(t)?h.wrap90(h.parse(t)):h.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid latitude ‘${t}’`)}get lon(){return this._lon}get lng(){return this._lon}get longitude(){return this._lon}set lon(t){if(this._lon=isNaN(t)?h.wrap180(h.parse(t)):h.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lon ‘${t}’`)}set lng(t){if(this._lon=isNaN(t)?h.wrap180(h.parse(t)):h.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lng ‘${t}’`)}set longitude(t){if(this._lon=isNaN(t)?h.wrap180(h.parse(t)):h.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid longitude ‘${t}’`)}static get metresToKm(){return.001}static get metresToMiles(){return 1/1609.344}static get metresToNauticalMiles(){return 1/1852}static parse(...t){if(0==t.length)throw new TypeError("invalid (empty) point");if(null===t[0]||null===t[1])throw new TypeError("invalid (null) point");let e,a;if(2==t.length&&([e,a]=t,e=h.wrap90(h.parse(e)),a=h.wrap180(h.parse(a)),isNaN(e)||isNaN(a)))throw new TypeError(`invalid point ‘${t.toString()}’`);if(1==t.length&&"string"==typeof t[0]&&([e,a]=t[0].split(","),e=h.wrap90(h.parse(e)),a=h.wrap180(h.parse(a)),isNaN(e)||isNaN(a)))throw new TypeError(`invalid point ‘${t[0]}’`);if(1==t.length&&"object"==typeof t[0]){const r=t[0];if("Point"==r.type&&Array.isArray(r.coordinates)?[a,e]=r.coordinates:(null!=r.latitude&&(e=r.latitude),null!=r.lat&&(e=r.lat),null!=r.longitude&&(a=r.longitude),null!=r.lng&&(a=r.lng),null!=r.lon&&(a=r.lon),e=h.wrap90(h.parse(e)),a=h.wrap180(h.parse(a))),isNaN(e)||isNaN(a))throw new TypeError(`invalid point ‘${JSON.stringify(t[0])}’`)}if(isNaN(e)||isNaN(a))throw new TypeError(`invalid point ‘${t.toString()}’`);return new c(e,a)}distanceTo(t,e=6371e3){if(t instanceof c||(t=c.parse(t)),isNaN(e))throw new TypeError(`invalid radius ‘${e}’`);const a=e,r=this.lat.toRadians(),n=this.lon.toRadians(),i=t.lat.toRadians(),o=i-r,s=t.lon.toRadians()-n,l=Math.sin(o/2)*Math.sin(o/2)+Math.cos(r)*Math.cos(i)*Math.sin(s/2)*Math.sin(s/2);return a*(2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)))}initialBearingTo(t){if(t instanceof c||(t=c.parse(t)),this.equals(t))return NaN;const e=this.lat.toRadians(),a=t.lat.toRadians(),r=(t.lon-this.lon).toRadians(),n=Math.cos(e)*Math.sin(a)-Math.sin(e)*Math.cos(a)*Math.cos(r),i=Math.sin(r)*Math.cos(a),o=Math.atan2(i,n).toDegrees();return h.wrap360(o)}finalBearingTo(t){t instanceof c||(t=c.parse(t));const e=t.initialBearingTo(this)+180;return h.wrap360(e)}midpointTo(t){t instanceof c||(t=c.parse(t));const e=this.lat.toRadians(),a=this.lon.toRadians(),r=t.lat.toRadians(),n=(t.lon-this.lon).toRadians(),i=Math.cos(e),o=0,s=Math.sin(e),l={x:i+Math.cos(r)*Math.cos(n),y:o+Math.cos(r)*Math.sin(n),z:s+Math.sin(r)},h=Math.atan2(l.z,Math.sqrt(l.x*l.x+l.y*l.y)),u=a+Math.atan2(l.y,l.x),d=h.toDegrees(),p=u.toDegrees();return new c(d,p)}intermediatePointTo(t,e){if(t instanceof c||(t=c.parse(t)),this.equals(t))return new c(this.lat,this.lon);const a=this.lat.toRadians(),r=this.lon.toRadians(),n=t.lat.toRadians(),i=t.lon.toRadians(),o=n-a,s=i-r,l=Math.sin(o/2)*Math.sin(o/2)+Math.cos(a)*Math.cos(n)*Math.sin(s/2)*Math.sin(s/2),h=2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)),u=Math.sin((1-e)*h)/Math.sin(h),d=Math.sin(e*h)/Math.sin(h),p=u*Math.cos(a)*Math.cos(r)+d*Math.cos(n)*Math.cos(i),g=u*Math.cos(a)*Math.sin(r)+d*Math.cos(n)*Math.sin(i),f=u*Math.sin(a)+d*Math.sin(n),M=Math.atan2(f,Math.sqrt(p*p+g*g)),y=Math.atan2(g,p),m=M.toDegrees(),v=y.toDegrees();return new c(m,v)}destinationPoint(t,e,a=6371e3){const r=t/a,n=Number(e).toRadians(),i=this.lat.toRadians(),o=this.lon.toRadians(),s=Math.sin(i)*Math.cos(r)+Math.cos(i)*Math.sin(r)*Math.cos(n),l=Math.asin(s),h=Math.sin(n)*Math.sin(r)*Math.cos(i),u=Math.cos(r)-Math.sin(i)*s,d=o+Math.atan2(h,u),p=l.toDegrees(),g=d.toDegrees();return new c(p,g)}static intersection(t,e,a,r){if(t instanceof c||(t=c.parse(t)),a instanceof c||(a=c.parse(a)),isNaN(e))throw new TypeError(`invalid brng1 ‘${e}’`);if(isNaN(r))throw new TypeError(`invalid brng2 ‘${r}’`);const n=t.lat.toRadians(),i=t.lon.toRadians(),o=a.lat.toRadians(),s=a.lon.toRadians(),l=Number(e).toRadians(),h=Number(r).toRadians(),d=o-n,p=s-i,g=2*Math.asin(Math.sqrt(Math.sin(d/2)*Math.sin(d/2)+Math.cos(n)*Math.cos(o)*Math.sin(p/2)*Math.sin(p/2)));if(Math.abs(g)<Number.EPSILON)return new c(t.lat,t.lon);const f=(Math.sin(o)-Math.sin(n)*Math.cos(g))/(Math.sin(g)*Math.cos(n)),M=(Math.sin(n)-Math.sin(o)*Math.cos(g))/(Math.sin(g)*Math.cos(o)),y=Math.acos(Math.min(Math.max(f,-1),1)),m=Math.acos(Math.min(Math.max(M,-1),1)),v=l-(Math.sin(s-i)>0?y:2*u-y),b=(Math.sin(s-i)>0?2*u-m:m)-h;if(0==Math.sin(v)&&0==Math.sin(b))return null;if(Math.sin(v)*Math.sin(b)<0)return null;const w=-Math.cos(v)*Math.cos(b)+Math.sin(v)*Math.sin(b)*Math.cos(g),N=Math.atan2(Math.sin(g)*Math.sin(v)*Math.sin(b),Math.cos(b)+Math.cos(v)*w),x=Math.asin(Math.min(Math.max(Math.sin(n)*Math.cos(N)+Math.cos(n)*Math.sin(N)*Math.cos(l),-1),1)),P=i+Math.atan2(Math.sin(l)*Math.sin(N)*Math.cos(n),Math.cos(N)-Math.sin(n)*Math.sin(x)),E=x.toDegrees(),R=P.toDegrees();return new c(E,R)}crossTrackDistanceTo(t,e,a=6371e3){t instanceof c||(t=c.parse(t)),e instanceof c||(e=c.parse(e));const r=a;if(this.equals(t))return 0;const n=t.distanceTo(this,r)/r,i=t.initialBearingTo(this).toRadians(),o=t.initialBearingTo(e).toRadians();return Math.asin(Math.sin(n)*Math.sin(i-o))*r}alongTrackDistanceTo(t,e,a=6371e3){t instanceof c||(t=c.parse(t)),e instanceof c||(e=c.parse(e));const r=a;if(this.equals(t))return 0;const n=t.distanceTo(this,r)/r,i=t.initialBearingTo(this).toRadians(),o=t.initialBearingTo(e).toRadians(),s=Math.asin(Math.sin(n)*Math.sin(i-o));return Math.acos(Math.cos(n)/Math.abs(Math.cos(s)))*Math.sign(Math.cos(o-i))*r}maxLatitude(t){const e=Number(t).toRadians(),a=this.lat.toRadians();return Math.acos(Math.abs(Math.sin(e)*Math.cos(a))).toDegrees()}static crossingParallels(t,e,a){if(t.equals(e))return null;const r=Number(a).toRadians(),n=t.lat.toRadians(),i=t.lon.toRadians(),o=e.lat.toRadians(),s=e.lon.toRadians()-i,l=Math.sin(n)*Math.cos(o)*Math.cos(r)*Math.sin(s),u=Math.sin(n)*Math.cos(o)*Math.cos(r)*Math.cos(s)-Math.cos(n)*Math.sin(o)*Math.cos(r),c=Math.cos(n)*Math.cos(o)*Math.sin(r)*Math.sin(s);if(c*c>l*l+u*u)return null;const d=Math.atan2(-u,l),p=Math.acos(c/Math.sqrt(l*l+u*u)),g=i+d+p,f=(i+d-p).toDegrees(),M=g.toDegrees();return{lon1:h.wrap180(f),lon2:h.wrap180(M)}}rhumbDistanceTo(t,e=6371e3){t instanceof c||(t=c.parse(t));const a=e,r=this.lat.toRadians(),n=t.lat.toRadians(),i=n-r;let o=Math.abs(t.lon-this.lon).toRadians();Math.abs(o)>u&&(o=o>0?-(2*u-o):2*u+o);const s=Math.log(Math.tan(n/2+u/4)/Math.tan(r/2+u/4)),l=Math.abs(s)>1e-11?i/s:Math.cos(r);return Math.sqrt(i*i+l*l*o*o)*a}rhumbBearingTo(t){if(t instanceof c||(t=c.parse(t)),this.equals(t))return NaN;const e=this.lat.toRadians(),a=t.lat.toRadians();let r=(t.lon-this.lon).toRadians();Math.abs(r)>u&&(r=r>0?-(2*u-r):2*u+r);const n=Math.log(Math.tan(a/2+u/4)/Math.tan(e/2+u/4)),i=Math.atan2(r,n).toDegrees();return h.wrap360(i)}rhumbDestinationPoint(t,e,a=6371e3){const r=this.lat.toRadians(),n=this.lon.toRadians(),i=Number(e).toRadians(),o=t/a,s=o*Math.cos(i);let l=r+s;Math.abs(l)>u/2&&(l=l>0?u-l:-u-l);const h=Math.log(Math.tan(l/2+u/4)/Math.tan(r/2+u/4)),d=Math.abs(h)>1e-11?s/h:Math.cos(r),p=n+o*Math.sin(i)/d,g=l.toDegrees(),f=p.toDegrees();return new c(g,f)}rhumbMidpointTo(t){t instanceof c||(t=c.parse(t));const e=this.lat.toRadians();let a=this.lon.toRadians();const r=t.lat.toRadians(),n=t.lon.toRadians();Math.abs(n-a)>u&&(a+=2*u);const i=(e+r)/2,o=Math.tan(u/4+e/2),s=Math.tan(u/4+r/2),l=Math.tan(u/4+i/2);let h=((n-a)*Math.log(l)+a*Math.log(s)-n*Math.log(o))/Math.log(s/o);isFinite(h)||(h=(a+n)/2);const d=i.toDegrees(),p=h.toDegrees();return new c(d,p)}static areaOf(t,e=6371e3){const a=e,r=t[0].equals(t[t.length-1]);r||t.push(t[0]);const n=t.length-1;let i=0;for(let e=0;e<n;e++){const a=t[e].lat.toRadians(),r=t[e+1].lat.toRadians(),n=(t[e+1].lon-t[e].lon).toRadians();i+=2*Math.atan2(Math.tan(n/2)*(Math.tan(a/2)+Math.tan(r/2)),1+Math.tan(a/2)*Math.tan(r/2))}(function(t){let e=0,a=t[0].initialBearingTo(t[1]);for(let r=0;r<t.length-1;r++){const n=t[r].initialBearingTo(t[r+1]),i=t[r].finalBearingTo(t[r+1]);e+=(n-a+540)%360-180,e+=(i-n+540)%360-180,a=i}const r=t[0].initialBearingTo(t[1]);e+=(r-a+540)%360-180;return Math.abs(e)<90})(t)&&(i=Math.abs(i)-2*u);const o=Math.abs(i*a*a);return r||t.pop(),o}equals(t){return t instanceof c||(t=c.parse(t)),!(Math.abs(this.lat-t.lat)>Number.EPSILON)&&!(Math.abs(this.lon-t.lon)>Number.EPSILON)}toGeoJSON(){return{type:"Point",coordinates:[this.lon,this.lat]}}toString(t="d",e=void 0){if(!["d","dm","dms","n"].includes(t))throw new RangeError(`invalid format ‘${t}’`);if("n"==t)return null==e&&(e=4),`${this.lat.toFixed(e)},${this.lon.toFixed(e)}`;return`${h.toLat(this.lat,t,e)}, ${h.toLon(this.lon,t,e)}`}}var d=(t,e)=>{var[a,r]=t,[n,i]=e,o=new c(r,a),s=new c(i,n);return o.distanceTo(s)},p=t=>{var e=t/1609.344;if(e<.5)return"".concat(Math.round(t),"m");if(e<10){var a=Number.parseFloat(e.toFixed(1)),r=1===a?"mile":"miles";return"".concat(a," ").concat(r)}var n=Math.round(e);return"".concat(n," miles")},g=(t,e,a)=>{var[r,n]=e,i=a.filter(e=>{var[a,i]=e;return(a!==r||i!==n)&&((t,e,a)=>{switch(t){case"ArrowUp":return a<0&&Math.abs(a)>=Math.abs(e);case"ArrowDown":return a>0&&Math.abs(a)>=Math.abs(e);case"ArrowLeft":return e<0&&Math.abs(e)>Math.abs(a);case"ArrowRight":return e>0&&Math.abs(e)>Math.abs(a);default:return!1}})(t,a-r,i-n)});if(!i.length)return a.findIndex(t=>t[0]===r&&t[1]===n);var o=-1,s=1/0;return i.forEach(t=>{var e=t[0]-r,i=t[1]-n,l=e*e+i*i;l<s&&(s=l,o=a.indexOf(t))}),o};function f(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),a.push.apply(a,r)}return a}function M(e){for(var a=1;a<arguments.length;a++){var r=null!=arguments[a]?arguments[a]:{};a%2?f(Object(r),!0).forEach(function(a){t(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var y="highlighted-label";function m(t,e){if("number"==typeof t)return t;if(!Array.isArray(t)||"interpolate"!==t[0])return function(t,e){var{stops:a}=t;if(a.length<2)return a.length>0?a[0][1]:0;for(var r=a[0],n=a[a.length-1],i=1;i<a.length;i++){var o=a[i];if(o[0]>e){n=o,r=a[i-1];break}r=a[i-1],n=o}var[s,l]=r,[h,u]=n;return e<=s?l:e>=h?u:l+(e-s)/(h-s)*(u-l)}(t,e);var[,,a,...r]=t;if("zoom"!==a[0])throw new Error("Only zoom-based expressions supported");for(var n=0;n<r.length-2;n+=2){var i=r[n],o=r[n+1],s=r[n+2],l=r[n+3];if(e<=i)return o;if(e<=s)return o+(e-i)/(s-i)*(l-o)}return r[r.length-1]}function v(t,e,a){return e.flatMap(e=>{var r,n=function(t){var e,a;return"string"==typeof t?null===(e=/^{(.+)}$/.exec(t))||void 0===e?void 0:e[1]:Array.isArray(t)?null===(a=t.find(t=>Array.isArray(t)&&"get"===t[0]))||void 0===a?void 0:a[1]:null}(null===(r=e.layout)||void 0===r?void 0:r["text-field"]);return n?a.filter(t=>{var a;return t.layer.id===e.id&&(null===(a=t.properties)||void 0===a?void 0:a[n])}).map(a=>function(t,e,a,r){var n=function(t){var{type:e,coordinates:a}=t;if("Point"===e)return a;if("MultiPoint"===e)return a[0];if(e.includes("LineString")){var r="LineString"===e?a:a[0];return[(r[0][0]+r[r.length-1][0])/2,(r[0][1]+r[r.length-1][1])/2]}if(e.includes("Polygon")){var n="Polygon"===e?a[0]:a[0][0],i=n.reduce((t,e)=>[t[0]+e[0],t[1]+e[1]],[0,0]);return[i[0]/n.length,i[1]/n.length]}return null}(t.geometry);if(!n)return null;var i=r.project({lng:n[0],lat:n[1]});return{text:t.properties[a],x:i.x,y:i.y,feature:t,layer:e}}(a,e,n,t)).filter(Boolean):[]})}function b(t,e){if(e.highlightLayerId&&t.getLayer(e.highlightLayerId)){try{t.removeLayer(e.highlightLayerId)}catch(t){}e.highlightLayerId=null,e.highlightedExpr=null}}function w(t,e,a){var r;if(null!=e&&null!==(r=e.feature)&&void 0!==r&&r.layer){b(t,a);var{feature:n,layer:i}=e;a.highlightLayerId="highlight-".concat(i.id);var{id:o,type:s,properties:l,geometry:h}=n;t.getSource(y).setData({id:o,type:s,properties:l,geometry:h}),a.highlightedExpr=i.layout["text-size"];var u=t.getZoom(),c=function(t,e,a){return{id:"highlight-".concat(t.id),type:t.type,source:y,layout:M(M({},t.layout),{},{"text-size":e,"text-allow-overlap":!0,"text-ignore-placement":!0,"text-max-angle":90}),paint:M(M({},t.paint),{},{"text-color":a.text,"text-halo-color":a.halo,"text-halo-width":3,"text-halo-blur":1,"text-opacity":1})}}(i,1.5*m(a.highlightedExpr,u),a.isDarkStyle?{text:"#ffffff",halo:"#000000"}:{text:"#000000",halo:"#ffffff"});t.addLayer(c),t.moveLayer(a.highlightLayerId)}}function N(t){t.getSource(y)||t.addSource(y,{type:"geojson",data:{type:"FeatureCollection",features:[]}})}function x(t){t.getStyle().layers.filter(t=>{var e;return"line"===(null===(e=t.layout)||void 0===e?void 0:e["symbol-placement"])}).forEach(e=>t.setLayoutProperty(e.id,"symbol-placement","line-center"))}function P(t,e,a,r){var n={isDarkStyle:"dark"===e,labels:[],currentPixel:null,highlightLayerId:null,highlightedExpr:null};function i(){var e=t.getStyle().layers.filter(t=>"symbol"===t.type),a=t.queryRenderedFeatures({layers:e.map(t=>t.id)});n.labels=v(t,e,a)}function o(){if(i(),!n.labels.length)return null;var e=t.project(t.getCenter()),a=function(t,e){var a;return null===(a=t.reduce((t,a)=>{var r=(a.x-e.x)**2+(a.y-e.y)**2;return!t||r<t.dist?{label:a,dist:r}:t},null))||void 0===a?void 0:a.label}(n.labels,e);return n.currentPixel={x:a.x,y:a.y},w(t,a,n),"".concat(a.text," (").concat(a.layer.id,")")}return x(t),N(t),null==r||r.on(a.MAP_SET_STYLE,e=>{t.once("styledata",()=>t.once("idle",()=>{x(t),N(t),n.isDarkStyle="dark"===(null==e?void 0:e.mapColorScheme)}))}),t.on("zoom",()=>{if(n.highlightLayerId&&n.highlightedExpr){var e=m(n.highlightedExpr,t.getZoom());t.setLayoutProperty(n.highlightLayerId,"text-size",1.5*e)}}),function(t){t.getStyle().layers.filter(t=>"symbol"===t.type).forEach(e=>{t.setPaintProperty(e.id,"text-opacity",["case",["boolean",["feature-state","highlighted"],!1],0,1])})}(t),{refreshLabels:i,highlightNextLabel:function(e){if(i(),!n.labels.length)return null;if(!n.currentPixel)return o();var a=function(t,e){if(!e.currentPixel)return null;var a=e.labels.map((t,e)=>({pixel:[t.x,t.y],index:e})).filter(t=>t.pixel[0]!==e.currentPixel.x||t.pixel[1]!==e.currentPixel.y);if(!a.length)return null;var r=a.map(t=>t.pixel),n=g(t,[e.currentPixel.x,e.currentPixel.y],r);return(null==n||n<0||n>=a.length)&&(n=0),e.labels[a[n].index]}(e,n);return a?(n.currentPixel={x:a.x,y:a.y},w(t,a,n),"".concat(a.text," (").concat(a.layer.id,")")):null},highlightLabelAtCenter:o,clearHighlightedLabel:()=>b(t,n)}}function E(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),a.push.apply(a,r)}return a}function R(e){for(var a=1;a<arguments.length;a++){var r=null!=arguments[a]?arguments[a]:{};a%2?E(Object(r),!0).forEach(function(a){t(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):E(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var L=(t,e,a,r,n,i,o)=>{t.getLayer(e)||t.addLayer(R(R({id:e,type:a,source:r},n&&{"source-layer":n}),{},{paint:i})),Object.entries(i).forEach(a=>{var[r,n]=a;t.setPaintProperty(e,r,n)}),t.setFilter(e,o)};function O(t){var{LngLatBounds:e,map:a,selectedFeatures:r,stylesMap:n}=t;if(!a)return null;var i=((t,e)=>{var a={};return null==e||e.forEach(e=>{var{featureId:r,layerId:n,idProperty:i,geometry:o}=e,s=t.getLayer(n);if(s){var l=s.source;a[l]||(a[l]={ids:new Set,fillIds:new Set,idProperty:i,layerId:n,hasFillGeometry:!1}),!o||"Polygon"!==o.type&&"MultiPolygon"!==o.type||(a[l].hasFillGeometry=!0,a[l].fillIds.add(r)),a[l].ids.add(r)}}),a})(a,r),o=[],s=new Set(Object.keys(i)),l=a._highlightedSources||new Set;return((t,e,a)=>{e.forEach(e=>{if(!a.has(e)){var r="highlight-".concat(e);["".concat(r,"-fill"),"".concat(r,"-line")].forEach(e=>{t.getLayer(e)&&t.setFilter(e,["==","id",""])})}})})(a,l,s),a._highlightedSources=s,s.forEach(t=>{var{ids:e,fillIds:r,idProperty:s,layerId:l,hasFillGeometry:h}=i[t],u=a.getLayer(l),c=u.sourceLayer,d=h?"fill":u.type,p="highlight-".concat(t),{stroke:g,strokeWidth:f,fill:M}=n[l],y=s?["get",s]:["id"],m=["in",y,["literal",[...e]]],v=["in",y,["literal",[...r]]],b={"line-color":g,"line-width":f};"fill"===d&&(L(a,"".concat(p,"-fill"),"fill",t,c,{"fill-color":M},v),L(a,"".concat(p,"-line"),"line",t,c,b,m)),"line"===d&&(a.getLayer("".concat(p,"-fill"))&&a.setFilter("".concat(p,"-fill"),["==","id",""]),L(a,"".concat(p,"-line"),"line",t,c,b,m)),o.push(...a.queryRenderedFeatures({layers:[l]}).filter(t=>{var a;return e.has(s?null===(a=t.properties)||void 0===a?void 0:a[s]:t.id)}))}),((t,e)=>{if(!e.length)return null;var a=new t;return e.forEach(t=>{var e=t=>"number"==typeof t[0]?a.extend(t):t.forEach(e);e(t.geometry.coordinates)}),[a.getWest(),a.getSouth(),a.getEast(),a.getNorth()]})(e,o)}var S=(t,e,a)=>{var r=(e.x-a.x)**2+(e.y-a.y)**2;if(0===r)return(t.x-e.x)**2+(t.y-e.y)**2;var n=((t.x-e.x)*(a.x-e.x)+(t.y-e.y)*(a.y-e.y))/r;return n=Math.max(0,Math.min(1,n)),(t.x-(e.x+n*(a.x-e.x)))**2+(t.y-(e.y+n*(a.y-e.y)))**2},T=function(t,e){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{radius:r=10}=a,n=[[e.x-r,e.y-r],[e.x+r,e.y+r]],i=t.queryRenderedFeatures(n);if(0===i.length)return[];var o=[];i.forEach(t=>{!1===o.includes(t.layer.id)&&o.push(t.layer.id)});for(var s=new Set,l=[],h=i.length-1;h>=0;h--){var u=i[h],c=void 0===u.id?JSON.stringify(u.properties):u.id;!1===s.has(c)&&(s.add(c),l.push(u))}var d=t.unproject(e),p=[d.lng,d.lat];return l.map(a=>{var r=0,n=a.geometry.type,i=((t,e,a)=>{var{coordinates:r,type:n}=a,i=1/0,o=e=>t.project(e),s=t=>{for(var a=0;a<t.length-1;a++){var r=S(e,o(t[a]),o(t[a+1]));r<i&&(i=r)}};if("Point"===n){var l=o(r);i=(e.x-l.x)**2+(e.y-l.y)**2}else"LineString"===n||"MultiPoint"===n?"LineString"===n?s(r):r.forEach(t=>{var a=o(t),r=(e.x-a.x)**2+(e.y-a.y)**2;r<i&&(i=r)}):"Polygon"===n||"MultiLineString"===n?r.forEach(s):"MultiPolygon"===n&&r.forEach(t=>t.forEach(s));return i})(t,e,a.geometry);if(r+=1e6*o.indexOf(a.layer.id),n.includes("Polygon")){var s=("Polygon"===n?[a.geometry.coordinates]:a.geometry.coordinates).some(t=>((t,e)=>{for(var[a,r]=t,n=!1,i=0,o=e.length-1;i<e.length;o=i,i++){var[s,l]=e[i],[h,u]=e[o];l>r!=u>r&&a<(h-s)*(r-l)/(u-l)+s&&(n=!n)}return n})(p,t[0]));!0===s?r-=5e5:r+=1e5}return{f:a,score:r+=i}}).sort((t,e)=>t.score-e.score).map(t=>{var{f:e}=t;return e})},D=["container","padding","mapStyle","center","zoom","bounds","pixelRatio"];function A(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),a.push.apply(a,r)}return a}function j(e){for(var a=1;a<arguments.length;a++){var r=null!=arguments[a]?arguments[a]:{};a%2?A(Object(r),!0).forEach(function(a){t(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):A(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}class _{constructor(t){var{mapFramework:e,mapProviderConfig:a={},events:r,eventBus:n}=t;this.maplibreModule=e,this.events=r,this.eventBus=n,this.capabilities={supportedShortcuts:i,supportsMapSizes:!0},Object.assign(this,a)}initMap(t){var r=this;return a(function*(){var{container:a,padding:n,mapStyle:i,center:o,zoom:l,bounds:h,pixelRatio:u}=t,c=e(t,D),{Map:d}=r.maplibreModule,{events:p,eventBus:g}=r,f=new d(j(j({},c),{},{container:a,style:null==i?void 0:i.url,pixelRatio:u,padding:n,center:o,zoom:l,fadeDuration:0,attributionControl:!1,dragRotate:!1,doubleClickZoom:!1}));f.touchZoomRotate.disableRotation(),r.map=f,r.map.setPadding(n),h&&f.fitBounds(h,{duration:0}),function(t){var e=Event.prototype.preventDefault;Event.prototype.preventDefault=function(){if(("touchmove"===this.type||"touchstart"===this.type)&&!this.cancelable){var a=t.getCanvas();if(a&&(this.target===a||a.contains(this.target)))return}e.call(this)}}(f),function(t){var e=t.getCanvas();e.removeAttribute("role"),e.setAttribute("tabindex",-1),e.removeAttribute("aria-label"),e.style.display="block"}(f),s({map:f,events:p,eventBus:g,getCenter:r.getCenter.bind(r),getZoom:r.getZoom.bind(r),getBounds:r.getBounds.bind(r),getResolution:r.getResolution.bind(r)}),function(t){var{map:e,events:a,eventBus:r}=t,n=t=>{e.setStyle(t.url,{diff:!1})},i=t=>{e.setPixelRatio(t)};r.on(a.MAP_SET_STYLE,n),r.on(a.MAP_SET_PIXEL_RATIO,i)}({map:f,events:p,eventBus:g}),f.on("load",()=>{r.labelNavigator=P(f,null==i?void 0:i.mapColorScheme,p,g)}),r.eventBus.emit(p.MAP_READY,r.getMapAPI())})()}getMapAPI(){return{map:this.map,crs:this.crs,fitToBounds:this.fitToBounds.bind(this),setView:this.setView.bind(this)}}destroyMap(){var t,e;null===(t=this.mapEvents)||void 0===t||t.remove(),null===(e=this.appEvents)||void 0===e||e.remove(),this.mapEvents=null,this.appEvents=null,this.map.remove()}setView(t){var{center:e,zoom:a}=t;this.map.flyTo({center:e||this.getCenter(),zoom:a||this.getZoom(),duration:r})}zoomIn(t){this.map.easeTo({zoom:this.getZoom()+t,duration:r})}zoomOut(t){this.map.easeTo({zoom:this.getZoom()-t,duration:r})}panBy(t){this.map.panBy(t,{duration:r})}fitToBounds(t){this.map.fitBounds(t,{duration:r})}setPadding(t){this.map.setPadding(t)}updateHighlightedFeatures(t,e){var{LngLatBounds:a}=this.maplibreModule;return O({LngLatBounds:a,map:this.map,selectedFeatures:t,stylesMap:e})}highlightNextLabel(t){var e;return(null===(e=this.labelNavigator)||void 0===e?void 0:e.highlightNextLabel(t))||null}highlightLabelAtCenter(){var t;return(null===(t=this.labelNavigator)||void 0===t?void 0:t.highlightLabelAtCenter())||null}clearHighlightedLabel(){var t;return(null===(t=this.labelNavigator)||void 0===t?void 0:t.clearHighlightedLabel())||null}getCenter(){var t=this.map.getCenter();return[Number(t.lng.toFixed(n)),Number(t.lat.toFixed(n))]}getZoom(){return Number(this.map.getZoom().toFixed(n))}getBounds(){return this.map.getBounds().toArray().flat(1)}getFeaturesAtPoint(t,e){return T(this.map,t,e)}getAreaDimensions(){var{LngLatBounds:t}=this.maplibreModule;return(t=>{var e,a,r,n;if(t&&"function"==typeof t.getWest)e=t.getWest(),a=t.getSouth(),r=t.getEast(),n=t.getNorth();else{if(!Array.isArray(t)||2!==t.length)return"";[[e,a],[r,n]]=t}var i=d([e,a],[r,a]),o=d([e,a],[e,n]),s=p(i),l=p(o);return"".concat(l," by ").concat(s)})(((t,e)=>{var{width:a,height:r}=e.getContainer().getBoundingClientRect(),n=e.getPadding(),i=[n.left,r-n.bottom],o=[a-n.right,n.top];return new t(e.unproject(i),e.unproject(o))})(t,this.map))}getCardinalMove(t,e){return((t,e)=>{var[a,r]=t,[n,i]=e,o=i-r,s=n-a,l=[];if(Math.abs(o)>1e-4){var h=Math.round(d([a,r],[a,i]));l.push("".concat(o>0?"north":"south"," ").concat(p(h)))}if(Math.abs(s)>1e-4){var u=Math.round(d([a,r],[n,r]));l.push("".concat(s>0?"east":"west"," ").concat(p(u)))}return l.join(", ")})(t,e)}getResolution(){return t=this.map.getCenter(),e=this.map.getZoom(),a=t.lat,r=Math.pow(2,e),40075016.686*Math.cos(a*Math.PI/180)/(512*r);var t,e,a,r}mapToScreen(t){return this.map.project(t)}screenToMap(t){var{lng:e,lat:a}=this.map.unproject([t.x,t.y]);return[e,a]}}export{_ as default};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var r,e,t,n,o={},i={};function u(r){var e=i[r];if(void 0!==e)return e.exports;var t=i[r]={exports:{}};return o[r].call(t.exports,t,t.exports,u),t.exports}function a(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function c(r){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},c(r)}function f(){var r,e,t="function"==typeof Symbol?Symbol:{},n=t.iterator||"@@iterator",o=t.toStringTag||"@@toStringTag";function i(t,n,o,i){var c=n&&n.prototype instanceof a?n:a,f=Object.create(c.prototype);return l(f,"_invoke",function(t,n,o){var i,a,c,f=0,l=o||[],p=!1,s={p:0,n:0,v:r,a:b,f:b.bind(r,4),d:function(e,t){return i=e,a=0,c=r,s.n=t,u}};function b(t,n){for(a=t,c=n,e=0;!p&&f&&!o&&e<l.length;e++){var o,i=l[e],b=s.p,y=i[2];t>3?(o=y===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=r):i[0]<=b&&((o=t<2&&b<i[1])?(a=0,s.v=n,s.n=i[1]):b<y&&(o=t<3||i[0]>n||n>y)&&(i[4]=t,i[5]=n,s.n=y,a=0))}if(o||t>1)return u;throw p=!0,n}return function(o,l,y){if(f>1)throw TypeError("Generator is already running");for(p&&1===l&&b(l,y),a=l,c=y;(e=a<2?r:c)||!p;){i||(a?a<3?(a>1&&(s.n=-1),b(a,c)):s.n=c:s.v=c);try{if(f=2,i){if(a||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,a<2&&(a=0)}else 1===a&&(e=i.return)&&e.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=r}else if((e=(p=s.n<0)?c:t.call(n,s))!==u)break}catch(e){i=r,a=1,c=e}finally{f=1}}return{value:e,done:p}}}(t,o,i),!0),f}var u={};function a(){}function c(){}function p(){}e=Object.getPrototypeOf;var s=[][n]?e(e([][n]())):(l(e={},n,function(){return this}),e),b=p.prototype=a.prototype=Object.create(s);function y(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,p):(r.__proto__=p,l(r,o,"GeneratorFunction")),r.prototype=Object.create(b),r}return c.prototype=p,l(b,"constructor",p),l(p,"constructor",c),c.displayName="GeneratorFunction",l(p,o,"GeneratorFunction"),l(b),l(b,o,"Generator"),l(b,n,function(){return this}),l(b,"toString",function(){return"[object Generator]"}),(f=function(){return{w:i,m:y}})()}function l(r,e,t,n){var o=Object.defineProperty;try{o({},"",{})}catch(r){o=0}l=function(r,e,t,n){function i(e,t){l(r,e,function(r){return this._invoke(e,t,r)})}e?o?o(r,e,{value:t,enumerable:!n,configurable:!n,writable:!n}):r[e]=t:(i("next",0),i("throw",1),i("return",2))},l(r,e,t,n)}function p(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})),t.push.apply(t,n)}return t}function s(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?p(Object(t),!0).forEach(function(e){b(r,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):p(Object(t)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))})}return r}function b(r,e,t){return(e=function(r){var e=function(r){if("object"!=c(r)||!r)return r;var e=r[Symbol.toPrimitive];if(void 0!==e){var t=e.call(r,"string");if("object"!=c(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}(r);return"symbol"==c(e)?e:e+""}(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function y(r,e,t,n,o,i,u){try{var a=r[i](u),c=a.value}catch(r){return void t(r)}a.done?e(c):Promise.resolve(c).then(n,o)}function v(){try{return new Function("var x = null ?? 5; var y = ({a:1})?.a;"),!0}catch(r){return!1}}function d(){var r,e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{checkDeviceCapabilities:function(){var r=function(){if(!window.WebGLRenderingContext)return{isEnabled:!1,error:"WebGL is not supported"};var r,e=document.createElement("canvas"),t=!1,n=function(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=function(r,e){if(r){if("string"==typeof r)return a(r,e);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?a(r,e):void 0}}(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var n=0,o=function(){};return{s:o,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(r){throw r},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,c=!1;return{s:function(){t=t.call(r)},n:function(){var r=t.next();return u=r.done,r},e:function(r){c=!0,i=r},f:function(){try{u||null==t.return||t.return()}finally{if(c)throw i}}}}(["webgl2","webgl1"]);try{for(n.s();!(r=n.n()).done;){var o=r.value;try{if((t=e.getContext(o))&&"function"==typeof t.getParameter)return{isEnabled:!0}}catch(r){}}}catch(r){n.e(r)}finally{n.f()}return{isEnabled:!1,error:"WebGL is supported, but disabled"}}(),e=document.documentMode;return{isSupported:r.isEnabled&&v(),error:e?"Internet Explorer is not supported":r.error}},load:(r=f().m(function r(){var e,n,o;return f().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,u.e("im-maplibre-framework").then(u.t.bind(u,"./node_modules/maplibre-gl/dist/maplibre-gl.js",19));case 1:return e=r.v,r.n=2,u.e("im-maplibre-provider").then(u.bind(u,"./providers/maplibre/src/maplibreProvider.js"));case 2:return n=r.v.default,o=s(s({},t),{},{crs:"EPSG:4326"}),r.a(2,{MapProvider:n,mapProviderConfig:o,mapFramework:e})}},r)}),e=function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function u(r){y(i,n,o,u,a,"next",r)}function a(r){y(i,n,o,u,a,"throw",r)}u(void 0)})},function(){return e.apply(this,arguments)})}}u.m=o,e=Object.getPrototypeOf?r=>Object.getPrototypeOf(r):r=>r.__proto__,u.t=function(t,n){if(1&n&&(t=this(t)),8&n)return t;if("object"==typeof t&&t){if(4&n&&t.__esModule)return t;if(16&n&&"function"==typeof t.then)return t}var o=Object.create(null);u.r(o);var i={};r=r||[null,e({}),e([]),e(e)];for(var a=2&n&&t;("object"==typeof a||"function"==typeof a)&&!~r.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach(r=>i[r]=()=>t[r]);return i.default=()=>t,u.d(o,i),o},u.d=(r,e)=>{for(var t in e)u.o(e,t)&&!u.o(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:e[t]})},u.f={},u.e=r=>Promise.all(Object.keys(u.f).reduce((e,t)=>(u.f[t](r,e),e),[])),u.u=r=>"../esm/"+r+".js",u.miniCssF=r=>{},u.o=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),u.r=r=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},(()=>{var r;if("string"==typeof import.meta.url&&(r=import.meta.url),!r)throw new Error("Automatic publicPath is not supported in this browser");r=r.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),u.p=r+"../css/"})(),t={index:0},n=r=>{var e,n,{__webpack_esm_ids__:o,__webpack_esm_modules__:i,__webpack_esm_runtime__:a}=r,c=0;for(e in i)u.o(i,e)&&(u.m[e]=i[e]);for(a&&a(u);c<o.length;c++)n=o[c],u.o(t,n)&&t[n]&&t[n][0](),t[o[c]]=0},u.f.j=(r,e)=>{var o=u.o(t,r)?t[r]:void 0;if(0!==o)if(o)e.push(o[1]);else{var i=import("../css/"+u.u(r)).then(n,e=>{throw 0!==t[r]&&(t[r]=void 0),e});i=Promise.race([i,new Promise(e=>o=t[r]=[e])]),e.push(o[1]=i)}};export{d as default};
|
|
1
|
+
import e from"@babel/runtime/helpers/defineProperty";import r from"@babel/runtime/helpers/asyncToGenerator";function t(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function n(r){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?t(Object(o),!0).forEach(function(t){e(r,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))})}return r}function o(){try{return new Function("var x = null ?? 5; var y = ({a:1})?.a;"),!0}catch(e){return!1}}function i(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{checkDeviceCapabilities:()=>{var e=(e=>{if(!window.WebGLRenderingContext)return{isEnabled:!1,error:"WebGL is not supported"};var r=document.createElement("canvas"),t=!1;for(var n of e)try{if((t=r.getContext(n))&&"function"==typeof t.getParameter)return{isEnabled:!0}}catch(e){}return{isEnabled:!1,error:"WebGL is supported, but disabled"}})(["webgl2","webgl1"]),r=document.documentMode;return{isSupported:e.isEnabled&&o(),error:r?"Internet Explorer is not supported":e.error}},load:(e=r(function*(){var e=yield import("maplibre-gl");return{MapProvider:(yield import(/* webpackChunkName: "im-maplibre-provider" */ "./im-maplibre-provider.js")).default,mapProviderConfig:n(n({},t),{},{crs:"EPSG:4326"}),mapFramework:e}}),function(){return e.apply(this,arguments)})}}export{i as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see im-maplibre-provider.js.LICENSE.txt */
|
|
2
|
-
"use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[772],{809(t,e,n){n.r(e),n.d(e,{default:()=>nt});var r=400,a=["showKeyboardHelp","selectControl","moveLarge","nudgeMap","zoomLarge","nudgeZoom","highlightLabelAtCenter","highlightNextLabel"];function o(t){var e=t.getCanvas();e.removeAttribute("role"),e.setAttribute("tabindex",-1),e.removeAttribute("aria-label"),e.style.display="block"}function i(t){var e=Event.prototype.preventDefault;Event.prototype.preventDefault=function(){if(("touchmove"===this.type||"touchstart"===this.type)&&!this.cancelable){var n=t.getCanvas();if(n&&(this.target===n||n.contains(this.target)))return}e.call(this)}}var l=function(t,e){var n=null,r=function(){for(var r=arguments.length,a=new Array(r),o=0;o<r;o++)a[o]=arguments[o];clearTimeout(n),n=setTimeout(function(){t.apply(void 0,a)},e)};return r.cancel=function(){n&&(clearTimeout(n),n=null)},r};function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function u(t){var e=t.map,n=t.events,r=t.eventBus,a=t.getCenter,o=t.getZoom,i=t.getBounds,u=t.getResolution,c=[],h=[],f=function(){var t=o();return{center:a(),bounds:i(),resolution:u(),zoom:t,isAtMaxZoom:e.getMaxZoom()<=t,isAtMinZoom:e.getMinZoom()>=t}},p=function(t,e){return r.emit(t,e)},d=function(){return p(n.MAP_LOADED)};e.on("load",d),c.push(["load",d]),e.once("idle",function(){return p(n.MAP_FIRST_IDLE,f())});var y=function(){return p(n.MAP_MOVE_START)};e.on("movestart",y),c.push(["movestart",y]);var g=l(function(){p(n.MAP_MOVE_END,f())},500);e.on("moveend",g),c.push(["moveend",g]),h.push(g);var v,m,b=(v=function(){p(n.MAP_MOVE,f())},m=0,function(){var t=Date.now();t-m>=10&&(m=t,v.apply(void 0,arguments))});e.on("zoom",b),c.push(["zoom",b]),h.push(b);var M=function(){return p(n.MAP_RENDER)};e.on("render",M),c.push(["render",M]);var w=l(function(){p(n.MAP_DATA_CHANGE,f())},500);e.on("styledata",w),c.push(["styledata",w]),h.push(w);var S=function(){return p(n.MAP_STYLE_CHANGE)};e.on("style.load",S),c.push(["style.load",S]);var x=function(t){return p(n.MAP_CLICK,{point:t.point,coords:[t.lngLat.lng,t.lngLat.lat]})};return e.on("click",x),c.push(["click",x]),{remove:function(){h.forEach(function(t){return t.cancel()}),c.forEach(function(t){var n,r,a=(r=2,function(t){if(Array.isArray(t))return t}(n=t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,a,o,i,l=[],s=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(l.push(r.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(n,r)||function(t,e){if(t){if("string"==typeof t)return s(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(t,e):void 0}}(n,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=a[0],i=a[1];return e.off(o,i)})}}}function c(t){var e=t.map,n=t.events,r=t.eventBus,a=function(t){e.setStyle(t.url,{diff:!1})},o=function(t){e.setPixelRatio(t)};return r.on(n.MAP_SET_STYLE,a),r.on(n.MAP_SET_PIXEL_RATIO,o),{remove:function(){r.off(n.MAP_SET_STYLE,a),r.off(n.MAP_SET_PIXEL_RATIO,o)}}}let h=" ";class f{static get separator(){return h}static set separator(t){h=t}static parse(t){if(!isNaN(parseFloat(t))&&isFinite(t))return Number(t);const e=String(t).trim().replace(/^-/,"").replace(/[NSEW]$/i,"").split(/[^0-9.,]+/);if(""==e[e.length-1]&&e.splice(e.length-1),""==e)return NaN;let n=null;switch(e.length){case 3:n=e[0]/1+e[1]/60+e[2]/3600;break;case 2:n=e[0]/1+e[1]/60;break;case 1:n=e[0];break;default:return NaN}return/^-|[WS]$/i.test(t.trim())&&(n=-n),Number(n)}static toDms(t,e="d",n=void 0){if(isNaN(t))return null;if("string"==typeof t&&""==t.trim())return null;if("boolean"==typeof t)return null;if(t==1/0)return null;if(null==t)return null;if(void 0===n)switch(e){case"d":case"deg":n=4;break;case"dm":case"deg+min":n=2;break;case"dms":case"deg+min+sec":n=0;break;default:e="d",n=4}t=Math.abs(t);let r=null,a=null,o=null,i=null;switch(e){default:case"d":case"deg":a=t.toFixed(n),a<100&&(a="0"+a),a<10&&(a="0"+a),r=a+"°";break;case"dm":case"deg+min":a=Math.floor(t),o=(60*t%60).toFixed(n),60==o&&(o=(0).toFixed(n),a++),a=("000"+a).slice(-3),o<10&&(o="0"+o),r=a+"°"+f.separator+o+"′";break;case"dms":case"deg+min+sec":a=Math.floor(t),o=Math.floor(3600*t/60)%60,i=(3600*t%60).toFixed(n),60==i&&(i=(0).toFixed(n),o++),60==o&&(o=0,a++),a=("000"+a).slice(-3),o=("00"+o).slice(-2),i<10&&(i="0"+i),r=a+"°"+f.separator+o+"′"+f.separator+i+"″"}return r}static toLat(t,e,n){const r=f.toDms(f.wrap90(t),e,n);return null===r?"–":r.slice(1)+f.separator+(t<0?"S":"N")}static toLon(t,e,n){const r=f.toDms(f.wrap180(t),e,n);return null===r?"–":r+f.separator+(t<0?"W":"E")}static toBrng(t,e,n){const r=f.toDms(f.wrap360(t),e,n);return null===r?"–":r.replace("360","0")}static fromLocale(t){const e=123456.789.toLocaleString(),n={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(n.thousands,"⁜").replace(n.decimal,".").replace("⁜",",")}static toLocale(t){const e=123456.789.toLocaleString(),n={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(/,([0-9])/,"⁜$1").replace(".",n.decimal).replace("⁜",n.thousands)}static compassPoint(t,e=3){if(![1,2,3].includes(Number(e)))throw new RangeError(`invalid precision ‘${e}’`);t=f.wrap360(t);const n=4*2**(e-1);return["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][Math.round(t*n/360)%n*16/n]}static wrap90(t){if(-90<=t&&t<=90)return t;const e=t;return 1*Math.abs(((e-90)%360+360)%360-180)-90}static wrap180(t){if(-180<=t&&t<=180)return t;const e=360;return((360*t/e-180)%e+e)%e-180}static wrap360(t){if(0<=t&&t<360)return t;const e=360;return(360*t/e%e+e)%e}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};const p=f,d=Math.PI;class y{constructor(t,e){if(isNaN(t))throw new TypeError(`invalid lat ‘${t}’`);if(isNaN(e))throw new TypeError(`invalid lon ‘${e}’`);this._lat=p.wrap90(Number(t)),this._lon=p.wrap180(Number(e))}get lat(){return this._lat}get latitude(){return this._lat}set lat(t){if(this._lat=isNaN(t)?p.wrap90(p.parse(t)):p.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid lat ‘${t}’`)}set latitude(t){if(this._lat=isNaN(t)?p.wrap90(p.parse(t)):p.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid latitude ‘${t}’`)}get lon(){return this._lon}get lng(){return this._lon}get longitude(){return this._lon}set lon(t){if(this._lon=isNaN(t)?p.wrap180(p.parse(t)):p.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lon ‘${t}’`)}set lng(t){if(this._lon=isNaN(t)?p.wrap180(p.parse(t)):p.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lng ‘${t}’`)}set longitude(t){if(this._lon=isNaN(t)?p.wrap180(p.parse(t)):p.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid longitude ‘${t}’`)}static get metresToKm(){return.001}static get metresToMiles(){return 1/1609.344}static get metresToNauticalMiles(){return 1/1852}static parse(...t){if(0==t.length)throw new TypeError("invalid (empty) point");if(null===t[0]||null===t[1])throw new TypeError("invalid (null) point");let e,n;if(2==t.length&&([e,n]=t,e=p.wrap90(p.parse(e)),n=p.wrap180(p.parse(n)),isNaN(e)||isNaN(n)))throw new TypeError(`invalid point ‘${t.toString()}’`);if(1==t.length&&"string"==typeof t[0]&&([e,n]=t[0].split(","),e=p.wrap90(p.parse(e)),n=p.wrap180(p.parse(n)),isNaN(e)||isNaN(n)))throw new TypeError(`invalid point ‘${t[0]}’`);if(1==t.length&&"object"==typeof t[0]){const r=t[0];if("Point"==r.type&&Array.isArray(r.coordinates)?[n,e]=r.coordinates:(null!=r.latitude&&(e=r.latitude),null!=r.lat&&(e=r.lat),null!=r.longitude&&(n=r.longitude),null!=r.lng&&(n=r.lng),null!=r.lon&&(n=r.lon),e=p.wrap90(p.parse(e)),n=p.wrap180(p.parse(n))),isNaN(e)||isNaN(n))throw new TypeError(`invalid point ‘${JSON.stringify(t[0])}’`)}if(isNaN(e)||isNaN(n))throw new TypeError(`invalid point ‘${t.toString()}’`);return new y(e,n)}distanceTo(t,e=6371e3){if(t instanceof y||(t=y.parse(t)),isNaN(e))throw new TypeError(`invalid radius ‘${e}’`);const n=e,r=this.lat.toRadians(),a=this.lon.toRadians(),o=t.lat.toRadians(),i=o-r,l=t.lon.toRadians()-a,s=Math.sin(i/2)*Math.sin(i/2)+Math.cos(r)*Math.cos(o)*Math.sin(l/2)*Math.sin(l/2);return n*(2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s)))}initialBearingTo(t){if(t instanceof y||(t=y.parse(t)),this.equals(t))return NaN;const e=this.lat.toRadians(),n=t.lat.toRadians(),r=(t.lon-this.lon).toRadians(),a=Math.cos(e)*Math.sin(n)-Math.sin(e)*Math.cos(n)*Math.cos(r),o=Math.sin(r)*Math.cos(n),i=Math.atan2(o,a).toDegrees();return p.wrap360(i)}finalBearingTo(t){t instanceof y||(t=y.parse(t));const e=t.initialBearingTo(this)+180;return p.wrap360(e)}midpointTo(t){t instanceof y||(t=y.parse(t));const e=this.lat.toRadians(),n=this.lon.toRadians(),r=t.lat.toRadians(),a=(t.lon-this.lon).toRadians(),o=Math.cos(e),i=Math.sin(e),l={x:o+Math.cos(r)*Math.cos(a),y:0+Math.cos(r)*Math.sin(a),z:i+Math.sin(r)},s=Math.atan2(l.z,Math.sqrt(l.x*l.x+l.y*l.y)),u=n+Math.atan2(l.y,l.x),c=s.toDegrees(),h=u.toDegrees();return new y(c,h)}intermediatePointTo(t,e){if(t instanceof y||(t=y.parse(t)),this.equals(t))return new y(this.lat,this.lon);const n=this.lat.toRadians(),r=this.lon.toRadians(),a=t.lat.toRadians(),o=t.lon.toRadians(),i=a-n,l=o-r,s=Math.sin(i/2)*Math.sin(i/2)+Math.cos(n)*Math.cos(a)*Math.sin(l/2)*Math.sin(l/2),u=2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s)),c=Math.sin((1-e)*u)/Math.sin(u),h=Math.sin(e*u)/Math.sin(u),f=c*Math.cos(n)*Math.cos(r)+h*Math.cos(a)*Math.cos(o),p=c*Math.cos(n)*Math.sin(r)+h*Math.cos(a)*Math.sin(o),d=c*Math.sin(n)+h*Math.sin(a),g=Math.atan2(d,Math.sqrt(f*f+p*p)),v=Math.atan2(p,f),m=g.toDegrees(),b=v.toDegrees();return new y(m,b)}destinationPoint(t,e,n=6371e3){const r=t/n,a=Number(e).toRadians(),o=this.lat.toRadians(),i=this.lon.toRadians(),l=Math.sin(o)*Math.cos(r)+Math.cos(o)*Math.sin(r)*Math.cos(a),s=Math.asin(l),u=Math.sin(a)*Math.sin(r)*Math.cos(o),c=Math.cos(r)-Math.sin(o)*l,h=i+Math.atan2(u,c),f=s.toDegrees(),p=h.toDegrees();return new y(f,p)}static intersection(t,e,n,r){if(t instanceof y||(t=y.parse(t)),n instanceof y||(n=y.parse(n)),isNaN(e))throw new TypeError(`invalid brng1 ‘${e}’`);if(isNaN(r))throw new TypeError(`invalid brng2 ‘${r}’`);const a=t.lat.toRadians(),o=t.lon.toRadians(),i=n.lat.toRadians(),l=n.lon.toRadians(),s=Number(e).toRadians(),u=Number(r).toRadians(),c=i-a,h=l-o,f=2*Math.asin(Math.sqrt(Math.sin(c/2)*Math.sin(c/2)+Math.cos(a)*Math.cos(i)*Math.sin(h/2)*Math.sin(h/2)));if(Math.abs(f)<Number.EPSILON)return new y(t.lat,t.lon);const p=(Math.sin(i)-Math.sin(a)*Math.cos(f))/(Math.sin(f)*Math.cos(a)),g=(Math.sin(a)-Math.sin(i)*Math.cos(f))/(Math.sin(f)*Math.cos(i)),v=Math.acos(Math.min(Math.max(p,-1),1)),m=Math.acos(Math.min(Math.max(g,-1),1)),b=s-(Math.sin(l-o)>0?v:2*d-v),M=(Math.sin(l-o)>0?2*d-m:m)-u;if(0==Math.sin(b)&&0==Math.sin(M))return null;if(Math.sin(b)*Math.sin(M)<0)return null;const w=-Math.cos(b)*Math.cos(M)+Math.sin(b)*Math.sin(M)*Math.cos(f),S=Math.atan2(Math.sin(f)*Math.sin(b)*Math.sin(M),Math.cos(M)+Math.cos(b)*w),x=Math.asin(Math.min(Math.max(Math.sin(a)*Math.cos(S)+Math.cos(a)*Math.sin(S)*Math.cos(s),-1),1)),N=o+Math.atan2(Math.sin(s)*Math.sin(S)*Math.cos(a),Math.cos(S)-Math.sin(a)*Math.sin(x)),P=x.toDegrees(),O=N.toDegrees();return new y(P,O)}crossTrackDistanceTo(t,e,n=6371e3){t instanceof y||(t=y.parse(t)),e instanceof y||(e=y.parse(e));const r=n;if(this.equals(t))return 0;const a=t.distanceTo(this,r)/r,o=t.initialBearingTo(this).toRadians(),i=t.initialBearingTo(e).toRadians();return Math.asin(Math.sin(a)*Math.sin(o-i))*r}alongTrackDistanceTo(t,e,n=6371e3){t instanceof y||(t=y.parse(t)),e instanceof y||(e=y.parse(e));const r=n;if(this.equals(t))return 0;const a=t.distanceTo(this,r)/r,o=t.initialBearingTo(this).toRadians(),i=t.initialBearingTo(e).toRadians(),l=Math.asin(Math.sin(a)*Math.sin(o-i));return Math.acos(Math.cos(a)/Math.abs(Math.cos(l)))*Math.sign(Math.cos(i-o))*r}maxLatitude(t){const e=Number(t).toRadians(),n=this.lat.toRadians();return Math.acos(Math.abs(Math.sin(e)*Math.cos(n))).toDegrees()}static crossingParallels(t,e,n){if(t.equals(e))return null;const r=Number(n).toRadians(),a=t.lat.toRadians(),o=t.lon.toRadians(),i=e.lat.toRadians(),l=e.lon.toRadians()-o,s=Math.sin(a)*Math.cos(i)*Math.cos(r)*Math.sin(l),u=Math.sin(a)*Math.cos(i)*Math.cos(r)*Math.cos(l)-Math.cos(a)*Math.sin(i)*Math.cos(r),c=Math.cos(a)*Math.cos(i)*Math.sin(r)*Math.sin(l);if(c*c>s*s+u*u)return null;const h=Math.atan2(-u,s),f=Math.acos(c/Math.sqrt(s*s+u*u)),d=o+h+f,y=(o+h-f).toDegrees(),g=d.toDegrees();return{lon1:p.wrap180(y),lon2:p.wrap180(g)}}rhumbDistanceTo(t,e=6371e3){t instanceof y||(t=y.parse(t));const n=e,r=this.lat.toRadians(),a=t.lat.toRadians(),o=a-r;let i=Math.abs(t.lon-this.lon).toRadians();Math.abs(i)>d&&(i=i>0?-(2*d-i):2*d+i);const l=Math.log(Math.tan(a/2+d/4)/Math.tan(r/2+d/4)),s=Math.abs(l)>1e-11?o/l:Math.cos(r);return Math.sqrt(o*o+s*s*i*i)*n}rhumbBearingTo(t){if(t instanceof y||(t=y.parse(t)),this.equals(t))return NaN;const e=this.lat.toRadians(),n=t.lat.toRadians();let r=(t.lon-this.lon).toRadians();Math.abs(r)>d&&(r=r>0?-(2*d-r):2*d+r);const a=Math.log(Math.tan(n/2+d/4)/Math.tan(e/2+d/4)),o=Math.atan2(r,a).toDegrees();return p.wrap360(o)}rhumbDestinationPoint(t,e,n=6371e3){const r=this.lat.toRadians(),a=this.lon.toRadians(),o=Number(e).toRadians(),i=t/n,l=i*Math.cos(o);let s=r+l;Math.abs(s)>d/2&&(s=s>0?d-s:-d-s);const u=Math.log(Math.tan(s/2+d/4)/Math.tan(r/2+d/4)),c=Math.abs(u)>1e-11?l/u:Math.cos(r),h=a+i*Math.sin(o)/c,f=s.toDegrees(),p=h.toDegrees();return new y(f,p)}rhumbMidpointTo(t){t instanceof y||(t=y.parse(t));const e=this.lat.toRadians();let n=this.lon.toRadians();const r=t.lat.toRadians(),a=t.lon.toRadians();Math.abs(a-n)>d&&(n+=2*d);const o=(e+r)/2,i=Math.tan(d/4+e/2),l=Math.tan(d/4+r/2),s=Math.tan(d/4+o/2);let u=((a-n)*Math.log(s)+n*Math.log(l)-a*Math.log(i))/Math.log(l/i);isFinite(u)||(u=(n+a)/2);const c=o.toDegrees(),h=u.toDegrees();return new y(c,h)}static areaOf(t,e=6371e3){const n=e,r=t[0].equals(t[t.length-1]);r||t.push(t[0]);const a=t.length-1;let o=0;for(let e=0;e<a;e++){const n=t[e].lat.toRadians(),r=t[e+1].lat.toRadians(),a=(t[e+1].lon-t[e].lon).toRadians();o+=2*Math.atan2(Math.tan(a/2)*(Math.tan(n/2)+Math.tan(r/2)),1+Math.tan(n/2)*Math.tan(r/2))}(function(t){let e=0,n=t[0].initialBearingTo(t[1]);for(let r=0;r<t.length-1;r++){const a=t[r].initialBearingTo(t[r+1]),o=t[r].finalBearingTo(t[r+1]);e+=(a-n+540)%360-180,e+=(o-a+540)%360-180,n=o}return e+=(t[0].initialBearingTo(t[1])-n+540)%360-180,Math.abs(e)<90})(t)&&(o=Math.abs(o)-2*d);const i=Math.abs(o*n*n);return r||t.pop(),i}equals(t){return t instanceof y||(t=y.parse(t)),!(Math.abs(this.lat-t.lat)>Number.EPSILON||Math.abs(this.lon-t.lon)>Number.EPSILON)}toGeoJSON(){return{type:"Point",coordinates:[this.lon,this.lat]}}toString(t="d",e=void 0){if(!["d","dm","dms","n"].includes(t))throw new RangeError(`invalid format ‘${t}’`);return"n"==t?(null==e&&(e=4),`${this.lat.toFixed(e)},${this.lon.toFixed(e)}`):`${p.toLat(this.lat,t,e)}, ${p.toLon(this.lon,t,e)}`}}function g(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,a,o,i,l=[],s=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(l.push(r.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return v(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var m=function(t,e){var n=g(t,2),r=n[0],a=n[1],o=g(e,2),i=o[0],l=o[1],s=new y(a,r),u=new y(l,i);return s.distanceTo(u)},b=function(t){var e=1609.344,n=t/e;if(n<.5/e)return"".concat(Math.round(t),"m");if(n<10){var r=Number.parseFloat(n.toFixed(1)),a=1===r?"mile":"miles";return"".concat(r," ").concat(a)}var o=Math.round(n),i=1===o?"mile":"miles";return"".concat(o," ").concat(i)};function M(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,a,o,i,l=[],s=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(l.push(r.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return w(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?w(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function S(t){return S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},S(t)}function x(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function N(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?x(Object(n),!0).forEach(function(e){P(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):x(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function P(t,e,n){return(e=function(t){var e=function(t){if("object"!=S(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=S(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==S(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function O(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var E="highlighted-label";function A(t,e){if("number"==typeof t)return t;if(!Array.isArray(t)||"interpolate"!==t[0])return function(t,e){var n=t.stops;if(n.length<2)return n.length>0?n[0][1]:0;for(var r=n[0],a=n[n.length-1],o=1;o<n.length;o++){var i=n[o];if(i[0]>e){a=i,r=n[o-1];break}r=n[o-1],a=i}var l=M(r,2),s=l[0],u=l[1],c=M(a,2),h=c[0],f=c[1];return e<=s?u:e>=h?f:u+(e-s)/(h-s)*(f-u)}(t,e);var n,r=function(t){if(Array.isArray(t))return t}(n=t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(n)||function(t,e){if(t){if("string"==typeof t)return O(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?O(t,e):void 0}}(n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),a=r[2],o=O(r).slice(3);if("zoom"!==a[0])throw new Error("Only zoom-based expressions supported");for(var i=0;i<o.length-2;i+=2){var l=o[i],s=o[i+1],u=o[i+2],c=o[i+3];if(e<=l)return s;if(e<=u)return s+(e-l)/(u-l)*(c-s)}return o[o.length-1]}function j(t,e){if(e.highlightLayerId&&t.getLayer(e.highlightLayerId)){try{t.removeLayer(e.highlightLayerId)}catch(t){}e.highlightLayerId=null,e.highlightedExpr=null}}function T(t,e,n){var r,a,o,i;if(null!=e&&null!==(r=e.feature)&&void 0!==r&&r.layer){j(t,n);var l=e.feature,s=e.layer;n.highlightLayerId="highlight-".concat(s.id);var u=l.id,c=l.type,h=l.properties,f=l.geometry;t.getSource(E).setData({id:u,type:c,properties:h,geometry:f}),n.highlightedExpr=s.layout["text-size"];var p=t.getZoom(),d=(a=s,o=1.5*A(n.highlightedExpr,p),i=n.isDarkStyle?{text:"#ffffff",halo:"#000000"}:{text:"#000000",halo:"#ffffff"},{id:"highlight-".concat(a.id),type:a.type,source:E,layout:N(N({},a.layout),{},{"text-size":o,"text-allow-overlap":!0,"text-ignore-placement":!0,"text-max-angle":90}),paint:N(N({},a.paint),{},{"text-color":i.text,"text-halo-color":i.halo,"text-halo-width":3,"text-halo-blur":1,"text-opacity":1})});t.addLayer(d),t.moveLayer(n.highlightLayerId)}}function R(t){t.getSource(E)||t.addSource(E,{type:"geojson",data:{type:"FeatureCollection",features:[]}})}function L(t){t.getStyle().layers.filter(function(t){var e;return"line"===(null===(e=t.layout)||void 0===e?void 0:e["symbol-placement"])}).forEach(function(e){return t.setLayoutProperty(e.id,"symbol-placement","line-center")})}function k(t,e,n,r){var a={isDarkStyle:"dark"===e,labels:[],currentPixel:null,highlightLayerId:null,highlightedExpr:null};function o(){var e=t.getStyle().layers.filter(function(t){return"symbol"===t.type}),n=t.queryRenderedFeatures({layers:e.map(function(t){return t.id})});a.labels=function(t,e,n){return e.flatMap(function(e){var r,a,o,i,l="string"==typeof(a=null===(r=e.layout)||void 0===r?void 0:r["text-field"])?null===(o=/^{(.+)}$/.exec(a))||void 0===o?void 0:o[1]:Array.isArray(a)?null===(i=a.find(function(t){return Array.isArray(t)&&"get"===t[0]}))||void 0===i?void 0:i[1]:null;return l?n.filter(function(t){var n;return t.layer.id===e.id&&(null===(n=t.properties)||void 0===n?void 0:n[l])}).map(function(n){return function(t,e,n,r){var a=function(t){var e=t.type,n=t.coordinates;if("Point"===e)return n;if("MultiPoint"===e)return n[0];if(e.includes("LineString")){var r="LineString"===e?n:n[0];return[(r[0][0]+r[r.length-1][0])/2,(r[0][1]+r[r.length-1][1])/2]}if(e.includes("Polygon")){var a="Polygon"===e?n[0]:n[0][0],o=a.reduce(function(t,e){return[t[0]+e[0],t[1]+e[1]]},[0,0]);return[o[0]/a.length,o[1]/a.length]}return null}(t.geometry);if(!a)return null;var o=r.project({lng:a[0],lat:a[1]});return{text:t.properties[n],x:o.x,y:o.y,feature:t,layer:e}}(n,e,l,t)}).filter(Boolean):[]})}(t,e,n)}function i(){if(o(),!a.labels.length)return null;var e=t.project(t.getCenter()),n=function(t,e){var n;return null===(n=t.reduce(function(t,n){var r=Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2);return!t||r<t.dist?{label:n,dist:r}:t},null))||void 0===n?void 0:n.label}(a.labels,e);return n&&(a.currentPixel={x:n.x,y:n.y}),T(t,n,a),"".concat(n.text," (").concat(n.layer.id,")")}return L(t),R(t),null==r||r.on(n.MAP_SET_STYLE,function(e){t.once("styledata",function(){return t.once("idle",function(){L(t),R(t),a.isDarkStyle="dark"===(null==e?void 0:e.mapColorScheme)})})}),t.on("zoom",function(){if(a.highlightLayerId&&a.highlightedExpr){var e=A(a.highlightedExpr,t.getZoom());t.setLayoutProperty(a.highlightLayerId,"text-size",1.5*e)}}),function(t){t.getStyle().layers.filter(function(t){return"symbol"===t.type}).forEach(function(e){t.setPaintProperty(e.id,"text-opacity",["case",["boolean",["feature-state","highlighted"],!1],0,1])})}(t),{refreshLabels:o,highlightNextLabel:function(e){if(o(),!a.labels.length)return null;if(!a.currentPixel)return i();var n=function(t,e){if(!e.currentPixel)return null;var n=e.labels.map(function(t,e){return{pixel:[t.x,t.y],index:e}}).filter(function(t){return t.pixel[0]!==e.currentPixel.x||t.pixel[1]!==e.currentPixel.y});if(!n.length)return null;var r=n.map(function(t){return t.pixel}),a=function(t,e,n){var r=g(e,2),a=r[0],o=r[1],i=n.filter(function(e){var n=g(e,2),r=n[0],i=n[1];return(r!==a||i!==o)&&function(t,e,n){switch(t){case"ArrowUp":return n<0&&Math.abs(n)>=Math.abs(e);case"ArrowDown":return n>0&&Math.abs(n)>=Math.abs(e);case"ArrowLeft":return e<0&&Math.abs(e)>Math.abs(n);case"ArrowRight":return e>0&&Math.abs(e)>Math.abs(n);default:return!1}}(t,r-a,i-o)});if(!i.length)return n.findIndex(function(t){return t[0]===a&&t[1]===o});var l=-1,s=1/0;return i.forEach(function(t){var e=t[0]-a,r=t[1]-o,i=e*e+r*r;i<s&&(s=i,l=n.indexOf(t))}),l}(t,[e.currentPixel.x,e.currentPixel.y],r);return(null==a||a<0||a>=n.length)&&(a=0),e.labels[n[a].index]}(e,a);return n?(a.currentPixel={x:n.x,y:n.y},T(t,n,a),"".concat(n.text," (").concat(n.layer.id,")")):null},highlightLabelAtCenter:i,clearHighlightedLabel:function(){return j(t,a)}}}function D(t){return D="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},D(t)}function I(t){return function(t){if(Array.isArray(t))return B(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||_(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(t,e){if(t){if("string"==typeof t)return B(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?B(t,e):void 0}}function B(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function C(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function F(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?C(Object(n),!0).forEach(function(e){$(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):C(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function $(t,e,n){return(e=function(t){var e=function(t){if("object"!=D(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=D(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==D(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var z=function(t,e,n,r,a,o,i){t.getLayer(e)||t.addLayer(F(F({id:e,type:n,source:r},a&&{"source-layer":a}),{},{paint:o})),Object.entries(o).forEach(function(n){var r,a,o=(a=2,function(t){if(Array.isArray(t))return t}(r=n)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,a,o,i,l=[],s=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(l.push(r.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(r,a)||_(r,a)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=o[0],l=o[1];t.setPaintProperty(e,i,l)}),t.setFilter(e,i)};function q(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,a,o,i,l=[],s=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(l.push(r.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Z(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Z(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Z(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var W=function(t,e,n){var r=Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2);if(0===r)return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2);var a=((t.x-e.x)*(n.x-e.x)+(t.y-e.y)*(n.y-e.y))/r;return a=Math.max(0,Math.min(1,a)),Math.pow(t.x-(e.x+a*(n.x-e.x)),2)+Math.pow(t.y-(e.y+a*(n.y-e.y)),2)},G=["container","padding","mapStyle","center","zoom","bounds","pixelRatio"];function H(t){return H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},H(t)}function U(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var s=r&&r.prototype instanceof l?r:l,u=Object.create(s.prototype);return V(u,"_invoke",function(n,r,a){var o,l,s,u=0,c=a||[],h=!1,f={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,n){return o=e,l=0,s=t,f.n=n,i}};function p(n,r){for(l=n,s=r,e=0;!h&&u&&!a&&e<c.length;e++){var a,o=c[e],p=f.p,d=o[2];n>3?(a=d===r)&&(s=o[(l=o[4])?5:(l=3,3)],o[4]=o[5]=t):o[0]<=p&&((a=n<2&&p<o[1])?(l=0,f.v=r,f.n=o[1]):p<d&&(a=n<3||o[0]>r||r>d)&&(o[4]=n,o[5]=r,f.n=d,l=0))}if(a||n>1)return i;throw h=!0,r}return function(a,c,d){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&p(c,d),l=c,s=d;(e=l<2?t:s)||!h;){o||(l?l<3?(l>1&&(f.n=-1),p(l,s)):f.n=s:f.v=s);try{if(u=2,o){if(l||(a="next"),e=o[a]){if(!(e=e.call(o,s)))throw TypeError("iterator result is not an object");if(!e.done)return e;s=e.value,l<2&&(l=0)}else 1===l&&(e=o.return)&&e.call(o),l<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),l=1);o=t}else if((e=(h=f.n<0)?s:n.call(r,f))!==i)break}catch(e){o=t,l=1,s=e}finally{u=1}}return{value:e,done:h}}}(n,a,o),!0),u}var i={};function l(){}function s(){}function u(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):(V(e={},r,function(){return this}),e),h=u.prototype=l.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,V(t,a,"GeneratorFunction")),t.prototype=Object.create(h),t}return s.prototype=u,V(h,"constructor",u),V(u,"constructor",s),s.displayName="GeneratorFunction",V(u,a,"GeneratorFunction"),V(h),V(h,a,"Generator"),V(h,r,function(){return this}),V(h,"toString",function(){return"[object Generator]"}),(U=function(){return{w:o,m:f}})()}function V(t,e,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(t){a=0}V=function(t,e,n,r){function o(e,n){V(t,e,function(t){return this._invoke(e,n,t)})}e?a?a(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},V(t,e,n,r)}function Y(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function J(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Y(Object(n),!0).forEach(function(e){K(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Y(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function K(t,e,n){return(e=et(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function X(t,e){if(null==t)return{};var n,r,a=function(t,e){if(null==t)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;n[r]=t[r]}return n}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],-1===e.indexOf(n)&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function Q(t,e,n,r,a,o,i){try{var l=t[o](i),s=l.value}catch(t){return void n(t)}l.done?e(s):Promise.resolve(s).then(r,a)}function tt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,et(r.key),r)}}function et(t){var e=function(t){if("object"!=H(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=H(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==H(e)?e:e+""}var nt=function(){return t=function t(e){var n=e.mapFramework,r=e.mapProviderConfig,o=void 0===r?{}:r,i=e.events,l=e.eventBus;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.maplibreModule=n,this.events=i,this.eventBus=l,this.capabilities={supportedShortcuts:a,supportsMapSizes:!0},Object.assign(this,o)},e=[{key:"initMap",value:(n=U().m(function t(e){var n,r,a,l,s,h,f,p,d,y,g,v,m=this;return U().w(function(t){for(;;)switch(t.n){case 0:n=e.container,r=e.padding,a=e.mapStyle,l=e.center,s=e.zoom,h=e.bounds,f=e.pixelRatio,p=X(e,G),d=this.maplibreModule.Map,y=this.events,g=this.eventBus,(v=new d(J(J({},p),{},{container:n,style:null==a?void 0:a.url,pixelRatio:f,padding:r,center:l,zoom:s,fadeDuration:0,attributionControl:!1,dragRotate:!1,doubleClickZoom:!1}))).touchZoomRotate.disableRotation(),this.map=v,this.map.setPadding(r),h&&v.fitBounds(h,{duration:0}),i(v),o(v),u({map:v,events:y,eventBus:g,getCenter:this.getCenter.bind(this),getZoom:this.getZoom.bind(this),getBounds:this.getBounds.bind(this),getResolution:this.getResolution.bind(this)}),c({map:v,events:y,eventBus:g}),v.on("load",function(){m.labelNavigator=k(v,null==a?void 0:a.mapColorScheme,y,g)}),this.eventBus.emit(y.MAP_READY,this.getMapAPI());case 1:return t.a(2)}},t,this)}),l=function(){var t=this,e=arguments;return new Promise(function(r,a){var o=n.apply(t,e);function i(t){Q(o,r,a,i,l,"next",t)}function l(t){Q(o,r,a,i,l,"throw",t)}i(void 0)})},function(t){return l.apply(this,arguments)})},{key:"getMapAPI",value:function(){return{map:this.map,crs:this.crs,fitToBounds:this.fitToBounds.bind(this),setView:this.setView.bind(this)}}},{key:"destroyMap",value:function(){var t,e;null===(t=this.mapEvents)||void 0===t||t.remove(),null===(e=this.appEvents)||void 0===e||e.remove(),this.mapEvents=null,this.appEvents=null,this.map.remove()}},{key:"setView",value:function(t){var e=t.center,n=t.zoom;this.map.flyTo({center:e||this.getCenter(),zoom:n||this.getZoom(),duration:r})}},{key:"zoomIn",value:function(t){this.map.easeTo({zoom:this.getZoom()+t,duration:r})}},{key:"zoomOut",value:function(t){this.map.easeTo({zoom:this.getZoom()-t,duration:r})}},{key:"panBy",value:function(t){this.map.panBy(t,{duration:r})}},{key:"fitToBounds",value:function(t){this.map.fitBounds(t,{duration:r})}},{key:"setPadding",value:function(t){this.map.setPadding(t)}},{key:"updateHighlightedFeatures",value:function(t,e){return function(t){var e=t.LngLatBounds,n=t.map,r=t.selectedFeatures,a=t.stylesMap;if(!n)return null;var o=function(t,e){var n={};return null==e||e.forEach(function(e){var r=e.featureId,a=e.layerId,o=e.idProperty,i=e.geometry,l=t.getLayer(a);if(l){var s=l.source;n[s]||(n[s]={ids:new Set,fillIds:new Set,idProperty:o,layerId:a,hasFillGeometry:!1}),!i||"Polygon"!==i.type&&"MultiPolygon"!==i.type||(n[s].hasFillGeometry=!0,n[s].fillIds.add(r)),n[s].ids.add(r)}}),n}(n,r),i=[],l=new Set(Object.keys(o)),s=n._highlightedSources||new Set;return function(t,e,n){e.forEach(function(e){if(!n.has(e)){var r="highlight-".concat(e);["".concat(r,"-fill"),"".concat(r,"-line")].forEach(function(e){t.getLayer(e)&&t.setFilter(e,["==","id",""])})}})}(n,s,l),n._highlightedSources=l,l.forEach(function(t){var e=o[t],r=e.ids,l=e.fillIds,s=e.idProperty,u=e.layerId,c=e.hasFillGeometry,h=n.getLayer(u),f=h.sourceLayer,p=c?"fill":h.type,d="highlight-".concat(t),y=a[u],g=y.stroke,v=y.strokeWidth,m=y.fill,b=s?["get",s]:["id"],M=["in",b,["literal",I(r)]],w=["in",b,["literal",I(l)]],S={"line-color":g,"line-width":v};"fill"===p&&(z(n,"".concat(d,"-fill"),"fill",t,f,{"fill-color":m},w),z(n,"".concat(d,"-line"),"line",t,f,S,M)),"line"===p&&(n.getLayer("".concat(d,"-fill"))&&n.setFilter("".concat(d,"-fill"),["==","id",""]),z(n,"".concat(d,"-line"),"line",t,f,S,M)),i.push.apply(i,I(n.queryRenderedFeatures({layers:[u]}).filter(function(t){var e;return r.has(s?null===(e=t.properties)||void 0===e?void 0:e[s]:t.id)})))}),function(t,e){if(!e.length)return null;var n=new t;return e.forEach(function(t){var e=function(t){return"number"==typeof t[0]?n.extend(t):t.forEach(e)};e(t.geometry.coordinates)}),[n.getWest(),n.getSouth(),n.getEast(),n.getNorth()]}(e,i)}({LngLatBounds:this.maplibreModule.LngLatBounds,map:this.map,selectedFeatures:t,stylesMap:e})}},{key:"highlightNextLabel",value:function(t){var e;return(null===(e=this.labelNavigator)||void 0===e?void 0:e.highlightNextLabel(t))||null}},{key:"highlightLabelAtCenter",value:function(){var t;return(null===(t=this.labelNavigator)||void 0===t?void 0:t.highlightLabelAtCenter())||null}},{key:"clearHighlightedLabel",value:function(){var t;return(null===(t=this.labelNavigator)||void 0===t?void 0:t.clearHighlightedLabel())||null}},{key:"getCenter",value:function(){var t=this.map.getCenter();return[Number(t.lng.toFixed(7)),Number(t.lat.toFixed(7))]}},{key:"getZoom",value:function(){return Number(this.map.getZoom().toFixed(7))}},{key:"getBounds",value:function(){return this.map.getBounds().toArray().flat(1)}},{key:"getFeaturesAtPoint",value:function(t,e){return function(t,e){var n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).radius,r=void 0===n?10:n,a=[[e.x-r,e.y-r],[e.x+r,e.y+r]],o=t.queryRenderedFeatures(a);if(0===o.length)return[];var i=[];o.forEach(function(t){!1===i.includes(t.layer.id)&&i.push(t.layer.id)});for(var l=new Set,s=[],u=o.length-1;u>=0;u--){var c=o[u],h=void 0===c.id?JSON.stringify(c.properties):c.id;!1===l.has(h)&&(l.add(h),s.push(c))}var f=t.unproject(e),p=[f.lng,f.lat];return s.map(function(n){var r=0,a=n.geometry.type,o=function(t,e,n){var r=n.coordinates,a=n.type,o=1/0,i=function(e){return t.project(e)},l=function(t){for(var n=0;n<t.length-1;n++){var r=W(e,i(t[n]),i(t[n+1]));r<o&&(o=r)}};if("Point"===a){var s=i(r);o=Math.pow(e.x-s.x,2)+Math.pow(e.y-s.y,2)}else"LineString"===a||"MultiPoint"===a?"LineString"===a?l(r):r.forEach(function(t){var n=i(t),r=Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2);r<o&&(o=r)}):"Polygon"===a||"MultiLineString"===a?r.forEach(l):"MultiPolygon"===a&&r.forEach(function(t){return t.forEach(l)});return o}(t,e,n.geometry);if(r+=1e6*i.indexOf(n.layer.id),a.includes("Polygon")){var l=("Polygon"===a?[n.geometry.coordinates]:n.geometry.coordinates).some(function(t){return function(t,e){for(var n=q(t,2),r=n[0],a=n[1],o=!1,i=0,l=e.length-1;i<e.length;l=i,i++){var s=q(e[i],2),u=s[0],c=s[1],h=q(e[l],2),f=h[0],p=h[1];c>a!=p>a&&r<(f-u)*(a-c)/(p-c)+u&&(o=!o)}return o}(p,t[0])});!0===l?r-=5e5:r+=1e5}return{f:n,score:r+=o}}).sort(function(t,e){return t.score-e.score}).map(function(t){return t.f})}(this.map,t,e)}},{key:"getAreaDimensions",value:function(){return function(t){var e,n,r,a;if(t&&"function"==typeof t.getWest)e=t.getWest(),n=t.getSouth(),r=t.getEast(),a=t.getNorth();else{if(!Array.isArray(t)||2!==t.length)return"";var o=g(t,2),i=g(o[0],2);e=i[0],n=i[1];var l=g(o[1],2);r=l[0],a=l[1]}var s=m([e,n],[r,n]),u=m([e,n],[e,a]),c=b(s),h=b(u);return"".concat(h," by ").concat(c)}((t=this.maplibreModule.LngLatBounds,e=this.map,n=e.getContainer().getBoundingClientRect(),r=n.width,a=n.height,o=e.getPadding(),i=[o.left,a-o.bottom],l=[r-o.right,o.top],new t(e.unproject(i),e.unproject(l))));var t,e,n,r,a,o,i,l}},{key:"getCardinalMove",value:function(t,e){return function(t,e){var n=g(t,2),r=n[0],a=n[1],o=g(e,2),i=o[0],l=o[1],s=l-a,u=i-r,c=[];if(Math.abs(s)>1e-4){var h=Math.round(m([r,a],[r,l]));c.push("".concat(s>0?"north":"south"," ").concat(b(h)))}if(Math.abs(u)>1e-4){var f=Math.round(m([r,a],[i,a]));c.push("".concat(u>0?"east":"west"," ").concat(b(f)))}return c.join(", ")}(t,e)}},{key:"getResolution",value:function(){return t=this.map.getCenter(),e=this.map.getZoom(),n=t.lat,r=Math.pow(2,e),40075016.686*Math.cos(n*Math.PI/180)/(512*r);var t,e,n,r}},{key:"mapToScreen",value:function(t){return this.map.project(t)}},{key:"screenToMap",value:function(t){var e=this.map.unproject([t.x,t.y]);return[e.lng,e.lat]}}],e&&tt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,l}()}}]);
|
|
2
|
+
"use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[772],{809(t,e,n){n.r(e),n.d(e,{default:()=>nt});var r=400,a=["showKeyboardHelp","selectControl","moveLarge","nudgeMap","zoomLarge","nudgeZoom","highlightLabelAtCenter","highlightNextLabel"];function o(t){var e=t.getCanvas();e.removeAttribute("role"),e.setAttribute("tabindex",-1),e.removeAttribute("aria-label"),e.style.display="block"}function i(t){var e=Event.prototype.preventDefault;Event.prototype.preventDefault=function(){if(("touchmove"===this.type||"touchstart"===this.type)&&!this.cancelable){var n=t.getCanvas();if(n&&(this.target===n||n.contains(this.target)))return}e.call(this)}}var l=function(t,e){var n=null,r=function(){for(var r=arguments.length,a=new Array(r),o=0;o<r;o++)a[o]=arguments[o];clearTimeout(n),n=setTimeout(function(){t.apply(void 0,a)},e)};return r.cancel=function(){n&&(clearTimeout(n),n=null)},r};function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function u(t){var e=t.map,n=t.events,r=t.eventBus,a=t.getCenter,o=t.getZoom,i=t.getBounds,u=t.getResolution,c=[],h=[],f=function(){var t=o();return{center:a(),bounds:i(),resolution:u(),zoom:t,isAtMaxZoom:e.getMaxZoom()<=t,isAtMinZoom:e.getMinZoom()>=t}},p=function(t,e){return r.emit(t,e)},d=function(){return p(n.MAP_LOADED)};e.on("load",d),c.push(["load",d]),e.once("idle",function(){return p(n.MAP_FIRST_IDLE,f())});var y=function(){return p(n.MAP_MOVE_START)};e.on("movestart",y),c.push(["movestart",y]);var g=l(function(){p(n.MAP_MOVE_END,f())},500);e.on("moveend",g),c.push(["moveend",g]),h.push(g);var v,m,b=(v=function(){p(n.MAP_MOVE,f())},m=0,function(){var t=Date.now();t-m>=10&&(m=t,v.apply(void 0,arguments))});e.on("zoom",b),c.push(["zoom",b]),h.push(b);var M=function(){return p(n.MAP_RENDER)};e.on("render",M),c.push(["render",M]);var w=l(function(){p(n.MAP_DATA_CHANGE,f())},500);e.on("styledata",w),c.push(["styledata",w]),h.push(w);var S=function(){return p(n.MAP_STYLE_CHANGE)};e.on("style.load",S),c.push(["style.load",S]);var x=function(t){return p(n.MAP_CLICK,{point:t.point,coords:[t.lngLat.lng,t.lngLat.lat]})};return e.on("click",x),c.push(["click",x]),{remove:function(){h.forEach(function(t){return t.cancel()}),c.forEach(function(t){var n,r,a=(r=2,function(t){if(Array.isArray(t))return t}(n=t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,a,o,i,l=[],s=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(l.push(r.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(n,r)||function(t,e){if(t){if("string"==typeof t)return s(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(t,e):void 0}}(n,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=a[0],i=a[1];return e.off(o,i)})}}}function c(t){var e=t.map,n=t.events,r=t.eventBus,a=function(t){e.setStyle(t.url,{diff:!1})},o=function(t){e.setPixelRatio(t)};return r.on(n.MAP_SET_STYLE,a),r.on(n.MAP_SET_PIXEL_RATIO,o),{remove:function(){r.off(n.MAP_SET_STYLE,a),r.off(n.MAP_SET_PIXEL_RATIO,o)}}}let h=" ";class f{static get separator(){return h}static set separator(t){h=t}static parse(t){if(!isNaN(parseFloat(t))&&isFinite(t))return Number(t);const e=String(t).trim().replace(/^-/,"").replace(/[NSEW]$/i,"").split(/[^0-9.,]+/);if(""==e[e.length-1]&&e.splice(e.length-1),""==e)return NaN;let n=null;switch(e.length){case 3:n=e[0]/1+e[1]/60+e[2]/3600;break;case 2:n=e[0]/1+e[1]/60;break;case 1:n=e[0];break;default:return NaN}return/^-|[WS]$/i.test(t.trim())&&(n=-n),Number(n)}static toDms(t,e="d",n=void 0){if(isNaN(t))return null;if("string"==typeof t&&""==t.trim())return null;if("boolean"==typeof t)return null;if(t==1/0)return null;if(null==t)return null;if(void 0===n)switch(e){case"d":case"deg":n=4;break;case"dm":case"deg+min":n=2;break;case"dms":case"deg+min+sec":n=0;break;default:e="d",n=4}t=Math.abs(t);let r=null,a=null,o=null,i=null;switch(e){default:case"d":case"deg":a=t.toFixed(n),a<100&&(a="0"+a),a<10&&(a="0"+a),r=a+"°";break;case"dm":case"deg+min":a=Math.floor(t),o=(60*t%60).toFixed(n),60==o&&(o=(0).toFixed(n),a++),a=("000"+a).slice(-3),o<10&&(o="0"+o),r=a+"°"+f.separator+o+"′";break;case"dms":case"deg+min+sec":a=Math.floor(t),o=Math.floor(3600*t/60)%60,i=(3600*t%60).toFixed(n),60==i&&(i=(0).toFixed(n),o++),60==o&&(o=0,a++),a=("000"+a).slice(-3),o=("00"+o).slice(-2),i<10&&(i="0"+i),r=a+"°"+f.separator+o+"′"+f.separator+i+"″"}return r}static toLat(t,e,n){const r=f.toDms(f.wrap90(t),e,n);return null===r?"–":r.slice(1)+f.separator+(t<0?"S":"N")}static toLon(t,e,n){const r=f.toDms(f.wrap180(t),e,n);return null===r?"–":r+f.separator+(t<0?"W":"E")}static toBrng(t,e,n){const r=f.toDms(f.wrap360(t),e,n);return null===r?"–":r.replace("360","0")}static fromLocale(t){const e=123456.789.toLocaleString(),n={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(n.thousands,"⁜").replace(n.decimal,".").replace("⁜",",")}static toLocale(t){const e=123456.789.toLocaleString(),n={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(/,([0-9])/,"⁜$1").replace(".",n.decimal).replace("⁜",n.thousands)}static compassPoint(t,e=3){if(![1,2,3].includes(Number(e)))throw new RangeError(`invalid precision ‘${e}’`);t=f.wrap360(t);const n=4*2**(e-1);return["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][Math.round(t*n/360)%n*16/n]}static wrap90(t){if(-90<=t&&t<=90)return t;const e=t;return 1*Math.abs(((e-90)%360+360)%360-180)-90}static wrap180(t){if(-180<=t&&t<=180)return t;const e=360;return((360*t/e-180)%e+e)%e-180}static wrap360(t){if(0<=t&&t<360)return t;const e=360;return(360*t/e%e+e)%e}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};const p=f,d=Math.PI;class y{constructor(t,e){if(isNaN(t))throw new TypeError(`invalid lat ‘${t}’`);if(isNaN(e))throw new TypeError(`invalid lon ‘${e}’`);this._lat=p.wrap90(Number(t)),this._lon=p.wrap180(Number(e))}get lat(){return this._lat}get latitude(){return this._lat}set lat(t){if(this._lat=isNaN(t)?p.wrap90(p.parse(t)):p.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid lat ‘${t}’`)}set latitude(t){if(this._lat=isNaN(t)?p.wrap90(p.parse(t)):p.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid latitude ‘${t}’`)}get lon(){return this._lon}get lng(){return this._lon}get longitude(){return this._lon}set lon(t){if(this._lon=isNaN(t)?p.wrap180(p.parse(t)):p.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lon ‘${t}’`)}set lng(t){if(this._lon=isNaN(t)?p.wrap180(p.parse(t)):p.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lng ‘${t}’`)}set longitude(t){if(this._lon=isNaN(t)?p.wrap180(p.parse(t)):p.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid longitude ‘${t}’`)}static get metresToKm(){return.001}static get metresToMiles(){return 1/1609.344}static get metresToNauticalMiles(){return 1/1852}static parse(...t){if(0==t.length)throw new TypeError("invalid (empty) point");if(null===t[0]||null===t[1])throw new TypeError("invalid (null) point");let e,n;if(2==t.length&&([e,n]=t,e=p.wrap90(p.parse(e)),n=p.wrap180(p.parse(n)),isNaN(e)||isNaN(n)))throw new TypeError(`invalid point ‘${t.toString()}’`);if(1==t.length&&"string"==typeof t[0]&&([e,n]=t[0].split(","),e=p.wrap90(p.parse(e)),n=p.wrap180(p.parse(n)),isNaN(e)||isNaN(n)))throw new TypeError(`invalid point ‘${t[0]}’`);if(1==t.length&&"object"==typeof t[0]){const r=t[0];if("Point"==r.type&&Array.isArray(r.coordinates)?[n,e]=r.coordinates:(null!=r.latitude&&(e=r.latitude),null!=r.lat&&(e=r.lat),null!=r.longitude&&(n=r.longitude),null!=r.lng&&(n=r.lng),null!=r.lon&&(n=r.lon),e=p.wrap90(p.parse(e)),n=p.wrap180(p.parse(n))),isNaN(e)||isNaN(n))throw new TypeError(`invalid point ‘${JSON.stringify(t[0])}’`)}if(isNaN(e)||isNaN(n))throw new TypeError(`invalid point ‘${t.toString()}’`);return new y(e,n)}distanceTo(t,e=6371e3){if(t instanceof y||(t=y.parse(t)),isNaN(e))throw new TypeError(`invalid radius ‘${e}’`);const n=e,r=this.lat.toRadians(),a=this.lon.toRadians(),o=t.lat.toRadians(),i=o-r,l=t.lon.toRadians()-a,s=Math.sin(i/2)*Math.sin(i/2)+Math.cos(r)*Math.cos(o)*Math.sin(l/2)*Math.sin(l/2);return n*(2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s)))}initialBearingTo(t){if(t instanceof y||(t=y.parse(t)),this.equals(t))return NaN;const e=this.lat.toRadians(),n=t.lat.toRadians(),r=(t.lon-this.lon).toRadians(),a=Math.cos(e)*Math.sin(n)-Math.sin(e)*Math.cos(n)*Math.cos(r),o=Math.sin(r)*Math.cos(n),i=Math.atan2(o,a).toDegrees();return p.wrap360(i)}finalBearingTo(t){t instanceof y||(t=y.parse(t));const e=t.initialBearingTo(this)+180;return p.wrap360(e)}midpointTo(t){t instanceof y||(t=y.parse(t));const e=this.lat.toRadians(),n=this.lon.toRadians(),r=t.lat.toRadians(),a=(t.lon-this.lon).toRadians(),o=Math.cos(e),i=Math.sin(e),l={x:o+Math.cos(r)*Math.cos(a),y:0+Math.cos(r)*Math.sin(a),z:i+Math.sin(r)},s=Math.atan2(l.z,Math.sqrt(l.x*l.x+l.y*l.y)),u=n+Math.atan2(l.y,l.x),c=s.toDegrees(),h=u.toDegrees();return new y(c,h)}intermediatePointTo(t,e){if(t instanceof y||(t=y.parse(t)),this.equals(t))return new y(this.lat,this.lon);const n=this.lat.toRadians(),r=this.lon.toRadians(),a=t.lat.toRadians(),o=t.lon.toRadians(),i=a-n,l=o-r,s=Math.sin(i/2)*Math.sin(i/2)+Math.cos(n)*Math.cos(a)*Math.sin(l/2)*Math.sin(l/2),u=2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s)),c=Math.sin((1-e)*u)/Math.sin(u),h=Math.sin(e*u)/Math.sin(u),f=c*Math.cos(n)*Math.cos(r)+h*Math.cos(a)*Math.cos(o),p=c*Math.cos(n)*Math.sin(r)+h*Math.cos(a)*Math.sin(o),d=c*Math.sin(n)+h*Math.sin(a),g=Math.atan2(d,Math.sqrt(f*f+p*p)),v=Math.atan2(p,f),m=g.toDegrees(),b=v.toDegrees();return new y(m,b)}destinationPoint(t,e,n=6371e3){const r=t/n,a=Number(e).toRadians(),o=this.lat.toRadians(),i=this.lon.toRadians(),l=Math.sin(o)*Math.cos(r)+Math.cos(o)*Math.sin(r)*Math.cos(a),s=Math.asin(l),u=Math.sin(a)*Math.sin(r)*Math.cos(o),c=Math.cos(r)-Math.sin(o)*l,h=i+Math.atan2(u,c),f=s.toDegrees(),p=h.toDegrees();return new y(f,p)}static intersection(t,e,n,r){if(t instanceof y||(t=y.parse(t)),n instanceof y||(n=y.parse(n)),isNaN(e))throw new TypeError(`invalid brng1 ‘${e}’`);if(isNaN(r))throw new TypeError(`invalid brng2 ‘${r}’`);const a=t.lat.toRadians(),o=t.lon.toRadians(),i=n.lat.toRadians(),l=n.lon.toRadians(),s=Number(e).toRadians(),u=Number(r).toRadians(),c=i-a,h=l-o,f=2*Math.asin(Math.sqrt(Math.sin(c/2)*Math.sin(c/2)+Math.cos(a)*Math.cos(i)*Math.sin(h/2)*Math.sin(h/2)));if(Math.abs(f)<Number.EPSILON)return new y(t.lat,t.lon);const p=(Math.sin(i)-Math.sin(a)*Math.cos(f))/(Math.sin(f)*Math.cos(a)),g=(Math.sin(a)-Math.sin(i)*Math.cos(f))/(Math.sin(f)*Math.cos(i)),v=Math.acos(Math.min(Math.max(p,-1),1)),m=Math.acos(Math.min(Math.max(g,-1),1)),b=s-(Math.sin(l-o)>0?v:2*d-v),M=(Math.sin(l-o)>0?2*d-m:m)-u;if(0==Math.sin(b)&&0==Math.sin(M))return null;if(Math.sin(b)*Math.sin(M)<0)return null;const w=-Math.cos(b)*Math.cos(M)+Math.sin(b)*Math.sin(M)*Math.cos(f),S=Math.atan2(Math.sin(f)*Math.sin(b)*Math.sin(M),Math.cos(M)+Math.cos(b)*w),x=Math.asin(Math.min(Math.max(Math.sin(a)*Math.cos(S)+Math.cos(a)*Math.sin(S)*Math.cos(s),-1),1)),N=o+Math.atan2(Math.sin(s)*Math.sin(S)*Math.cos(a),Math.cos(S)-Math.sin(a)*Math.sin(x)),P=x.toDegrees(),O=N.toDegrees();return new y(P,O)}crossTrackDistanceTo(t,e,n=6371e3){t instanceof y||(t=y.parse(t)),e instanceof y||(e=y.parse(e));const r=n;if(this.equals(t))return 0;const a=t.distanceTo(this,r)/r,o=t.initialBearingTo(this).toRadians(),i=t.initialBearingTo(e).toRadians();return Math.asin(Math.sin(a)*Math.sin(o-i))*r}alongTrackDistanceTo(t,e,n=6371e3){t instanceof y||(t=y.parse(t)),e instanceof y||(e=y.parse(e));const r=n;if(this.equals(t))return 0;const a=t.distanceTo(this,r)/r,o=t.initialBearingTo(this).toRadians(),i=t.initialBearingTo(e).toRadians(),l=Math.asin(Math.sin(a)*Math.sin(o-i));return Math.acos(Math.cos(a)/Math.abs(Math.cos(l)))*Math.sign(Math.cos(i-o))*r}maxLatitude(t){const e=Number(t).toRadians(),n=this.lat.toRadians();return Math.acos(Math.abs(Math.sin(e)*Math.cos(n))).toDegrees()}static crossingParallels(t,e,n){if(t.equals(e))return null;const r=Number(n).toRadians(),a=t.lat.toRadians(),o=t.lon.toRadians(),i=e.lat.toRadians(),l=e.lon.toRadians()-o,s=Math.sin(a)*Math.cos(i)*Math.cos(r)*Math.sin(l),u=Math.sin(a)*Math.cos(i)*Math.cos(r)*Math.cos(l)-Math.cos(a)*Math.sin(i)*Math.cos(r),c=Math.cos(a)*Math.cos(i)*Math.sin(r)*Math.sin(l);if(c*c>s*s+u*u)return null;const h=Math.atan2(-u,s),f=Math.acos(c/Math.sqrt(s*s+u*u)),d=o+h+f,y=(o+h-f).toDegrees(),g=d.toDegrees();return{lon1:p.wrap180(y),lon2:p.wrap180(g)}}rhumbDistanceTo(t,e=6371e3){t instanceof y||(t=y.parse(t));const n=e,r=this.lat.toRadians(),a=t.lat.toRadians(),o=a-r;let i=Math.abs(t.lon-this.lon).toRadians();Math.abs(i)>d&&(i=i>0?-(2*d-i):2*d+i);const l=Math.log(Math.tan(a/2+d/4)/Math.tan(r/2+d/4)),s=Math.abs(l)>1e-11?o/l:Math.cos(r);return Math.sqrt(o*o+s*s*i*i)*n}rhumbBearingTo(t){if(t instanceof y||(t=y.parse(t)),this.equals(t))return NaN;const e=this.lat.toRadians(),n=t.lat.toRadians();let r=(t.lon-this.lon).toRadians();Math.abs(r)>d&&(r=r>0?-(2*d-r):2*d+r);const a=Math.log(Math.tan(n/2+d/4)/Math.tan(e/2+d/4)),o=Math.atan2(r,a).toDegrees();return p.wrap360(o)}rhumbDestinationPoint(t,e,n=6371e3){const r=this.lat.toRadians(),a=this.lon.toRadians(),o=Number(e).toRadians(),i=t/n,l=i*Math.cos(o);let s=r+l;Math.abs(s)>d/2&&(s=s>0?d-s:-d-s);const u=Math.log(Math.tan(s/2+d/4)/Math.tan(r/2+d/4)),c=Math.abs(u)>1e-11?l/u:Math.cos(r),h=a+i*Math.sin(o)/c,f=s.toDegrees(),p=h.toDegrees();return new y(f,p)}rhumbMidpointTo(t){t instanceof y||(t=y.parse(t));const e=this.lat.toRadians();let n=this.lon.toRadians();const r=t.lat.toRadians(),a=t.lon.toRadians();Math.abs(a-n)>d&&(n+=2*d);const o=(e+r)/2,i=Math.tan(d/4+e/2),l=Math.tan(d/4+r/2),s=Math.tan(d/4+o/2);let u=((a-n)*Math.log(s)+n*Math.log(l)-a*Math.log(i))/Math.log(l/i);isFinite(u)||(u=(n+a)/2);const c=o.toDegrees(),h=u.toDegrees();return new y(c,h)}static areaOf(t,e=6371e3){const n=e,r=t[0].equals(t[t.length-1]);r||t.push(t[0]);const a=t.length-1;let o=0;for(let e=0;e<a;e++){const n=t[e].lat.toRadians(),r=t[e+1].lat.toRadians(),a=(t[e+1].lon-t[e].lon).toRadians();o+=2*Math.atan2(Math.tan(a/2)*(Math.tan(n/2)+Math.tan(r/2)),1+Math.tan(n/2)*Math.tan(r/2))}(function(t){let e=0,n=t[0].initialBearingTo(t[1]);for(let r=0;r<t.length-1;r++){const a=t[r].initialBearingTo(t[r+1]),o=t[r].finalBearingTo(t[r+1]);e+=(a-n+540)%360-180,e+=(o-a+540)%360-180,n=o}return e+=(t[0].initialBearingTo(t[1])-n+540)%360-180,Math.abs(e)<90})(t)&&(o=Math.abs(o)-2*d);const i=Math.abs(o*n*n);return r||t.pop(),i}equals(t){return t instanceof y||(t=y.parse(t)),!(Math.abs(this.lat-t.lat)>Number.EPSILON||Math.abs(this.lon-t.lon)>Number.EPSILON)}toGeoJSON(){return{type:"Point",coordinates:[this.lon,this.lat]}}toString(t="d",e=void 0){if(!["d","dm","dms","n"].includes(t))throw new RangeError(`invalid format ‘${t}’`);return"n"==t?(null==e&&(e=4),`${this.lat.toFixed(e)},${this.lon.toFixed(e)}`):`${p.toLat(this.lat,t,e)}, ${p.toLon(this.lon,t,e)}`}}function g(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,a,o,i,l=[],s=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(l.push(r.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return v(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var m=function(t,e){var n=g(t,2),r=n[0],a=n[1],o=g(e,2),i=o[0],l=o[1],s=new y(a,r),u=new y(l,i);return s.distanceTo(u)},b=function(t){var e=t/1609.344;if(e<.5)return"".concat(Math.round(t),"m");if(e<10){var n=Number.parseFloat(e.toFixed(1)),r=1===n?"mile":"miles";return"".concat(n," ").concat(r)}var a=Math.round(e);return"".concat(a," miles")};function M(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,a,o,i,l=[],s=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(l.push(r.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return w(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?w(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function S(t){return S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},S(t)}function x(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function N(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?x(Object(n),!0).forEach(function(e){P(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):x(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function P(t,e,n){return(e=function(t){var e=function(t){if("object"!=S(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=S(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==S(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function O(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var E="highlighted-label";function A(t,e){if("number"==typeof t)return t;if(!Array.isArray(t)||"interpolate"!==t[0])return function(t,e){var n=t.stops;if(n.length<2)return n.length>0?n[0][1]:0;for(var r=n[0],a=n[n.length-1],o=1;o<n.length;o++){var i=n[o];if(i[0]>e){a=i,r=n[o-1];break}r=n[o-1],a=i}var l=M(r,2),s=l[0],u=l[1],c=M(a,2),h=c[0],f=c[1];return e<=s?u:e>=h?f:u+(e-s)/(h-s)*(f-u)}(t,e);var n,r=function(t){if(Array.isArray(t))return t}(n=t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(n)||function(t,e){if(t){if("string"==typeof t)return O(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?O(t,e):void 0}}(n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),a=r[2],o=O(r).slice(3);if("zoom"!==a[0])throw new Error("Only zoom-based expressions supported");for(var i=0;i<o.length-2;i+=2){var l=o[i],s=o[i+1],u=o[i+2],c=o[i+3];if(e<=l)return s;if(e<=u)return s+(e-l)/(u-l)*(c-s)}return o[o.length-1]}function j(t,e){if(e.highlightLayerId&&t.getLayer(e.highlightLayerId)){try{t.removeLayer(e.highlightLayerId)}catch(t){}e.highlightLayerId=null,e.highlightedExpr=null}}function T(t,e,n){var r,a,o,i;if(null!=e&&null!==(r=e.feature)&&void 0!==r&&r.layer){j(t,n);var l=e.feature,s=e.layer;n.highlightLayerId="highlight-".concat(s.id);var u=l.id,c=l.type,h=l.properties,f=l.geometry;t.getSource(E).setData({id:u,type:c,properties:h,geometry:f}),n.highlightedExpr=s.layout["text-size"];var p=t.getZoom(),d=(a=s,o=1.5*A(n.highlightedExpr,p),i=n.isDarkStyle?{text:"#ffffff",halo:"#000000"}:{text:"#000000",halo:"#ffffff"},{id:"highlight-".concat(a.id),type:a.type,source:E,layout:N(N({},a.layout),{},{"text-size":o,"text-allow-overlap":!0,"text-ignore-placement":!0,"text-max-angle":90}),paint:N(N({},a.paint),{},{"text-color":i.text,"text-halo-color":i.halo,"text-halo-width":3,"text-halo-blur":1,"text-opacity":1})});t.addLayer(d),t.moveLayer(n.highlightLayerId)}}function R(t){t.getSource(E)||t.addSource(E,{type:"geojson",data:{type:"FeatureCollection",features:[]}})}function L(t){t.getStyle().layers.filter(function(t){var e;return"line"===(null===(e=t.layout)||void 0===e?void 0:e["symbol-placement"])}).forEach(function(e){return t.setLayoutProperty(e.id,"symbol-placement","line-center")})}function k(t,e,n,r){var a={isDarkStyle:"dark"===e,labels:[],currentPixel:null,highlightLayerId:null,highlightedExpr:null};function o(){var e=t.getStyle().layers.filter(function(t){return"symbol"===t.type}),n=t.queryRenderedFeatures({layers:e.map(function(t){return t.id})});a.labels=function(t,e,n){return e.flatMap(function(e){var r,a,o,i,l="string"==typeof(a=null===(r=e.layout)||void 0===r?void 0:r["text-field"])?null===(o=/^{(.+)}$/.exec(a))||void 0===o?void 0:o[1]:Array.isArray(a)?null===(i=a.find(function(t){return Array.isArray(t)&&"get"===t[0]}))||void 0===i?void 0:i[1]:null;return l?n.filter(function(t){var n;return t.layer.id===e.id&&(null===(n=t.properties)||void 0===n?void 0:n[l])}).map(function(n){return function(t,e,n,r){var a=function(t){var e=t.type,n=t.coordinates;if("Point"===e)return n;if("MultiPoint"===e)return n[0];if(e.includes("LineString")){var r="LineString"===e?n:n[0];return[(r[0][0]+r[r.length-1][0])/2,(r[0][1]+r[r.length-1][1])/2]}if(e.includes("Polygon")){var a="Polygon"===e?n[0]:n[0][0],o=a.reduce(function(t,e){return[t[0]+e[0],t[1]+e[1]]},[0,0]);return[o[0]/a.length,o[1]/a.length]}return null}(t.geometry);if(!a)return null;var o=r.project({lng:a[0],lat:a[1]});return{text:t.properties[n],x:o.x,y:o.y,feature:t,layer:e}}(n,e,l,t)}).filter(Boolean):[]})}(t,e,n)}function i(){if(o(),!a.labels.length)return null;var e=t.project(t.getCenter()),n=function(t,e){var n;return null===(n=t.reduce(function(t,n){var r=Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2);return!t||r<t.dist?{label:n,dist:r}:t},null))||void 0===n?void 0:n.label}(a.labels,e);return a.currentPixel={x:n.x,y:n.y},T(t,n,a),"".concat(n.text," (").concat(n.layer.id,")")}return L(t),R(t),null==r||r.on(n.MAP_SET_STYLE,function(e){t.once("styledata",function(){return t.once("idle",function(){L(t),R(t),a.isDarkStyle="dark"===(null==e?void 0:e.mapColorScheme)})})}),t.on("zoom",function(){if(a.highlightLayerId&&a.highlightedExpr){var e=A(a.highlightedExpr,t.getZoom());t.setLayoutProperty(a.highlightLayerId,"text-size",1.5*e)}}),function(t){t.getStyle().layers.filter(function(t){return"symbol"===t.type}).forEach(function(e){t.setPaintProperty(e.id,"text-opacity",["case",["boolean",["feature-state","highlighted"],!1],0,1])})}(t),{refreshLabels:o,highlightNextLabel:function(e){if(o(),!a.labels.length)return null;if(!a.currentPixel)return i();var n=function(t,e){if(!e.currentPixel)return null;var n=e.labels.map(function(t,e){return{pixel:[t.x,t.y],index:e}}).filter(function(t){return t.pixel[0]!==e.currentPixel.x||t.pixel[1]!==e.currentPixel.y});if(!n.length)return null;var r=n.map(function(t){return t.pixel}),a=function(t,e,n){var r=g(e,2),a=r[0],o=r[1],i=n.filter(function(e){var n=g(e,2),r=n[0],i=n[1];return(r!==a||i!==o)&&function(t,e,n){switch(t){case"ArrowUp":return n<0&&Math.abs(n)>=Math.abs(e);case"ArrowDown":return n>0&&Math.abs(n)>=Math.abs(e);case"ArrowLeft":return e<0&&Math.abs(e)>Math.abs(n);case"ArrowRight":return e>0&&Math.abs(e)>Math.abs(n);default:return!1}}(t,r-a,i-o)});if(!i.length)return n.findIndex(function(t){return t[0]===a&&t[1]===o});var l=-1,s=1/0;return i.forEach(function(t){var e=t[0]-a,r=t[1]-o,i=e*e+r*r;i<s&&(s=i,l=n.indexOf(t))}),l}(t,[e.currentPixel.x,e.currentPixel.y],r);return(null==a||a<0||a>=n.length)&&(a=0),e.labels[n[a].index]}(e,a);return n?(a.currentPixel={x:n.x,y:n.y},T(t,n,a),"".concat(n.text," (").concat(n.layer.id,")")):null},highlightLabelAtCenter:i,clearHighlightedLabel:function(){return j(t,a)}}}function D(t){return D="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},D(t)}function I(t){return function(t){if(Array.isArray(t))return B(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||_(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(t,e){if(t){if("string"==typeof t)return B(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?B(t,e):void 0}}function B(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function C(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function F(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?C(Object(n),!0).forEach(function(e){$(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):C(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function $(t,e,n){return(e=function(t){var e=function(t){if("object"!=D(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=D(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==D(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var z=function(t,e,n,r,a,o,i){t.getLayer(e)||t.addLayer(F(F({id:e,type:n,source:r},a&&{"source-layer":a}),{},{paint:o})),Object.entries(o).forEach(function(n){var r,a,o=(a=2,function(t){if(Array.isArray(t))return t}(r=n)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,a,o,i,l=[],s=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(l.push(r.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(r,a)||_(r,a)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=o[0],l=o[1];t.setPaintProperty(e,i,l)}),t.setFilter(e,i)};function q(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,a,o,i,l=[],s=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(l.push(r.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Z(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Z(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Z(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var W=function(t,e,n){var r=Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2);if(0===r)return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2);var a=((t.x-e.x)*(n.x-e.x)+(t.y-e.y)*(n.y-e.y))/r;return a=Math.max(0,Math.min(1,a)),Math.pow(t.x-(e.x+a*(n.x-e.x)),2)+Math.pow(t.y-(e.y+a*(n.y-e.y)),2)},G=["container","padding","mapStyle","center","zoom","bounds","pixelRatio"];function H(t){return H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},H(t)}function U(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var s=r&&r.prototype instanceof l?r:l,u=Object.create(s.prototype);return V(u,"_invoke",function(n,r,a){var o,l,s,u=0,c=a||[],h=!1,f={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,n){return o=e,l=0,s=t,f.n=n,i}};function p(n,r){for(l=n,s=r,e=0;!h&&u&&!a&&e<c.length;e++){var a,o=c[e],p=f.p,d=o[2];n>3?(a=d===r)&&(s=o[(l=o[4])?5:(l=3,3)],o[4]=o[5]=t):o[0]<=p&&((a=n<2&&p<o[1])?(l=0,f.v=r,f.n=o[1]):p<d&&(a=n<3||o[0]>r||r>d)&&(o[4]=n,o[5]=r,f.n=d,l=0))}if(a||n>1)return i;throw h=!0,r}return function(a,c,d){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&p(c,d),l=c,s=d;(e=l<2?t:s)||!h;){o||(l?l<3?(l>1&&(f.n=-1),p(l,s)):f.n=s:f.v=s);try{if(u=2,o){if(l||(a="next"),e=o[a]){if(!(e=e.call(o,s)))throw TypeError("iterator result is not an object");if(!e.done)return e;s=e.value,l<2&&(l=0)}else 1===l&&(e=o.return)&&e.call(o),l<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),l=1);o=t}else if((e=(h=f.n<0)?s:n.call(r,f))!==i)break}catch(e){o=t,l=1,s=e}finally{u=1}}return{value:e,done:h}}}(n,a,o),!0),u}var i={};function l(){}function s(){}function u(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):(V(e={},r,function(){return this}),e),h=u.prototype=l.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,V(t,a,"GeneratorFunction")),t.prototype=Object.create(h),t}return s.prototype=u,V(h,"constructor",u),V(u,"constructor",s),s.displayName="GeneratorFunction",V(u,a,"GeneratorFunction"),V(h),V(h,a,"Generator"),V(h,r,function(){return this}),V(h,"toString",function(){return"[object Generator]"}),(U=function(){return{w:o,m:f}})()}function V(t,e,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(t){a=0}V=function(t,e,n,r){function o(e,n){V(t,e,function(t){return this._invoke(e,n,t)})}e?a?a(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},V(t,e,n,r)}function Y(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function J(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Y(Object(n),!0).forEach(function(e){K(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Y(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function K(t,e,n){return(e=et(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function X(t,e){if(null==t)return{};var n,r,a=function(t,e){if(null==t)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;n[r]=t[r]}return n}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],-1===e.indexOf(n)&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function Q(t,e,n,r,a,o,i){try{var l=t[o](i),s=l.value}catch(t){return void n(t)}l.done?e(s):Promise.resolve(s).then(r,a)}function tt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,et(r.key),r)}}function et(t){var e=function(t){if("object"!=H(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=H(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==H(e)?e:e+""}var nt=function(){return t=function t(e){var n=e.mapFramework,r=e.mapProviderConfig,o=void 0===r?{}:r,i=e.events,l=e.eventBus;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.maplibreModule=n,this.events=i,this.eventBus=l,this.capabilities={supportedShortcuts:a,supportsMapSizes:!0},Object.assign(this,o)},e=[{key:"initMap",value:(n=U().m(function t(e){var n,r,a,l,s,h,f,p,d,y,g,v,m=this;return U().w(function(t){for(;;)switch(t.n){case 0:n=e.container,r=e.padding,a=e.mapStyle,l=e.center,s=e.zoom,h=e.bounds,f=e.pixelRatio,p=X(e,G),d=this.maplibreModule.Map,y=this.events,g=this.eventBus,(v=new d(J(J({},p),{},{container:n,style:null==a?void 0:a.url,pixelRatio:f,padding:r,center:l,zoom:s,fadeDuration:0,attributionControl:!1,dragRotate:!1,doubleClickZoom:!1}))).touchZoomRotate.disableRotation(),this.map=v,this.map.setPadding(r),h&&v.fitBounds(h,{duration:0}),i(v),o(v),u({map:v,events:y,eventBus:g,getCenter:this.getCenter.bind(this),getZoom:this.getZoom.bind(this),getBounds:this.getBounds.bind(this),getResolution:this.getResolution.bind(this)}),c({map:v,events:y,eventBus:g}),v.on("load",function(){m.labelNavigator=k(v,null==a?void 0:a.mapColorScheme,y,g)}),this.eventBus.emit(y.MAP_READY,this.getMapAPI());case 1:return t.a(2)}},t,this)}),l=function(){var t=this,e=arguments;return new Promise(function(r,a){var o=n.apply(t,e);function i(t){Q(o,r,a,i,l,"next",t)}function l(t){Q(o,r,a,i,l,"throw",t)}i(void 0)})},function(t){return l.apply(this,arguments)})},{key:"getMapAPI",value:function(){return{map:this.map,crs:this.crs,fitToBounds:this.fitToBounds.bind(this),setView:this.setView.bind(this)}}},{key:"destroyMap",value:function(){var t,e;null===(t=this.mapEvents)||void 0===t||t.remove(),null===(e=this.appEvents)||void 0===e||e.remove(),this.mapEvents=null,this.appEvents=null,this.map.remove()}},{key:"setView",value:function(t){var e=t.center,n=t.zoom;this.map.flyTo({center:e||this.getCenter(),zoom:n||this.getZoom(),duration:r})}},{key:"zoomIn",value:function(t){this.map.easeTo({zoom:this.getZoom()+t,duration:r})}},{key:"zoomOut",value:function(t){this.map.easeTo({zoom:this.getZoom()-t,duration:r})}},{key:"panBy",value:function(t){this.map.panBy(t,{duration:r})}},{key:"fitToBounds",value:function(t){this.map.fitBounds(t,{duration:r})}},{key:"setPadding",value:function(t){this.map.setPadding(t)}},{key:"updateHighlightedFeatures",value:function(t,e){return function(t){var e=t.LngLatBounds,n=t.map,r=t.selectedFeatures,a=t.stylesMap;if(!n)return null;var o=function(t,e){var n={};return null==e||e.forEach(function(e){var r=e.featureId,a=e.layerId,o=e.idProperty,i=e.geometry,l=t.getLayer(a);if(l){var s=l.source;n[s]||(n[s]={ids:new Set,fillIds:new Set,idProperty:o,layerId:a,hasFillGeometry:!1}),!i||"Polygon"!==i.type&&"MultiPolygon"!==i.type||(n[s].hasFillGeometry=!0,n[s].fillIds.add(r)),n[s].ids.add(r)}}),n}(n,r),i=[],l=new Set(Object.keys(o)),s=n._highlightedSources||new Set;return function(t,e,n){e.forEach(function(e){if(!n.has(e)){var r="highlight-".concat(e);["".concat(r,"-fill"),"".concat(r,"-line")].forEach(function(e){t.getLayer(e)&&t.setFilter(e,["==","id",""])})}})}(n,s,l),n._highlightedSources=l,l.forEach(function(t){var e=o[t],r=e.ids,l=e.fillIds,s=e.idProperty,u=e.layerId,c=e.hasFillGeometry,h=n.getLayer(u),f=h.sourceLayer,p=c?"fill":h.type,d="highlight-".concat(t),y=a[u],g=y.stroke,v=y.strokeWidth,m=y.fill,b=s?["get",s]:["id"],M=["in",b,["literal",I(r)]],w=["in",b,["literal",I(l)]],S={"line-color":g,"line-width":v};"fill"===p&&(z(n,"".concat(d,"-fill"),"fill",t,f,{"fill-color":m},w),z(n,"".concat(d,"-line"),"line",t,f,S,M)),"line"===p&&(n.getLayer("".concat(d,"-fill"))&&n.setFilter("".concat(d,"-fill"),["==","id",""]),z(n,"".concat(d,"-line"),"line",t,f,S,M)),i.push.apply(i,I(n.queryRenderedFeatures({layers:[u]}).filter(function(t){var e;return r.has(s?null===(e=t.properties)||void 0===e?void 0:e[s]:t.id)})))}),function(t,e){if(!e.length)return null;var n=new t;return e.forEach(function(t){var e=function(t){return"number"==typeof t[0]?n.extend(t):t.forEach(e)};e(t.geometry.coordinates)}),[n.getWest(),n.getSouth(),n.getEast(),n.getNorth()]}(e,i)}({LngLatBounds:this.maplibreModule.LngLatBounds,map:this.map,selectedFeatures:t,stylesMap:e})}},{key:"highlightNextLabel",value:function(t){var e;return(null===(e=this.labelNavigator)||void 0===e?void 0:e.highlightNextLabel(t))||null}},{key:"highlightLabelAtCenter",value:function(){var t;return(null===(t=this.labelNavigator)||void 0===t?void 0:t.highlightLabelAtCenter())||null}},{key:"clearHighlightedLabel",value:function(){var t;return(null===(t=this.labelNavigator)||void 0===t?void 0:t.clearHighlightedLabel())||null}},{key:"getCenter",value:function(){var t=this.map.getCenter();return[Number(t.lng.toFixed(7)),Number(t.lat.toFixed(7))]}},{key:"getZoom",value:function(){return Number(this.map.getZoom().toFixed(7))}},{key:"getBounds",value:function(){return this.map.getBounds().toArray().flat(1)}},{key:"getFeaturesAtPoint",value:function(t,e){return function(t,e){var n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).radius,r=void 0===n?10:n,a=[[e.x-r,e.y-r],[e.x+r,e.y+r]],o=t.queryRenderedFeatures(a);if(0===o.length)return[];var i=[];o.forEach(function(t){!1===i.includes(t.layer.id)&&i.push(t.layer.id)});for(var l=new Set,s=[],u=o.length-1;u>=0;u--){var c=o[u],h=void 0===c.id?JSON.stringify(c.properties):c.id;!1===l.has(h)&&(l.add(h),s.push(c))}var f=t.unproject(e),p=[f.lng,f.lat];return s.map(function(n){var r=0,a=n.geometry.type,o=function(t,e,n){var r=n.coordinates,a=n.type,o=1/0,i=function(e){return t.project(e)},l=function(t){for(var n=0;n<t.length-1;n++){var r=W(e,i(t[n]),i(t[n+1]));r<o&&(o=r)}};if("Point"===a){var s=i(r);o=Math.pow(e.x-s.x,2)+Math.pow(e.y-s.y,2)}else"LineString"===a||"MultiPoint"===a?"LineString"===a?l(r):r.forEach(function(t){var n=i(t),r=Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2);r<o&&(o=r)}):"Polygon"===a||"MultiLineString"===a?r.forEach(l):"MultiPolygon"===a&&r.forEach(function(t){return t.forEach(l)});return o}(t,e,n.geometry);if(r+=1e6*i.indexOf(n.layer.id),a.includes("Polygon")){var l=("Polygon"===a?[n.geometry.coordinates]:n.geometry.coordinates).some(function(t){return function(t,e){for(var n=q(t,2),r=n[0],a=n[1],o=!1,i=0,l=e.length-1;i<e.length;l=i,i++){var s=q(e[i],2),u=s[0],c=s[1],h=q(e[l],2),f=h[0],p=h[1];c>a!=p>a&&r<(f-u)*(a-c)/(p-c)+u&&(o=!o)}return o}(p,t[0])});!0===l?r-=5e5:r+=1e5}return{f:n,score:r+=o}}).sort(function(t,e){return t.score-e.score}).map(function(t){return t.f})}(this.map,t,e)}},{key:"getAreaDimensions",value:function(){return function(t){var e,n,r,a;if(t&&"function"==typeof t.getWest)e=t.getWest(),n=t.getSouth(),r=t.getEast(),a=t.getNorth();else{if(!Array.isArray(t)||2!==t.length)return"";var o=g(t,2),i=g(o[0],2);e=i[0],n=i[1];var l=g(o[1],2);r=l[0],a=l[1]}var s=m([e,n],[r,n]),u=m([e,n],[e,a]),c=b(s),h=b(u);return"".concat(h," by ").concat(c)}((t=this.maplibreModule.LngLatBounds,e=this.map,n=e.getContainer().getBoundingClientRect(),r=n.width,a=n.height,o=e.getPadding(),i=[o.left,a-o.bottom],l=[r-o.right,o.top],new t(e.unproject(i),e.unproject(l))));var t,e,n,r,a,o,i,l}},{key:"getCardinalMove",value:function(t,e){return function(t,e){var n=g(t,2),r=n[0],a=n[1],o=g(e,2),i=o[0],l=o[1],s=l-a,u=i-r,c=[];if(Math.abs(s)>1e-4){var h=Math.round(m([r,a],[r,l]));c.push("".concat(s>0?"north":"south"," ").concat(b(h)))}if(Math.abs(u)>1e-4){var f=Math.round(m([r,a],[i,a]));c.push("".concat(u>0?"east":"west"," ").concat(b(f)))}return c.join(", ")}(t,e)}},{key:"getResolution",value:function(){return t=this.map.getCenter(),e=this.map.getZoom(),n=t.lat,r=Math.pow(2,e),40075016.686*Math.cos(n*Math.PI/180)/(512*r);var t,e,n,r}},{key:"mapToScreen",value:function(t){return this.map.project(t)}},{key:"screenToMap",value:function(t){var e=this.map.unproject([t.x,t.y]);return[e.lng,e.lat]}}],e&&tt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,l}()}}]);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { attachAppEvents } from './appEvents.js'
|
|
2
|
+
|
|
3
|
+
describe('attachAppEvents', () => {
|
|
4
|
+
let map, eventBus, events
|
|
5
|
+
|
|
6
|
+
beforeEach(() => {
|
|
7
|
+
map = {
|
|
8
|
+
setStyle: jest.fn(),
|
|
9
|
+
setPixelRatio: jest.fn()
|
|
10
|
+
}
|
|
11
|
+
eventBus = {
|
|
12
|
+
on: jest.fn(),
|
|
13
|
+
off: jest.fn()
|
|
14
|
+
}
|
|
15
|
+
events = {
|
|
16
|
+
MAP_SET_STYLE: 'map:set-style',
|
|
17
|
+
MAP_SET_PIXEL_RATIO: 'map:set-pixel-ratio'
|
|
18
|
+
}
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
it('attaches handlers and triggers correct map methods', () => {
|
|
22
|
+
const controller = attachAppEvents({ map, events, eventBus })
|
|
23
|
+
|
|
24
|
+
// Verify eventBus.on was called with correct handlers
|
|
25
|
+
expect(eventBus.on).toHaveBeenCalledWith(events.MAP_SET_STYLE, expect.any(Function))
|
|
26
|
+
expect(eventBus.on).toHaveBeenCalledWith(events.MAP_SET_PIXEL_RATIO, expect.any(Function))
|
|
27
|
+
|
|
28
|
+
// Extract the attached handlers
|
|
29
|
+
const styleHandler = eventBus.on.mock.calls.find(c => c[0] === events.MAP_SET_STYLE)[1]
|
|
30
|
+
const pixelHandler = eventBus.on.mock.calls.find(c => c[0] === events.MAP_SET_PIXEL_RATIO)[1]
|
|
31
|
+
|
|
32
|
+
// Call handlers to verify map methods
|
|
33
|
+
styleHandler({ url: 'style.json' })
|
|
34
|
+
pixelHandler(2)
|
|
35
|
+
|
|
36
|
+
expect(map.setStyle).toHaveBeenCalledWith('style.json', { diff: false })
|
|
37
|
+
expect(map.setPixelRatio).toHaveBeenCalledWith(2)
|
|
38
|
+
|
|
39
|
+
// Verify remove detaches handlers
|
|
40
|
+
controller.remove()
|
|
41
|
+
expect(eventBus.off).toHaveBeenCalledWith(events.MAP_SET_STYLE, styleHandler)
|
|
42
|
+
expect(eventBus.off).toHaveBeenCalledWith(events.MAP_SET_PIXEL_RATIO, pixelHandler)
|
|
43
|
+
})
|
|
44
|
+
})
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import createMapLibreProvider from './index.js'
|
|
2
|
+
import { getWebGL } from './utils/detectWebgl.js'
|
|
3
|
+
|
|
4
|
+
jest.mock('./utils/detectWebgl.js', () => ({ getWebGL: jest.fn() }))
|
|
5
|
+
jest.mock('maplibre-gl', () => ({ VERSION: '3.x' }))
|
|
6
|
+
jest.mock('./maplibreProvider.js', () => ({ default: class MockProvider {} }))
|
|
7
|
+
|
|
8
|
+
describe('createMapLibreProvider', () => {
|
|
9
|
+
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
getWebGL.mockReturnValue({ isEnabled: true, error: null })
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
test('checkDeviceCapabilities: WebGL enabled, no IE → isSupported true, no error', () => {
|
|
15
|
+
const result = createMapLibreProvider().checkDeviceCapabilities()
|
|
16
|
+
expect(result.isSupported).toBe(true)
|
|
17
|
+
expect(result.error).toBeFalsy()
|
|
18
|
+
expect(getWebGL).toHaveBeenCalledWith(['webgl2', 'webgl1'])
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
test('checkDeviceCapabilities: WebGL disabled → isSupported false, returns webGL error', () => {
|
|
22
|
+
getWebGL.mockReturnValue({ isEnabled: false, error: 'WebGL not supported' })
|
|
23
|
+
const result = createMapLibreProvider().checkDeviceCapabilities()
|
|
24
|
+
expect(result.isSupported).toBe(false)
|
|
25
|
+
expect(result.error).toBe('WebGL not supported')
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
test('checkDeviceCapabilities: IE detected → error is IE message', () => {
|
|
29
|
+
Object.defineProperty(document, 'documentMode', { get: () => 11, configurable: true })
|
|
30
|
+
try {
|
|
31
|
+
const result = createMapLibreProvider().checkDeviceCapabilities()
|
|
32
|
+
expect(result.error).toBe('Internet Explorer is not supported')
|
|
33
|
+
} finally {
|
|
34
|
+
Object.defineProperty(document, 'documentMode', { get: () => undefined, configurable: true })
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
test('supportsModernMaplibre returns false when Function constructor throws → isSupported false', () => {
|
|
39
|
+
const RealFunction = global.Function
|
|
40
|
+
global.Function = function () { throw new SyntaxError('unsupported') }
|
|
41
|
+
try {
|
|
42
|
+
const result = createMapLibreProvider().checkDeviceCapabilities()
|
|
43
|
+
expect(result.isSupported).toBe(false)
|
|
44
|
+
} finally {
|
|
45
|
+
global.Function = RealFunction
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
test('load returns MapProvider, mapFramework, and mapProviderConfig with config spread', async () => {
|
|
50
|
+
const result = await createMapLibreProvider({ tileSize: 512 }).load()
|
|
51
|
+
expect(result.MapProvider).toBeDefined()
|
|
52
|
+
expect(result.mapFramework).toBeDefined()
|
|
53
|
+
expect(result.mapProviderConfig).toEqual({ tileSize: 512, crs: 'EPSG:4326' })
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
test('load uses empty default config', async () => {
|
|
57
|
+
const { mapProviderConfig } = await createMapLibreProvider().load()
|
|
58
|
+
expect(mapProviderConfig).toEqual({ crs: 'EPSG:4326' })
|
|
59
|
+
})
|
|
60
|
+
})
|