@defra/interactive-map 0.0.8-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.
Files changed (75) hide show
  1. package/dist/esm/im-core.js +1 -0
  2. package/dist/esm/im-shell.js +1 -0
  3. package/dist/esm/index.js +1 -2
  4. package/dist/umd/im-core.js +1 -1
  5. package/dist/umd/index.js +1 -1
  6. package/docs/api/button-definition.md +104 -3
  7. package/docs/api.md +21 -1
  8. package/docs/getting-started.md +78 -8
  9. package/package.json +31 -24
  10. package/plugins/beta/datasets/dist/css/index.css +50 -1
  11. package/plugins/beta/datasets/dist/esm/im-datasets-plugin.js +1 -0
  12. package/plugins/beta/datasets/dist/esm/index.js +1 -2
  13. package/plugins/beta/draw-es/dist/esm/im-draw-es-plugin.js +1 -0
  14. package/plugins/beta/draw-es/dist/esm/index.js +1 -2
  15. package/plugins/beta/draw-ml/dist/esm/im-draw-ml-plugin.js +1 -0
  16. package/plugins/beta/draw-ml/dist/esm/index.js +1 -2
  17. package/plugins/beta/frame/dist/css/index.css +11 -1
  18. package/plugins/beta/frame/dist/esm/im-frame-plugin.js +1 -0
  19. package/plugins/beta/frame/dist/esm/index.js +1 -2
  20. package/plugins/beta/map-styles/dist/css/index.css +79 -1
  21. package/plugins/beta/map-styles/dist/esm/im-map-styles-plugin.js +1 -0
  22. package/plugins/beta/map-styles/dist/esm/index.js +1 -2
  23. package/plugins/beta/scale-bar/dist/esm/im-scale-bar-plugin.js +1 -0
  24. package/plugins/beta/scale-bar/dist/esm/index.js +1 -2
  25. package/plugins/beta/use-location/dist/esm/im-use-location-plugin.js +1 -0
  26. package/plugins/beta/use-location/dist/esm/index.js +1 -2
  27. package/plugins/beta/use-location/dist/umd/index.js +1 -1
  28. package/plugins/interact/dist/esm/im-interact-plugin.js +1 -0
  29. package/plugins/interact/dist/esm/index.js +1 -2
  30. package/plugins/search/dist/esm/im-search-plugin.js +1 -0
  31. package/plugins/search/dist/esm/index.js +1 -2
  32. package/plugins/search/src/components/Suggestions/Suggestions.module.scss +1 -1
  33. package/plugins/search/src/search.scss +1 -1
  34. package/providers/beta/esri/dist/css/index.css +30 -1
  35. package/providers/beta/esri/dist/esm/im-esri-provider.js +1 -0
  36. package/providers/beta/esri/dist/esm/index.js +1 -2
  37. package/providers/beta/open-names/dist/esm/im-reverse-geocode.js +1 -0
  38. package/providers/beta/open-names/dist/esm/index.js +1 -2
  39. package/providers/beta/open-names/src/utils/mapToLocationModel.test.js +61 -0
  40. package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -0
  41. package/providers/maplibre/dist/esm/index.js +1 -2
  42. package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
  43. package/providers/maplibre/src/appEvents.test.js +44 -0
  44. package/providers/maplibre/src/index.test.js +60 -0
  45. package/providers/maplibre/src/mapEvents.test.js +115 -0
  46. package/providers/maplibre/src/maplibreProvider.test.js +205 -0
  47. package/providers/maplibre/src/utils/calculateLinearTextSize.test.js +31 -0
  48. package/providers/maplibre/src/utils/detectWebgl.test.js +63 -0
  49. package/providers/maplibre/src/utils/highlightFeatures.test.js +126 -0
  50. package/providers/maplibre/src/utils/labels.js +1 -3
  51. package/providers/maplibre/src/utils/labels.test.js +231 -0
  52. package/providers/maplibre/src/utils/maplibreFixes.test.js +66 -0
  53. package/providers/maplibre/src/utils/queryFeatures.test.js +60 -0
  54. package/providers/maplibre/src/utils/spatial.js +5 -4
  55. package/providers/maplibre/src/utils/spatial.test.js +96 -0
  56. package/rollup.esm.mjs +288 -0
  57. package/src/App/store/appActionsMap.js +1 -1
  58. package/src/InteractiveMap/InteractiveMap.js +3 -2
  59. package/webpack.dev.mjs +9 -1
  60. package/webpack.prod.mjs +8 -1
  61. package/webpack.umd.mjs +1 -2
  62. package/dist/esm/index.js.LICENSE.txt +0 -1
  63. package/plugins/beta/datasets/dist/esm/index.js.LICENSE.txt +0 -1
  64. package/plugins/beta/draw-es/dist/esm/index.js.LICENSE.txt +0 -1
  65. package/plugins/beta/draw-ml/dist/esm/index.js.LICENSE.txt +0 -1
  66. package/plugins/beta/frame/dist/esm/index.js.LICENSE.txt +0 -1
  67. package/plugins/beta/map-styles/dist/esm/index.js.LICENSE.txt +0 -1
  68. package/plugins/beta/scale-bar/dist/esm/index.js.LICENSE.txt +0 -1
  69. package/plugins/beta/use-location/dist/esm/index.js.LICENSE.txt +0 -1
  70. package/plugins/interact/dist/esm/index.js.LICENSE.txt +0 -1
  71. package/plugins/search/dist/esm/index.js.LICENSE.txt +0 -1
  72. package/providers/beta/esri/dist/esm/index.js.LICENSE.txt +0 -1
  73. package/providers/beta/open-names/dist/esm/index.js.LICENSE.txt +0 -1
  74. package/providers/maplibre/dist/esm/index.js.LICENSE.txt +0 -6
  75. package/webpack.esm.mjs +0 -154
@@ -1,2 +1 @@
1
- /*! For license information please see index.js.LICENSE.txt */
2
- import{useEffect as t,useRef as e}from"react";import{jsx as r,jsxs as n}from"react/jsx-runtime";var o={"./plugins/search/src/manifest.js"(o,i,a){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 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 u(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){l(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 l(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}a.d(i,{manifest:()=>Ot}),a.r(i);var f={TOGGLE_EXPANDED:function(t,e){return u(u({},t),{},{isExpanded:e,areSuggestionsVisible:e})},SET_KEYBOARD_FOCUS_WITHIN:function(t,e){return u(u({},t),{},{hasKeyboardFocusWithin:e,areSuggestionsVisible:!0})},INPUT_BLUR:function(t,e){return u(u({},t),{},{hasKeyboardFocusWithin:!1,areSuggestionsVisible:t.areSuggestionsVisible&&"keyboard"!==e,selectedIndex:-1})},SET_VALUE:function(t,e){return u(u({},t),{},{value:e})},UPDATE_SUGGESTIONS:function(t,e){return u(u({},t),{},{suggestions:e})},SHOW_SUGGESTIONS:function(t){return u(u({},t),{},{areSuggestionsVisible:!0})},HIDE_SUGGESTIONS:function(t){return u(u({},t),{},{areSuggestionsVisible:!1})},SET_SELECTED:function(t,e){return u(u({},t),{},{selectedIndex:e,areSuggestionsVisible:e>=0})}},p=function(t){var e=t.id,n=t.isExpanded,o=t.onClick,i=t.buttonRef,a=t.searchIcon;return r("button",{"aria-label":"Open search",className:"im-c-map-button",onClick:o,"aria-controls":"".concat(e,"-search-form"),ref:i,style:n?{display:"none"}:void 0,children:a&&r("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",dangerouslySetInnerHTML:{__html:a}})})},d=function(t){var e=t.id,n=t.pluginState,o=t.handleSuggestionClick;return r("ul",{id:"".concat(e,"-search-suggestions"),role:"listbox","aria-labelledby":"".concat(e,"-search"),className:"im-c-search-suggestions",style:n.areSuggestionsVisible&&n.suggestions.length?void 0:{display:"none"},children:n.suggestions.map(function(t,i){return r("li",{id:"".concat(e,"-search-suggestion-").concat(i),className:"im-c-search-suggestions__item",role:"option","aria-selected":n.selectedIndex===i,"aria-setsize":n.suggestions.length,"aria-posinset":i+1,onClick:function(){return o(t)},children:r("span",{className:"im-c-search-suggestions__label",dangerouslySetInnerHTML:{__html:t.marked}})},t.id)})})};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 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 m(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){b(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 b(t,e,r){return(e=function(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+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var g=function(t){var e=t.id,o=t.pluginState,i=t.pluginConfig,a=t.appState,s=t.inputRef,c=t.events,u=t.children,l=["im-c-search-form",i.isExpanded&&"im-c-search-form--default-expanded","im-c-panel"].filter(Boolean).join(" ");return n("form",{id:"".concat(e,"-search-form"),role:"search",className:l,style:m({display:i.isExpanded||o.isExpanded?"flex":void 0},"mobile"!==a.breakpoint&&(null==i?void 0:i.width)&&{width:i.width}),"aria-controls":"".concat(e,"-viewport"),onSubmit:function(t){return c.handleSubmit(t,a,o)},children:[r("button",{type:"submit",style:{display:"none"},"aria-hidden":"true",tabIndex:-1,children:"Submit"}),n("div",{className:"im-c-search__input-container".concat(o.hasKeyboardFocusWithin?" im-c-search__input-container--keyboard-focus-within":""),children:[r("label",{htmlFor:"".concat(e,"-search"),className:"im-u-visually-hidden",children:"Search"}),r("input",{id:"".concat(e,"-search"),className:"im-c-search__input",type:"search",role:"combobox","aria-expanded":o.suggestionsVisible,"aria-controls":"".concat(e,"-search-suggestions"),"aria-activedescendant":o.selectedIndex>=0?"".concat(e,"-search-suggestion-").concat(o.selectedIndex):void 0,"aria-describedby":o.value?void 0:"".concat(e,"-search-hint"),"aria-autocomplete":"list",autoComplete:"off",placeholder:"Search",name:"".concat(e,"-search"),spellCheck:!1,enterKeyHint:"search",value:o.value,onClick:c.handleInputClick,onChange:c.handleInputChange,onFocus:function(){return c.handleInputFocus(a.interfaceType)},onBlur:function(){return c.handleInputBlur(a.interfaceType)},onKeyDown:function(t){return c.handleInputKeyDown(t,o)},ref:s}),r("span",{id:"".concat(e,"-search-hint"),className:"im-c-search__hint",children:"When search results are available use up and down arrows to review and enter to select. Touch device users, explore by touch or with swipe gestures."}),u]}),r(d,{id:e,appState:a,pluginState:o,handleSuggestionClick:function(t){return c.handleSuggestionClick(t,a)}})]})},v=function(t){var e=t.defaultExpanded,n=t.onClick,o=t.closeIcon;return r("button",{"aria-label":"Close search",className:"im-c-map-button im-c-search-close-button",type:"button",onClick:n,style:e?{display:"none"}:void 0,children:o&&r("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",dangerouslySetInnerHTML:{__html:o}})})};let w=" ";class S{static get separator(){return w}static set separator(t){w=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,o=null,i=null,a=null;switch(e){default:case"d":case"deg":o=t.toFixed(r),o<100&&(o="0"+o),o<10&&(o="0"+o),n=o+"°";break;case"dm":case"deg+min":o=Math.floor(t),i=(60*t%60).toFixed(r),60==i&&(i=(0).toFixed(r),o++),o=("000"+o).slice(-3),i<10&&(i="0"+i),n=o+"°"+S.separator+i+"′";break;case"dms":case"deg+min+sec":o=Math.floor(t),i=Math.floor(3600*t/60)%60,a=(3600*t%60).toFixed(r),60==a&&(a=(0).toFixed(r),i++),60==i&&(i=0,o++),o=("000"+o).slice(-3),i=("00"+i).slice(-2),a<10&&(a="0"+a),n=o+"°"+S.separator+i+"′"+S.separator+a+"″"}return n}static toLat(t,e,r){const n=S.toDms(S.wrap90(t),e,r);return null===n?"–":n.slice(1)+S.separator+(t<0?"S":"N")}static toLon(t,e,r){const n=S.toDms(S.wrap180(t),e,r);return null===n?"–":n+S.separator+(t<0?"W":"E")}static toBrng(t,e,r){const n=S.toDms(S.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=S.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 O=S;class E{constructor(t,e,r){if(isNaN(t)||isNaN(e)||isNaN(r))throw new TypeError(`invalid vector [${t},${e},${r}]`);this.x=Number(t),this.y=Number(e),this.z=Number(r)}get length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}plus(t){if(!(t instanceof E))throw new TypeError("v is not Vector3d object");return new E(this.x+t.x,this.y+t.y,this.z+t.z)}minus(t){if(!(t instanceof E))throw new TypeError("v is not Vector3d object");return new E(this.x-t.x,this.y-t.y,this.z-t.z)}times(t){if(isNaN(t))throw new TypeError(`invalid scalar value ‘${t}’`);return new E(this.x*t,this.y*t,this.z*t)}dividedBy(t){if(isNaN(t))throw new TypeError(`invalid scalar value ‘${t}’`);return new E(this.x/t,this.y/t,this.z/t)}dot(t){if(!(t instanceof E))throw new TypeError("v is not Vector3d object");return this.x*t.x+this.y*t.y+this.z*t.z}cross(t){if(!(t instanceof E))throw new TypeError("v is not Vector3d object");const e=this.y*t.z-this.z*t.y,r=this.z*t.x-this.x*t.z,n=this.x*t.y-this.y*t.x;return new E(e,r,n)}negate(){return new E(-this.x,-this.y,-this.z)}unit(){const t=this.length;if(1==t)return this;if(0==t)return this;const e=this.x/t,r=this.y/t,n=this.z/t;return new E(e,r,n)}angleTo(t,e=void 0){if(!(t instanceof E))throw new TypeError("v is not Vector3d object");if(!(e instanceof E||null==e))throw new TypeError("n is not Vector3d object");const r=null==e||this.cross(t).dot(e)>=0?1:-1,n=this.cross(t).length*r,o=this.dot(t);return Math.atan2(n,o)}rotateAround(t,e){if(!(t instanceof E))throw new TypeError("axis is not Vector3d object");const r=e.toRadians(),n=this.unit(),o=t.unit(),i=Math.sin(r),a=Math.cos(r),s=1-a,c=o.x,u=o.y,l=o.z,f=[[s*c*c+a,s*c*u-i*l,s*c*l+i*u],[s*c*u+i*l,s*u*u+a,s*u*l-i*c],[s*c*l-i*u,s*u*l+i*c,s*l*l+a]],p=[f[0][0]*n.x+f[0][1]*n.y+f[0][2]*n.z,f[1][0]*n.x+f[1][1]*n.y+f[1][2]*n.z,f[2][0]*n.x+f[2][1]*n.y+f[2][2]*n.z];return new E(p[0],p[1],p[2])}toString(t=3){return`[${this.x.toFixed(t)},${this.y.toFixed(t)},${this.z.toFixed(t)}]`}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};const j=E,N={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563}},T={WGS84:{ellipsoid:N.WGS84}};Object.freeze(N.WGS84),Object.freeze(T.WGS84);class P{constructor(t,e,r=0){if(isNaN(t)||null==t)throw new TypeError(`invalid lat ‘${t}’`);if(isNaN(e)||null==e)throw new TypeError(`invalid lon ‘${e}’`);if(isNaN(r)||null==r)throw new TypeError(`invalid height ‘${r}’`);this._lat=O.wrap90(Number(t)),this._lon=O.wrap180(Number(e)),this._height=Number(r)}get lat(){return this._lat}get latitude(){return this._lat}set lat(t){if(this._lat=isNaN(t)?O.wrap90(O.parse(t)):O.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid lat ‘${t}’`)}set latitude(t){if(this._lat=isNaN(t)?O.wrap90(O.parse(t)):O.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)?O.wrap180(O.parse(t)):O.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lon ‘${t}’`)}set lng(t){if(this._lon=isNaN(t)?O.wrap180(O.parse(t)):O.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lng ‘${t}’`)}set longitude(t){if(this._lon=isNaN(t)?O.wrap180(O.parse(t)):O.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid longitude ‘${t}’`)}get height(){return this._height}set height(t){if(this._height=Number(t),isNaN(this._height))throw new TypeError(`invalid height ‘${t}’`)}get datum(){return this._datum}set datum(t){this._datum=t}static get ellipsoids(){return N}static get datums(){return T}static parse(...t){if(0==t.length)throw new TypeError("invalid (empty) point");let e,r,n;if("object"==typeof t[0]&&(1==t.length||!isNaN(parseFloat(t[1])))){const o=t[0];if("Point"==o.type&&Array.isArray(o.coordinates)?([r,e,n]=o.coordinates,n=n||0):(null!=o.latitude&&(e=o.latitude),null!=o.lat&&(e=o.lat),null!=o.longitude&&(r=o.longitude),null!=o.lng&&(r=o.lng),null!=o.lon&&(r=o.lon),null!=o.height&&(n=o.height),e=O.wrap90(O.parse(e)),r=O.wrap180(O.parse(r))),null!=t[1]&&(n=t[1]),isNaN(e)||isNaN(r))throw new TypeError(`invalid point ‘${JSON.stringify(t[0])}’`)}if("string"==typeof t[0]&&2==t[0].split(",").length&&([e,r]=t[0].split(","),e=O.wrap90(O.parse(e)),r=O.wrap180(O.parse(r)),n=t[1]||0,isNaN(e)||isNaN(r)))throw new TypeError(`invalid point ‘${t[0]}’`);if(null==e&&null==r&&([e,r]=t,e=O.wrap90(O.parse(e)),r=O.wrap180(O.parse(r)),n=t[2]||0,isNaN(e)||isNaN(r)))throw new TypeError(`invalid point ‘${t.toString()}’`);return new this(e,r,n)}toCartesian(){const t=this.datum?this.datum.ellipsoid:this.referenceFrame?this.referenceFrame.ellipsoid:N.WGS84,e=this.lat.toRadians(),r=this.lon.toRadians(),n=this.height,{a:o,f:i}=t,a=Math.sin(e),s=Math.cos(e),c=Math.sin(r),u=Math.cos(r),l=2*i-i*i,f=o/Math.sqrt(1-l*a*a);return new _((f+n)*s*u,(f+n)*s*c,(f*(1-l)+n)*a)}equals(t){if(!(t instanceof P))throw new TypeError(`invalid point ‘${t}’`);return!(Math.abs(this.lat-t.lat)>Number.EPSILON||Math.abs(this.lon-t.lon)>Number.EPSILON||Math.abs(this.height-t.height)>Number.EPSILON||this.datum!=t.datum||this.referenceFrame!=t.referenceFrame||this.epoch!=t.epoch)}toString(t="d",e=void 0,r=null){if(!["d","dm","dms","n"].includes(t))throw new RangeError(`invalid format ‘${t}’`);const n=(this.height>=0?" +":" ")+this.height.toFixed(r)+"m";return"n"==t?(null==e&&(e=4),`${this.lat.toFixed(e)}, ${this.lon.toFixed(e)}${null==r?"":n}`):`${O.toLat(this.lat,t,e)}, ${O.toLon(this.lon,t,e)}${null==r?"":n}`}}class _ extends j{constructor(t,e,r){super(t,e,r)}toLatLon(t=N.WGS84){if(!t||!t.a)throw new TypeError(`invalid ellipsoid ‘${t}’`);const{x:e,y:r,z:n}=this,{a:o,b:i,f:a}=t,s=2*a-a*a,c=s/(1-s),u=Math.sqrt(e*e+r*r),l=i*n/(o*u)*(1+c*i/Math.sqrt(u*u+n*n)),f=l/Math.sqrt(1+l*l),p=f/l,d=isNaN(p)?0:Math.atan2(n+c*i*f*f*f,u-s*o*p*p*p),h=Math.atan2(r,e),y=Math.sin(d),m=u*Math.cos(d)+n*y-o*o/(o/Math.sqrt(1-s*y*y));return new P(d.toDegrees(),h.toDegrees(),m)}toString(t=0){return`[${this.x.toFixed(t)},${this.y.toFixed(t)},${this.z.toFixed(t)}]`}}const x={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563},Airy1830:{a:6377563.396,b:6356256.909,f:1/299.3249646},AiryModified:{a:6377340.189,b:6356034.448,f:1/299.3249646},Bessel1841:{a:6377397.155,b:6356078.962818,f:1/299.1528128},Clarke1866:{a:6378206.4,b:6356583.8,f:1/294.978698214},Clarke1880IGN:{a:6378249.2,b:6356515,f:1/293.466021294},GRS80:{a:6378137,b:6356752.31414,f:1/298.257222101},Intl1924:{a:6378388,b:6356911.946,f:1/297},WGS72:{a:6378135,b:6356750.5,f:1/298.26}},G={ED50:{ellipsoid:x.Intl1924,transform:[89.5,93.8,123.1,-1.2,0,0,.156]},ETRS89:{ellipsoid:x.GRS80,transform:[0,0,0,0,0,0,0]},Irl1975:{ellipsoid:x.AiryModified,transform:[-482.53,130.596,-564.557,-8.15,1.042,.214,.631]},NAD27:{ellipsoid:x.Clarke1866,transform:[8,-160,-176,0,0,0,0]},NAD83:{ellipsoid:x.GRS80,transform:[.9956,-1.9103,-.5215,-62e-5,.025915,.009426,.011599]},NTF:{ellipsoid:x.Clarke1880IGN,transform:[168,60,-320,0,0,0,0]},OSGB36:{ellipsoid:x.Airy1830,transform:[-446.448,125.157,-542.06,20.4894,-.1502,-.247,-.8421]},Potsdam:{ellipsoid:x.Bessel1841,transform:[-582,-105,-414,-8.3,1.04,.35,-3.08]},TokyoJapan:{ellipsoid:x.Bessel1841,transform:[148,-507,-685,0,0,0,0]},WGS72:{ellipsoid:x.WGS72,transform:[0,0,-4.5,-.22,0,0,.554]},WGS84:{ellipsoid:x.WGS84,transform:[0,0,0,0,0,0,0]}};Object.keys(x).forEach(t=>Object.freeze(x[t])),Object.keys(G).forEach(t=>{Object.freeze(G[t]),Object.freeze(G[t].transform)});class k extends P{constructor(t,e,r=0,n=G.WGS84){if(!n||null==n.ellipsoid)throw new TypeError(`unrecognised datum ‘${n}’`);super(t,e,r),this._datum=n}get datum(){return this._datum}static get ellipsoids(){return x}static get datums(){return G}static parse(...t){let e=G.WGS84;if((4==t.length||3==t.length&&"object"==typeof t[2])&&(e=t.pop()),!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);const r=super.parse(...t);return r._datum=e,r}convertDatum(t){if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);return this.toCartesian().convertDatum(t).toLatLon()}toCartesian(){const t=super.toCartesian();return new D(t.x,t.y,t.z,this.datum)}}class D extends _{constructor(t,e,r,n=void 0){if(n&&null==n.ellipsoid)throw new TypeError(`unrecognised datum ‘${n}’`);super(t,e,r),n&&(this._datum=n)}get datum(){return this._datum}set datum(t){if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);this._datum=t}toLatLon(t=void 0){t&&(console.info("datum parameter to Cartesian_Datum.toLatLon is deprecated: set datum before calling toLatLon()"),this.datum=t);const e=this.datum||G.WGS84;if(!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);const r=super.toLatLon(e.ellipsoid);return new k(r.lat,r.lon,r.height,this.datum)}convertDatum(t){if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);if(!this.datum)throw new TypeError("cartesian coordinate has no datum");let e=null,r=null;null!=this.datum&&this.datum!=G.WGS84||(e=this,r=t.transform),t==G.WGS84&&(e=this,r=this.datum.transform.map(t=>-t)),null==r&&(e=this.convertDatum(G.WGS84),r=t.transform);const n=e.applyTransform(r);return n.datum=t,n}applyTransform(t){const{x:e,y:r,z:n}=this,o=t[0],i=t[1],a=t[2],s=t[3]/1e6+1,c=(t[4]/3600).toRadians(),u=(t[5]/3600).toRadians(),l=(t[6]/3600).toRadians();return new D(o+e*s-r*l+n*u,i+e*l+r*s-n*c,a-e*u+r*c+n*s)}}const M={trueOrigin:{lat:49,lon:-2},falseOrigin:{easting:-4e5,northing:1e5},scaleFactor:.9996012717,ellipsoid:k.ellipsoids.Airy1830};class C{constructor(t,e){if(this.easting=Number(t),this.northing=Number(e),isNaN(t)||this.easting<0||this.easting>7e5)throw new RangeError(`invalid easting ‘${t}’`);if(isNaN(e)||this.northing<0||this.northing>13e5)throw new RangeError(`invalid northing ‘${e}’`)}toLatLon(t=k.datums.WGS84){const{easting:e,northing:r}=this,{a:n,b:o}=M.ellipsoid,i=M.trueOrigin.lat.toRadians(),a=M.trueOrigin.lon.toRadians(),s=-M.falseOrigin.easting,c=-M.falseOrigin.northing,u=M.scaleFactor,l=1-o*o/(n*n),f=(n-o)/(n+o),p=f*f,d=f*f*f;let h=i,y=0;do{h=(r-c-y)/(n*u)+h,y=o*u*((1+f+5/4*p+5/4*d)*(h-i)-(3*f+3*f*f+21/8*d)*Math.sin(h-i)*Math.cos(h+i)+(15/8*p+15/8*d)*Math.sin(2*(h-i))*Math.cos(2*(h+i))-35/24*d*Math.sin(3*(h-i))*Math.cos(3*(h+i)))}while(Math.abs(r-c-y)>=1e-5);const m=Math.cos(h),b=Math.sin(h),g=n*u/Math.sqrt(1-l*b*b),v=n*u*(1-l)/Math.pow(1-l*b*b,1.5),w=g/v-1,S=Math.tan(h),O=S*S,E=O*O,j=1/m,N=g*g*g,T=N*g*g,P=e-s,_=P*P,x=_*P,G=_*_,D=x*_;h=h-S/(2*v*g)*_+S/(24*v*N)*(5+3*O+w-9*O*w)*G-S/(720*v*T)*(61+90*O+45*E)*(G*_);const C=a+j/g*P-j/(6*N)*(g/v+2*O)*x+j/(120*T)*(5+28*O+24*E)*D-j/(T*g*g*5040)*(61+662*O+1320*E+E*O*720)*(D*_);let I=new R(h.toDegrees(),C.toDegrees(),0,k.datums.OSGB36);return t!=k.datums.OSGB36&&(I=I.convertDatum(t),I=new R(I.lat,I.lon,I.height,I.datum)),I}static parse(t){let e=(t=String(t).trim()).match(/^(\d+),\s*(\d+)$/);if(e)return new C(e[1],e[2]);if(e=t.match(/^[HNST][ABCDEFGHJKLMNOPQRSTUVWXYZ]\s*[0-9]+\s*[0-9]+$/i),!e)throw new Error(`invalid grid reference ‘${t}’`);let r=t.toUpperCase().charCodeAt(0)-"A".charCodeAt(0),n=t.toUpperCase().charCodeAt(1)-"A".charCodeAt(0);r>7&&r--,n>7&&n--;const o=(r-2)%5*5+n%5,i=19-5*Math.floor(r/5)-Math.floor(n/5);let a=t.slice(2).trim().split(/\s+/);if(1==a.length&&(a=[a[0].slice(0,a[0].length/2),a[0].slice(a[0].length/2)]),a[0].length!=a[1].length)throw new Error(`invalid grid reference ‘${t}’`);a[0]=a[0].padEnd(5,"0"),a[1]=a[1].padEnd(5,"0");const s=o+a[0],c=i+a[1];return new C(s,c)}toString(t=10){if(![0,2,4,6,8,10,12,14,16].includes(Number(t)))throw new RangeError(`invalid precision ‘${t}’`);let{easting:e,northing:r}=this;if(0==t){const t={useGrouping:!1,minimumIntegerDigits:6,maximumFractionDigits:3};return`${e.toLocaleString("en",t)},${r.toLocaleString("en",t)}`}const n=Math.floor(e/1e5),o=Math.floor(r/1e5);let i=19-o-(19-o)%5+Math.floor((n+10)/5),a=5*(19-o)%25+n%5;i>7&&i++,a>7&&a++;const s=String.fromCharCode(i+"A".charCodeAt(0),a+"A".charCodeAt(0));return e=Math.floor(e%1e5/Math.pow(10,5-t/2)),r=Math.floor(r%1e5/Math.pow(10,5-t/2)),e=e.toString().padStart(t/2,"0"),r=r.toString().padStart(t/2,"0"),`${s} ${e} ${r}`}}class R extends k{toOsGrid(){const t=this.datum==k.datums.OSGB36?this:this.convertDatum(k.datums.OSGB36),e=t.lat.toRadians(),r=t.lon.toRadians(),{a:n,b:o}=M.ellipsoid,i=M.trueOrigin.lat.toRadians(),a=M.trueOrigin.lon.toRadians(),s=-M.falseOrigin.easting,c=-M.falseOrigin.northing,u=M.scaleFactor,l=1-o*o/(n*n),f=(n-o)/(n+o),p=f*f,d=f*f*f,h=Math.cos(e),y=Math.sin(e),m=n*u/Math.sqrt(1-l*y*y),b=n*u*(1-l)/Math.pow(1-l*y*y,1.5),g=m/b-1,v=o*u*((1+f+5/4*p+5/4*d)*(e-i)-(3*f+3*f*f+21/8*d)*Math.sin(e-i)*Math.cos(e+i)+(15/8*p+15/8*d)*Math.sin(2*(e-i))*Math.cos(2*(e+i))-35/24*d*Math.sin(3*(e-i))*Math.cos(3*(e+i))),w=h*h*h,S=w*h*h,O=Math.tan(e)*Math.tan(e),E=O*O,j=r-a,N=j*j,T=N*j,P=T*j,_=P*j;let x=v+c+m/2*y*h*N+m/24*y*w*(5-O+9*g)*P+m/720*y*S*(61-58*O+E)*(_*j),G=s+m*h*j+m/6*w*(m/b-O)*T+m/120*S*(5-18*O+E+14*g-58*O*g)*_;x=Number(x.toFixed(3)),G=Number(G.toFixed(3));try{return new C(G,x)}catch(e){throw new Error(`${e.message} from (${t.lat.toFixed(6)},${t.lon.toFixed(6)}).toOsGrid()`)}}convertDatum(t){const e=super.convertDatum(t);return new R(e.lat,e.lon,e.height,e.datum)}}function I(t){return I="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},I(t)}var A;function L(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 $(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?L(Object(r),!0).forEach(function(e){F(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):L(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function F(t,e,r){return(e=function(t){var e=function(t){if("object"!=I(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=I(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==I(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var W=500,U=function(t,e){var r,n,o,i,a=e.MBR_XMIN,s=e.MBR_YMIN,c=e.MBR_XMAX,u=e.MBR_YMAX,l=e.GEOMETRY_X,f=e.GEOMETRY_Y;if(null==a?(r=l-W,n=f-W,o=l+W,i=f+W):(r=a,n=s,o=c,i=u),"EPSG:27700"===t)return[r,n,o,i];if("EPSG:4326"===t){var p=new C(r,n).toLatLon(),d=new C(o,i).toLatLon();return[p.lon,p.lat,d.lon,d.lat].map(function(t){return Math.round(1e6*t)/1e6})}throw new Error("Unsupported CRS: ".concat(t))},B=function(t,e){var r=e.GEOMETRY_X,n=e.GEOMETRY_Y;if("EPSG:27700"===t)return[r,n];if("EPSG:4326"===t){var o=new C(r,n).toLatLon();return[Math.round(1e6*o.lon)/1e6,Math.round(1e6*o.lat)/1e6]}throw new Error("Unsupported CRS: ".concat(t))};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}function V(t){return function(t){if(Array.isArray(t))return q(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||H(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 Y(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=H(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},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,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function H(t,e){if(t){if("string"==typeof t)return q(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)?q(t,e):void 0}}function q(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 K(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof s?n:s,u=Object.create(c.prototype);return X(u,"_invoke",function(r,n,o){var i,s,c,u=0,l=o||[],f=!1,p={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,r){return i=e,s=0,c=t,p.n=r,a}};function d(r,n){for(s=r,c=n,e=0;!f&&u&&!o&&e<l.length;e++){var o,i=l[e],d=p.p,h=i[2];r>3?(o=h===n)&&(c=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=t):i[0]<=d&&((o=r<2&&d<i[1])?(s=0,p.v=n,p.n=i[1]):d<h&&(o=r<3||i[0]>n||n>h)&&(i[4]=r,i[5]=n,p.n=h,s=0))}if(o||r>1)return a;throw f=!0,n}return function(o,l,h){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,h),s=l,c=h;(e=s<2?t:c)||!f;){i||(s?s<3?(s>1&&(p.n=-1),d(s,c)):p.n=c:p.v=c);try{if(u=2,i){if(s||(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,s<2&&(s=0)}else 1===s&&(e=i.return)&&e.call(i),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=t}else if((e=(f=p.n<0)?c:r.call(n,p))!==a)break}catch(e){i=t,s=1,c=e}finally{u=1}}return{value:e,done:f}}}(r,o,i),!0),u}var a={};function s(){}function c(){}function u(){}e=Object.getPrototypeOf;var l=[][n]?e(e([][n]())):(X(e={},n,function(){return this}),e),f=u.prototype=s.prototype=Object.create(l);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,X(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=u,X(f,"constructor",u),X(u,"constructor",c),c.displayName="GeneratorFunction",X(u,o,"GeneratorFunction"),X(f),X(f,o,"Generator"),X(f,n,function(){return this}),X(f,"toString",function(){return"[object Generator]"}),(K=function(){return{w:i,m:p}})()}function X(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}X=function(t,e,r,n){function i(e,r){X(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(i("next",0),i("throw",1),i("return",2))},X(t,e,r,n)}function Z(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function J(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(t){Z(i,n,o,a,s,"next",t)}function s(t){Z(i,n,o,a,s,"throw",t)}a(void 0)})}}var Q=function(t){return t.replace(/[^a-zA-Z0-9\s\-.,]/g,"").trim()},tt=function(t,e,r){var n,o={url:null===(n=t.urlTemplate)||void 0===n?void 0:n.replace("{query}",encodeURIComponent(e)),options:{method:"GET"}};return"function"==typeof t.buildRequest?t.buildRequest(e,function(){return o}):"function"==typeof r?r(o,e):o},et=function(){var t=J(K().m(function t(e,r,n){var o,i,a;return K().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,fetch(r.url,r.options);case 1:if((o=t.v).ok){t.n=2;break}return console.error("Fetch error for ".concat(e.label||"dataset",": ").concat(o.status)),t.a(2,null);case 2:return t.n=3,o.json();case 3:return i=t.v,t.a(2,e.parseResults(i,n));case 4:return t.p=4,a=t.v,console.error("Network error for ".concat(e.label||"dataset",":"),a),t.a(2,null)}},t,null,[[0,4]])}));return function(e,r,n){return t.apply(this,arguments)}}(),rt=function(){var t=J(K().m(function t(e,r,n,o){var i,a,s,c,u,l,f,p,d;return K().w(function(t){for(;;)switch(t.p=t.n){case 0:i=Q(e),a=r.filter(function(t){var e=!t.includeRegex||t.includeRegex.test(i),r=!!t.excludeRegex&&t.excludeRegex.test(i);return e&&!r}),s=[],c=Y(a),t.p=1,c.s();case 2:if((u=c.n()).done){t.n=5;break}return l=u.value,f=tt(l,i,o),t.n=3,et(l,f,i);case 3:if(null==(p=t.v)||!p.length){t.n=4;break}if(s=[].concat(V(s),V(p)),!l.exclusive){t.n=4;break}return t.a(3,5);case 4:t.n=2;break;case 5:t.n=7;break;case 6:t.p=6,d=t.v,c.e(d);case 7:return t.p=7,c.f(),t.f(7);case 8:return n({type:"UPDATE_SUGGESTIONS",payload:s}),t.a(2,{results:s,sanitisedValue:i})}},t,null,[[1,6,7,8]])}));return function(e,r,n,o){return t.apply(this,arguments)}}();function nt(t){var e=t.mapProvider,r=t.bounds,n=t.point,o=t.markers,i=t.showMarker,a=t.markerColor;e.fitToBounds(r),i&&o.add("search",n,{color:a})}function ot(t){return ot="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},ot(t)}function it(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof s?n:s,u=Object.create(c.prototype);return at(u,"_invoke",function(r,n,o){var i,s,c,u=0,l=o||[],f=!1,p={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,r){return i=e,s=0,c=t,p.n=r,a}};function d(r,n){for(s=r,c=n,e=0;!f&&u&&!o&&e<l.length;e++){var o,i=l[e],d=p.p,h=i[2];r>3?(o=h===n)&&(c=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=t):i[0]<=d&&((o=r<2&&d<i[1])?(s=0,p.v=n,p.n=i[1]):d<h&&(o=r<3||i[0]>n||n>h)&&(i[4]=r,i[5]=n,p.n=h,s=0))}if(o||r>1)return a;throw f=!0,n}return function(o,l,h){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,h),s=l,c=h;(e=s<2?t:c)||!f;){i||(s?s<3?(s>1&&(p.n=-1),d(s,c)):p.n=c:p.v=c);try{if(u=2,i){if(s||(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,s<2&&(s=0)}else 1===s&&(e=i.return)&&e.call(i),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=t}else if((e=(f=p.n<0)?c:r.call(n,p))!==a)break}catch(e){i=t,s=1,c=e}finally{u=1}}return{value:e,done:f}}}(r,o,i),!0),u}var a={};function s(){}function c(){}function u(){}e=Object.getPrototypeOf;var l=[][n]?e(e([][n]())):(at(e={},n,function(){return this}),e),f=u.prototype=s.prototype=Object.create(l);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,at(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=u,at(f,"constructor",u),at(u,"constructor",c),c.displayName="GeneratorFunction",at(u,o,"GeneratorFunction"),at(f),at(f,o,"Generator"),at(f,n,function(){return this}),at(f,"toString",function(){return"[object Generator]"}),(it=function(){return{w:i,m:p}})()}function at(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}at=function(t,e,r,n){function i(e,r){at(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(i("next",0),i("throw",1),i("return",2))},at(t,e,r,n)}function st(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 ct(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?st(Object(r),!0).forEach(function(e){ut(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):st(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function ut(t,e,r){return(e=function(t){var e=function(t){if("object"!=ot(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=ot(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ot(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function lt(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function ft(t){return ft="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},ft(t)}function pt(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 dt(t,e,r){return(e=function(t){var e=function(t){if("object"!=ft(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=ft(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ft(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ht(t){return ht="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},ht(t)}function yt(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 mt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?yt(Object(r),!0).forEach(function(e){bt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):yt(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function bt(t,e,r){return(e=function(t){var e=function(t){if("object"!=ht(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=ht(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ht(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function gt(t){var e,r,n,o=t.dispatch,i=t.searchContainerRef,a=(e=function(e){return rt(e,t.datasets,o,t.transformRequest)},r=null,n=function(){for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];clearTimeout(r),r=setTimeout(function(){e.apply(void 0,n)},350)},n.cancel=function(){r&&(clearTimeout(r),r=null)},n),s=function(t){var e=t.dispatch,r=t.services,n=t.viewportRef,o=t.mapProvider,i=t.markers,a=t.datasets,s=t.transformRequest,c=t.showMarker,u=t.markerColor,l="";return{handleOpenClick:function(){e({type:"TOGGLE_EXPANDED",payload:!0}),r.eventBus.emit("search:open")},handleCloseClick:function(t,n){e({type:"TOGGLE_EXPANDED",payload:!1}),e({type:"UPDATE_SUGGESTIONS",payload:[]}),e({type:"SET_VALUE",payload:""}),setTimeout(function(){return n.current.focus()},0),i.remove("search"),r.eventBus.emit("search:clear"),r.eventBus.emit("search:close")},handleSubmit:function(t,f,p){return(d=it().m(function d(){var h,y,m,b,g,v,w,S,O,E,j,N;return it().w(function(d){for(;;)switch(d.n){case 0:if(t.preventDefault(),h=p.suggestions,y=p.selectedIndex,m=p.value,b=null==m?void 0:m.trim(),e({type:"SET_SELECTED",payload:-1}),e({type:"HIDE_SUGGESTIONS"}),!(y>=0)){d.n=1;break}return v=h[y],e({type:"SET_VALUE",payload:v.text}),null===(g=n.current)||void 0===g||g.focus(),nt({mapProvider:o,bounds:v.bounds,point:v.point,markers:i,showMarker:c,markerColor:u}),r.eventBus.emit("search:match",ct({query:v.text},v)),d.a(2);case 1:if(!((null==b?void 0:b.length)<3)){d.n=2;break}return d.a(2);case 2:if(w=h,h.length&&b===l){d.n=4;break}return d.n=3,rt(b,a,e,s);case 3:S=d.v,O=S.results,E=S.sanitisedValue,w=O,l=E;case 4:w.length&&("keyboard"===f.interfaceType&&(null===(j=n.current)||void 0===j||j.focus()),"mobile"===f.breakpoint&&(e({type:"TOGGLE_EXPANDED",payload:!1}),r.eventBus.emit("search:close")),N=w[0],nt({mapProvider:o,bounds:N.bounds,point:N.point,markers:i,showMarker:c,markerColor:u}),r.eventBus.emit("search:match",ct({query:m},N)));case 5:return d.a(2)}},d)}),function(){var t=this,e=arguments;return new Promise(function(r,n){var o=d.apply(t,e);function i(t){lt(o,r,n,i,a,"next",t)}function a(t){lt(o,r,n,i,a,"throw",t)}i(void 0)})})();var d}}}(t),c=function(t){var e=t.dispatch,r=t.debouncedFetchSuggestions;return{handleInputClick:function(){e({type:"SHOW_SUGGESTIONS"})},handleInputFocus:function(t){e({type:"SET_KEYBOARD_FOCUS_WITHIN",payload:"keyboard"===t})},handleInputBlur:function(t){e({type:"INPUT_BLUR",payload:t})},handleInputChange:function(t){var n=t.target.value;if(e({type:"SET_VALUE",payload:n}),n.length<3)return r.cancel(),e({type:"UPDATE_SUGGESTIONS",payload:[]}),void e({type:"HIDE_SUGGESTIONS"});e({type:"SHOW_SUGGESTIONS"}),r(n)}}}(mt(mt({},t),{},{debouncedFetchSuggestions:a})),u=function(t){var e=t.dispatch,r=t.services,n=t.mapProvider,o=t.markers,i=t.showMarker,a=t.markerColor,s=function(t,e){var r;return e>=0?"".concat(null===(r=t[e])||void 0===r?void 0:r.text,". ").concat(e+1," of ").concat(t.length," is highlighted"):"".concat(t.length," suggestions available")};return{handleSuggestionClick:function(t,s){e({type:"SET_VALUE",payload:t.text}),e({type:"HIDE_SUGGESTIONS"}),e({type:"SET_SELECTED",payload:-1}),"mobile"===s.breakpoint&&(e({type:"TOGGLE_EXPANDED",payload:!1}),r.eventBus.emit("search:close")),nt({mapProvider:n,bounds:t.bounds,point:t.point,markers:o,showMarker:i,markerColor:a}),r.eventBus.emit("search:match",function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?pt(Object(r),!0).forEach(function(e){dt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):pt(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({query:t.text},t))},handleInputKeyDown:function(t,n){var o=n.suggestions,i=n.selectedIndex;switch(t.key){case"ArrowDown":if(null==o||!o.length)return;if(t.preventDefault(),i<o.length-1){var a=i+1;r.announce(s(o,a)),e({type:"SET_SELECTED",payload:a}),e({type:"SET_KEYBOARD_FOCUS_WITHIN",payload:!1})}break;case"ArrowUp":if(null==o||!o.length)return;t.preventDefault();var c=i>0?i-1:-1;r.announce(s(o,c)),e({type:"SET_SELECTED",payload:c}),e({type:"SET_KEYBOARD_FOCUS_WITHIN",payload:c<0});break;case"Escape":t.preventDefault(),e({type:"HIDE_SUGGESTIONS"}),e({type:"SET_SELECTED",payload:-1})}}}}(t);return mt(mt(mt(mt({},s),c),u),{},{handleOutside:function(e){i.current.contains(e.target)||(o({type:"TOGGLE_EXPANDED",payload:!1}),t.services.eventBus.emit("search:close"))}})}function vt(t){return vt="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},vt(t)}function wt(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 St(t,e,r){return(e=function(t){var e=function(t){if("object"!=vt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=vt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==vt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Ot={reducer:{initialState:{isExpanded:!1,hasKeyboardFocusWithin:!1,value:"",suggestions:[],areSuggestionsVisible:!1,selectedIndex:-1},actions:f},controls:[{id:"search",label:"Search",mobile:{slot:"top-right"},tablet:{slot:"top-left"},desktop:{slot:"top-left"},render:function(o){var i=o.appConfig,a=o.iconRegistry,s=o.pluginState,c=o.pluginConfig,u=o.appState,l=o.mapState,f=o.services,d=o.mapProvider,h=i.id,y=u.interfaceType,m=c.isExpanded,b=c.customDatasets,w=c.osNamesURL,S=s.dispatch,O=s.isExpanded,E=s.areSuggestionsVisible,j=s.suggestions,N=a.close,T=a.search,P=e(null),_=e(null),x=e(null),G=e(null),k=u.layoutRefs.viewportRef,D=function(t){var e,r=t.customDatasets,n=t.crs;return[].concat([{name:"osNames",urlTemplate:t.osNamesURL,parseResults:function(t,e){return function(t,e,r){var n;if(!t||t.error||0===(null===(n=t.header)||void 0===n?void 0:n.totalresults))return[];var o=t.results;return o=function(t,e){var r=e.toLowerCase().replace(/,/g,"").split(" ");return t.filter(function(t){return r.some(function(r){return t.GAZETTEER_ENTRY.NAME1.toLowerCase().includes(r)||(n=(n=e).replace(/\s/g,""),/^(([A-Z]{1,2}\d[A-Z\d]?|ASCN|STHL|TDCU|BBND|[BFS]IQQ|PCRN|TKCA) ?\d[A-Z]{2}|BFPO ?\d{1,4}|(KY\d|MSR|VG|AI)[ -]?\d{4}|[A-Z]{2} ?\d{2}|GE ?CX|GIR ?0A{2}|SAN ?TA1)$/i.test(n));var n})})}(o,e),(o=(o=function(t){return Array.from(new Map(t.map(function(t){return[t.GAZETTEER_ENTRY.ID,t]})).values())}(o)).slice(0,8)).map(function(t){return $($({id:t.GAZETTEER_ENTRY.ID,bounds:U(r,t.GAZETTEER_ENTRY),point:B(r,t.GAZETTEER_ENTRY)},function(t,e){var r,n,o,i,a,s,c=e.NAME1,u=e.COUNTY_UNITARY,l=e.DISTRICT_BOROUGH,f=e.POSTCODE_DISTRICT,p=e.LOCAL_TYPE,d="".concat(["City","Postcode"].includes(p)?"":f+", ").concat("City"===p?"":u||l),h="".concat(c).concat(d?", "+d:"");return{text:h,marked:(r=h,n=t,a=n.replace(/\s+/g,"").split("").join(String.raw(A||(o=["s*"],(i=["\\s*"])||(i=o.slice(0)),A=Object.freeze(Object.defineProperties(o,{raw:{value:Object.freeze(i)}}))))),s=new RegExp("(".concat(a,")"),"i"),r.replace(s,"<mark>$1</mark>"))}}(e,t.GAZETTEER_ENTRY)),{},{type:"os-names"})})}(t,e,n)},includeRegex:/^[a-zA-Z0-9\s,-]+$/,excludeRegex:/^(?:[a-z]{2}\s*(?:\d{3}\s*\d{3}|\d{4}\s*\d{4}|\d{5}\s*\d{5})|\d+\s*,?\s*\d+)$/i}],function(t){if(Array.isArray(t))return z(t)}(e=void 0===r?[]:r)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(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}}(e)||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.")}())}({customDatasets:b,osNamesURL:w,crs:d.crs}),M=e(null);M.current||(M.current=gt(function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?wt(Object(r),!0).forEach(function(e){St(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):wt(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({dispatch:S,datasets:D,services:f,mapProvider:d,viewportRef:k,searchContainerRef:P,markers:l.markers},c)));var C=M.current,R=O||!!(m&&E&&j.length);return t(function(){var t;O&&(null===(t=x.current)||void 0===t||t.focus())},[O]),t(function(){if(u.dispatch({type:"TOGGLE_HAS_EXCLUSIVE_CONTROL",payload:O}),R)return k.current.style.pointerEvents="none",document.addEventListener("focusin",C.handleOutside),document.addEventListener("pointerdown",C.handleOutside),function(){k.current.style.pointerEvents="auto",document.removeEventListener("focusin",C.handleOutside),document.removeEventListener("pointerdown",C.handleOutside)}},[O,y,E,j]),n("div",{className:"im-c-search",ref:P,children:[!m&&r(p,{id:h,isExpanded:O,onClick:function(){return C.handleOpenClick(u)},buttonRef:_,searchIcon:T}),r(g,{id:h,pluginState:s,pluginConfig:c,appState:u,inputRef:x,events:C,children:r(v,{defaultExpanded:m,onClick:function(t){return C.handleCloseClick(t,_,u)},closeIcon:N,ref:G})})]})}}],icons:[{id:"search",svgContent:'<path d="m21 21-4.34-4.34"></path><circle cx="11" cy="11" r="8"></circle>'}]}}},i={};function a(t){var e=i[t];if(void 0!==e)return e.exports;var r=i[t]={exports:{}};return o[t](r,r.exports,a),r.exports}a.d=(t,e)=>{for(var r in e)a.o(e,r)&&!a.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var s={};function c(t){return c="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},c(t)}function u(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof s?n:s,u=Object.create(c.prototype);return l(u,"_invoke",function(r,n,o){var i,s,c,u=0,l=o||[],f=!1,p={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,r){return i=e,s=0,c=t,p.n=r,a}};function d(r,n){for(s=r,c=n,e=0;!f&&u&&!o&&e<l.length;e++){var o,i=l[e],d=p.p,h=i[2];r>3?(o=h===n)&&(c=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=t):i[0]<=d&&((o=r<2&&d<i[1])?(s=0,p.v=n,p.n=i[1]):d<h&&(o=r<3||i[0]>n||n>h)&&(i[4]=r,i[5]=n,p.n=h,s=0))}if(o||r>1)return a;throw f=!0,n}return function(o,l,h){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,h),s=l,c=h;(e=s<2?t:c)||!f;){i||(s?s<3?(s>1&&(p.n=-1),d(s,c)):p.n=c:p.v=c);try{if(u=2,i){if(s||(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,s<2&&(s=0)}else 1===s&&(e=i.return)&&e.call(i),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=t}else if((e=(f=p.n<0)?c:r.call(n,p))!==a)break}catch(e){i=t,s=1,c=e}finally{u=1}}return{value:e,done:f}}}(r,o,i),!0),u}var a={};function s(){}function c(){}function f(){}e=Object.getPrototypeOf;var p=[][n]?e(e([][n]())):(l(e={},n,function(){return this}),e),d=f.prototype=s.prototype=Object.create(p);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,l(t,o,"GeneratorFunction")),t.prototype=Object.create(d),t}return c.prototype=f,l(d,"constructor",f),l(f,"constructor",c),c.displayName="GeneratorFunction",l(f,o,"GeneratorFunction"),l(d),l(d,o,"Generator"),l(d,n,function(){return this}),l(d,"toString",function(){return"[object Generator]"}),(u=function(){return{w:i,m:h}})()}function l(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}l=function(t,e,r,n){function i(e,r){l(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(i("next",0),i("throw",1),i("return",2))},l(t,e,r,n)}function f(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function p(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 d(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?p(Object(r),!0).forEach(function(e){h(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function h(t,e,r){return(e=function(t){var e=function(t){if("object"!=c(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==c(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function y(){var t,e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r.isExpanded&&(r.manifest={controls:[{id:"search",mobile:{slot:"banner"}}]}),d(d({showMarker:!0},r),{},{id:"search",load:(t=u().m(function t(){var e;return u().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,Promise.resolve().then(a.bind(a,"./plugins/search/src/manifest.js"));case 1:return e=t.v.manifest,t.a(2,e)}},t)}),e=function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(t){f(i,n,o,a,s,"next",t)}function s(t){f(i,n,o,a,s,"throw",t)}a(void 0)})},function(){return e.apply(this,arguments)})})}a.d(s,{A:()=>y});const m=s.A;export{m as default};
1
+ import e from"@babel/runtime/helpers/asyncToGenerator";import r from"@babel/runtime/helpers/defineProperty";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(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?t(Object(o),!0).forEach(function(t){r(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))})}return e}function o(){var r,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.isExpanded&&(t.manifest={controls:[{id:"search",mobile:{slot:"banner"}}]}),n(n({showMarker:!0},t),{},{id:"search",load:(r=e(function*(){return(yield import(/* webpackChunkName: "im-search-plugin" */ "./im-search-plugin.js")).manifest}),function(){return r.apply(this,arguments)})})}export{o as default};
@@ -1,4 +1,4 @@
1
- @use '/src/scss/tools/index' as tools;
1
+ @use '../../../../../src/scss/tools/index' as tools;
2
2
 
3
3
  // Suggestions
4
4
  .im-c-search-suggestions {
@@ -1,4 +1,4 @@
1
- @use '/src/scss/tools/index' as tools;
1
+ @use '../../../src/scss/tools/index' as tools;
2
2
 
3
3
 
4
4
  // Components, using 'CSS in Component' pattern
@@ -1 +1,30 @@
1
- :root{font-family:inherit !important;text-rendering:auto !important;-webkit-font-smoothing:auto !important;-moz-osx-font-smoothing:auto !important}:root:not(.esri-ui):not([class*=calcite]):not([class*=esri]){--calcite-font-family: inherit !important;--calcite-sans-family: inherit !important}body,html{font-family:inherit !important;text-rendering:auto !important;-webkit-font-smoothing:auto !important;-moz-osx-font-smoothing:auto !important}.your-map-container{font-family:var(--calcite-font-family)}:not(.esri-view):not(.esri-ui):not([class*=calcite]):not([class*=esri]).calcite-typography,:not(.esri-view):not(.esri-ui):not([class*=calcite]):not([class*=esri]) .calcite-typography{font-family:inherit !important;font-size:inherit !important;font-weight:inherit !important;letter-spacing:inherit !important;line-height:inherit !important}
1
+ :root {
2
+ font-family: inherit !important;
3
+ text-rendering: auto !important;
4
+ -webkit-font-smoothing: auto !important;
5
+ -moz-osx-font-smoothing: auto !important;
6
+ }
7
+
8
+ :root:not(.esri-ui):not([class*=calcite]):not([class*=esri]) {
9
+ --calcite-font-family: inherit !important;
10
+ --calcite-sans-family: inherit !important;
11
+ }
12
+
13
+ body, html {
14
+ font-family: inherit !important;
15
+ text-rendering: auto !important;
16
+ -webkit-font-smoothing: auto !important;
17
+ -moz-osx-font-smoothing: auto !important;
18
+ }
19
+
20
+ .your-map-container {
21
+ font-family: var(--calcite-font-family);
22
+ }
23
+
24
+ :not(.esri-view):not(.esri-ui):not([class*=calcite]):not([class*=esri]).calcite-typography, :not(.esri-view):not(.esri-ui):not([class*=calcite]):not([class*=esri]) .calcite-typography {
25
+ font-family: inherit !important;
26
+ font-size: inherit !important;
27
+ font-weight: inherit !important;
28
+ letter-spacing: inherit !important;
29
+ line-height: inherit !important;
30
+ }
@@ -0,0 +1 @@
1
+ import e from"@babel/runtime/helpers/objectWithoutProperties";import t from"@babel/runtime/helpers/asyncToGenerator";import i from"@arcgis/core/config.js";import n from"@arcgis/core/Map.js";import o from"@arcgis/core/views/MapView.js";import r from"@arcgis/core/layers/VectorTileLayer.js";import{when as a,once as s,watch as m}from"@arcgis/core/core/reactiveUtils.js";import u from"@arcgis/core/geometry/Extent.js";import l from"@arcgis/core/geometry/Point.js";var v={animationDuration:200},c=["showKeyboardHelp","selectControl","moveLarge","nudgeMap","zoomLarge","nudgeZoom"];var p=(e,t)=>{var i=null,n=function(){for(var n=arguments.length,o=new Array(n),r=0;r<n;r++)o[r]=arguments[r];clearTimeout(i),i=setTimeout(()=>{e(...o)},t)};return n.cancel=()=>{i&&(clearTimeout(i),i=null)},n};function h(e){var{mapProvider:t,view:i,baseTileLayer:n,events:o,eventBus:r,getZoom:u,getCenter:l,getBounds:v,getResolution:c}=e,h=!1,d=[],y=[],g=e=>{var t=(()=>{if(h||!i||i.destroyed||!i.extent)return null;var{maxZoom:e,minZoom:t}=i.constraints;return{center:l(),bounds:v(),resolution:c(),zoom:u(),isAtMaxZoom:i.zoom+.01>=e,isAtMinZoom:i.zoom-.01<=t}})();t&&r.emit(e,t)};a(()=>n.loaded&&i.resolution>0,()=>g(o.MAP_LOADED)),s(()=>i.ready).then(()=>{h||r.emit(o.MAP_READY,t.getMapAPI())}),s(()=>i.stationary).then(()=>g(o.MAP_FIRST_IDLE));var w=p(()=>g(o.MAP_MOVE_END),500);y.push(w),d.push(m(()=>[i.interacting,i.animation],e=>{var[t,i]=e;(t||i)&&r.emit(o.MAP_MOVE_START),t||i||w()}));var f,x,M,b=(f=()=>g(o.MAP_MOVE),x=10,M=0,function(){var e=Date.now();e-M>=x&&(M=e,f(...arguments))});y.push(b),d.push(m(()=>i.zoom,b)),d.push(m(()=>i.extent,()=>r.emit(o.MAP_RENDER),{initial:!1}));var E=p(()=>g(o.MAP_DATA_CHANGE),500);return y.push(E),d.push(m(()=>i.updating,e=>!e&&E())),d.push(i.on("click",e=>{var t=e.mapPoint,i={x:e.x,y:e.y};r.emit(o.MAP_CLICK,{point:i,coords:[t.x,t.y]})})),{remove(){h=!0,y.forEach(e=>e.cancel()),d.forEach(e=>e.remove())}}}var d=e=>{var t=1609.344,i=e/t;if(i<.5/t)return"".concat(Math.round(e),"m");if(i<10){var n=Number.parseFloat(i.toFixed(1)),o=1===n?"mile":"miles";return"".concat(n," ").concat(o)}var r=Math.round(i),a=1===r?"mile":"miles";return"".concat(r," ").concat(a)};var y={top:0,right:0,bottom:0,left:0};function g(){return(g=t(function*(e,t){if(!e||!t)return[];var i=e.map.layers.filter(e=>e instanceof r);return i.length?(yield e.hitTest(t,{include:i.toArray()})).results.map(e=>({layerId:e.layer.id,layerTitle:e.layer.title||e.layer.id,type:e.layer.type,geometry:e.graphic.geometry,symbol:e.graphic.symbol})):[]})).apply(this,arguments)}var w=e=>e?new u({xmin:e[0],ymin:e[1],xmax:e[2],ymax:e[3],spatialReference:{wkid:27700}}):void 0,f=e=>e?new l({x:e[0],y:e[1],spatialReference:{wkid:27700}}):void 0,x=["container","padding","mapStyle","maxExtent"];class M{constructor(e){var{mapProviderConfig:t={},events:i,eventBus:n}=e;this.events=i,this.eventBus=n,this.capabilities={supportedShortcuts:c,supportsMapSizes:!1},Object.assign(this,t),this.mapEventHandles=[],this.appEventHandles=[]}initMap(a){var s=this;return t(function*(){var{container:t,padding:m,mapStyle:u,maxExtent:l}=a;e(a,x);var{events:v,eventBus:c}=s;s.setupConfig&&(yield s.setupConfig(i));var p=new r({id:"baselayer",url:u.url,visible:!0}),d=new n({layers:[p]}),y=l?w(l):null,g=new o({spatialReference:27700,container:t,map:d,zoom:a.zoom,center:f(a.center),maxExtent:l,constraints:{snapToZoom:!1,minZoom:a.minZoom,maxZoom:a.maxZoom,maxScale:0,geometry:y,rotationEnabled:!1},ui:{components:[]},popupEnabled:!1});(e=>{if(e){var t=e.querySelector(".esri-view-surface");t.removeAttribute("role"),t.tabIndex=-1,t.style["outline-color"]="transparent",t.style.touchAction="none"}})(g.container),g.padding=m,a.bounds&&g.when(()=>g.goTo(w(a.bounds),{duration:0})),s.mapEventHandles=h({mapProvider:s,view:g,baseTileLayer:p,events:v,eventBus:c,getZoom:s.getZoom.bind(s),getCenter:s.getCenter.bind(s),getBounds:s.getBounds.bind(s),getResolution:s.getResolution.bind(s)}),s.appEventHandles=function(e){var{baseTileLayer:t,events:i,eventBus:n}=e,o=e=>{t.loadStyle(e.url).then(()=>{n.emit(i.MAP_STYLE_CHANGE,e)})};return n.on(i.MAP_SET_STYLE,o),{remove(){n.off(i.MAP_SET_STYLE,o)}}}({baseTileLayer:p,events:v,eventBus:c})||[],s.map=d,s.view=g,s.baseTileLayer=p})()}destroyMap(){var e,t;null===(e=this.mapEvents)||void 0===e||e.remove(),null===(t=this.appEvents)||void 0===t||t.remove(),this.mapEvents=null,this.appEvents=null,this.view&&(this.view.container=null,this.view.destroy(),this.view=null),this.map&&(this.map.removeAll(),this.map=null)}getMapAPI(){return{map:this.map,view:this.view,crs:this.crs,fitToBounds:this.fitToBounds.bind(this),setView:this.setView.bind(this)}}setView(e){var t,{center:i,zoom:n}=e;null===(t=this.view.animation)||void 0===t||t.destroy(),this.view.goTo({center:i,zoom:n,duration:v.animationDuration})}zoomIn(e){var t;null===(t=this.view.animation)||void 0===t||t.destroy(),this.view.goTo({zoom:this.view.zoom+e,duration:v.animationDuration})}zoomOut(e){var t;null===(t=this.view.animation)||void 0===t||t.destroy(),this.view.goTo({zoom:this.view.zoom-e,duration:v.animationDuration})}panBy(e){var{x:t,y:i}=this.view.toScreen(this.view.center),n={x:t+e[0],y:i+e[1]},o=this.view.toMap(n);this.view.goTo({center:o,duration:v.animationDuration})}fitToBounds(e){this.view.goTo(w(e),{duration:v.DELAY})}setPadding(e){this.view.padding=e}getCenter(){var e=this.view.center;return[e.x,e.y].map(e=>Math.round(100*e)/100)}getZoom(){return this.view.zoom}getBounds(){var{xmin:e,ymin:t,xmax:i,ymax:n}=this.view.extent;return[e,t,i,n].map(e=>Math.round(100*e)/100)}getFeaturesAtPoint(e,t){return function(e,t){return g.apply(this,arguments)}(this.view,e)}getAreaDimensions(){return(e=>{if(!(e&&e instanceof u))return"";var t=e.xmin,i=e.ymin,n=e.xmax,o=e.ymax-i,r=d(n-t),a=d(o);return"".concat(a," by ").concat(r)})(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:y;if(!e.container)return null;var{width:i,height:n}=e.container.getBoundingClientRect(),o={x:t.left,y:n-t.bottom},r={x:i-t.right,y:t.top},a=e.toMap(o),s=e.toMap(r);return new u({xmin:a.x,ymin:a.y,xmax:s.x,ymax:s.y,spatialReference:a.spatialReference})}(this.view))}getCardinalMove(e,t){return function(e,t){var[i,n]=e,[o,r]=t,a=o-i,s=r-n,m=[];return Math.abs(s)>.1&&m.push("".concat(s>0?"north":"south"," ").concat(d(Math.abs(s)))),Math.abs(a)>.1&&m.push("".concat(a>0?"east":"west"," ").concat(d(Math.abs(a)))),m.join(", ")}(e,t)}getResolution(){return this.view.resolution}mapToScreen(e){var t=f(e),i=this.view.toScreen(t);return{x:i.x,y:i.y}}screenToMap(e){var t=this.view.toMap(e);return[t.x,t.y]}}export{M as default};
@@ -1,2 +1 @@
1
- /*! For license information please see index.js.LICENSE.txt */
2
- import{default as t}from"@arcgis/core/config.js";import{default as e}from"@arcgis/core/Map.js";import{default as n}from"@arcgis/core/views/MapView.js";import{default as r}from"@arcgis/core/layers/VectorTileLayer.js";import{once as o,watch as i,when as a}from"@arcgis/core/core/reactiveUtils.js";import{default as u}from"@arcgis/core/geometry/Extent.js";import{default as c}from"@arcgis/core/geometry/Point.js";var f={"./providers/beta/esri/src/esriProvider.js"(f,s,l){l.d(s,{default:()=>z}),l.r(s);var p={animationDuration:200},v=["showKeyboardHelp","selectControl","moveLarge","nudgeMap","zoomLarge","nudgeZoom"];function y(t){var e=t.baseTileLayer,n=t.events,r=t.eventBus,o=function(t){e.loadStyle(t.url).then(function(){r.emit(n.MAP_STYLE_CHANGE,t)})};return r.on(n.MAP_SET_STYLE,o),{remove:function(){r.off(n.MAP_SET_STYLE,o)}}}var m=function(t,e){var n=null,r=function(){for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];clearTimeout(n),n=setTimeout(function(){t.apply(void 0,o)},e)};return r.cancel=function(){n&&(clearTimeout(n),n=null)},r};function d(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 h(t){var e=t.mapProvider,n=t.view,r=t.baseTileLayer,u=t.events,c=t.eventBus,f=t.getZoom,s=t.getCenter,l=t.getBounds,p=t.getResolution,v=!1,y=[],h=[],b=function(t){var e=function(){if(v||!n||n.destroyed||!n.extent)return null;var t=n.constraints,e=t.maxZoom,r=t.minZoom;return{center:s(),bounds:l(),resolution:p(),zoom:f(),isAtMaxZoom:n.zoom+.01>=e,isAtMinZoom:n.zoom-.01<=r}}();e&&c.emit(t,e)};a(function(){return r.loaded&&n.resolution>0},function(){return b(u.MAP_LOADED)}),o(function(){return n.ready}).then(function(){v||c.emit(u.MAP_READY,e.getMapAPI())}),o(function(){return n.stationary}).then(function(){return b(u.MAP_FIRST_IDLE)});var g=m(function(){return b(u.MAP_MOVE_END)},500);h.push(g),y.push(i(function(){return[n.interacting,n.animation]},function(t){var e,n,r=(n=2,function(t){if(Array.isArray(t))return t}(e=t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,f=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);c=!0);}catch(t){f=!0,o=t}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(f)throw o}}return u}}(e,n)||function(t,e){if(t){if("string"==typeof t)return d(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)?d(t,e):void 0}}(e,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=r[0],i=r[1];(o||i)&&c.emit(u.MAP_MOVE_START),o||i||g()}));var w,O,S=(w=function(){return b(u.MAP_MOVE)},O=0,function(){var t=Date.now();t-O>=10&&(O=t,w.apply(void 0,arguments))});h.push(S),y.push(i(function(){return n.zoom},S)),y.push(i(function(){return n.extent},function(){return c.emit(u.MAP_RENDER)},{initial:!1}));var j=m(function(){return b(u.MAP_DATA_CHANGE)},500);return h.push(j),y.push(i(function(){return n.updating},function(t){return!t&&j()})),y.push(n.on("click",function(t){var e=t.mapPoint,n={x:t.x,y:t.y};c.emit(u.MAP_CLICK,{point:n,coords:[e.x,e.y]})})),{remove:function(){v=!0,h.forEach(function(t){return t.cancel()}),y.forEach(function(t){return t.remove()})}}}function b(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,o,i,a,u=[],c=!0,f=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);c=!0);}catch(t){f=!0,o=t}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(f)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return g(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)?g(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 g(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){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)),o=1===r?"mile":"miles";return"".concat(r," ").concat(o)}var i=Math.round(n),a=1===i?"mile":"miles";return"".concat(i," ").concat(a)},O={top:0,right:0,bottom:0,left:0};function S(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,f=Object.create(c.prototype);return j(f,"_invoke",function(n,r,o){var i,u,c,f=0,s=o||[],l=!1,p={p:0,n:0,v:t,a:v,f:v.bind(t,4),d:function(e,n){return i=e,u=0,c=t,p.n=n,a}};function v(n,r){for(u=n,c=r,e=0;!l&&f&&!o&&e<s.length;e++){var o,i=s[e],v=p.p,y=i[2];n>3?(o=y===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=v&&((o=n<2&&v<i[1])?(u=0,p.v=r,p.n=i[1]):v<y&&(o=n<3||i[0]>r||r>y)&&(i[4]=n,i[5]=r,p.n=y,u=0))}if(o||n>1)return a;throw l=!0,r}return function(o,s,y){if(f>1)throw TypeError("Generator is already running");for(l&&1===s&&v(s,y),u=s,c=y;(e=u<2?t:c)||!l;){i||(u?u<3?(u>1&&(p.n=-1),v(u,c)):p.n=c:p.v=c);try{if(f=2,i){if(u||(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,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(l=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{f=1}}return{value:e,done:l}}}(n,o,i),!0),f}var a={};function u(){}function c(){}function f(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(j(e={},r,function(){return this}),e),l=f.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,j(t,o,"GeneratorFunction")),t.prototype=Object.create(l),t}return c.prototype=f,j(l,"constructor",f),j(f,"constructor",c),c.displayName="GeneratorFunction",j(f,o,"GeneratorFunction"),j(l),j(l,o,"Generator"),j(l,r,function(){return this}),j(l,"toString",function(){return"[object Generator]"}),(S=function(){return{w:i,m:p}})()}function j(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}j=function(t,e,n,r){function i(e,n){j(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},j(t,e,n,r)}function x(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function P(){var t;return t=S().m(function t(e,n){var o,i;return S().w(function(t){for(;;)switch(t.n){case 0:if(e&&n){t.n=1;break}return t.a(2,[]);case 1:if((o=e.map.layers.filter(function(t){return t instanceof r})).length){t.n=2;break}return t.a(2,[]);case 2:return t.n=3,e.hitTest(n,{include:o.toArray()});case 3:return i=t.v,t.a(2,i.results.map(function(t){return{layerId:t.layer.id,layerTitle:t.layer.title||t.layer.id,type:t.layer.type,geometry:t.graphic.geometry,symbol:t.graphic.symbol}}))}},t)}),P=function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(t){x(i,r,o,a,u,"next",t)}function u(t){x(i,r,o,a,u,"throw",t)}a(void 0)})},P.apply(this,arguments)}var E=function(t){return t?new u({xmin:t[0],ymin:t[1],xmax:t[2],ymax:t[3],spatialReference:{wkid:27700}}):void 0},T=function(t){return t?new c({x:t[0],y:t[1],spatialReference:{wkid:27700}}):void 0},A=function(t){if(t){var e=t.querySelector(".esri-view-surface");e.removeAttribute("role"),e.tabIndex=-1,e.style["outline-color"]="transparent",e.style.touchAction="none"}},M=["container","padding","mapStyle","maxExtent"];function _(t){return _="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},_(t)}function k(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,f=Object.create(c.prototype);return G(f,"_invoke",function(n,r,o){var i,u,c,f=0,s=o||[],l=!1,p={p:0,n:0,v:t,a:v,f:v.bind(t,4),d:function(e,n){return i=e,u=0,c=t,p.n=n,a}};function v(n,r){for(u=n,c=r,e=0;!l&&f&&!o&&e<s.length;e++){var o,i=s[e],v=p.p,y=i[2];n>3?(o=y===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=v&&((o=n<2&&v<i[1])?(u=0,p.v=r,p.n=i[1]):v<y&&(o=n<3||i[0]>r||r>y)&&(i[4]=n,i[5]=r,p.n=y,u=0))}if(o||n>1)return a;throw l=!0,r}return function(o,s,y){if(f>1)throw TypeError("Generator is already running");for(l&&1===s&&v(s,y),u=s,c=y;(e=u<2?t:c)||!l;){i||(u?u<3?(u>1&&(p.n=-1),v(u,c)):p.n=c:p.v=c);try{if(f=2,i){if(u||(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,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(l=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{f=1}}return{value:e,done:l}}}(n,o,i),!0),f}var a={};function u(){}function c(){}function f(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(G(e={},r,function(){return this}),e),l=f.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,G(t,o,"GeneratorFunction")),t.prototype=Object.create(l),t}return c.prototype=f,G(l,"constructor",f),G(f,"constructor",c),c.displayName="GeneratorFunction",G(f,o,"GeneratorFunction"),G(l),G(l,o,"Generator"),G(l,r,function(){return this}),G(l,"toString",function(){return"[object Generator]"}),(k=function(){return{w:i,m:p}})()}function G(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}G=function(t,e,n,r){function i(e,n){G(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},G(t,e,n,r)}function C(t,e){if(null==t)return{};var n,r,o=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 i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],-1===e.indexOf(n)&&{}.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}function D(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function L(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,I(r.key),r)}}function I(t){var e=function(t){if("object"!=_(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=_(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==_(e)?e:e+""}var z=function(){return o=function t(e){var n=e.mapProviderConfig,r=void 0===n?{}:n,o=e.events,i=e.eventBus;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.events=o,this.eventBus=i,this.capabilities={supportedShortcuts:v,supportsMapSizes:!1},Object.assign(this,r),this.mapEventHandles=[],this.appEventHandles=[]},i=[{key:"initMap",value:(a=k().m(function o(i){var a,u,c,f,s,l,p,v,m,d;return k().w(function(o){for(;;)switch(o.n){case 0:if(a=i.container,u=i.padding,c=i.mapStyle,f=i.maxExtent,C(i,M),s=this.events,l=this.eventBus,!this.setupConfig){o.n=1;break}return o.n=1,this.setupConfig(t);case 1:p=new r({id:"baselayer",url:c.url,visible:!0}),v=new e({layers:[p]}),m=f?E(f):null,d=new n({spatialReference:27700,container:a,map:v,zoom:i.zoom,center:T(i.center),maxExtent:f,constraints:{snapToZoom:!1,minZoom:i.minZoom,maxZoom:i.maxZoom,maxScale:0,geometry:m,rotationEnabled:!1},ui:{components:[]},popupEnabled:!1}),A(d.container),d.padding=u,i.bounds&&d.when(function(){return d.goTo(E(i.bounds),{duration:0})}),this.mapEventHandles=h({mapProvider:this,map:v,view:d,baseTileLayer:p,events:s,eventBus:l,getZoom:this.getZoom.bind(this),getCenter:this.getCenter.bind(this),getBounds:this.getBounds.bind(this),getResolution:this.getResolution.bind(this)}),this.appEventHandles=y({baseTileLayer:p,events:s,eventBus:l})||[],this.map=v,this.view=d,this.baseTileLayer=p;case 2:return o.a(2)}},o,this)}),c=function(){var t=this,e=arguments;return new Promise(function(n,r){var o=a.apply(t,e);function i(t){D(o,n,r,i,u,"next",t)}function u(t){D(o,n,r,i,u,"throw",t)}i(void 0)})},function(t){return c.apply(this,arguments)})},{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.view&&(this.view.container=null,this.view.destroy(),this.view=null),this.map&&(this.map.removeAll(),this.map=null)}},{key:"getMapAPI",value:function(){return{map:this.map,view:this.view,crs:this.crs,fitToBounds:this.fitToBounds.bind(this),setView:this.setView.bind(this)}}},{key:"setView",value:function(t){var e,n=t.center,r=t.zoom;null===(e=this.view.animation)||void 0===e||e.destroy(),this.view.goTo({center:n,zoom:r,duration:p.animationDuration})}},{key:"zoomIn",value:function(t){var e;null===(e=this.view.animation)||void 0===e||e.destroy(),this.view.goTo({zoom:this.view.zoom+t,duration:p.animationDuration})}},{key:"zoomOut",value:function(t){var e;null===(e=this.view.animation)||void 0===e||e.destroy(),this.view.goTo({zoom:this.view.zoom-t,duration:p.animationDuration})}},{key:"panBy",value:function(t){var e=this.view.toScreen(this.view.center),n=e.x,r=e.y,o={x:n+t[0],y:r+t[1]},i=this.view.toMap(o);this.view.goTo({center:i,duration:p.animationDuration})}},{key:"fitToBounds",value:function(t){this.view.goTo(E(t),{duration:p.DELAY})}},{key:"setPadding",value:function(t){this.view.padding=t}},{key:"getCenter",value:function(){var t=this.view.center;return[t.x,t.y].map(function(t){return Math.round(100*t)/100})}},{key:"getZoom",value:function(){return this.view.zoom}},{key:"getBounds",value:function(){var t=this.view.extent;return[t.xmin,t.ymin,t.xmax,t.ymax].map(function(t){return Math.round(100*t)/100})}},{key:"getFeaturesAtPoint",value:function(t,e){return function(t,e){return P.apply(this,arguments)}(this.view,t)}},{key:"getAreaDimensions",value:function(){return function(t){if(!(t&&t instanceof u))return"";var e=t.xmin,n=t.ymin,r=t.xmax,o=t.ymax-n,i=w(r-e),a=w(o);return"".concat(a," by ").concat(i)}(function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:O;if(!t.container)return null;var n=t.container.getBoundingClientRect(),r=n.width,o=n.height,i={x:e.left,y:o-e.bottom},a={x:r-e.right,y:e.top},c=t.toMap(i),f=t.toMap(a);return new u({xmin:c.x,ymin:c.y,xmax:f.x,ymax:f.y,spatialReference:c.spatialReference})}(this.view))}},{key:"getCardinalMove",value:function(t,e){return function(t,e){var n=b(t,2),r=n[0],o=n[1],i=b(e,2),a=i[0]-r,u=i[1]-o,c=[];return Math.abs(u)>.1&&c.push("".concat(u>0?"north":"south"," ").concat(w(Math.abs(u)))),Math.abs(a)>.1&&c.push("".concat(a>0?"east":"west"," ").concat(w(Math.abs(a)))),c.join(", ")}(t,e)}},{key:"getResolution",value:function(){return this.view.resolution}},{key:"mapToScreen",value:function(t){var e=T(t),n=this.view.toScreen(e);return{x:n.x,y:n.y}}},{key:"screenToMap",value:function(t){var e=this.view.toMap(t);return[e.x,e.y]}}],i&&L(o.prototype,i),Object.defineProperty(o,"prototype",{writable:!1}),o;var o,i,a,c}()}},s={};function l(t){var e=s[t];if(void 0!==e)return e.exports;var n=s[t]={exports:{}};return f[t](n,n.exports,l),n.exports}function p(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 v(t){return v="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},v(t)}function y(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,f=Object.create(c.prototype);return m(f,"_invoke",function(n,r,o){var i,u,c,f=0,s=o||[],l=!1,p={p:0,n:0,v:t,a:v,f:v.bind(t,4),d:function(e,n){return i=e,u=0,c=t,p.n=n,a}};function v(n,r){for(u=n,c=r,e=0;!l&&f&&!o&&e<s.length;e++){var o,i=s[e],v=p.p,y=i[2];n>3?(o=y===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=v&&((o=n<2&&v<i[1])?(u=0,p.v=r,p.n=i[1]):v<y&&(o=n<3||i[0]>r||r>y)&&(i[4]=n,i[5]=r,p.n=y,u=0))}if(o||n>1)return a;throw l=!0,r}return function(o,s,y){if(f>1)throw TypeError("Generator is already running");for(l&&1===s&&v(s,y),u=s,c=y;(e=u<2?t:c)||!l;){i||(u?u<3?(u>1&&(p.n=-1),v(u,c)):p.n=c:p.v=c);try{if(f=2,i){if(u||(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,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(l=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{f=1}}return{value:e,done:l}}}(n,o,i),!0),f}var a={};function u(){}function c(){}function f(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(m(e={},r,function(){return this}),e),l=f.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,m(t,o,"GeneratorFunction")),t.prototype=Object.create(l),t}return c.prototype=f,m(l,"constructor",f),m(f,"constructor",c),c.displayName="GeneratorFunction",m(f,o,"GeneratorFunction"),m(l),m(l,o,"Generator"),m(l,r,function(){return this}),m(l,"toString",function(){return"[object Generator]"}),(y=function(){return{w:i,m:p}})()}function m(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}m=function(t,e,n,r){function i(e,n){m(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},m(t,e,n,r)}function d(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 h(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?d(Object(n),!0).forEach(function(e){b(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function b(t,e,n){return(e=function(t){var e=function(t){if("object"!=v(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=v(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==v(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function g(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}l.d=(t,e)=>{for(var n in e)l.o(e,n)&&!l.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},l.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),l.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var w=document.documentMode,O={isSupported:!!Array.prototype.findLast,error:"Array.FindLast() is not supported"},S=function(){if(!window.WebGLRenderingContext)return{isEnabled:!1,error:"WebGL is not supported"};var t,e=document.createElement("canvas"),n=!1,r=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return p(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)?p(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},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,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(["webgl2","webgl1"]);try{for(r.s();!(t=r.n()).done;){var o=t.value;try{if((n=e.getContext(o))&&"function"==typeof n.getParameter)return{isEnabled:!0}}catch(t){}}}catch(t){r.e(t)}finally{r.f()}return{isEnabled:!1,error:"WebGL is supported, but disabled"}}();function j(){var t,e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{checkDeviceCapabilities:function(){return{isSupported:O.isSupported&&S.isEnabled&&!w,error:"Internet Explorer is not supported"}},load:(t=y().m(function t(){var e,r,o;return y().w(function(t){for(;;)switch(t.p=t.n){case 0:return e=h(h({},n),{},{crs:"EPSG:27700"}),t.p=1,t.n=2,Promise.resolve().then(l.bind(l,"./providers/beta/esri/src/esriProvider.js"));case 2:return r=t.v.default,t.a(2,{MapProvider:r,mapProviderConfig:e});case 3:throw t.p=3,o=t.v,console.error("Failed to load map provider",o),o;case 4:return t.a(2)}},t,null,[[1,3]])}),e=function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(t){g(i,r,o,a,u,"next",t)}function u(t){g(i,r,o,a,u,"throw",t)}a(void 0)})},function(){return e.apply(this,arguments)})}}export{j 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 o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,o)}return t}function o(r){for(var o=1;o<arguments.length;o++){var n=null!=arguments[o]?arguments[o]:{};o%2?t(Object(n),!0).forEach(function(t){e(r,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(n,e))})}return r}var n=document.documentMode,i="Internet Explorer is not supported",p={isSupported:!!Array.prototype.findLast},a=(e=>{if(!window.WebGLRenderingContext)return{isEnabled:!1,error:"WebGL is not supported"};var r=document.createElement("canvas"),t=!1;for(var o of e)try{if((t=r.getContext(o))&&"function"==typeof t.getParameter)return{isEnabled:!0}}catch(e){}return{isEnabled:!1,error:"WebGL is supported, but disabled"}})(["webgl2","webgl1"]);function c(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{checkDeviceCapabilities:()=>({isSupported:p.isSupported&&a.isEnabled&&!n,error:i}),load:(e=r(function*(){var e=o(o({},t),{},{crs:"EPSG:27700"});try{return{MapProvider:(yield import(/* webpackChunkName: "im-esri-provider" */ "./im-esri-provider.js")).default,mapProviderConfig:e}}catch(e){throw console.error("Failed to load map provider",e),e}}),function(){return e.apply(this,arguments)})}}export{c as default};
@@ -0,0 +1 @@
1
+ import t from"@babel/runtime/helpers/asyncToGenerator";let e=" ";class r{static get separator(){return e}static set separator(t){e=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",i=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===i)switch(e){case"d":case"deg":i=4;break;case"dm":case"deg+min":i=2;break;case"dms":case"deg+min+sec":i=0;break;default:e="d",i=4}t=Math.abs(t);let a=null,o=null,n=null,s=null;switch(e){default:case"d":case"deg":o=t.toFixed(i),o<100&&(o="0"+o),o<10&&(o="0"+o),a=o+"°";break;case"dm":case"deg+min":o=Math.floor(t),n=(60*t%60).toFixed(i),60==n&&(n=(0).toFixed(i),o++),o=("000"+o).slice(-3),n<10&&(n="0"+n),a=o+"°"+r.separator+n+"′";break;case"dms":case"deg+min+sec":o=Math.floor(t),n=Math.floor(3600*t/60)%60,s=(3600*t%60).toFixed(i),60==s&&(s=(0).toFixed(i),n++),60==n&&(n=0,o++),o=("000"+o).slice(-3),n=("00"+n).slice(-2),s<10&&(s="0"+s),a=o+"°"+r.separator+n+"′"+r.separator+s+"″"}return a}static toLat(t,e,i){const a=r.toDms(r.wrap90(t),e,i);return null===a?"–":a.slice(1)+r.separator+(t<0?"S":"N")}static toLon(t,e,i){const a=r.toDms(r.wrap180(t),e,i);return null===a?"–":a+r.separator+(t<0?"W":"E")}static toBrng(t,e,i){const a=r.toDms(r.wrap360(t),e,i);return null===a?"–":a.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=r.wrap360(t);const i=4*2**(e-1);return["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][Math.round(t*i/360)%i*16/i]}static wrap90(t){if(-90<=t&&t<=90)return t;const e=t,r=360;return 1*Math.abs(((e-90)%r+r)%r-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};class i{constructor(t,e,r){if(isNaN(t)||isNaN(e)||isNaN(r))throw new TypeError(`invalid vector [${t},${e},${r}]`);this.x=Number(t),this.y=Number(e),this.z=Number(r)}get length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}plus(t){if(!(t instanceof i))throw new TypeError("v is not Vector3d object");return new i(this.x+t.x,this.y+t.y,this.z+t.z)}minus(t){if(!(t instanceof i))throw new TypeError("v is not Vector3d object");return new i(this.x-t.x,this.y-t.y,this.z-t.z)}times(t){if(isNaN(t))throw new TypeError(`invalid scalar value ‘${t}’`);return new i(this.x*t,this.y*t,this.z*t)}dividedBy(t){if(isNaN(t))throw new TypeError(`invalid scalar value ‘${t}’`);return new i(this.x/t,this.y/t,this.z/t)}dot(t){if(!(t instanceof i))throw new TypeError("v is not Vector3d object");return this.x*t.x+this.y*t.y+this.z*t.z}cross(t){if(!(t instanceof i))throw new TypeError("v is not Vector3d object");const e=this.y*t.z-this.z*t.y,r=this.z*t.x-this.x*t.z,a=this.x*t.y-this.y*t.x;return new i(e,r,a)}negate(){return new i(-this.x,-this.y,-this.z)}unit(){const t=this.length;if(1==t)return this;if(0==t)return this;const e=this.x/t,r=this.y/t,a=this.z/t;return new i(e,r,a)}angleTo(t,e=void 0){if(!(t instanceof i))throw new TypeError("v is not Vector3d object");if(!(e instanceof i||null==e))throw new TypeError("n is not Vector3d object");const r=null==e||this.cross(t).dot(e)>=0?1:-1,a=this.cross(t).length*r,o=this.dot(t);return Math.atan2(a,o)}rotateAround(t,e){if(!(t instanceof i))throw new TypeError("axis is not Vector3d object");const r=e.toRadians(),a=this.unit(),o=t.unit(),n=Math.sin(r),s=Math.cos(r),l=1-s,c=o.x,h=o.y,u=o.z,d=[[l*c*c+s,l*c*h-n*u,l*c*u+n*h],[l*c*h+n*u,l*h*h+s,l*h*u-n*c],[l*c*u-n*h,l*h*u+n*c,l*u*u+s]],p=[d[0][0]*a.x+d[0][1]*a.y+d[0][2]*a.z,d[1][0]*a.x+d[1][1]*a.y+d[1][2]*a.z,d[2][0]*a.x+d[2][1]*a.y+d[2][2]*a.z];return new i(p[0],p[1],p[2])}toString(t=3){return`[${this.x.toFixed(t)},${this.y.toFixed(t)},${this.z.toFixed(t)}]`}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};const a={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563}},o={WGS84:{ellipsoid:a.WGS84}};Object.freeze(a.WGS84),Object.freeze(o.WGS84);class n{constructor(t,e,i=0){if(isNaN(t)||null==t)throw new TypeError(`invalid lat ‘${t}’`);if(isNaN(e)||null==e)throw new TypeError(`invalid lon ‘${e}’`);if(isNaN(i)||null==i)throw new TypeError(`invalid height ‘${i}’`);this._lat=r.wrap90(Number(t)),this._lon=r.wrap180(Number(e)),this._height=Number(i)}get lat(){return this._lat}get latitude(){return this._lat}set lat(t){if(this._lat=isNaN(t)?r.wrap90(r.parse(t)):r.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid lat ‘${t}’`)}set latitude(t){if(this._lat=isNaN(t)?r.wrap90(r.parse(t)):r.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)?r.wrap180(r.parse(t)):r.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lon ‘${t}’`)}set lng(t){if(this._lon=isNaN(t)?r.wrap180(r.parse(t)):r.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lng ‘${t}’`)}set longitude(t){if(this._lon=isNaN(t)?r.wrap180(r.parse(t)):r.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid longitude ‘${t}’`)}get height(){return this._height}set height(t){if(this._height=Number(t),isNaN(this._height))throw new TypeError(`invalid height ‘${t}’`)}get datum(){return this._datum}set datum(t){this._datum=t}static get ellipsoids(){return a}static get datums(){return o}static parse(...t){if(0==t.length)throw new TypeError("invalid (empty) point");let e,i,a;if("object"==typeof t[0]&&(1==t.length||!isNaN(parseFloat(t[1])))){const o=t[0];if("Point"==o.type&&Array.isArray(o.coordinates)?([i,e,a]=o.coordinates,a=a||0):(null!=o.latitude&&(e=o.latitude),null!=o.lat&&(e=o.lat),null!=o.longitude&&(i=o.longitude),null!=o.lng&&(i=o.lng),null!=o.lon&&(i=o.lon),null!=o.height&&(a=o.height),e=r.wrap90(r.parse(e)),i=r.wrap180(r.parse(i))),null!=t[1]&&(a=t[1]),isNaN(e)||isNaN(i))throw new TypeError(`invalid point ‘${JSON.stringify(t[0])}’`)}if("string"==typeof t[0]&&2==t[0].split(",").length&&([e,i]=t[0].split(","),e=r.wrap90(r.parse(e)),i=r.wrap180(r.parse(i)),a=t[1]||0,isNaN(e)||isNaN(i)))throw new TypeError(`invalid point ‘${t[0]}’`);if(null==e&&null==i&&([e,i]=t,e=r.wrap90(r.parse(e)),i=r.wrap180(r.parse(i)),a=t[2]||0,isNaN(e)||isNaN(i)))throw new TypeError(`invalid point ‘${t.toString()}’`);return new this(e,i,a)}toCartesian(){const t=this.datum?this.datum.ellipsoid:this.referenceFrame?this.referenceFrame.ellipsoid:a.WGS84,e=this.lat.toRadians(),r=this.lon.toRadians(),i=this.height,{a:o,f:n}=t,l=Math.sin(e),c=Math.cos(e),h=Math.sin(r),u=Math.cos(r),d=2*n-n*n,p=o/Math.sqrt(1-d*l*l);return new s((p+i)*c*u,(p+i)*c*h,(p*(1-d)+i)*l)}equals(t){if(!(t instanceof n))throw new TypeError(`invalid point ‘${t}’`);return!(Math.abs(this.lat-t.lat)>Number.EPSILON)&&(!(Math.abs(this.lon-t.lon)>Number.EPSILON)&&(!(Math.abs(this.height-t.height)>Number.EPSILON)&&(this.datum==t.datum&&(this.referenceFrame==t.referenceFrame&&this.epoch==t.epoch))))}toString(t="d",e=void 0,i=null){if(!["d","dm","dms","n"].includes(t))throw new RangeError(`invalid format ‘${t}’`);const a=(this.height>=0?" +":" ")+this.height.toFixed(i)+"m";if("n"==t){null==e&&(e=4);return`${this.lat.toFixed(e)}, ${this.lon.toFixed(e)}${null==i?"":a}`}return`${r.toLat(this.lat,t,e)}, ${r.toLon(this.lon,t,e)}${null==i?"":a}`}}class s extends i{constructor(t,e,r){super(t,e,r)}toLatLon(t=a.WGS84){if(!t||!t.a)throw new TypeError(`invalid ellipsoid ‘${t}’`);const{x:e,y:r,z:i}=this,{a:o,b:s,f:l}=t,c=2*l-l*l,h=c/(1-c),u=Math.sqrt(e*e+r*r),d=s*i/(o*u)*(1+h*s/Math.sqrt(u*u+i*i)),p=d/Math.sqrt(1+d*d),m=p/d,f=isNaN(m)?0:Math.atan2(i+h*s*p*p*p,u-c*o*m*m*m),g=Math.atan2(r,e),y=Math.sin(f),w=u*Math.cos(f)+i*y-o*o/(o/Math.sqrt(1-c*y*y));return new n(f.toDegrees(),g.toDegrees(),w)}toString(t=0){return`[${this.x.toFixed(t)},${this.y.toFixed(t)},${this.z.toFixed(t)}]`}}const l={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563},Airy1830:{a:6377563.396,b:6356256.909,f:1/299.3249646},AiryModified:{a:6377340.189,b:6356034.448,f:1/299.3249646},Bessel1841:{a:6377397.155,b:6356078.962818,f:1/299.1528128},Clarke1866:{a:6378206.4,b:6356583.8,f:1/294.978698214},Clarke1880IGN:{a:6378249.2,b:6356515,f:1/293.466021294},GRS80:{a:6378137,b:6356752.31414,f:1/298.257222101},Intl1924:{a:6378388,b:6356911.946,f:1/297},WGS72:{a:6378135,b:6356750.5,f:1/298.26}},c={ED50:{ellipsoid:l.Intl1924,transform:[89.5,93.8,123.1,-1.2,0,0,.156]},ETRS89:{ellipsoid:l.GRS80,transform:[0,0,0,0,0,0,0]},Irl1975:{ellipsoid:l.AiryModified,transform:[-482.53,130.596,-564.557,-8.15,1.042,.214,.631]},NAD27:{ellipsoid:l.Clarke1866,transform:[8,-160,-176,0,0,0,0]},NAD83:{ellipsoid:l.GRS80,transform:[.9956,-1.9103,-.5215,-62e-5,.025915,.009426,.011599]},NTF:{ellipsoid:l.Clarke1880IGN,transform:[168,60,-320,0,0,0,0]},OSGB36:{ellipsoid:l.Airy1830,transform:[-446.448,125.157,-542.06,20.4894,-.1502,-.247,-.8421]},Potsdam:{ellipsoid:l.Bessel1841,transform:[-582,-105,-414,-8.3,1.04,.35,-3.08]},TokyoJapan:{ellipsoid:l.Bessel1841,transform:[148,-507,-685,0,0,0,0]},WGS72:{ellipsoid:l.WGS72,transform:[0,0,-4.5,-.22,0,0,.554]},WGS84:{ellipsoid:l.WGS84,transform:[0,0,0,0,0,0,0]}};Object.keys(l).forEach(t=>Object.freeze(l[t])),Object.keys(c).forEach(t=>{Object.freeze(c[t]),Object.freeze(c[t].transform)});class h extends n{constructor(t,e,r=0,i=c.WGS84){if(!i||null==i.ellipsoid)throw new TypeError(`unrecognised datum ‘${i}’`);super(t,e,r),this._datum=i}get datum(){return this._datum}static get ellipsoids(){return l}static get datums(){return c}static parse(...t){let e=c.WGS84;if((4==t.length||3==t.length&&"object"==typeof t[2])&&(e=t.pop()),!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);const r=super.parse(...t);return r._datum=e,r}convertDatum(t){if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);return this.toCartesian().convertDatum(t).toLatLon()}toCartesian(){const t=super.toCartesian();return new u(t.x,t.y,t.z,this.datum)}}class u extends s{constructor(t,e,r,i=void 0){if(i&&null==i.ellipsoid)throw new TypeError(`unrecognised datum ‘${i}’`);super(t,e,r),i&&(this._datum=i)}get datum(){return this._datum}set datum(t){if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);this._datum=t}toLatLon(t=void 0){t&&(console.info("datum parameter to Cartesian_Datum.toLatLon is deprecated: set datum before calling toLatLon()"),this.datum=t);const e=this.datum||c.WGS84;if(!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);const r=super.toLatLon(e.ellipsoid);return new h(r.lat,r.lon,r.height,this.datum)}convertDatum(t){if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);if(!this.datum)throw new TypeError("cartesian coordinate has no datum");let e=null,r=null;null!=this.datum&&this.datum!=c.WGS84||(e=this,r=t.transform),t==c.WGS84&&(e=this,r=this.datum.transform.map(t=>-t)),null==r&&(e=this.convertDatum(c.WGS84),r=t.transform);const i=e.applyTransform(r);return i.datum=t,i}applyTransform(t){const{x:e,y:r,z:i}=this,a=t[0],o=t[1],n=t[2],s=t[3]/1e6+1,l=(t[4]/3600).toRadians(),c=(t[5]/3600).toRadians(),h=(t[6]/3600).toRadians();return new u(a+e*s-r*h+i*c,o+e*h+r*s-i*l,n-e*c+r*l+i*s)}}const d={trueOrigin:{lat:49,lon:-2},scaleFactor:.9996012717,ellipsoid:h.ellipsoids.Airy1830};class p{constructor(t,e){if(this.easting=Number(t),this.northing=Number(e),isNaN(t)||this.easting<0||this.easting>7e5)throw new RangeError(`invalid easting ‘${t}’`);if(isNaN(e)||this.northing<0||this.northing>13e5)throw new RangeError(`invalid northing ‘${e}’`)}toLatLon(t=h.datums.WGS84){const{easting:e,northing:r}=this,{a:i,b:a}=d.ellipsoid,o=d.trueOrigin.lat.toRadians(),n=d.trueOrigin.lon.toRadians(),s=-1e5,l=d.scaleFactor,c=1-a*a/(i*i),u=(i-a)/(i+a),p=u*u,f=u*u*u;let g=o,y=0;do{g=(r-s-y)/(i*l)+g;y=a*l*((1+u+5/4*p+5/4*f)*(g-o)-(3*u+3*u*u+21/8*f)*Math.sin(g-o)*Math.cos(g+o)+(15/8*p+15/8*f)*Math.sin(2*(g-o))*Math.cos(2*(g+o))-35/24*f*Math.sin(3*(g-o))*Math.cos(3*(g+o)))}while(Math.abs(r-s-y)>=1e-5);const w=Math.cos(g),N=Math.sin(g),_=i*l/Math.sqrt(1-c*N*N),E=i*l*(1-c)/Math.pow(1-c*N*N,1.5),b=_/E-1,S=Math.tan(g),M=S*S,v=M*M,$=1/w,T=_*_*_,x=T*_*_,G=e-4e5,R=G*G,W=R*G,F=R*R,O=W*R;g=g-S/(2*E*_)*R+S/(24*E*T)*(5+3*M+b-9*M*b)*F-S/(720*E*x)*(61+90*M+45*v)*(F*R);const L=n+$/_*G-$/(6*T)*(_/E+2*M)*W+$/(120*x)*(5+28*M+24*v)*O-$/(5040*(x*_*_))*(61+662*M+1320*v+720*(v*M))*(O*R);let z=new m(g.toDegrees(),L.toDegrees(),0,h.datums.OSGB36);return t!=h.datums.OSGB36&&(z=z.convertDatum(t),z=new m(z.lat,z.lon,z.height,z.datum)),z}static parse(t){let e=(t=String(t).trim()).match(/^(\d+),\s*(\d+)$/);if(e)return new p(e[1],e[2]);if(e=t.match(/^[HNST][ABCDEFGHJKLMNOPQRSTUVWXYZ]\s*[0-9]+\s*[0-9]+$/i),!e)throw new Error(`invalid grid reference ‘${t}’`);let r=t.toUpperCase().charCodeAt(0)-"A".charCodeAt(0),i=t.toUpperCase().charCodeAt(1)-"A".charCodeAt(0);r>7&&r--,i>7&&i--;const a=(r-2)%5*5+i%5,o=19-5*Math.floor(r/5)-Math.floor(i/5);let n=t.slice(2).trim().split(/\s+/);if(1==n.length&&(n=[n[0].slice(0,n[0].length/2),n[0].slice(n[0].length/2)]),n[0].length!=n[1].length)throw new Error(`invalid grid reference ‘${t}’`);n[0]=n[0].padEnd(5,"0"),n[1]=n[1].padEnd(5,"0");const s=a+n[0],l=o+n[1];return new p(s,l)}toString(t=10){if(![0,2,4,6,8,10,12,14,16].includes(Number(t)))throw new RangeError(`invalid precision ‘${t}’`);let{easting:e,northing:r}=this;if(0==t){const t={useGrouping:!1,minimumIntegerDigits:6,maximumFractionDigits:3};return`${e.toLocaleString("en",t)},${r.toLocaleString("en",t)}`}const i=Math.floor(e/1e5),a=Math.floor(r/1e5);let o=19-a-(19-a)%5+Math.floor((i+10)/5),n=5*(19-a)%25+i%5;o>7&&o++,n>7&&n++;const s=String.fromCharCode(o+"A".charCodeAt(0),n+"A".charCodeAt(0));return e=Math.floor(e%1e5/Math.pow(10,5-t/2)),r=Math.floor(r%1e5/Math.pow(10,5-t/2)),e=e.toString().padStart(t/2,"0"),r=r.toString().padStart(t/2,"0"),`${s} ${e} ${r}`}}class m extends h{toOsGrid(){const t=this.datum==h.datums.OSGB36?this:this.convertDatum(h.datums.OSGB36),e=t.lat.toRadians(),r=t.lon.toRadians(),{a:i,b:a}=d.ellipsoid,o=d.trueOrigin.lat.toRadians(),n=d.trueOrigin.lon.toRadians(),s=d.scaleFactor,l=1-a*a/(i*i),c=(i-a)/(i+a),u=c*c,m=c*c*c,f=Math.cos(e),g=Math.sin(e),y=i*s/Math.sqrt(1-l*g*g),w=i*s*(1-l)/Math.pow(1-l*g*g,1.5),N=y/w-1,_=a*s*((1+c+5/4*u+5/4*m)*(e-o)-(3*c+3*c*c+21/8*m)*Math.sin(e-o)*Math.cos(e+o)+(15/8*u+15/8*m)*Math.sin(2*(e-o))*Math.cos(2*(e+o))-35/24*m*Math.sin(3*(e-o))*Math.cos(3*(e+o))),E=f*f*f,b=E*f*f,S=Math.tan(e)*Math.tan(e),M=S*S,v=r-n,$=v*v,T=$*v,x=T*v,G=x*v;let R=_+-1e5+y/2*g*f*$+y/24*g*E*(5-S+9*N)*x+y/720*g*b*(61-58*S+M)*(G*v),W=4e5+y*f*v+y/6*E*(y/w-S)*T+y/120*b*(5-18*S+M+14*N-58*S*N)*G;R=Number(R.toFixed(3)),W=Number(W.toFixed(3));try{return new p(W,R)}catch(e){throw new Error(`${e.message} from (${t.lat.toFixed(6)},${t.lon.toFixed(6)}).toOsGrid()`)}}convertDatum(t){const e=super.convertDatum(t);return new m(e.lat,e.lon,e.height,e.datum)}}var f=function(){var e=t(function*(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"https://api.os.uk/search/names/v1/nearest?point={easting},{northing}&radius=1000&fq=local_type:Airfield%20local_type:Airport%20local_type:Bus_Station%20local_type:Chemical_Works%20local_type:City%20local_type:Coach_Station%20local_type:Electricity_Distribution%20local_type:Electricity_Production%20local_type:Further_Education%20local_type:Gas_Distribution_or_Storage%20local_type:Hamlet%20local_type:Harbour%20local_type:Helicopter_Station%20local_type:Heliport%20local_type:Higher_or_University_Education%20local_type:Hill_Or_Mountain%20local_type:Hospice%20local_type:Hospital%20local_type:Medical_Care_Accommodation%20local_type:Named_Road%20local_type:Non_State_Primary_Education%20local_type:Non_State_Secondary_Education%20local_type:Other_Settlement%20local_type:Passenger_Ferry_Terminal%20local_type:Port_Consisting_of_Docks_and_Nautical_Berthing%20local_type:Postcode%20local_type:Primary_Education%20local_type:Railway_Station%20local_type:Road_User_Services%20local_type:Secondary_Education%20local_type:Section_Of_Named_Road%20local_type:Section_Of_Numbered_Road%20local_type:Special_Needs_Education%20local_type:Suburban_Area%20local_type:Town%20local_type:Urban_Greenspace%20local_type:Vehicular_Ferry_Terminal%20local_type:Vehicular_Rail_Terminal%20local_type:Village%20local_type:Waterfall%20",e=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,i=arguments.length>4?arguments[4]:void 0,a=i;if("EPSG:4326"===r)try{a=[(a=new m(i[1],i[0]).toOsGrid()).easting,a.northing].map(t=>Math.round(t))}catch(t){return console.log(t),null}t=t.replace("{easting}",Math.round(a[0])).replace("{northing}",Math.round(a[1]));var o=new Request(t,{method:"GET"});if(e)try{o=yield e(o)}catch(t){return console.log("Error transforming request:",t),null}var n=yield fetch(o),s=yield n.json(),l=function(t){var{ID:e,NAME1:r,POPULATED_PLACE:i,COUNTY_UNITARY:a,REGION:o,GEOMETRY_X:n,GEOMETRY_Y:s}=t;return{id:e||"",place:"".concat(r).concat(i?", "+i:"").concat(a?", "+a:"",", ").concat(o),county:a||"",coordinates:[n,s]}}(s.results[0].GAZETTEER_ENTRY);if("EPSG:4326"===r){var c=new p(l.coordinates[0],l.coordinates[1]).toLatLon();l.coordinates=[c.lat,c.lon]}var h="Approximate centre ".concat(null==l?void 0:l.place);return s.results?h:null});return function(){return e.apply(this,arguments)}}();export{f as reverseGeocode};
@@ -1,2 +1 @@
1
- /*! For license information please see index.js.LICENSE.txt */
2
- var t={"./providers/beta/open-names/src/reverseGeocode.js"(t,e,r){r.d(e,{reverseGeocode:()=>S}),r.r(e);let n=" ";class o{static get separator(){return n}static set separator(t){n=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,i=null,a=null,s=null;switch(e){default:case"d":case"deg":i=t.toFixed(r),i<100&&(i="0"+i),i<10&&(i="0"+i),n=i+"°";break;case"dm":case"deg+min":i=Math.floor(t),a=(60*t%60).toFixed(r),60==a&&(a=(0).toFixed(r),i++),i=("000"+i).slice(-3),a<10&&(a="0"+a),n=i+"°"+o.separator+a+"′";break;case"dms":case"deg+min+sec":i=Math.floor(t),a=Math.floor(3600*t/60)%60,s=(3600*t%60).toFixed(r),60==s&&(s=(0).toFixed(r),a++),60==a&&(a=0,i++),i=("000"+i).slice(-3),a=("00"+a).slice(-2),s<10&&(s="0"+s),n=i+"°"+o.separator+a+"′"+o.separator+s+"″"}return n}static toLat(t,e,r){const n=o.toDms(o.wrap90(t),e,r);return null===n?"–":n.slice(1)+o.separator+(t<0?"S":"N")}static toLon(t,e,r){const n=o.toDms(o.wrap180(t),e,r);return null===n?"–":n+o.separator+(t<0?"W":"E")}static toBrng(t,e,r){const n=o.toDms(o.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=o.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 i=o;class a{constructor(t,e,r){if(isNaN(t)||isNaN(e)||isNaN(r))throw new TypeError(`invalid vector [${t},${e},${r}]`);this.x=Number(t),this.y=Number(e),this.z=Number(r)}get length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}plus(t){if(!(t instanceof a))throw new TypeError("v is not Vector3d object");return new a(this.x+t.x,this.y+t.y,this.z+t.z)}minus(t){if(!(t instanceof a))throw new TypeError("v is not Vector3d object");return new a(this.x-t.x,this.y-t.y,this.z-t.z)}times(t){if(isNaN(t))throw new TypeError(`invalid scalar value ‘${t}’`);return new a(this.x*t,this.y*t,this.z*t)}dividedBy(t){if(isNaN(t))throw new TypeError(`invalid scalar value ‘${t}’`);return new a(this.x/t,this.y/t,this.z/t)}dot(t){if(!(t instanceof a))throw new TypeError("v is not Vector3d object");return this.x*t.x+this.y*t.y+this.z*t.z}cross(t){if(!(t instanceof a))throw new TypeError("v is not Vector3d object");const e=this.y*t.z-this.z*t.y,r=this.z*t.x-this.x*t.z,n=this.x*t.y-this.y*t.x;return new a(e,r,n)}negate(){return new a(-this.x,-this.y,-this.z)}unit(){const t=this.length;if(1==t)return this;if(0==t)return this;const e=this.x/t,r=this.y/t,n=this.z/t;return new a(e,r,n)}angleTo(t,e=void 0){if(!(t instanceof a))throw new TypeError("v is not Vector3d object");if(!(e instanceof a||null==e))throw new TypeError("n is not Vector3d object");const r=null==e||this.cross(t).dot(e)>=0?1:-1,n=this.cross(t).length*r,o=this.dot(t);return Math.atan2(n,o)}rotateAround(t,e){if(!(t instanceof a))throw new TypeError("axis is not Vector3d object");const r=e.toRadians(),n=this.unit(),o=t.unit(),i=Math.sin(r),s=Math.cos(r),l=1-s,c=o.x,u=o.y,h=o.z,p=[[l*c*c+s,l*c*u-i*h,l*c*h+i*u],[l*c*u+i*h,l*u*u+s,l*u*h-i*c],[l*c*h-i*u,l*u*h+i*c,l*h*h+s]],d=[p[0][0]*n.x+p[0][1]*n.y+p[0][2]*n.z,p[1][0]*n.x+p[1][1]*n.y+p[1][2]*n.z,p[2][0]*n.x+p[2][1]*n.y+p[2][2]*n.z];return new a(d[0],d[1],d[2])}toString(t=3){return`[${this.x.toFixed(t)},${this.y.toFixed(t)},${this.z.toFixed(t)}]`}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};const s=a,l={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563}},c={WGS84:{ellipsoid:l.WGS84}};Object.freeze(l.WGS84),Object.freeze(c.WGS84);class u{constructor(t,e,r=0){if(isNaN(t)||null==t)throw new TypeError(`invalid lat ‘${t}’`);if(isNaN(e)||null==e)throw new TypeError(`invalid lon ‘${e}’`);if(isNaN(r)||null==r)throw new TypeError(`invalid height ‘${r}’`);this._lat=i.wrap90(Number(t)),this._lon=i.wrap180(Number(e)),this._height=Number(r)}get lat(){return this._lat}get latitude(){return this._lat}set lat(t){if(this._lat=isNaN(t)?i.wrap90(i.parse(t)):i.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid lat ‘${t}’`)}set latitude(t){if(this._lat=isNaN(t)?i.wrap90(i.parse(t)):i.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)?i.wrap180(i.parse(t)):i.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lon ‘${t}’`)}set lng(t){if(this._lon=isNaN(t)?i.wrap180(i.parse(t)):i.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lng ‘${t}’`)}set longitude(t){if(this._lon=isNaN(t)?i.wrap180(i.parse(t)):i.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid longitude ‘${t}’`)}get height(){return this._height}set height(t){if(this._height=Number(t),isNaN(this._height))throw new TypeError(`invalid height ‘${t}’`)}get datum(){return this._datum}set datum(t){this._datum=t}static get ellipsoids(){return l}static get datums(){return c}static parse(...t){if(0==t.length)throw new TypeError("invalid (empty) point");let e,r,n;if("object"==typeof t[0]&&(1==t.length||!isNaN(parseFloat(t[1])))){const o=t[0];if("Point"==o.type&&Array.isArray(o.coordinates)?([r,e,n]=o.coordinates,n=n||0):(null!=o.latitude&&(e=o.latitude),null!=o.lat&&(e=o.lat),null!=o.longitude&&(r=o.longitude),null!=o.lng&&(r=o.lng),null!=o.lon&&(r=o.lon),null!=o.height&&(n=o.height),e=i.wrap90(i.parse(e)),r=i.wrap180(i.parse(r))),null!=t[1]&&(n=t[1]),isNaN(e)||isNaN(r))throw new TypeError(`invalid point ‘${JSON.stringify(t[0])}’`)}if("string"==typeof t[0]&&2==t[0].split(",").length&&([e,r]=t[0].split(","),e=i.wrap90(i.parse(e)),r=i.wrap180(i.parse(r)),n=t[1]||0,isNaN(e)||isNaN(r)))throw new TypeError(`invalid point ‘${t[0]}’`);if(null==e&&null==r&&([e,r]=t,e=i.wrap90(i.parse(e)),r=i.wrap180(i.parse(r)),n=t[2]||0,isNaN(e)||isNaN(r)))throw new TypeError(`invalid point ‘${t.toString()}’`);return new this(e,r,n)}toCartesian(){const t=this.datum?this.datum.ellipsoid:this.referenceFrame?this.referenceFrame.ellipsoid:l.WGS84,e=this.lat.toRadians(),r=this.lon.toRadians(),n=this.height,{a:o,f:i}=t,a=Math.sin(e),s=Math.cos(e),c=Math.sin(r),u=Math.cos(r),p=2*i-i*i,d=o/Math.sqrt(1-p*a*a);return new h((d+n)*s*u,(d+n)*s*c,(d*(1-p)+n)*a)}equals(t){if(!(t instanceof u))throw new TypeError(`invalid point ‘${t}’`);return!(Math.abs(this.lat-t.lat)>Number.EPSILON||Math.abs(this.lon-t.lon)>Number.EPSILON||Math.abs(this.height-t.height)>Number.EPSILON||this.datum!=t.datum||this.referenceFrame!=t.referenceFrame||this.epoch!=t.epoch)}toString(t="d",e=void 0,r=null){if(!["d","dm","dms","n"].includes(t))throw new RangeError(`invalid format ‘${t}’`);const n=(this.height>=0?" +":" ")+this.height.toFixed(r)+"m";return"n"==t?(null==e&&(e=4),`${this.lat.toFixed(e)}, ${this.lon.toFixed(e)}${null==r?"":n}`):`${i.toLat(this.lat,t,e)}, ${i.toLon(this.lon,t,e)}${null==r?"":n}`}}class h extends s{constructor(t,e,r){super(t,e,r)}toLatLon(t=l.WGS84){if(!t||!t.a)throw new TypeError(`invalid ellipsoid ‘${t}’`);const{x:e,y:r,z:n}=this,{a:o,b:i,f:a}=t,s=2*a-a*a,c=s/(1-s),h=Math.sqrt(e*e+r*r),p=i*n/(o*h)*(1+c*i/Math.sqrt(h*h+n*n)),d=p/Math.sqrt(1+p*p),f=d/p,y=isNaN(f)?0:Math.atan2(n+c*i*d*d*d,h-s*o*f*f*f),m=Math.atan2(r,e),g=Math.sin(y),w=h*Math.cos(y)+n*g-o*o/(o/Math.sqrt(1-s*g*g));return new u(y.toDegrees(),m.toDegrees(),w)}toString(t=0){return`[${this.x.toFixed(t)},${this.y.toFixed(t)},${this.z.toFixed(t)}]`}}const p={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563},Airy1830:{a:6377563.396,b:6356256.909,f:1/299.3249646},AiryModified:{a:6377340.189,b:6356034.448,f:1/299.3249646},Bessel1841:{a:6377397.155,b:6356078.962818,f:1/299.1528128},Clarke1866:{a:6378206.4,b:6356583.8,f:1/294.978698214},Clarke1880IGN:{a:6378249.2,b:6356515,f:1/293.466021294},GRS80:{a:6378137,b:6356752.31414,f:1/298.257222101},Intl1924:{a:6378388,b:6356911.946,f:1/297},WGS72:{a:6378135,b:6356750.5,f:1/298.26}},d={ED50:{ellipsoid:p.Intl1924,transform:[89.5,93.8,123.1,-1.2,0,0,.156]},ETRS89:{ellipsoid:p.GRS80,transform:[0,0,0,0,0,0,0]},Irl1975:{ellipsoid:p.AiryModified,transform:[-482.53,130.596,-564.557,-8.15,1.042,.214,.631]},NAD27:{ellipsoid:p.Clarke1866,transform:[8,-160,-176,0,0,0,0]},NAD83:{ellipsoid:p.GRS80,transform:[.9956,-1.9103,-.5215,-62e-5,.025915,.009426,.011599]},NTF:{ellipsoid:p.Clarke1880IGN,transform:[168,60,-320,0,0,0,0]},OSGB36:{ellipsoid:p.Airy1830,transform:[-446.448,125.157,-542.06,20.4894,-.1502,-.247,-.8421]},Potsdam:{ellipsoid:p.Bessel1841,transform:[-582,-105,-414,-8.3,1.04,.35,-3.08]},TokyoJapan:{ellipsoid:p.Bessel1841,transform:[148,-507,-685,0,0,0,0]},WGS72:{ellipsoid:p.WGS72,transform:[0,0,-4.5,-.22,0,0,.554]},WGS84:{ellipsoid:p.WGS84,transform:[0,0,0,0,0,0,0]}};Object.keys(p).forEach(t=>Object.freeze(p[t])),Object.keys(d).forEach(t=>{Object.freeze(d[t]),Object.freeze(d[t].transform)});class f extends u{constructor(t,e,r=0,n=d.WGS84){if(!n||null==n.ellipsoid)throw new TypeError(`unrecognised datum ‘${n}’`);super(t,e,r),this._datum=n}get datum(){return this._datum}static get ellipsoids(){return p}static get datums(){return d}static parse(...t){let e=d.WGS84;if((4==t.length||3==t.length&&"object"==typeof t[2])&&(e=t.pop()),!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);const r=super.parse(...t);return r._datum=e,r}convertDatum(t){if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);return this.toCartesian().convertDatum(t).toLatLon()}toCartesian(){const t=super.toCartesian();return new y(t.x,t.y,t.z,this.datum)}}class y extends h{constructor(t,e,r,n=void 0){if(n&&null==n.ellipsoid)throw new TypeError(`unrecognised datum ‘${n}’`);super(t,e,r),n&&(this._datum=n)}get datum(){return this._datum}set datum(t){if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);this._datum=t}toLatLon(t=void 0){t&&(console.info("datum parameter to Cartesian_Datum.toLatLon is deprecated: set datum before calling toLatLon()"),this.datum=t);const e=this.datum||d.WGS84;if(!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);const r=super.toLatLon(e.ellipsoid);return new f(r.lat,r.lon,r.height,this.datum)}convertDatum(t){if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);if(!this.datum)throw new TypeError("cartesian coordinate has no datum");let e=null,r=null;null!=this.datum&&this.datum!=d.WGS84||(e=this,r=t.transform),t==d.WGS84&&(e=this,r=this.datum.transform.map(t=>-t)),null==r&&(e=this.convertDatum(d.WGS84),r=t.transform);const n=e.applyTransform(r);return n.datum=t,n}applyTransform(t){const{x:e,y:r,z:n}=this,o=t[0],i=t[1],a=t[2],s=t[3]/1e6+1,l=(t[4]/3600).toRadians(),c=(t[5]/3600).toRadians(),u=(t[6]/3600).toRadians();return new y(o+e*s-r*u+n*c,i+e*u+r*s-n*l,a-e*c+r*l+n*s)}}const m={trueOrigin:{lat:49,lon:-2},falseOrigin:{easting:-4e5,northing:1e5},scaleFactor:.9996012717,ellipsoid:f.ellipsoids.Airy1830};class g{constructor(t,e){if(this.easting=Number(t),this.northing=Number(e),isNaN(t)||this.easting<0||this.easting>7e5)throw new RangeError(`invalid easting ‘${t}’`);if(isNaN(e)||this.northing<0||this.northing>13e5)throw new RangeError(`invalid northing ‘${e}’`)}toLatLon(t=f.datums.WGS84){const{easting:e,northing:r}=this,{a:n,b:o}=m.ellipsoid,i=m.trueOrigin.lat.toRadians(),a=m.trueOrigin.lon.toRadians(),s=-m.falseOrigin.easting,l=-m.falseOrigin.northing,c=m.scaleFactor,u=1-o*o/(n*n),h=(n-o)/(n+o),p=h*h,d=h*h*h;let y=i,g=0;do{y=(r-l-g)/(n*c)+y,g=o*c*((1+h+5/4*p+5/4*d)*(y-i)-(3*h+3*h*h+21/8*d)*Math.sin(y-i)*Math.cos(y+i)+(15/8*p+15/8*d)*Math.sin(2*(y-i))*Math.cos(2*(y+i))-35/24*d*Math.sin(3*(y-i))*Math.cos(3*(y+i)))}while(Math.abs(r-l-g)>=1e-5);const b=Math.cos(y),v=Math.sin(y),_=n*c/Math.sqrt(1-u*v*v),N=n*c*(1-u)/Math.pow(1-u*v*v,1.5),S=_/N-1,E=Math.tan(y),O=E*E,M=O*O,T=1/b,x=_*_*_,G=x*_*_,$=e-s,j=$*$,P=j*$,F=j*j,R=P*j;y=y-E/(2*N*_)*j+E/(24*N*x)*(5+3*O+S-9*O*S)*F-E/(720*N*G)*(61+90*O+45*M)*(F*j);const W=a+T/_*$-T/(6*x)*(_/N+2*O)*P+T/(120*G)*(5+28*O+24*M)*R-T/(G*_*_*5040)*(61+662*O+1320*M+M*O*720)*(R*j);let D=new w(y.toDegrees(),W.toDegrees(),0,f.datums.OSGB36);return t!=f.datums.OSGB36&&(D=D.convertDatum(t),D=new w(D.lat,D.lon,D.height,D.datum)),D}static parse(t){let e=(t=String(t).trim()).match(/^(\d+),\s*(\d+)$/);if(e)return new g(e[1],e[2]);if(e=t.match(/^[HNST][ABCDEFGHJKLMNOPQRSTUVWXYZ]\s*[0-9]+\s*[0-9]+$/i),!e)throw new Error(`invalid grid reference ‘${t}’`);let r=t.toUpperCase().charCodeAt(0)-"A".charCodeAt(0),n=t.toUpperCase().charCodeAt(1)-"A".charCodeAt(0);r>7&&r--,n>7&&n--;const o=(r-2)%5*5+n%5,i=19-5*Math.floor(r/5)-Math.floor(n/5);let a=t.slice(2).trim().split(/\s+/);if(1==a.length&&(a=[a[0].slice(0,a[0].length/2),a[0].slice(a[0].length/2)]),a[0].length!=a[1].length)throw new Error(`invalid grid reference ‘${t}’`);a[0]=a[0].padEnd(5,"0"),a[1]=a[1].padEnd(5,"0");const s=o+a[0],l=i+a[1];return new g(s,l)}toString(t=10){if(![0,2,4,6,8,10,12,14,16].includes(Number(t)))throw new RangeError(`invalid precision ‘${t}’`);let{easting:e,northing:r}=this;if(0==t){const t={useGrouping:!1,minimumIntegerDigits:6,maximumFractionDigits:3};return`${e.toLocaleString("en",t)},${r.toLocaleString("en",t)}`}const n=Math.floor(e/1e5),o=Math.floor(r/1e5);let i=19-o-(19-o)%5+Math.floor((n+10)/5),a=5*(19-o)%25+n%5;i>7&&i++,a>7&&a++;const s=String.fromCharCode(i+"A".charCodeAt(0),a+"A".charCodeAt(0));return e=Math.floor(e%1e5/Math.pow(10,5-t/2)),r=Math.floor(r%1e5/Math.pow(10,5-t/2)),e=e.toString().padStart(t/2,"0"),r=r.toString().padStart(t/2,"0"),`${s} ${e} ${r}`}}class w extends f{toOsGrid(){const t=this.datum==f.datums.OSGB36?this:this.convertDatum(f.datums.OSGB36),e=t.lat.toRadians(),r=t.lon.toRadians(),{a:n,b:o}=m.ellipsoid,i=m.trueOrigin.lat.toRadians(),a=m.trueOrigin.lon.toRadians(),s=-m.falseOrigin.easting,l=-m.falseOrigin.northing,c=m.scaleFactor,u=1-o*o/(n*n),h=(n-o)/(n+o),p=h*h,d=h*h*h,y=Math.cos(e),w=Math.sin(e),b=n*c/Math.sqrt(1-u*w*w),v=n*c*(1-u)/Math.pow(1-u*w*w,1.5),_=b/v-1,N=o*c*((1+h+5/4*p+5/4*d)*(e-i)-(3*h+3*h*h+21/8*d)*Math.sin(e-i)*Math.cos(e+i)+(15/8*p+15/8*d)*Math.sin(2*(e-i))*Math.cos(2*(e+i))-35/24*d*Math.sin(3*(e-i))*Math.cos(3*(e+i))),S=y*y*y,E=S*y*y,O=Math.tan(e)*Math.tan(e),M=O*O,T=r-a,x=T*T,G=x*T,$=G*T,j=$*T;let P=N+l+b/2*w*y*x+b/24*w*S*(5-O+9*_)*$+b/720*w*E*(61-58*O+M)*(j*T),F=s+b*y*T+b/6*S*(b/v-O)*G+b/120*E*(5-18*O+M+14*_-58*O*_)*j;P=Number(P.toFixed(3)),F=Number(F.toFixed(3));try{return new g(F,P)}catch(e){throw new Error(`${e.message} from (${t.lat.toFixed(6)},${t.lon.toFixed(6)}).toOsGrid()`)}}convertDatum(t){const e=super.convertDatum(t);return new w(e.lat,e.lon,e.height,e.datum)}}function b(t){var e=t.ID,r=t.NAME1,n=t.POPULATED_PLACE,o=t.COUNTY_UNITARY,i=t.REGION,a=t.GEOMETRY_X,s=t.GEOMETRY_Y;return{id:e||"",place:"".concat(r).concat(n?", "+n:"").concat(o?", "+o:"",", ").concat(i),county:o||"",coordinates:[a,s]}}function v(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var l=n&&n.prototype instanceof s?n:s,c=Object.create(l.prototype);return _(c,"_invoke",function(r,n,o){var i,s,l,c=0,u=o||[],h=!1,p={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,r){return i=e,s=0,l=t,p.n=r,a}};function d(r,n){for(s=r,l=n,e=0;!h&&c&&!o&&e<u.length;e++){var o,i=u[e],d=p.p,f=i[2];r>3?(o=f===n)&&(l=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=t):i[0]<=d&&((o=r<2&&d<i[1])?(s=0,p.v=n,p.n=i[1]):d<f&&(o=r<3||i[0]>n||n>f)&&(i[4]=r,i[5]=n,p.n=f,s=0))}if(o||r>1)return a;throw h=!0,n}return function(o,u,f){if(c>1)throw TypeError("Generator is already running");for(h&&1===u&&d(u,f),s=u,l=f;(e=s<2?t:l)||!h;){i||(s?s<3?(s>1&&(p.n=-1),d(s,l)):p.n=l:p.v=l);try{if(c=2,i){if(s||(o="next"),e=i[o]){if(!(e=e.call(i,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=i.return)&&e.call(i),s<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=t}else if((e=(h=p.n<0)?l:r.call(n,p))!==a)break}catch(e){i=t,s=1,l=e}finally{c=1}}return{value:e,done:h}}}(r,o,i),!0),c}var a={};function s(){}function l(){}function c(){}e=Object.getPrototypeOf;var u=[][n]?e(e([][n]())):(_(e={},n,function(){return this}),e),h=c.prototype=s.prototype=Object.create(u);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,_(t,o,"GeneratorFunction")),t.prototype=Object.create(h),t}return l.prototype=c,_(h,"constructor",c),_(c,"constructor",l),l.displayName="GeneratorFunction",_(c,o,"GeneratorFunction"),_(h),_(h,o,"Generator"),_(h,n,function(){return this}),_(h,"toString",function(){return"[object Generator]"}),(v=function(){return{w:i,m:p}})()}function _(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}_=function(t,e,r,n){function i(e,r){_(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(i("next",0),i("throw",1),i("return",2))},_(t,e,r,n)}function N(t,e,r,n,o,i,a){try{var s=t[i](a),l=s.value}catch(t){return void r(t)}s.done?e(l):Promise.resolve(l).then(n,o)}var S=function(){var t,e=(t=v().m(function t(){var e,r,n,o,i,a,s,l,c,u,h,p,d,f,y=arguments;return v().w(function(t){for(;;)switch(t.p=t.n){case 0:if(e=y.length>0&&void 0!==y[0]?y[0]:"https://api.os.uk/search/names/v1/nearest?point={easting},{northing}&radius=1000&fq=local_type:Airfield%20local_type:Airport%20local_type:Bus_Station%20local_type:Chemical_Works%20local_type:City%20local_type:Coach_Station%20local_type:Electricity_Distribution%20local_type:Electricity_Production%20local_type:Further_Education%20local_type:Gas_Distribution_or_Storage%20local_type:Hamlet%20local_type:Harbour%20local_type:Helicopter_Station%20local_type:Heliport%20local_type:Higher_or_University_Education%20local_type:Hill_Or_Mountain%20local_type:Hospice%20local_type:Hospital%20local_type:Medical_Care_Accommodation%20local_type:Named_Road%20local_type:Non_State_Primary_Education%20local_type:Non_State_Secondary_Education%20local_type:Other_Settlement%20local_type:Passenger_Ferry_Terminal%20local_type:Port_Consisting_of_Docks_and_Nautical_Berthing%20local_type:Postcode%20local_type:Primary_Education%20local_type:Railway_Station%20local_type:Road_User_Services%20local_type:Secondary_Education%20local_type:Section_Of_Named_Road%20local_type:Section_Of_Numbered_Road%20local_type:Special_Needs_Education%20local_type:Suburban_Area%20local_type:Town%20local_type:Urban_Greenspace%20local_type:Vehicular_Ferry_Terminal%20local_type:Vehicular_Rail_Terminal%20local_type:Village%20local_type:Waterfall%20",r=y.length>1?y[1]:void 0,i=o=y.length>4?y[4]:void 0,"EPSG:4326"!==(n=y.length>2?y[2]:void 0)){t.n=3;break}t.p=1,i=[(i=new w(o[1],o[0]).toOsGrid()).easting,i.northing].map(function(t){return Math.round(t)}),t.n=3;break;case 2:return t.p=2,d=t.v,console.log(d),t.a(2,null);case 3:if(e=e.replace("{easting}",Math.round(i[0])).replace("{northing}",Math.round(i[1])),a=new Request(e,{method:"GET"}),!r){t.n=7;break}return t.p=4,t.n=5,r(a);case 5:a=t.v,t.n=7;break;case 6:return t.p=6,f=t.v,console.log("Error transforming request:",f),t.a(2,null);case 7:return t.n=8,fetch(a);case 8:return s=t.v,t.n=9,s.json();case 9:return l=t.v,c=b(l.results[0].GAZETTEER_ENTRY),"EPSG:4326"===n&&(u=new g(c.coordinates[0],c.coordinates[1]),h=u.toLatLon(),c.coordinates=[h.lat,h.lon]),p="Approximate centre ".concat(null==c?void 0:c.place),t.a(2,l.results?p:null)}},t,null,[[4,6],[1,2]])}),function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(t){N(i,n,o,a,s,"next",t)}function s(t){N(i,n,o,a,s,"throw",t)}a(void 0)})});return function(){return e.apply(this,arguments)}}()}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};function o(t){return o="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},o(t)}function i(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function s(r,n,o,i){var s=n&&n.prototype instanceof c?n:c,u=Object.create(s.prototype);return a(u,"_invoke",function(r,n,o){var i,a,s,c=0,u=o||[],h=!1,p={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,r){return i=e,a=0,s=t,p.n=r,l}};function d(r,n){for(a=r,s=n,e=0;!h&&c&&!o&&e<u.length;e++){var o,i=u[e],d=p.p,f=i[2];r>3?(o=f===n)&&(s=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,p.v=n,p.n=i[1]):d<f&&(o=r<3||i[0]>n||n>f)&&(i[4]=r,i[5]=n,p.n=f,a=0))}if(o||r>1)return l;throw h=!0,n}return function(o,u,f){if(c>1)throw TypeError("Generator is already running");for(h&&1===u&&d(u,f),a=u,s=f;(e=a<2?t:s)||!h;){i||(a?a<3?(a>1&&(p.n=-1),d(a,s)):p.n=s:p.v=s);try{if(c=2,i){if(a||(o="next"),e=i[o]){if(!(e=e.call(i,s)))throw TypeError("iterator result is not an object");if(!e.done)return e;s=e.value,a<2&&(a=0)}else 1===a&&(e=i.return)&&e.call(i),a<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((e=(h=p.n<0)?s:r.call(n,p))!==l)break}catch(e){i=t,a=1,s=e}finally{c=1}}return{value:e,done:h}}}(r,o,i),!0),u}var l={};function c(){}function u(){}function h(){}e=Object.getPrototypeOf;var p=[][n]?e(e([][n]())):(a(e={},n,function(){return this}),e),d=h.prototype=c.prototype=Object.create(p);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,a(t,o,"GeneratorFunction")),t.prototype=Object.create(d),t}return u.prototype=h,a(d,"constructor",h),a(h,"constructor",u),u.displayName="GeneratorFunction",a(h,o,"GeneratorFunction"),a(d),a(d,o,"Generator"),a(d,n,function(){return this}),a(d,"toString",function(){return"[object Generator]"}),(i=function(){return{w:s,m:f}})()}function a(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}a=function(t,e,r,n){function i(e,r){a(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(i("next",0),i("throw",1),i("return",2))},a(t,e,r,n)}function s(t,e,r,n,o,i,a){try{var s=t[i](a),l=s.value}catch(t){return void r(t)}s.done?e(l):Promise.resolve(l).then(n,o)}function l(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 c(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?l(Object(r),!0).forEach(function(e){u(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function u(t,e,r){return(e=function(t){var e=function(t){if("object"!=o(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==o(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function h(){var t,e;return c(c({},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),{},{load:(t=i().m(function t(){var e;return i().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,Promise.resolve().then(r.bind(r,"./providers/beta/open-names/src/reverseGeocode.js"));case 1:return e=t.v,t.a(2,e.reverseGeocode)}},t)}),e=function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(t){s(i,n,o,a,l,"next",t)}function l(t){s(i,n,o,a,l,"throw",t)}a(void 0)})},function(){return e.apply(this,arguments)})})}r.d(n,{A:()=>h});const p=n.A;export{p as default};
1
+ import e from"@babel/runtime/helpers/asyncToGenerator";import r from"@babel/runtime/helpers/defineProperty";function t(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,o)}return t}function o(e){for(var o=1;o<arguments.length;o++){var n=null!=arguments[o]?arguments[o]:{};o%2?t(Object(n),!0).forEach(function(t){r(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function n(){var r;return o(o({},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),{},{load:(r=e(function*(){return(yield import(/* webpackChunkName: "im-reverse-geocode" */ "./im-reverse-geocode.js")).reverseGeocode}),function(){return r.apply(this,arguments)})})}export{n as default};
@@ -0,0 +1,61 @@
1
+ import { mapToLocationModel } from './mapToLocationModel.js'
2
+
3
+ describe('mapToLocationModel', () => {
4
+ it('maps all fields correctly', () => {
5
+ const raw = {
6
+ ID: '123',
7
+ NAME1: 'Springfield',
8
+ POPULATED_PLACE: 'Downtown',
9
+ COUNTY_UNITARY: 'Shelby',
10
+ REGION: 'Midlands',
11
+ GEOMETRY_X: 10.5,
12
+ GEOMETRY_Y: 20.5
13
+ }
14
+
15
+ const result = mapToLocationModel(raw)
16
+
17
+ expect(result).toEqual({
18
+ id: '123',
19
+ place: 'Springfield, Downtown, Shelby, Midlands',
20
+ county: 'Shelby',
21
+ coordinates: [10.5, 20.5]
22
+ })
23
+ })
24
+
25
+ it('handles missing optional fields', () => {
26
+ const raw = {
27
+ ID: '456',
28
+ NAME1: 'Smallville',
29
+ REGION: 'Eastlands',
30
+ GEOMETRY_X: 1,
31
+ GEOMETRY_Y: 2
32
+ }
33
+
34
+ const result = mapToLocationModel(raw)
35
+
36
+ expect(result).toEqual({
37
+ id: '456',
38
+ place: 'Smallville, Eastlands',
39
+ county: '',
40
+ coordinates: [1, 2]
41
+ })
42
+ })
43
+
44
+ it('handles missing ID', () => {
45
+ const raw = {
46
+ NAME1: 'Nowhere',
47
+ REGION: 'Unknown',
48
+ GEOMETRY_X: 0,
49
+ GEOMETRY_Y: 0
50
+ }
51
+
52
+ const result = mapToLocationModel(raw)
53
+
54
+ expect(result).toEqual({
55
+ id: '',
56
+ place: 'Nowhere, Unknown',
57
+ county: '',
58
+ coordinates: [0, 0]
59
+ })
60
+ })
61
+ })
@@ -0,0 +1 @@
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};