@defra/interactive-map 0.0.7-alpha → 0.0.9-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/templates/map.njk +2 -2
- package/dist/esm/im-core.js +1 -2
- package/dist/esm/im-shell.js +1 -0
- package/dist/esm/index.js +1 -2
- package/dist/umd/im-core.js +1 -1
- package/dist/umd/index.js +1 -1
- package/docs/api/button-definition.md +104 -3
- package/docs/api.md +21 -1
- package/docs/getting-started.md +78 -8
- package/package.json +31 -24
- package/plugins/beta/datasets/dist/css/index.css +50 -1
- package/plugins/beta/datasets/dist/esm/im-datasets-plugin.js +1 -2
- package/plugins/beta/datasets/dist/esm/index.js +1 -2
- package/plugins/beta/draw-es/dist/esm/im-draw-es-plugin.js +1 -2
- package/plugins/beta/draw-es/dist/esm/index.js +1 -2
- package/plugins/beta/draw-ml/dist/esm/im-draw-ml-plugin.js +1 -1
- package/plugins/beta/draw-ml/dist/esm/index.js +1 -2
- package/plugins/beta/frame/dist/css/index.css +11 -1
- package/plugins/beta/frame/dist/esm/im-frame-plugin.js +1 -1
- package/plugins/beta/frame/dist/esm/index.js +1 -2
- package/plugins/beta/map-styles/dist/css/index.css +79 -1
- package/plugins/beta/map-styles/dist/esm/im-map-styles-plugin.js +1 -1
- package/plugins/beta/map-styles/dist/esm/index.js +1 -2
- package/plugins/beta/scale-bar/dist/esm/im-scale-bar-plugin.js +1 -1
- package/plugins/beta/scale-bar/dist/esm/index.js +1 -2
- package/plugins/beta/use-location/dist/esm/im-use-location-plugin.js +1 -1
- package/plugins/beta/use-location/dist/esm/index.js +1 -2
- package/plugins/beta/use-location/dist/umd/index.js +1 -1
- package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
- package/plugins/interact/dist/esm/index.js +1 -2
- package/plugins/search/dist/esm/im-search-plugin.js +1 -2
- package/plugins/search/dist/esm/index.js +1 -2
- package/plugins/search/src/components/Suggestions/Suggestions.module.scss +1 -1
- package/plugins/search/src/search.scss +1 -1
- package/providers/beta/esri/dist/css/index.css +30 -0
- package/providers/beta/esri/dist/esm/im-esri-provider.js +1 -2
- package/providers/beta/esri/dist/esm/index.js +1 -2
- package/providers/beta/open-names/dist/esm/im-reverse-geocode.js +1 -2
- package/providers/beta/open-names/dist/esm/index.js +1 -2
- package/providers/beta/open-names/src/utils/mapToLocationModel.test.js +61 -0
- package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -2
- package/providers/maplibre/dist/esm/index.js +1 -2
- package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
- package/providers/maplibre/src/appEvents.test.js +44 -0
- package/providers/maplibre/src/index.test.js +60 -0
- package/providers/maplibre/src/mapEvents.test.js +115 -0
- package/providers/maplibre/src/maplibreProvider.test.js +205 -0
- package/providers/maplibre/src/utils/calculateLinearTextSize.test.js +31 -0
- package/providers/maplibre/src/utils/detectWebgl.test.js +63 -0
- package/providers/maplibre/src/utils/highlightFeatures.test.js +126 -0
- package/providers/maplibre/src/utils/labels.js +1 -3
- package/providers/maplibre/src/utils/labels.test.js +231 -0
- package/providers/maplibre/src/utils/maplibreFixes.test.js +66 -0
- package/providers/maplibre/src/utils/queryFeatures.test.js +60 -0
- package/providers/maplibre/src/utils/spatial.js +5 -4
- package/providers/maplibre/src/utils/spatial.test.js +96 -0
- package/rollup.esm.mjs +288 -0
- package/src/App/store/appActionsMap.js +1 -1
- package/src/InteractiveMap/InteractiveMap.js +3 -2
- package/webpack.dev.mjs +9 -1
- package/webpack.prod.mjs +8 -1
- package/webpack.umd.mjs +1 -3
- package/dist/esm/im-core.js.LICENSE.txt +0 -1
- package/dist/esm/index.js.LICENSE.txt +0 -1
- package/plugins/beta/datasets/dist/esm/im-datasets-plugin.js.LICENSE.txt +0 -1
- package/plugins/beta/datasets/dist/esm/index.js.LICENSE.txt +0 -1
- package/plugins/beta/draw-es/dist/esm/im-draw-es-plugin.js.LICENSE.txt +0 -1
- package/plugins/beta/draw-es/dist/esm/index.js.LICENSE.txt +0 -1
- package/plugins/beta/draw-ml/dist/esm/index.js.LICENSE.txt +0 -1
- package/plugins/beta/frame/dist/esm/index.js.LICENSE.txt +0 -1
- package/plugins/beta/map-styles/dist/esm/index.js.LICENSE.txt +0 -1
- package/plugins/beta/scale-bar/dist/esm/index.js.LICENSE.txt +0 -1
- package/plugins/beta/use-location/dist/esm/index.js.LICENSE.txt +0 -1
- package/plugins/interact/dist/esm/index.js.LICENSE.txt +0 -1
- package/plugins/search/dist/esm/im-search-plugin.js.LICENSE.txt +0 -1
- package/plugins/search/dist/esm/index.js.LICENSE.txt +0 -1
- package/providers/beta/esri/dist/css/im-esri-provider.css +0 -1
- package/providers/beta/esri/dist/esm/im-esri-provider.js.LICENSE.txt +0 -1
- package/providers/beta/esri/dist/esm/index.js.LICENSE.txt +0 -1
- package/providers/beta/open-names/dist/esm/im-reverse-geocode.js.LICENSE.txt +0 -1
- package/providers/beta/open-names/dist/esm/index.js.LICENSE.txt +0 -1
- package/providers/maplibre/dist/esm/im-maplibre-framework.js +0 -2
- package/providers/maplibre/dist/esm/im-maplibre-framework.js.LICENSE.txt +0 -4
- package/providers/maplibre/dist/esm/im-maplibre-provider.js.LICENSE.txt +0 -1
- package/providers/maplibre/dist/esm/index.js.LICENSE.txt +0 -1
- package/webpack.esm.mjs +0 -153
|
@@ -1,2 +1 @@
|
|
|
1
|
-
/*! For license information please see im-search-plugin.js.LICENSE.txt */
|
|
2
|
-
export const __webpack_esm_id__="im-search-plugin";export const __webpack_esm_ids__=["im-search-plugin"];export const __webpack_esm_modules__={"./plugins/search/src/manifest.js"(t,e,r){function n(t){return n="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},n(t)}function o(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 i(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach(function(e){a(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function a(t,e,r){return(e=function(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}r.d(e,{manifest:()=>wt}),r.r(e);var s={TOGGLE_EXPANDED:function(t,e){return i(i({},t),{},{isExpanded:e,areSuggestionsVisible:e})},SET_KEYBOARD_FOCUS_WITHIN:function(t,e){return i(i({},t),{},{hasKeyboardFocusWithin:e,areSuggestionsVisible:!0})},INPUT_BLUR:function(t,e){return i(i({},t),{},{hasKeyboardFocusWithin:!1,areSuggestionsVisible:t.areSuggestionsVisible&&"keyboard"!==e,selectedIndex:-1})},SET_VALUE:function(t,e){return i(i({},t),{},{value:e})},UPDATE_SUGGESTIONS:function(t,e){return i(i({},t),{},{suggestions:e})},SHOW_SUGGESTIONS:function(t){return i(i({},t),{},{areSuggestionsVisible:!0})},HIDE_SUGGESTIONS:function(t){return i(i({},t),{},{areSuggestionsVisible:!1})},SET_SELECTED:function(t,e){return i(i({},t),{},{selectedIndex:e,areSuggestionsVisible:e>=0})}},c=r("react"),u=r("react/jsx-runtime"),l=function(t){var e=t.id,r=t.isExpanded,n=t.onClick,o=t.buttonRef,i=t.searchIcon;return(0,u.jsx)("button",{"aria-label":"Open search",className:"im-c-map-button",onClick:n,"aria-controls":"".concat(e,"-search-form"),ref:o,style:r?{display:"none"}:void 0,children:i&&(0,u.jsx)("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:i}})})},f=function(t){var e=t.id,r=t.pluginState,n=t.handleSuggestionClick;return(0,u.jsx)("ul",{id:"".concat(e,"-search-suggestions"),role:"listbox","aria-labelledby":"".concat(e,"-search"),className:"im-c-search-suggestions",style:r.areSuggestionsVisible&&r.suggestions.length?void 0:{display:"none"},children:r.suggestions.map(function(t,o){return(0,u.jsx)("li",{id:"".concat(e,"-search-suggestion-").concat(o),className:"im-c-search-suggestions__item",role:"option","aria-selected":r.selectedIndex===o,"aria-setsize":r.suggestions.length,"aria-posinset":o+1,onClick:function(){return n(t)},children:(0,u.jsx)("span",{className:"im-c-search-suggestions__label",dangerouslySetInnerHTML:{__html:t.marked}})},t.id)})})};function p(t){return p="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},p(t)}function d(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 h(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?d(Object(r),!0).forEach(function(e){y(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function y(t,e,r){return(e=function(t){var e=function(t){if("object"!=p(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=p(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==p(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var m=function(t){var e=t.id,r=t.pluginState,n=t.pluginConfig,o=t.appState,i=t.inputRef,a=t.events,s=t.children,c=["im-c-search-form",n.isExpanded&&"im-c-search-form--default-expanded","im-c-panel"].filter(Boolean).join(" ");return(0,u.jsxs)("form",{id:"".concat(e,"-search-form"),role:"search",className:c,style:h({display:n.isExpanded||r.isExpanded?"flex":void 0},"mobile"!==o.breakpoint&&(null==n?void 0:n.width)&&{width:n.width}),"aria-controls":"".concat(e,"-viewport"),onSubmit:function(t){return a.handleSubmit(t,o,r)},children:[(0,u.jsx)("button",{type:"submit",style:{display:"none"},"aria-hidden":"true",tabIndex:-1,children:"Submit"}),(0,u.jsxs)("div",{className:"im-c-search__input-container".concat(r.hasKeyboardFocusWithin?" im-c-search__input-container--keyboard-focus-within":""),children:[(0,u.jsx)("label",{htmlFor:"".concat(e,"-search"),className:"im-u-visually-hidden",children:"Search"}),(0,u.jsx)("input",{id:"".concat(e,"-search"),className:"im-c-search__input",type:"search",role:"combobox","aria-expanded":r.suggestionsVisible,"aria-controls":"".concat(e,"-search-suggestions"),"aria-activedescendant":r.selectedIndex>=0?"".concat(e,"-search-suggestion-").concat(r.selectedIndex):void 0,"aria-describedby":r.value?void 0:"".concat(e,"-search-hint"),"aria-autocomplete":"list",autoComplete:"off",placeholder:"Search",name:"".concat(e,"-search"),spellCheck:!1,enterKeyHint:"search",value:r.value,onClick:a.handleInputClick,onChange:a.handleInputChange,onFocus:function(){return a.handleInputFocus(o.interfaceType)},onBlur:function(){return a.handleInputBlur(o.interfaceType)},onKeyDown:function(t){return a.handleInputKeyDown(t,r)},ref:i}),(0,u.jsx)("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."}),s]}),(0,u.jsx)(f,{id:e,appState:o,pluginState:r,handleSuggestionClick:function(t){return a.handleSuggestionClick(t,o)}})]})},b=function(t){var e=t.defaultExpanded,r=t.onClick,n=t.closeIcon;return(0,u.jsx)("button",{"aria-label":"Close search",className:"im-c-map-button im-c-search-close-button",type:"button",onClick:r,style:e?{display:"none"}:void 0,children:n&&(0,u.jsx)("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:n}})})};let g=" ";class v{static get separator(){return g}static set separator(t){g=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+"°"+v.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+"°"+v.separator+i+"′"+v.separator+a+"″"}return n}static toLat(t,e,r){const n=v.toDms(v.wrap90(t),e,r);return null===n?"–":n.slice(1)+v.separator+(t<0?"S":"N")}static toLon(t,e,r){const n=v.toDms(v.wrap180(t),e,r);return null===n?"–":n+v.separator+(t<0?"W":"E")}static toBrng(t,e,r){const n=v.toDms(v.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=v.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 w=v;class S{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 S))throw new TypeError("v is not Vector3d object");return new S(this.x+t.x,this.y+t.y,this.z+t.z)}minus(t){if(!(t instanceof S))throw new TypeError("v is not Vector3d object");return new S(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 S(this.x*t,this.y*t,this.z*t)}dividedBy(t){if(isNaN(t))throw new TypeError(`invalid scalar value ‘${t}’`);return new S(this.x/t,this.y/t,this.z/t)}dot(t){if(!(t instanceof S))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 S))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 S(e,r,n)}negate(){return new S(-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 S(e,r,n)}angleTo(t,e=void 0){if(!(t instanceof S))throw new TypeError("v is not Vector3d object");if(!(e instanceof S||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 S))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 S(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 E=S,O={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563}},N={WGS84:{ellipsoid:O.WGS84}};Object.freeze(O.WGS84),Object.freeze(N.WGS84);class j{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=w.wrap90(Number(t)),this._lon=w.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)?w.wrap90(w.parse(t)):w.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid lat ‘${t}’`)}set latitude(t){if(this._lat=isNaN(t)?w.wrap90(w.parse(t)):w.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)?w.wrap180(w.parse(t)):w.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lon ‘${t}’`)}set lng(t){if(this._lon=isNaN(t)?w.wrap180(w.parse(t)):w.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lng ‘${t}’`)}set longitude(t){if(this._lon=isNaN(t)?w.wrap180(w.parse(t)):w.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 O}static get datums(){return N}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=w.wrap90(w.parse(e)),r=w.wrap180(w.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=w.wrap90(w.parse(e)),r=w.wrap180(w.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=w.wrap90(w.parse(e)),r=w.wrap180(w.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:O.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 T((f+n)*s*u,(f+n)*s*c,(f*(1-l)+n)*a)}equals(t){if(!(t instanceof j))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}`):`${w.toLat(this.lat,t,e)}, ${w.toLon(this.lon,t,e)}${null==r?"":n}`}}class T extends E{constructor(t,e,r){super(t,e,r)}toLatLon(t=O.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 j(d.toDegrees(),h.toDegrees(),m)}toString(t=0){return`[${this.x.toFixed(t)},${this.y.toFixed(t)},${this.z.toFixed(t)}]`}}const _={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}},P={ED50:{ellipsoid:_.Intl1924,transform:[89.5,93.8,123.1,-1.2,0,0,.156]},ETRS89:{ellipsoid:_.GRS80,transform:[0,0,0,0,0,0,0]},Irl1975:{ellipsoid:_.AiryModified,transform:[-482.53,130.596,-564.557,-8.15,1.042,.214,.631]},NAD27:{ellipsoid:_.Clarke1866,transform:[8,-160,-176,0,0,0,0]},NAD83:{ellipsoid:_.GRS80,transform:[.9956,-1.9103,-.5215,-62e-5,.025915,.009426,.011599]},NTF:{ellipsoid:_.Clarke1880IGN,transform:[168,60,-320,0,0,0,0]},OSGB36:{ellipsoid:_.Airy1830,transform:[-446.448,125.157,-542.06,20.4894,-.1502,-.247,-.8421]},Potsdam:{ellipsoid:_.Bessel1841,transform:[-582,-105,-414,-8.3,1.04,.35,-3.08]},TokyoJapan:{ellipsoid:_.Bessel1841,transform:[148,-507,-685,0,0,0,0]},WGS72:{ellipsoid:_.WGS72,transform:[0,0,-4.5,-.22,0,0,.554]},WGS84:{ellipsoid:_.WGS84,transform:[0,0,0,0,0,0,0]}};Object.keys(_).forEach(t=>Object.freeze(_[t])),Object.keys(P).forEach(t=>{Object.freeze(P[t]),Object.freeze(P[t].transform)});class x extends j{constructor(t,e,r=0,n=P.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 _}static get datums(){return P}static parse(...t){let e=P.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 k(t.x,t.y,t.z,this.datum)}}class k extends T{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||P.WGS84;if(!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);const r=super.toLatLon(e.ellipsoid);return new x(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!=P.WGS84||(e=this,r=t.transform),t==P.WGS84&&(e=this,r=this.datum.transform.map(t=>-t)),null==r&&(e=this.convertDatum(P.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 k(o+e*s-r*l+n*u,i+e*l+r*s-n*c,a-e*u+r*c+n*s)}}const G={trueOrigin:{lat:49,lon:-2},falseOrigin:{easting:-4e5,northing:1e5},scaleFactor:.9996012717,ellipsoid:x.ellipsoids.Airy1830};class D{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=x.datums.WGS84){const{easting:e,northing:r}=this,{a:n,b:o}=G.ellipsoid,i=G.trueOrigin.lat.toRadians(),a=G.trueOrigin.lon.toRadians(),s=-G.falseOrigin.easting,c=-G.falseOrigin.northing,u=G.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),E=S*S,O=E*E,N=1/m,j=g*g*g,T=j*g*g,_=e-s,P=_*_,k=P*_,D=P*P,R=k*P;h=h-S/(2*v*g)*P+S/(24*v*j)*(5+3*E+w-9*E*w)*D-S/(720*v*T)*(61+90*E+45*O)*(D*P);const C=a+N/g*_-N/(6*j)*(g/v+2*E)*k+N/(120*T)*(5+28*E+24*O)*R-N/(T*g*g*5040)*(61+662*E+1320*O+O*E*720)*(R*P);let I=new M(h.toDegrees(),C.toDegrees(),0,x.datums.OSGB36);return t!=x.datums.OSGB36&&(I=I.convertDatum(t),I=new M(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 D(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 D(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 M extends x{toOsGrid(){const t=this.datum==x.datums.OSGB36?this:this.convertDatum(x.datums.OSGB36),e=t.lat.toRadians(),r=t.lon.toRadians(),{a:n,b:o}=G.ellipsoid,i=G.trueOrigin.lat.toRadians(),a=G.trueOrigin.lon.toRadians(),s=-G.falseOrigin.easting,c=-G.falseOrigin.northing,u=G.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,E=Math.tan(e)*Math.tan(e),O=E*E,N=r-a,j=N*N,T=j*N,_=T*N,P=_*N;let k=v+c+m/2*y*h*j+m/24*y*w*(5-E+9*g)*_+m/720*y*S*(61-58*E+O)*(P*N),M=s+m*h*N+m/6*w*(m/b-E)*T+m/120*S*(5-18*E+O+14*g-58*E*g)*P;k=Number(k.toFixed(3)),M=Number(M.toFixed(3));try{return new D(M,k)}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)}}function R(t){return R="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},R(t)}var C;function I(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 A(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?I(Object(r),!0).forEach(function(e){L(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):I(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"!=R(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=R(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==R(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var $=500,F=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-$,n=f-$,o=l+$,i=f+$):(r=a,n=s,o=c,i=u),"EPSG:27700"===t)return[r,n,o,i];if("EPSG:4326"===t){var p=new D(r,n).toLatLon(),d=new D(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))},W=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 D(r,n).toLatLon();return[Math.round(1e6*o.lon)/1e6,Math.round(1e6*o.lat)/1e6]}throw new Error("Unsupported CRS: ".concat(t))};function U(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 B(t){return function(t){if(Array.isArray(t))return Y(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||V(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 z(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=V(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 V(t,e){if(t){if("string"==typeof t)return Y(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)?Y(t,e):void 0}}function Y(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 H(){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 q(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]())):(q(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,q(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=u,q(f,"constructor",u),q(u,"constructor",c),c.displayName="GeneratorFunction",q(u,o,"GeneratorFunction"),q(f),q(f,o,"Generator"),q(f,n,function(){return this}),q(f,"toString",function(){return"[object Generator]"}),(H=function(){return{w:i,m:p}})()}function q(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}q=function(t,e,r,n){function i(e,r){q(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))},q(t,e,r,n)}function K(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 X(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(t){K(i,n,o,a,s,"next",t)}function s(t){K(i,n,o,a,s,"throw",t)}a(void 0)})}}var Z=function(t){return t.replace(/[^a-zA-Z0-9\s\-.,]/g,"").trim()},J=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},Q=function(){var t=X(H().m(function t(e,r,n){var o,i,a;return H().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)}}(),tt=function(){var t=X(H().m(function t(e,r,n,o){var i,a,s,c,u,l,f,p,d;return H().w(function(t){for(;;)switch(t.p=t.n){case 0:i=Z(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=z(a),t.p=1,c.s();case 2:if((u=c.n()).done){t.n=5;break}return l=u.value,f=J(l,i,o),t.n=3,Q(l,f,i);case 3:if(null==(p=t.v)||!p.length){t.n=4;break}if(s=[].concat(B(s),B(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 et(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 rt(t){return rt="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},rt(t)}function nt(){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 ot(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]())):(ot(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,ot(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=u,ot(f,"constructor",u),ot(u,"constructor",c),c.displayName="GeneratorFunction",ot(u,o,"GeneratorFunction"),ot(f),ot(f,o,"Generator"),ot(f,n,function(){return this}),ot(f,"toString",function(){return"[object Generator]"}),(nt=function(){return{w:i,m:p}})()}function ot(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}ot=function(t,e,r,n){function i(e,r){ot(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))},ot(t,e,r,n)}function it(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 at(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?it(Object(r),!0).forEach(function(e){st(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):it(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function st(t,e,r){return(e=function(t){var e=function(t){if("object"!=rt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=rt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==rt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ct(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 ut(t){return ut="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},ut(t)}function lt(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 ft(t,e,r){return(e=function(t){var e=function(t){if("object"!=ut(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=ut(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ut(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function pt(t){return pt="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},pt(t)}function dt(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 ht(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?dt(Object(r),!0).forEach(function(e){yt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):dt(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function yt(t,e,r){return(e=function(t){var e=function(t){if("object"!=pt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=pt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==pt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function mt(t){var e,r,n,o=t.dispatch,i=t.searchContainerRef,a=(e=function(e){return tt(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=nt().m(function d(){var h,y,m,b,g,v,w,S,E,O,N,j;return nt().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(),et({mapProvider:o,bounds:v.bounds,point:v.point,markers:i,showMarker:c,markerColor:u}),r.eventBus.emit("search:match",at({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,tt(b,a,e,s);case 3:S=d.v,E=S.results,O=S.sanitisedValue,w=E,l=O;case 4:w.length&&("keyboard"===f.interfaceType&&(null===(N=n.current)||void 0===N||N.focus()),"mobile"===f.breakpoint&&(e({type:"TOGGLE_EXPANDED",payload:!1}),r.eventBus.emit("search:close")),j=w[0],et({mapProvider:o,bounds:j.bounds,point:j.point,markers:i,showMarker:c,markerColor:u}),r.eventBus.emit("search:match",at({query:m},j)));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){ct(o,r,n,i,a,"next",t)}function a(t){ct(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)}}}(ht(ht({},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")),et({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?lt(Object(r),!0).forEach(function(e){ft(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):lt(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 ht(ht(ht(ht({},s),c),u),{},{handleOutside:function(e){i.current.contains(e.target)||(o({type:"TOGGLE_EXPANDED",payload:!1}),t.services.eventBus.emit("search:close"))}})}function bt(t){return bt="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},bt(t)}function gt(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 vt(t,e,r){return(e=function(t){var e=function(t){if("object"!=bt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=bt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==bt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var wt={reducer:{initialState:{isExpanded:!1,hasKeyboardFocusWithin:!1,value:"",suggestions:[],areSuggestionsVisible:!1,selectedIndex:-1},actions:s},controls:[{id:"search",label:"Search",mobile:{slot:"top-right"},tablet:{slot:"top-left"},desktop:{slot:"top-left"},render:function(t){var e=t.appConfig,r=t.iconRegistry,n=t.pluginState,o=t.pluginConfig,i=t.appState,a=t.mapState,s=t.services,f=t.mapProvider,p=e.id,d=i.interfaceType,h=o.isExpanded,y=o.customDatasets,g=o.osNamesURL,v=n.dispatch,w=n.isExpanded,S=n.areSuggestionsVisible,E=n.suggestions,O=r.close,N=r.search,j=(0,c.useRef)(null),T=(0,c.useRef)(null),_=(0,c.useRef)(null),P=(0,c.useRef)(null),x=i.layoutRefs.viewportRef,k=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 A(A({id:t.GAZETTEER_ENTRY.ID,bounds:F(r,t.GAZETTEER_ENTRY),point:W(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(C||(o=["s*"],(i=["\\s*"])||(i=o.slice(0)),C=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 U(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 U(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)?U(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:y,osNamesURL:g,crs:f.crs}),G=(0,c.useRef)(null);G.current||(G.current=mt(function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?gt(Object(r),!0).forEach(function(e){vt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):gt(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({dispatch:v,datasets:k,services:s,mapProvider:f,viewportRef:x,searchContainerRef:j,markers:a.markers},o)));var D=G.current,M=w||!!(h&&S&&E.length);return(0,c.useEffect)(function(){var t;w&&(null===(t=_.current)||void 0===t||t.focus())},[w]),(0,c.useEffect)(function(){if(i.dispatch({type:"TOGGLE_HAS_EXCLUSIVE_CONTROL",payload:w}),M)return x.current.style.pointerEvents="none",document.addEventListener("focusin",D.handleOutside),document.addEventListener("pointerdown",D.handleOutside),function(){x.current.style.pointerEvents="auto",document.removeEventListener("focusin",D.handleOutside),document.removeEventListener("pointerdown",D.handleOutside)}},[w,d,S,E]),(0,u.jsxs)("div",{className:"im-c-search",ref:j,children:[!h&&(0,u.jsx)(l,{id:p,isExpanded:w,onClick:function(){return D.handleOpenClick(i)},buttonRef:T,searchIcon:N}),(0,u.jsx)(m,{id:p,pluginState:n,pluginConfig:o,appState:i,inputRef:_,events:D,children:(0,u.jsx)(b,{defaultExpanded:h,onClick:function(t){return D.handleCloseClick(t,T,i)},closeIcon:O,ref:P})})]})}}],icons:[{id:"search",svgContent:'<path d="m21 21-4.34-4.34"></path><circle cx="11" cy="11" r="8"></circle>'}]}}};
|
|
1
|
+
import{useRef as e,useEffect as t}from"preact/compat";import{jsx as r,jsxs as n}from"preact/jsx-runtime";import a from"@babel/runtime/helpers/defineProperty";import i from"@babel/runtime/helpers/taggedTemplateLiteral";import o from"@babel/runtime/helpers/asyncToGenerator";function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach(function(t){a(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var c={TOGGLE_EXPANDED:(e,t)=>l(l({},e),{},{isExpanded:t,areSuggestionsVisible:t}),SET_KEYBOARD_FOCUS_WITHIN:(e,t)=>l(l({},e),{},{hasKeyboardFocusWithin:t,areSuggestionsVisible:!0}),INPUT_BLUR:(e,t)=>l(l({},e),{},{hasKeyboardFocusWithin:!1,areSuggestionsVisible:e.areSuggestionsVisible&&"keyboard"!==t,selectedIndex:-1}),SET_VALUE:(e,t)=>l(l({},e),{},{value:t}),UPDATE_SUGGESTIONS:(e,t)=>l(l({},e),{},{suggestions:t}),SHOW_SUGGESTIONS:e=>l(l({},e),{},{areSuggestionsVisible:!0}),HIDE_SUGGESTIONS:e=>l(l({},e),{},{areSuggestionsVisible:!1}),SET_SELECTED:(e,t)=>l(l({},e),{},{selectedIndex:t,areSuggestionsVisible:t>=0})},u=e=>{var{id:t,isExpanded:n,onClick:a,buttonRef:i,searchIcon:o}=e;return r("button",{"aria-label":"Open search",className:"im-c-map-button",onClick:a,"aria-controls":"".concat(t,"-search-form"),ref:i,style:n?{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}})})},d=e=>{var{id:t,pluginState:n,handleSuggestionClick:a}=e;return r("ul",{id:"".concat(t,"-search-suggestions"),role:"listbox","aria-labelledby":"".concat(t,"-search"),className:"im-c-search-suggestions",style:n.areSuggestionsVisible&&n.suggestions.length?void 0:{display:"none"},children:n.suggestions.map((e,i)=>r("li",{id:"".concat(t,"-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:()=>a(e),children:r("span",{className:"im-c-search-suggestions__label",dangerouslySetInnerHTML:{__html:e.marked}})},e.id))})};function h(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?h(Object(r),!0).forEach(function(t){a(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):h(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var f=e=>{var{id:t,pluginState:a,pluginConfig:i,appState:o,inputRef:s,events:l,children:c}=e,u=["im-c-search-form",i.isExpanded&&"im-c-search-form--default-expanded","im-c-panel"].filter(Boolean).join(" ");return n("form",{id:"".concat(t,"-search-form"),role:"search",className:u,style:p({display:i.isExpanded||a.isExpanded?"flex":void 0},"mobile"!==o.breakpoint&&(null==i?void 0:i.width)&&{width:i.width}),"aria-controls":"".concat(t,"-viewport"),onSubmit:e=>l.handleSubmit(e,o,a),children:[r("button",{type:"submit",style:{display:"none"},"aria-hidden":"true",tabIndex:-1,children:"Submit"}),n("div",{className:"im-c-search__input-container".concat(a.hasKeyboardFocusWithin?" im-c-search__input-container--keyboard-focus-within":""),children:[r("label",{htmlFor:"".concat(t,"-search"),className:"im-u-visually-hidden",children:"Search"}),r("input",{id:"".concat(t,"-search"),className:"im-c-search__input",type:"search",role:"combobox","aria-expanded":a.suggestionsVisible,"aria-controls":"".concat(t,"-search-suggestions"),"aria-activedescendant":a.selectedIndex>=0?"".concat(t,"-search-suggestion-").concat(a.selectedIndex):void 0,"aria-describedby":a.value?void 0:"".concat(t,"-search-hint"),"aria-autocomplete":"list",autoComplete:"off",placeholder:"Search",name:"".concat(t,"-search"),spellCheck:!1,enterKeyHint:"search",value:a.value,onClick:l.handleInputClick,onChange:l.handleInputChange,onFocus:()=>l.handleInputFocus(o.interfaceType),onBlur:()=>l.handleInputBlur(o.interfaceType),onKeyDown:e=>l.handleInputKeyDown(e,a),ref:s}),r("span",{id:"".concat(t,"-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."}),c]}),r(d,{id:t,appState:o,pluginState:a,handleSuggestionClick:e=>l.handleSuggestionClick(e,o)})]})},m=e=>{var{defaultExpanded:t,onClick:n,closeIcon:a}=e;return r("button",{"aria-label":"Close search",className:"im-c-map-button im-c-search-close-button",type:"button",onClick:n,style:t?{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}})})};let g=" ";class y{static get separator(){return g}static set separator(e){g=e}static parse(e){if(!isNaN(parseFloat(e))&&isFinite(e))return Number(e);const t=String(e).trim().replace(/^-/,"").replace(/[NSEW]$/i,"").split(/[^0-9.,]+/);if(""==t[t.length-1]&&t.splice(t.length-1),""==t)return NaN;let r=null;switch(t.length){case 3:r=t[0]/1+t[1]/60+t[2]/3600;break;case 2:r=t[0]/1+t[1]/60;break;case 1:r=t[0];break;default:return NaN}return/^-|[WS]$/i.test(e.trim())&&(r=-r),Number(r)}static toDms(e,t="d",r=void 0){if(isNaN(e))return null;if("string"==typeof e&&""==e.trim())return null;if("boolean"==typeof e)return null;if(e==1/0)return null;if(null==e)return null;if(void 0===r)switch(t){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:t="d",r=4}e=Math.abs(e);let n=null,a=null,i=null,o=null;switch(t){default:case"d":case"deg":a=e.toFixed(r),a<100&&(a="0"+a),a<10&&(a="0"+a),n=a+"°";break;case"dm":case"deg+min":a=Math.floor(e),i=(60*e%60).toFixed(r),60==i&&(i=(0).toFixed(r),a++),a=("000"+a).slice(-3),i<10&&(i="0"+i),n=a+"°"+y.separator+i+"′";break;case"dms":case"deg+min+sec":a=Math.floor(e),i=Math.floor(3600*e/60)%60,o=(3600*e%60).toFixed(r),60==o&&(o=(0).toFixed(r),i++),60==i&&(i=0,a++),a=("000"+a).slice(-3),i=("00"+i).slice(-2),o<10&&(o="0"+o),n=a+"°"+y.separator+i+"′"+y.separator+o+"″"}return n}static toLat(e,t,r){const n=y.toDms(y.wrap90(e),t,r);return null===n?"–":n.slice(1)+y.separator+(e<0?"S":"N")}static toLon(e,t,r){const n=y.toDms(y.wrap180(e),t,r);return null===n?"–":n+y.separator+(e<0?"W":"E")}static toBrng(e,t,r){const n=y.toDms(y.wrap360(e),t,r);return null===n?"–":n.replace("360","0")}static fromLocale(e){const t=123456.789.toLocaleString(),r={thousands:t.slice(3,4),decimal:t.slice(7,8)};return e.replace(r.thousands,"⁜").replace(r.decimal,".").replace("⁜",",")}static toLocale(e){const t=123456.789.toLocaleString(),r={thousands:t.slice(3,4),decimal:t.slice(7,8)};return e.replace(/,([0-9])/,"⁜$1").replace(".",r.decimal).replace("⁜",r.thousands)}static compassPoint(e,t=3){if(![1,2,3].includes(Number(t)))throw new RangeError(`invalid precision ‘${t}’`);e=y.wrap360(e);const r=4*2**(t-1);return["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][Math.round(e*r/360)%r*16/r]}static wrap90(e){if(-90<=e&&e<=90)return e;const t=e,r=360;return 1*Math.abs(((t-90)%r+r)%r-180)-90}static wrap180(e){if(-180<=e&&e<=180)return e;const t=360;return((360*e/t-180)%t+t)%t-180}static wrap360(e){if(0<=e&&e<360)return e;const t=360;return(360*e/t%t+t)%t}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};class b{constructor(e,t,r){if(isNaN(e)||isNaN(t)||isNaN(r))throw new TypeError(`invalid vector [${e},${t},${r}]`);this.x=Number(e),this.y=Number(t),this.z=Number(r)}get length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}plus(e){if(!(e instanceof b))throw new TypeError("v is not Vector3d object");return new b(this.x+e.x,this.y+e.y,this.z+e.z)}minus(e){if(!(e instanceof b))throw new TypeError("v is not Vector3d object");return new b(this.x-e.x,this.y-e.y,this.z-e.z)}times(e){if(isNaN(e))throw new TypeError(`invalid scalar value ‘${e}’`);return new b(this.x*e,this.y*e,this.z*e)}dividedBy(e){if(isNaN(e))throw new TypeError(`invalid scalar value ‘${e}’`);return new b(this.x/e,this.y/e,this.z/e)}dot(e){if(!(e instanceof b))throw new TypeError("v is not Vector3d object");return this.x*e.x+this.y*e.y+this.z*e.z}cross(e){if(!(e instanceof b))throw new TypeError("v is not Vector3d object");const t=this.y*e.z-this.z*e.y,r=this.z*e.x-this.x*e.z,n=this.x*e.y-this.y*e.x;return new b(t,r,n)}negate(){return new b(-this.x,-this.y,-this.z)}unit(){const e=this.length;if(1==e)return this;if(0==e)return this;const t=this.x/e,r=this.y/e,n=this.z/e;return new b(t,r,n)}angleTo(e,t=void 0){if(!(e instanceof b))throw new TypeError("v is not Vector3d object");if(!(t instanceof b||null==t))throw new TypeError("n is not Vector3d object");const r=null==t||this.cross(e).dot(t)>=0?1:-1,n=this.cross(e).length*r,a=this.dot(e);return Math.atan2(n,a)}rotateAround(e,t){if(!(e instanceof b))throw new TypeError("axis is not Vector3d object");const r=t.toRadians(),n=this.unit(),a=e.unit(),i=Math.sin(r),o=Math.cos(r),s=1-o,l=a.x,c=a.y,u=a.z,d=[[s*l*l+o,s*l*c-i*u,s*l*u+i*c],[s*l*c+i*u,s*c*c+o,s*c*u-i*l],[s*l*u-i*c,s*c*u+i*l,s*u*u+o]],h=[d[0][0]*n.x+d[0][1]*n.y+d[0][2]*n.z,d[1][0]*n.x+d[1][1]*n.y+d[1][2]*n.z,d[2][0]*n.x+d[2][1]*n.y+d[2][2]*n.z];return new b(h[0],h[1],h[2])}toString(e=3){return`[${this.x.toFixed(e)},${this.y.toFixed(e)},${this.z.toFixed(e)}]`}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};const w={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563}},E={WGS84:{ellipsoid:w.WGS84}};Object.freeze(w.WGS84),Object.freeze(E.WGS84);class v{constructor(e,t,r=0){if(isNaN(e)||null==e)throw new TypeError(`invalid lat ‘${e}’`);if(isNaN(t)||null==t)throw new TypeError(`invalid lon ‘${t}’`);if(isNaN(r)||null==r)throw new TypeError(`invalid height ‘${r}’`);this._lat=y.wrap90(Number(e)),this._lon=y.wrap180(Number(t)),this._height=Number(r)}get lat(){return this._lat}get latitude(){return this._lat}set lat(e){if(this._lat=isNaN(e)?y.wrap90(y.parse(e)):y.wrap90(Number(e)),isNaN(this._lat))throw new TypeError(`invalid lat ‘${e}’`)}set latitude(e){if(this._lat=isNaN(e)?y.wrap90(y.parse(e)):y.wrap90(Number(e)),isNaN(this._lat))throw new TypeError(`invalid latitude ‘${e}’`)}get lon(){return this._lon}get lng(){return this._lon}get longitude(){return this._lon}set lon(e){if(this._lon=isNaN(e)?y.wrap180(y.parse(e)):y.wrap180(Number(e)),isNaN(this._lon))throw new TypeError(`invalid lon ‘${e}’`)}set lng(e){if(this._lon=isNaN(e)?y.wrap180(y.parse(e)):y.wrap180(Number(e)),isNaN(this._lon))throw new TypeError(`invalid lng ‘${e}’`)}set longitude(e){if(this._lon=isNaN(e)?y.wrap180(y.parse(e)):y.wrap180(Number(e)),isNaN(this._lon))throw new TypeError(`invalid longitude ‘${e}’`)}get height(){return this._height}set height(e){if(this._height=Number(e),isNaN(this._height))throw new TypeError(`invalid height ‘${e}’`)}get datum(){return this._datum}set datum(e){this._datum=e}static get ellipsoids(){return w}static get datums(){return E}static parse(...e){if(0==e.length)throw new TypeError("invalid (empty) point");let t,r,n;if("object"==typeof e[0]&&(1==e.length||!isNaN(parseFloat(e[1])))){const a=e[0];if("Point"==a.type&&Array.isArray(a.coordinates)?([r,t,n]=a.coordinates,n=n||0):(null!=a.latitude&&(t=a.latitude),null!=a.lat&&(t=a.lat),null!=a.longitude&&(r=a.longitude),null!=a.lng&&(r=a.lng),null!=a.lon&&(r=a.lon),null!=a.height&&(n=a.height),t=y.wrap90(y.parse(t)),r=y.wrap180(y.parse(r))),null!=e[1]&&(n=e[1]),isNaN(t)||isNaN(r))throw new TypeError(`invalid point ‘${JSON.stringify(e[0])}’`)}if("string"==typeof e[0]&&2==e[0].split(",").length&&([t,r]=e[0].split(","),t=y.wrap90(y.parse(t)),r=y.wrap180(y.parse(r)),n=e[1]||0,isNaN(t)||isNaN(r)))throw new TypeError(`invalid point ‘${e[0]}’`);if(null==t&&null==r&&([t,r]=e,t=y.wrap90(y.parse(t)),r=y.wrap180(y.parse(r)),n=e[2]||0,isNaN(t)||isNaN(r)))throw new TypeError(`invalid point ‘${e.toString()}’`);return new this(t,r,n)}toCartesian(){const e=this.datum?this.datum.ellipsoid:this.referenceFrame?this.referenceFrame.ellipsoid:w.WGS84,t=this.lat.toRadians(),r=this.lon.toRadians(),n=this.height,{a:a,f:i}=e,o=Math.sin(t),s=Math.cos(t),l=Math.sin(r),c=Math.cos(r),u=2*i-i*i,d=a/Math.sqrt(1-u*o*o);return new S((d+n)*s*c,(d+n)*s*l,(d*(1-u)+n)*o)}equals(e){if(!(e instanceof v))throw new TypeError(`invalid point ‘${e}’`);return!(Math.abs(this.lat-e.lat)>Number.EPSILON)&&(!(Math.abs(this.lon-e.lon)>Number.EPSILON)&&(!(Math.abs(this.height-e.height)>Number.EPSILON)&&(this.datum==e.datum&&(this.referenceFrame==e.referenceFrame&&this.epoch==e.epoch))))}toString(e="d",t=void 0,r=null){if(!["d","dm","dms","n"].includes(e))throw new RangeError(`invalid format ‘${e}’`);const n=(this.height>=0?" +":" ")+this.height.toFixed(r)+"m";if("n"==e){null==t&&(t=4);return`${this.lat.toFixed(t)}, ${this.lon.toFixed(t)}${null==r?"":n}`}return`${y.toLat(this.lat,e,t)}, ${y.toLon(this.lon,e,t)}${null==r?"":n}`}}class S extends b{constructor(e,t,r){super(e,t,r)}toLatLon(e=w.WGS84){if(!e||!e.a)throw new TypeError(`invalid ellipsoid ‘${e}’`);const{x:t,y:r,z:n}=this,{a:a,b:i,f:o}=e,s=2*o-o*o,l=s/(1-s),c=Math.sqrt(t*t+r*r),u=i*n/(a*c)*(1+l*i/Math.sqrt(c*c+n*n)),d=u/Math.sqrt(1+u*u),h=d/u,p=isNaN(h)?0:Math.atan2(n+l*i*d*d*d,c-s*a*h*h*h),f=Math.atan2(r,t),m=Math.sin(p),g=c*Math.cos(p)+n*m-a*a/(a/Math.sqrt(1-s*m*m));return new v(p.toDegrees(),f.toDegrees(),g)}toString(e=0){return`[${this.x.toFixed(e)},${this.y.toFixed(e)},${this.z.toFixed(e)}]`}}const O={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}},N={ED50:{ellipsoid:O.Intl1924,transform:[89.5,93.8,123.1,-1.2,0,0,.156]},ETRS89:{ellipsoid:O.GRS80,transform:[0,0,0,0,0,0,0]},Irl1975:{ellipsoid:O.AiryModified,transform:[-482.53,130.596,-564.557,-8.15,1.042,.214,.631]},NAD27:{ellipsoid:O.Clarke1866,transform:[8,-160,-176,0,0,0,0]},NAD83:{ellipsoid:O.GRS80,transform:[.9956,-1.9103,-.5215,-62e-5,.025915,.009426,.011599]},NTF:{ellipsoid:O.Clarke1880IGN,transform:[168,60,-320,0,0,0,0]},OSGB36:{ellipsoid:O.Airy1830,transform:[-446.448,125.157,-542.06,20.4894,-.1502,-.247,-.8421]},Potsdam:{ellipsoid:O.Bessel1841,transform:[-582,-105,-414,-8.3,1.04,.35,-3.08]},TokyoJapan:{ellipsoid:O.Bessel1841,transform:[148,-507,-685,0,0,0,0]},WGS72:{ellipsoid:O.WGS72,transform:[0,0,-4.5,-.22,0,0,.554]},WGS84:{ellipsoid:O.WGS84,transform:[0,0,0,0,0,0,0]}};Object.keys(O).forEach(e=>Object.freeze(O[e])),Object.keys(N).forEach(e=>{Object.freeze(N[e]),Object.freeze(N[e].transform)});class T extends v{constructor(e,t,r=0,n=N.WGS84){if(!n||null==n.ellipsoid)throw new TypeError(`unrecognised datum ‘${n}’`);super(e,t,r),this._datum=n}get datum(){return this._datum}static get ellipsoids(){return O}static get datums(){return N}static parse(...e){let t=N.WGS84;if((4==e.length||3==e.length&&"object"==typeof e[2])&&(t=e.pop()),!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);const r=super.parse(...e);return r._datum=t,r}convertDatum(e){if(!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);return this.toCartesian().convertDatum(e).toLatLon()}toCartesian(){const e=super.toCartesian();return new _(e.x,e.y,e.z,this.datum)}}class _ extends S{constructor(e,t,r,n=void 0){if(n&&null==n.ellipsoid)throw new TypeError(`unrecognised datum ‘${n}’`);super(e,t,r),n&&(this._datum=n)}get datum(){return this._datum}set datum(e){if(!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);this._datum=e}toLatLon(e=void 0){e&&(console.info("datum parameter to Cartesian_Datum.toLatLon is deprecated: set datum before calling toLatLon()"),this.datum=e);const t=this.datum||N.WGS84;if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);const r=super.toLatLon(t.ellipsoid);return new T(r.lat,r.lon,r.height,this.datum)}convertDatum(e){if(!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);if(!this.datum)throw new TypeError("cartesian coordinate has no datum");let t=null,r=null;null!=this.datum&&this.datum!=N.WGS84||(t=this,r=e.transform),e==N.WGS84&&(t=this,r=this.datum.transform.map(e=>-e)),null==r&&(t=this.convertDatum(N.WGS84),r=e.transform);const n=t.applyTransform(r);return n.datum=e,n}applyTransform(e){const{x:t,y:r,z:n}=this,a=e[0],i=e[1],o=e[2],s=e[3]/1e6+1,l=(e[4]/3600).toRadians(),c=(e[5]/3600).toRadians(),u=(e[6]/3600).toRadians();return new _(a+t*s-r*u+n*c,i+t*u+r*s-n*l,o-t*c+r*l+n*s)}}const D={trueOrigin:{lat:49,lon:-2},scaleFactor:.9996012717,ellipsoid:T.ellipsoids.Airy1830};class x{constructor(e,t){if(this.easting=Number(e),this.northing=Number(t),isNaN(e)||this.easting<0||this.easting>7e5)throw new RangeError(`invalid easting ‘${e}’`);if(isNaN(t)||this.northing<0||this.northing>13e5)throw new RangeError(`invalid northing ‘${t}’`)}toLatLon(e=T.datums.WGS84){const{easting:t,northing:r}=this,{a:n,b:a}=D.ellipsoid,i=D.trueOrigin.lat.toRadians(),o=D.trueOrigin.lon.toRadians(),s=-1e5,l=D.scaleFactor,c=1-a*a/(n*n),u=(n-a)/(n+a),d=u*u,h=u*u*u;let p=i,f=0;do{p=(r-s-f)/(n*l)+p;f=a*l*((1+u+5/4*d+5/4*h)*(p-i)-(3*u+3*u*u+21/8*h)*Math.sin(p-i)*Math.cos(p+i)+(15/8*d+15/8*h)*Math.sin(2*(p-i))*Math.cos(2*(p+i))-35/24*h*Math.sin(3*(p-i))*Math.cos(3*(p+i)))}while(Math.abs(r-s-f)>=1e-5);const m=Math.cos(p),g=Math.sin(p),y=n*l/Math.sqrt(1-c*g*g),b=n*l*(1-c)/Math.pow(1-c*g*g,1.5),w=y/b-1,E=Math.tan(p),v=E*E,S=v*v,O=1/m,N=y*y*y,_=N*y*y,x=t-4e5,P=x*x,M=P*x,G=P*P,C=M*P;p=p-E/(2*b*y)*P+E/(24*b*N)*(5+3*v+w-9*v*w)*G-E/(720*b*_)*(61+90*v+45*S)*(G*P);const R=o+O/y*x-O/(6*N)*(y/b+2*v)*M+O/(120*_)*(5+28*v+24*S)*C-O/(5040*(_*y*y))*(61+662*v+1320*S+720*(S*v))*(C*P);let k=new j(p.toDegrees(),R.toDegrees(),0,T.datums.OSGB36);return e!=T.datums.OSGB36&&(k=k.convertDatum(e),k=new j(k.lat,k.lon,k.height,k.datum)),k}static parse(e){let t=(e=String(e).trim()).match(/^(\d+),\s*(\d+)$/);if(t)return new x(t[1],t[2]);if(t=e.match(/^[HNST][ABCDEFGHJKLMNOPQRSTUVWXYZ]\s*[0-9]+\s*[0-9]+$/i),!t)throw new Error(`invalid grid reference ‘${e}’`);let r=e.toUpperCase().charCodeAt(0)-"A".charCodeAt(0),n=e.toUpperCase().charCodeAt(1)-"A".charCodeAt(0);r>7&&r--,n>7&&n--;const a=(r-2)%5*5+n%5,i=19-5*Math.floor(r/5)-Math.floor(n/5);let o=e.slice(2).trim().split(/\s+/);if(1==o.length&&(o=[o[0].slice(0,o[0].length/2),o[0].slice(o[0].length/2)]),o[0].length!=o[1].length)throw new Error(`invalid grid reference ‘${e}’`);o[0]=o[0].padEnd(5,"0"),o[1]=o[1].padEnd(5,"0");const s=a+o[0],l=i+o[1];return new x(s,l)}toString(e=10){if(![0,2,4,6,8,10,12,14,16].includes(Number(e)))throw new RangeError(`invalid precision ‘${e}’`);let{easting:t,northing:r}=this;if(0==e){const e={useGrouping:!1,minimumIntegerDigits:6,maximumFractionDigits:3};return`${t.toLocaleString("en",e)},${r.toLocaleString("en",e)}`}const n=Math.floor(t/1e5),a=Math.floor(r/1e5);let i=19-a-(19-a)%5+Math.floor((n+10)/5),o=5*(19-a)%25+n%5;i>7&&i++,o>7&&o++;const s=String.fromCharCode(i+"A".charCodeAt(0),o+"A".charCodeAt(0));return t=Math.floor(t%1e5/Math.pow(10,5-e/2)),r=Math.floor(r%1e5/Math.pow(10,5-e/2)),t=t.toString().padStart(e/2,"0"),r=r.toString().padStart(e/2,"0"),`${s} ${t} ${r}`}}class j extends T{toOsGrid(){const e=this.datum==T.datums.OSGB36?this:this.convertDatum(T.datums.OSGB36),t=e.lat.toRadians(),r=e.lon.toRadians(),{a:n,b:a}=D.ellipsoid,i=D.trueOrigin.lat.toRadians(),o=D.trueOrigin.lon.toRadians(),s=D.scaleFactor,l=1-a*a/(n*n),c=(n-a)/(n+a),u=c*c,d=c*c*c,h=Math.cos(t),p=Math.sin(t),f=n*s/Math.sqrt(1-l*p*p),m=n*s*(1-l)/Math.pow(1-l*p*p,1.5),g=f/m-1,y=a*s*((1+c+5/4*u+5/4*d)*(t-i)-(3*c+3*c*c+21/8*d)*Math.sin(t-i)*Math.cos(t+i)+(15/8*u+15/8*d)*Math.sin(2*(t-i))*Math.cos(2*(t+i))-35/24*d*Math.sin(3*(t-i))*Math.cos(3*(t+i))),b=h*h*h,w=b*h*h,E=Math.tan(t)*Math.tan(t),v=E*E,S=r-o,O=S*S,N=O*S,_=N*S,j=_*S;let P=y+-1e5+f/2*p*h*O+f/24*p*b*(5-E+9*g)*_+f/720*p*w*(61-58*E+v)*(j*S),M=4e5+f*h*S+f/6*b*(f/m-E)*N+f/120*w*(5-18*E+v+14*g-58*E*g)*j;P=Number(P.toFixed(3)),M=Number(M.toFixed(3));try{return new x(M,P)}catch(t){throw new Error(`${t.message} from (${e.lat.toFixed(6)},${e.lon.toFixed(6)}).toOsGrid()`)}}convertDatum(e){const t=super.convertDatum(e);return new j(t.lat,t.lon,t.height,t.datum)}}var P;function M(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function G(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?M(Object(r),!0).forEach(function(t){a(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):M(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var C=500,R=(e,t)=>{var r,n,a,i,{MBR_XMIN:o,MBR_YMIN:s,MBR_XMAX:l,MBR_YMAX:c,GEOMETRY_X:u,GEOMETRY_Y:d}=t;if(null==o?(r=u-C,n=d-C,a=u+C,i=d+C):(r=o,n=s,a=l,i=c),"EPSG:27700"===e)return[r,n,a,i];if("EPSG:4326"===e){var h=new x(r,n).toLatLon(),p=new x(a,i).toLatLon();return[h.lon,h.lat,p.lon,p.lat].map(e=>Math.round(1e6*e)/1e6)}throw new Error("Unsupported CRS: ".concat(e))},k=(e,t)=>{var{GEOMETRY_X:r,GEOMETRY_Y:n}=t;if("EPSG:27700"===e)return[r,n];if("EPSG:4326"===e){var a=new x(r,n).toLatLon();return[Math.round(1e6*a.lon)/1e6,Math.round(1e6*a.lat)/1e6]}throw new Error("Unsupported CRS: ".concat(e))},I=(e,t,r)=>{var n;if(!e||e.error||0===(null===(n=e.header)||void 0===n?void 0:n.totalresults))return[];var a=e.results;return a=((e,t)=>{var r=t.toLowerCase().replace(/,/g,"").split(" ");return e.filter(e=>r.some(r=>{return e.GAZETTEER_ENTRY.NAME1.toLowerCase().includes(r)||(n=(n=t).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}))})(a,t),(a=(a=(e=>Array.from(new Map(e.map(e=>[e.GAZETTEER_ENTRY.ID,e])).values()))(a)).slice(0,8)).map(e=>G(G({id:e.GAZETTEER_ENTRY.ID,bounds:R(r,e.GAZETTEER_ENTRY),point:k(r,e.GAZETTEER_ENTRY)},((e,t)=>{var r,n,a,o,{NAME1:s,COUNTY_UNITARY:l,DISTRICT_BOROUGH:c,POSTCODE_DISTRICT:u,LOCAL_TYPE:d}=t,h="".concat(["City","Postcode"].includes(d)?"":u+", ").concat("City"===d?"":l||c),p="".concat(s).concat(h?", "+h:"");return{text:p,marked:(r=p,n=e,a=n.replace(/\s+/g,"").split("").join(String.raw(P||(P=i(["s*"],["\\s*"])))),o=new RegExp("(".concat(a,")"),"i"),r.replace(o,"<mark>$1</mark>"))}})(t,e.GAZETTEER_ENTRY)),{},{type:"os-names"}))};var L=(e,t,r)=>{var n,a={url:null===(n=e.urlTemplate)||void 0===n?void 0:n.replace("{query}",encodeURIComponent(t)),options:{method:"GET"}};return"function"==typeof e.buildRequest?e.buildRequest(t,()=>a):"function"==typeof r?r(a,t):a},A=function(){var e=o(function*(e,t,r){try{var n=yield fetch(t.url,t.options);if(!n.ok)return console.error("Fetch error for ".concat(e.label||"dataset",": ").concat(n.status)),null;var a=yield n.json();return e.parseResults(a,r)}catch(t){return console.error("Network error for ".concat(e.label||"dataset",":"),t),null}});return function(t,r,n){return e.apply(this,arguments)}}(),$=function(){var e=o(function*(e,t,r,n){var a=(e=>e.replace(/[^a-zA-Z0-9\s\-.,]/g,"").trim())(e),i=t.filter(e=>{var t=!e.includeRegex||e.includeRegex.test(a),r=!!e.excludeRegex&&e.excludeRegex.test(a);return t&&!r}),o=[];for(var s of i){var l=L(s,a,n),c=yield A(s,l,a);if(null!=c&&c.length&&(o=[...o,...c],s.exclusive))break}return r({type:"UPDATE_SUGGESTIONS",payload:o}),{results:o,sanitisedValue:a}});return function(t,r,n,a){return e.apply(this,arguments)}}();function F(e){var{mapProvider:t,bounds:r,point:n,markers:a,showMarker:i,markerColor:o}=e;t.fitToBounds(r),i&&a.add("search",n,{color:o})}var W=3;function U(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function B(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?U(Object(r),!0).forEach(function(t){a(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):U(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function z(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}var V=e=>{var{dispatch:t,services:r,mapProvider:n,markers:i,showMarker:o,markerColor:s}=e,l=(e,t)=>{var r;return t>=0?"".concat(null===(r=e[t])||void 0===r?void 0:r.text,". ").concat(t+1," of ").concat(e.length," is highlighted"):"".concat(e.length," suggestions available")};return{handleSuggestionClick(e,l){t({type:"SET_VALUE",payload:e.text}),t({type:"HIDE_SUGGESTIONS"}),t({type:"SET_SELECTED",payload:-1}),"mobile"===l.breakpoint&&(t({type:"TOGGLE_EXPANDED",payload:!1}),r.eventBus.emit("search:close")),F({mapProvider:n,bounds:e.bounds,point:e.point,markers:i,showMarker:o,markerColor:s}),r.eventBus.emit("search:match",function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?z(Object(r),!0).forEach(function(t){a(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):z(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({query:e.text},e))},handleInputKeyDown(e,n){var{suggestions:a,selectedIndex:i}=n;switch(e.key){case"ArrowDown":if(null==a||!a.length)return;if(e.preventDefault(),i<a.length-1){var o=i+1;r.announce(l(a,o)),t({type:"SET_SELECTED",payload:o}),t({type:"SET_KEYBOARD_FOCUS_WITHIN",payload:!1})}break;case"ArrowUp":if(null==a||!a.length)return;e.preventDefault();var s=i>0?i-1:-1;r.announce(l(a,s)),t({type:"SET_SELECTED",payload:s}),t({type:"SET_KEYBOARD_FOCUS_WITHIN",payload:s<0});break;case"Escape":e.preventDefault(),t({type:"HIDE_SUGGESTIONS"}),t({type:"SET_SELECTED",payload:-1})}}}};function Y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function H(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Y(Object(r),!0).forEach(function(t){a(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Y(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function q(e){var t,r,n,a,{dispatch:i,searchContainerRef:s}=e,l=(t=t=>$(t,e.datasets,i,e.transformRequest),r=350,n=null,a=function(){for(var e=arguments.length,a=new Array(e),i=0;i<e;i++)a[i]=arguments[i];clearTimeout(n),n=setTimeout(()=>{t(...a)},r)},a.cancel=()=>{n&&(clearTimeout(n),n=null)},a),c=(e=>{var{dispatch:t,services:r,viewportRef:n,mapProvider:a,markers:i,datasets:s,transformRequest:l,showMarker:c,markerColor:u}=e,d="";return{handleOpenClick(){t({type:"TOGGLE_EXPANDED",payload:!0}),r.eventBus.emit("search:open")},handleCloseClick(e,n){t({type:"TOGGLE_EXPANDED",payload:!1}),t({type:"UPDATE_SUGGESTIONS",payload:[]}),t({type:"SET_VALUE",payload:""}),setTimeout(()=>n.current.focus(),0),i.remove("search"),r.eventBus.emit("search:clear"),r.eventBus.emit("search:close")},handleSubmit:(e,h,p)=>o(function*(){e.preventDefault();var{suggestions:o,selectedIndex:f,value:m}=p,g=null==m?void 0:m.trim();if(t({type:"SET_SELECTED",payload:-1}),t({type:"HIDE_SUGGESTIONS"}),f>=0){var y,b=o[f];return t({type:"SET_VALUE",payload:b.text}),null===(y=n.current)||void 0===y||y.focus(),F({mapProvider:a,bounds:b.bounds,point:b.point,markers:i,showMarker:c,markerColor:u}),void r.eventBus.emit("search:match",B({query:b.text},b))}if(!((null==g?void 0:g.length)<W)){var w=o;if(!o.length||g!==d){var{results:E,sanitisedValue:v}=yield $(g,s,t,l);w=E,d=v}if(w.length){var S;"keyboard"===h.interfaceType&&(null===(S=n.current)||void 0===S||S.focus()),"mobile"===h.breakpoint&&(t({type:"TOGGLE_EXPANDED",payload:!1}),r.eventBus.emit("search:close"));var O=w[0];F({mapProvider:a,bounds:O.bounds,point:O.point,markers:i,showMarker:c,markerColor:u}),r.eventBus.emit("search:match",B({query:m},O))}}})()}})(e),u=(e=>{var{dispatch:t,debouncedFetchSuggestions:r}=e;return{handleInputClick(){t({type:"SHOW_SUGGESTIONS"})},handleInputFocus(e){t({type:"SET_KEYBOARD_FOCUS_WITHIN",payload:"keyboard"===e})},handleInputBlur(e){t({type:"INPUT_BLUR",payload:e})},handleInputChange(e){var n=e.target.value;if(t({type:"SET_VALUE",payload:n}),n.length<W)return r.cancel(),t({type:"UPDATE_SUGGESTIONS",payload:[]}),void t({type:"HIDE_SUGGESTIONS"});t({type:"SHOW_SUGGESTIONS"}),r(n)}}})(H(H({},e),{},{debouncedFetchSuggestions:l})),d=V(e);return H(H(H(H({},c),u),d),{},{handleOutside(t){s.current.contains(t.target)||(i({type:"TOGGLE_EXPANDED",payload:!1}),e.services.eventBus.emit("search:close"))}})}function K(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}var X={reducer:{initialState:{isExpanded:!1,hasKeyboardFocusWithin:!1,value:"",suggestions:[],areSuggestionsVisible:!1,selectedIndex:-1},actions:c},controls:[{id:"search",label:"Search",mobile:{slot:"top-right"},tablet:{slot:"top-left"},desktop:{slot:"top-left"},render:function(i){var{appConfig:o,iconRegistry:s,pluginState:l,pluginConfig:c,appState:d,mapState:h,services:p,mapProvider:g}=i,{id:y}=o,{interfaceType:b}=d,{isExpanded:w,customDatasets:E,osNamesURL:v}=c,{dispatch:S,isExpanded:O,areSuggestionsVisible:N,suggestions:T}=l,_=s.close,D=s.search,x=e(null),j=e(null),P=e(null),M=e(null),G=d.layoutRefs.viewportRef,C=function(e){var{customDatasets:t=[],osNamesURL:r,crs:n}=e;return[{name:"osNames",urlTemplate:r,parseResults:(e,t)=>I(e,t,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},...t]}({customDatasets:E,osNamesURL:v,crs:g.crs}),R=e(null);R.current||(R.current=q(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?K(Object(r),!0).forEach(function(t){a(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):K(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({dispatch:S,datasets:C,services:p,mapProvider:g,viewportRef:G,searchContainerRef:x,markers:h.markers},c)));var k=R.current,L=O||!!(w&&N&&T.length);return t(()=>{var e;O&&(null===(e=P.current)||void 0===e||e.focus())},[O]),t(()=>{if(d.dispatch({type:"TOGGLE_HAS_EXCLUSIVE_CONTROL",payload:O}),L)return G.current.style.pointerEvents="none",document.addEventListener("focusin",k.handleOutside),document.addEventListener("pointerdown",k.handleOutside),()=>{G.current.style.pointerEvents="auto",document.removeEventListener("focusin",k.handleOutside),document.removeEventListener("pointerdown",k.handleOutside)}},[O,b,N,T]),n("div",{className:"im-c-search",ref:x,children:[!w&&r(u,{id:y,isExpanded:O,onClick:()=>k.handleOpenClick(d),buttonRef:j,searchIcon:D}),r(f,{id:y,pluginState:l,pluginConfig:c,appState:d,inputRef:P,events:k,children:r(m,{defaultExpanded:w,onClick:e=>k.handleCloseClick(e,j,d),closeIcon:_,ref:M})})]})}}],icons:[{id:"search",svgContent:'<path d="m21 21-4.34-4.34"></path><circle cx="11" cy="11" r="8"></circle>'}]};export{X as manifest};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import*as e from"react";import*as r from"react/jsx-runtime";var t,n,o={react(r,t,n){var o,i;r.exports=(o={useEffect:()=>e.useEffect,useRef:()=>e.useRef},i={},n.d(i,o),i)},"react/jsx-runtime"(e,t,n){var o,i;e.exports=(o={jsx:()=>r.jsx,jsxs:()=>r.jsxs},i={},n.d(i,o),i)}},i={};function c(e){var r=i[e];if(void 0!==r)return r.exports;var t=i[e]={exports:{}};return o[e](t,t.exports,c),t.exports}c.m=o,c.d=(e,r)=>{for(var t in r)c.o(r,t)&&!c.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},c.f={},c.e=e=>Promise.all(Object.keys(c.f).reduce((r,t)=>(c.f[t](e,r),r),[])),c.u=e=>"../esm/"+e+".js",c.miniCssF=e=>{},c.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;if("string"==typeof import.meta.url&&(e=import.meta.url),!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),c.p=e+"../css/"})(),t={index:0},n=e=>{var r,n,{__webpack_esm_ids__:o,__webpack_esm_modules__:i,__webpack_esm_runtime__:u}=e,a=0;for(r in i)c.o(i,r)&&(c.m[r]=i[r]);for(u&&u(c);a<o.length;a++)n=o[a],c.o(t,n)&&t[n]&&t[n][0](),t[o[a]]=0},c.f.j=(e,r)=>{var o=c.o(t,e)?t[e]:void 0;if(0!==o)if(o)r.push(o[1]);else{var i=import("../css/"+c.u(e)).then(n,r=>{throw 0!==t[e]&&(t[e]=void 0),r});i=Promise.race([i,new Promise(r=>o=t[e]=[r])]),r.push(o[1]=i)}};var u={};function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function f(){var e,r,t="function"==typeof Symbol?Symbol:{},n=t.iterator||"@@iterator",o=t.toStringTag||"@@toStringTag";function i(t,n,o,i){var a=n&&n.prototype instanceof u?n:u,f=Object.create(a.prototype);return s(f,"_invoke",function(t,n,o){var i,u,a,f=0,s=o||[],p=!1,l={p:0,n:0,v:e,a:b,f:b.bind(e,4),d:function(r,t){return i=r,u=0,a=e,l.n=t,c}};function b(t,n){for(u=t,a=n,r=0;!p&&f&&!o&&r<s.length;r++){var o,i=s[r],b=l.p,y=i[2];t>3?(o=y===n)&&(a=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=b&&((o=t<2&&b<i[1])?(u=0,l.v=n,l.n=i[1]):b<y&&(o=t<3||i[0]>n||n>y)&&(i[4]=t,i[5]=n,l.n=y,u=0))}if(o||t>1)return c;throw p=!0,n}return function(o,s,y){if(f>1)throw TypeError("Generator is already running");for(p&&1===s&&b(s,y),u=s,a=y;(r=u<2?e:a)||!p;){i||(u?u<3?(u>1&&(l.n=-1),b(u,a)):l.n=a:l.v=a);try{if(f=2,i){if(u||(o="next"),r=i[o]){if(!(r=r.call(i,a)))throw TypeError("iterator result is not an object");if(!r.done)return r;a=r.value,u<2&&(u=0)}else 1===u&&(r=i.return)&&r.call(i),u<2&&(a=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((r=(p=l.n<0)?a:t.call(n,l))!==c)break}catch(r){i=e,u=1,a=r}finally{f=1}}return{value:r,done:p}}}(t,o,i),!0),f}var c={};function u(){}function a(){}function p(){}r=Object.getPrototypeOf;var l=[][n]?r(r([][n]())):(s(r={},n,function(){return this}),r),b=p.prototype=u.prototype=Object.create(l);function y(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,s(e,o,"GeneratorFunction")),e.prototype=Object.create(b),e}return a.prototype=p,s(b,"constructor",p),s(p,"constructor",a),a.displayName="GeneratorFunction",s(p,o,"GeneratorFunction"),s(b),s(b,o,"Generator"),s(b,n,function(){return this}),s(b,"toString",function(){return"[object Generator]"}),(f=function(){return{w:i,m:y}})()}function s(e,r,t,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}s=function(e,r,t,n){function i(r,t){s(e,r,function(e){return this._invoke(r,t,e)})}r?o?o(e,r,{value:t,enumerable:!n,configurable:!n,writable:!n}):e[r]=t:(i("next",0),i("throw",1),i("return",2))},s(e,r,t,n)}function p(e,r,t,n,o,i,c){try{var u=e[i](c),a=u.value}catch(e){return void t(e)}u.done?r(a):Promise.resolve(a).then(n,o)}function l(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 b(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?l(Object(t),!0).forEach(function(r){y(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):l(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function y(e,r,t){return(r=function(e){var r=function(e){if("object"!=a(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var t=r.call(e,"string");if("object"!=a(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==a(r)?r:r+""}(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function m(){var e,r,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.isExpanded&&(t.manifest={controls:[{id:"search",mobile:{slot:"banner"}}]}),b(b({showMarker:!0},t),{},{id:"search",load:(e=f().m(function e(){var r;return f().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,c.e("im-search-plugin").then(c.bind(c,"./plugins/search/src/manifest.js"));case 1:return r=e.v.manifest,e.a(2,r)}},e)}),r=function(){var r=this,t=arguments;return new Promise(function(n,o){var i=e.apply(r,t);function c(e){p(i,n,o,c,u,"next",e)}function u(e){p(i,n,o,c,u,"throw",e)}c(void 0)})},function(){return r.apply(this,arguments)})})}c.d(u,{A:()=>m});const v=u.A;export{v 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};
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export const __webpack_esm_id__="im-esri-provider";export const __webpack_esm_ids__=["im-esri-provider"];export const __webpack_esm_modules__={"./providers/beta/esri/src/esriProvider.js"(t,e,n){n.d(e,{default:()=>D}),n.r(e);var r=n("@arcgis/core/config.js"),o=n("@arcgis/core/Map.js"),i=n("@arcgis/core/views/MapView.js"),a=n("@arcgis/core/layers/VectorTileLayer.js"),u={animationDuration:200},c=["showKeyboardHelp","selectControl","moveLarge","nudgeMap","zoomLarge","nudgeZoom"];function s(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 l=n("@arcgis/core/core/reactiveUtils.js"),f=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 v(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function p(t){var e=t.mapProvider,n=t.view,r=t.baseTileLayer,o=t.events,i=t.eventBus,a=t.getZoom,u=t.getCenter,c=t.getBounds,s=t.getResolution,p=!1,y=[],m=[],h=function(t){var e=function(){if(p||!n||n.destroyed||!n.extent)return null;var t=n.constraints,e=t.maxZoom,r=t.minZoom;return{center:u(),bounds:c(),resolution:s(),zoom:a(),isAtMaxZoom:n.zoom+.01>=e,isAtMinZoom:n.zoom-.01<=r}}();e&&i.emit(t,e)};(0,l.when)(function(){return r.loaded&&n.resolution>0},function(){return h(o.MAP_LOADED)}),(0,l.once)(function(){return n.ready}).then(function(){p||i.emit(o.MAP_READY,e.getMapAPI())}),(0,l.once)(function(){return n.stationary}).then(function(){return h(o.MAP_FIRST_IDLE)});var d=f(function(){return h(o.MAP_MOVE_END)},500);m.push(d),y.push((0,l.watch)(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,s=!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){s=!0,o=t}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,n)||function(t,e){if(t){if("string"==typeof t)return v(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(t,e):void 0}}(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.")}()),a=r[0],u=r[1];(a||u)&&i.emit(o.MAP_MOVE_START),a||u||d()}));var b,g,w=(b=function(){return h(o.MAP_MOVE)},g=0,function(){var t=Date.now();t-g>=10&&(g=t,b.apply(void 0,arguments))});m.push(w),y.push((0,l.watch)(function(){return n.zoom},w)),y.push((0,l.watch)(function(){return n.extent},function(){return i.emit(o.MAP_RENDER)},{initial:!1}));var x=f(function(){return h(o.MAP_DATA_CHANGE)},500);return m.push(x),y.push((0,l.watch)(function(){return n.updating},function(t){return!t&&x()})),y.push(n.on("click",function(t){var e=t.mapPoint,n={x:t.x,y:t.y};i.emit(o.MAP_CLICK,{point:n,coords:[e.x,e.y]})})),{remove:function(){p=!0,m.forEach(function(t){return t.cancel()}),y.forEach(function(t){return t.remove()})}}}var y=n("@arcgis/core/geometry/Extent.js");function m(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!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){s=!0,o=t}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return h(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)?h(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 h(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 d=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)},b={top:0,right:0,bottom:0,left:0};function g(){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,s=Object.create(c.prototype);return w(s,"_invoke",function(n,r,o){var i,u,c,s=0,l=o||[],f=!1,v={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,n){return i=e,u=0,c=t,v.n=n,a}};function p(n,r){for(u=n,c=r,e=0;!f&&s&&!o&&e<l.length;e++){var o,i=l[e],p=v.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]<=p&&((o=n<2&&p<i[1])?(u=0,v.v=r,v.n=i[1]):p<y&&(o=n<3||i[0]>r||r>y)&&(i[4]=n,i[5]=r,v.n=y,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,y){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,y),u=l,c=y;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(v.n=-1),p(u,c)):v.n=c:v.v=c);try{if(s=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=(f=v.n<0)?c:n.call(r,v))!==a)break}catch(e){i=t,u=1,c=e}finally{s=1}}return{value:e,done:f}}}(n,o,i),!0),s}var a={};function u(){}function c(){}function s(){}e=Object.getPrototypeOf;var l=[][r]?e(e([][r]())):(w(e={},r,function(){return this}),e),f=s.prototype=u.prototype=Object.create(l);function v(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,s):(t.__proto__=s,w(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=s,w(f,"constructor",s),w(s,"constructor",c),c.displayName="GeneratorFunction",w(s,o,"GeneratorFunction"),w(f),w(f,o,"Generator"),w(f,r,function(){return this}),w(f,"toString",function(){return"[object Generator]"}),(g=function(){return{w:i,m:v}})()}function w(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}w=function(t,e,n,r){function i(e,n){w(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))},w(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 _(){var t;return t=g().m(function t(e,n){var r,o;return g().w(function(t){for(;;)switch(t.n){case 0:if(e&&n){t.n=1;break}return t.a(2,[]);case 1:if((r=e.map.layers.filter(function(t){return t instanceof a.default})).length){t.n=2;break}return t.a(2,[]);case 2:return t.n=3,e.hitTest(n,{include:r.toArray()});case 3:return o=t.v,t.a(2,o.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)}),_=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)})},_.apply(this,arguments)}var T=n("@arcgis/core/geometry/Point.js"),S=function(t){return t?new y.default({xmin:t[0],ymin:t[1],xmax:t[2],ymax:t[3],spatialReference:{wkid:27700}}):void 0},E=function(t){return t?new T.default({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"}},j=["container","padding","mapStyle","maxExtent"];function M(t){return M="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},M(t)}function O(){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,s=Object.create(c.prototype);return P(s,"_invoke",function(n,r,o){var i,u,c,s=0,l=o||[],f=!1,v={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,n){return i=e,u=0,c=t,v.n=n,a}};function p(n,r){for(u=n,c=r,e=0;!f&&s&&!o&&e<l.length;e++){var o,i=l[e],p=v.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]<=p&&((o=n<2&&p<i[1])?(u=0,v.v=r,v.n=i[1]):p<y&&(o=n<3||i[0]>r||r>y)&&(i[4]=n,i[5]=r,v.n=y,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,y){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,y),u=l,c=y;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(v.n=-1),p(u,c)):v.n=c:v.v=c);try{if(s=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=(f=v.n<0)?c:n.call(r,v))!==a)break}catch(e){i=t,u=1,c=e}finally{s=1}}return{value:e,done:f}}}(n,o,i),!0),s}var a={};function u(){}function c(){}function s(){}e=Object.getPrototypeOf;var l=[][r]?e(e([][r]())):(P(e={},r,function(){return this}),e),f=s.prototype=u.prototype=Object.create(l);function v(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,s):(t.__proto__=s,P(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=s,P(f,"constructor",s),P(s,"constructor",c),c.displayName="GeneratorFunction",P(s,o,"GeneratorFunction"),P(f),P(f,o,"Generator"),P(f,r,function(){return this}),P(f,"toString",function(){return"[object Generator]"}),(O=function(){return{w:i,m:v}})()}function P(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}P=function(t,e,n,r){function i(e,n){P(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))},P(t,e,n,r)}function k(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 z(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 C(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,B(r.key),r)}}function B(t){var e=function(t){if("object"!=M(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=M(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==M(e)?e:e+""}var D=function(){return t=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:c,supportsMapSizes:!1},Object.assign(this,r),this.mapEventHandles=[],this.appEventHandles=[]},e=[{key:"initMap",value:(n=O().m(function t(e){var n,u,c,l,f,v,y,m,h,d;return O().w(function(t){for(;;)switch(t.n){case 0:if(n=e.container,u=e.padding,c=e.mapStyle,l=e.maxExtent,k(e,j),f=this.events,v=this.eventBus,!this.setupConfig){t.n=1;break}return t.n=1,this.setupConfig(r.default);case 1:y=new a.default({id:"baselayer",url:c.url,visible:!0}),m=new o.default({layers:[y]}),h=l?S(l):null,d=new i.default({spatialReference:27700,container:n,map:m,zoom:e.zoom,center:E(e.center),maxExtent:l,constraints:{snapToZoom:!1,minZoom:e.minZoom,maxZoom:e.maxZoom,maxScale:0,geometry:h,rotationEnabled:!1},ui:{components:[]},popupEnabled:!1}),A(d.container),d.padding=u,e.bounds&&d.when(function(){return d.goTo(S(e.bounds),{duration:0})}),this.mapEventHandles=p({mapProvider:this,map:m,view:d,baseTileLayer:y,events:f,eventBus:v,getZoom:this.getZoom.bind(this),getCenter:this.getCenter.bind(this),getBounds:this.getBounds.bind(this),getResolution:this.getResolution.bind(this)}),this.appEventHandles=s({baseTileLayer:y,events:f,eventBus:v})||[],this.map=m,this.view=d,this.baseTileLayer=y;case 2:return t.a(2)}},t,this)}),l=function(){var t=this,e=arguments;return new Promise(function(r,o){var i=n.apply(t,e);function a(t){z(i,r,o,a,u,"next",t)}function u(t){z(i,r,o,a,u,"throw",t)}a(void 0)})},function(t){return l.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:u.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:u.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:u.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:u.animationDuration})}},{key:"fitToBounds",value:function(t){this.view.goTo(S(t),{duration:u.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 _.apply(this,arguments)}(this.view,t)}},{key:"getAreaDimensions",value:function(){return function(t){if(!(t&&t instanceof y.default))return"";var e=t.xmin,n=t.ymin,r=t.xmax,o=t.ymax-n,i=d(r-e),a=d(o);return"".concat(a," by ").concat(i)}(function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:b;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},u=t.toMap(i),c=t.toMap(a);return new y.default({xmin:u.x,ymin:u.y,xmax:c.x,ymax:c.y,spatialReference:u.spatialReference})}(this.view))}},{key:"getCardinalMove",value:function(t,e){return function(t,e){var n=m(t,2),r=n[0],o=n[1],i=m(e,2),a=i[0]-r,u=i[1]-o,c=[];return Math.abs(u)>.1&&c.push("".concat(u>0?"north":"south"," ").concat(d(Math.abs(u)))),Math.abs(a)>.1&&c.push("".concat(a>0?"east":"west"," ").concat(d(Math.abs(a)))),c.join(", ")}(t,e)}},{key:"getResolution",value:function(){return this.view.resolution}},{key:"mapToScreen",value:function(t){var e=E(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]}}],e&&C(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,l}()}};
|
|
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
|
-
|
|
2
|
-
import*as e from"@arcgis/core/Map.js";import*as r from"@arcgis/core/config.js";import*as t from"@arcgis/core/core/reactiveUtils.js";import*as o from"@arcgis/core/geometry/Extent.js";import*as n from"@arcgis/core/geometry/Point.js";import*as i from"@arcgis/core/layers/VectorTileLayer.js";import*as a from"@arcgis/core/views/MapView.js";var c,u,s={"@arcgis/core/Map.js"(r,t,o){var n,i;r.exports=(n={default:()=>e.default},i={},o.d(i,n),i)},"@arcgis/core/config.js"(e,t,o){var n,i;e.exports=(n={default:()=>r.default},i={},o.d(i,n),i)},"@arcgis/core/core/reactiveUtils.js"(e,r,o){var n,i;e.exports=(n={once:()=>t.once,watch:()=>t.watch,when:()=>t.when},i={},o.d(i,n),i)},"@arcgis/core/geometry/Extent.js"(e,r,t){var n,i;e.exports=(n={default:()=>o.default},i={},t.d(i,n),i)},"@arcgis/core/geometry/Point.js"(e,r,t){var o,i;e.exports=(o={default:()=>n.default},i={},t.d(i,o),i)},"@arcgis/core/layers/VectorTileLayer.js"(e,r,t){var o,n;e.exports=(o={default:()=>i.default},n={},t.d(n,o),n)},"@arcgis/core/views/MapView.js"(e,r,t){var o,n;e.exports=(o={default:()=>a.default},n={},t.d(n,o),n)}},f={};function l(e){var r=f[e];if(void 0!==r)return r.exports;var t=f[e]={exports:{}};return s[e](t,t.exports,l),t.exports}function p(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,o=Array(r);t<r;t++)o[t]=e[t];return o}function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function y(){var e,r,t="function"==typeof Symbol?Symbol:{},o=t.iterator||"@@iterator",n=t.toStringTag||"@@toStringTag";function i(t,o,n,i){var u=o&&o.prototype instanceof c?o:c,s=Object.create(u.prototype);return m(s,"_invoke",function(t,o,n){var i,c,u,s=0,f=n||[],l=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(r,t){return i=r,c=0,u=e,p.n=t,a}};function d(t,o){for(c=t,u=o,r=0;!l&&s&&!n&&r<f.length;r++){var n,i=f[r],d=p.p,y=i[2];t>3?(n=y===o)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=d&&((n=t<2&&d<i[1])?(c=0,p.v=o,p.n=i[1]):d<y&&(n=t<3||i[0]>o||o>y)&&(i[4]=t,i[5]=o,p.n=y,c=0))}if(n||t>1)return a;throw l=!0,o}return function(n,f,y){if(s>1)throw TypeError("Generator is already running");for(l&&1===f&&d(f,y),c=f,u=y;(r=c<2?e:u)||!l;){i||(c?c<3?(c>1&&(p.n=-1),d(c,u)):p.n=u:p.v=u);try{if(s=2,i){if(c||(n="next"),r=i[n]){if(!(r=r.call(i,u)))throw TypeError("iterator result is not an object");if(!r.done)return r;u=r.value,c<2&&(c=0)}else 1===c&&(r=i.return)&&r.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+n+"' method"),c=1);i=e}else if((r=(l=p.n<0)?u:t.call(o,p))!==a)break}catch(r){i=e,c=1,u=r}finally{s=1}}return{value:r,done:l}}}(t,n,i),!0),s}var a={};function c(){}function u(){}function s(){}r=Object.getPrototypeOf;var f=[][o]?r(r([][o]())):(m(r={},o,function(){return this}),r),l=s.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,m(e,n,"GeneratorFunction")),e.prototype=Object.create(l),e}return u.prototype=s,m(l,"constructor",s),m(s,"constructor",u),u.displayName="GeneratorFunction",m(s,n,"GeneratorFunction"),m(l),m(l,n,"Generator"),m(l,o,function(){return this}),m(l,"toString",function(){return"[object Generator]"}),(y=function(){return{w:i,m:p}})()}function m(e,r,t,o){var n=Object.defineProperty;try{n({},"",{})}catch(e){n=0}m=function(e,r,t,o){function i(r,t){m(e,r,function(e){return this._invoke(r,t,e)})}r?n?n(e,r,{value:t,enumerable:!o,configurable:!o,writable:!o}):e[r]=t:(i("next",0),i("throw",1),i("return",2))},m(e,r,t,o)}function v(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 b(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?v(Object(t),!0).forEach(function(r){g(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):v(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function g(e,r,t){return(r=function(e){var r=function(e){if("object"!=d(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var t=r.call(e,"string");if("object"!=d(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==d(r)?r:r+""}(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function h(e,r,t,o,n,i,a){try{var c=e[i](a),u=c.value}catch(e){return void t(e)}c.done?r(u):Promise.resolve(u).then(o,n)}l.m=s,l.d=(e,r)=>{for(var t in r)l.o(r,t)&&!l.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},l.f={},l.e=e=>Promise.all(Object.keys(l.f).reduce((r,t)=>(l.f[t](e,r),r),[])),l.u=e=>"../esm/"+e+".js",l.miniCssF=e=>"../css/"+e+".css",l.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;if("string"==typeof import.meta.url&&(e=import.meta.url),!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),l.p=e+"../css/"})(),(()=>{if("undefined"!=typeof document){var e={index:0};l.f.miniCss=(r,t)=>{e[r]?t.push(e[r]):0!==e[r]&&{"im-esri-provider":1}[r]&&t.push(e[r]=(e=>new Promise((r,t)=>{var o=l.miniCssF(e),n=l.p+o;if(((e,r)=>{for(var t=document.getElementsByTagName("link"),o=0;o<t.length;o++){var n=(a=t[o]).getAttribute("data-href")||a.getAttribute("href");if("stylesheet"===a.rel&&(n===e||n===r))return a}var i=document.getElementsByTagName("style");for(o=0;o<i.length;o++){var a;if((n=(a=i[o]).getAttribute("data-href"))===e||n===r)return a}})(o,n))return r();((e,r,t,o,n)=>{var i=document.createElement("link");i.rel="stylesheet",i.type="text/css",l.nc&&(i.nonce=l.nc),i.onerror=i.onload=t=>{if(i.onerror=i.onload=null,"load"===t.type)o();else{var a=t&&t.type,c=t&&t.target&&t.target.href||r,u=new Error("Loading CSS chunk "+e+" failed.\n("+a+": "+c+")");u.name="ChunkLoadError",u.code="CSS_CHUNK_LOAD_FAILED",u.type=a,u.request=c,i.parentNode&&i.parentNode.removeChild(i),n(u)}},i.href=r,document.head.appendChild(i)})(e,n,0,r,t)}))(r).then(()=>{e[r]=0},t=>{throw delete e[r],t}))}}})(),c={index:0},u=e=>{var r,t,{__webpack_esm_ids__:o,__webpack_esm_modules__:n,__webpack_esm_runtime__:i}=e,a=0;for(r in n)l.o(n,r)&&(l.m[r]=n[r]);for(i&&i(l);a<o.length;a++)t=o[a],l.o(c,t)&&c[t]&&c[t][0](),c[o[a]]=0},l.f.j=(e,r)=>{var t=l.o(c,e)?c[e]:void 0;if(0!==t)if(t)r.push(t[1]);else{var o=import("../css/"+l.u(e)).then(u,r=>{throw 0!==c[e]&&(c[e]=void 0),r});o=Promise.race([o,new Promise(r=>t=c[e]=[r])]),r.push(t[1]=o)}};var w=document.documentMode,j={isSupported:!!Array.prototype.findLast,error:"Array.FindLast() is not supported"},O=function(){if(!window.WebGLRenderingContext)return{isEnabled:!1,error:"WebGL is not supported"};var e,r=document.createElement("canvas"),t=!1,o=function(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=function(e,r){if(e){if("string"==typeof e)return p(e,r);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?p(e,r):void 0}}(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var o=0,n=function(){};return{s:n,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:n}}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,c=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){c=!0,i=e},f:function(){try{a||null==t.return||t.return()}finally{if(c)throw i}}}}(["webgl2","webgl1"]);try{for(o.s();!(e=o.n()).done;){var n=e.value;try{if((t=r.getContext(n))&&"function"==typeof t.getParameter)return{isEnabled:!0}}catch(e){}}}catch(e){o.e(e)}finally{o.f()}return{isEnabled:!1,error:"WebGL is supported, but disabled"}}();function P(){var e,r,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{checkDeviceCapabilities:function(){return{isSupported:j.isSupported&&O.isEnabled&&!w,error:"Internet Explorer is not supported"}},load:(e=y().m(function e(){var r,o,n;return y().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=b(b({},t),{},{crs:"EPSG:27700"}),e.p=1,e.n=2,l.e("im-esri-provider").then(l.bind(l,"./providers/beta/esri/src/esriProvider.js"));case 2:return o=e.v.default,e.a(2,{MapProvider:o,mapProviderConfig:r});case 3:throw e.p=3,n=e.v,console.error("Failed to load map provider",n),n;case 4:return e.a(2)}},e,null,[[1,3]])}),r=function(){var r=this,t=arguments;return new Promise(function(o,n){var i=e.apply(r,t);function a(e){h(i,o,n,a,c,"next",e)}function c(e){h(i,o,n,a,c,"throw",e)}a(void 0)})},function(){return r.apply(this,arguments)})}}export{P 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};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
/*! For license information please see im-reverse-geocode.js.LICENSE.txt */
|
|
2
|
-
export const __webpack_esm_id__="im-reverse-geocode";export const __webpack_esm_ids__=["im-reverse-geocode"];export const __webpack_esm_modules__={"./providers/beta/open-names/src/reverseGeocode.js"(t,e,r){r.d(e,{reverseGeocode:()=>E}),r.r(e);let n=" ";class i{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,o=null,a=null,s=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),a=(60*t%60).toFixed(r),60==a&&(a=(0).toFixed(r),o++),o=("000"+o).slice(-3),a<10&&(a="0"+a),n=o+"°"+i.separator+a+"′";break;case"dms":case"deg+min+sec":o=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,o++),o=("000"+o).slice(-3),a=("00"+a).slice(-2),s<10&&(s="0"+s),n=o+"°"+i.separator+a+"′"+i.separator+s+"″"}return n}static toLat(t,e,r){const n=i.toDms(i.wrap90(t),e,r);return null===n?"–":n.slice(1)+i.separator+(t<0?"S":"N")}static toLon(t,e,r){const n=i.toDms(i.wrap180(t),e,r);return null===n?"–":n+i.separator+(t<0?"W":"E")}static toBrng(t,e,r){const n=i.toDms(i.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=i.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=i;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,i=this.dot(t);return Math.atan2(n,i)}rotateAround(t,e){if(!(t instanceof a))throw new TypeError("axis is not Vector3d object");const r=e.toRadians(),n=this.unit(),i=t.unit(),o=Math.sin(r),s=Math.cos(r),l=1-s,c=i.x,u=i.y,h=i.z,d=[[l*c*c+s,l*c*u-o*h,l*c*h+o*u],[l*c*u+o*h,l*u*u+s,l*u*h-o*c],[l*c*h-o*u,l*u*h+o*c,l*h*h+s]],p=[d[0][0]*n.x+d[0][1]*n.y+d[0][2]*n.z,d[1][0]*n.x+d[1][1]*n.y+d[1][2]*n.z,d[2][0]*n.x+d[2][1]*n.y+d[2][2]*n.z];return new a(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 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=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 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 i=t[0];if("Point"==i.type&&Array.isArray(i.coordinates)?([r,e,n]=i.coordinates,n=n||0):(null!=i.latitude&&(e=i.latitude),null!=i.lat&&(e=i.lat),null!=i.longitude&&(r=i.longitude),null!=i.lng&&(r=i.lng),null!=i.lon&&(r=i.lon),null!=i.height&&(n=i.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:l.WGS84,e=this.lat.toRadians(),r=this.lon.toRadians(),n=this.height,{a:i,f:o}=t,a=Math.sin(e),s=Math.cos(e),c=Math.sin(r),u=Math.cos(r),d=2*o-o*o,p=i/Math.sqrt(1-d*a*a);return new h((p+n)*s*u,(p+n)*s*c,(p*(1-d)+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}`):`${o.toLat(this.lat,t,e)}, ${o.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:i,b:o,f:a}=t,s=2*a-a*a,c=s/(1-s),h=Math.sqrt(e*e+r*r),d=o*n/(i*h)*(1+c*o/Math.sqrt(h*h+n*n)),p=d/Math.sqrt(1+d*d),f=p/d,m=isNaN(f)?0:Math.atan2(n+c*o*p*p*p,h-s*i*f*f*f),g=Math.atan2(r,e),y=Math.sin(m),w=h*Math.cos(m)+n*y-i*i/(i/Math.sqrt(1-s*y*y));return new u(m.toDegrees(),g.toDegrees(),w)}toString(t=0){return`[${this.x.toFixed(t)},${this.y.toFixed(t)},${this.z.toFixed(t)}]`}}const d={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}},p={ED50:{ellipsoid:d.Intl1924,transform:[89.5,93.8,123.1,-1.2,0,0,.156]},ETRS89:{ellipsoid:d.GRS80,transform:[0,0,0,0,0,0,0]},Irl1975:{ellipsoid:d.AiryModified,transform:[-482.53,130.596,-564.557,-8.15,1.042,.214,.631]},NAD27:{ellipsoid:d.Clarke1866,transform:[8,-160,-176,0,0,0,0]},NAD83:{ellipsoid:d.GRS80,transform:[.9956,-1.9103,-.5215,-62e-5,.025915,.009426,.011599]},NTF:{ellipsoid:d.Clarke1880IGN,transform:[168,60,-320,0,0,0,0]},OSGB36:{ellipsoid:d.Airy1830,transform:[-446.448,125.157,-542.06,20.4894,-.1502,-.247,-.8421]},Potsdam:{ellipsoid:d.Bessel1841,transform:[-582,-105,-414,-8.3,1.04,.35,-3.08]},TokyoJapan:{ellipsoid:d.Bessel1841,transform:[148,-507,-685,0,0,0,0]},WGS72:{ellipsoid:d.WGS72,transform:[0,0,-4.5,-.22,0,0,.554]},WGS84:{ellipsoid:d.WGS84,transform:[0,0,0,0,0,0,0]}};Object.keys(d).forEach(t=>Object.freeze(d[t])),Object.keys(p).forEach(t=>{Object.freeze(p[t]),Object.freeze(p[t].transform)});class f extends u{constructor(t,e,r=0,n=p.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 d}static get datums(){return p}static parse(...t){let e=p.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 m(t.x,t.y,t.z,this.datum)}}class m 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||p.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!=p.WGS84||(e=this,r=t.transform),t==p.WGS84&&(e=this,r=this.datum.transform.map(t=>-t)),null==r&&(e=this.convertDatum(p.WGS84),r=t.transform);const n=e.applyTransform(r);return n.datum=t,n}applyTransform(t){const{x:e,y:r,z:n}=this,i=t[0],o=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 m(i+e*s-r*u+n*c,o+e*u+r*s-n*l,a-e*c+r*l+n*s)}}const g={trueOrigin:{lat:49,lon:-2},falseOrigin:{easting:-4e5,northing:1e5},scaleFactor:.9996012717,ellipsoid:f.ellipsoids.Airy1830};class y{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:i}=g.ellipsoid,o=g.trueOrigin.lat.toRadians(),a=g.trueOrigin.lon.toRadians(),s=-g.falseOrigin.easting,l=-g.falseOrigin.northing,c=g.scaleFactor,u=1-i*i/(n*n),h=(n-i)/(n+i),d=h*h,p=h*h*h;let m=o,y=0;do{m=(r-l-y)/(n*c)+m,y=i*c*((1+h+5/4*d+5/4*p)*(m-o)-(3*h+3*h*h+21/8*p)*Math.sin(m-o)*Math.cos(m+o)+(15/8*d+15/8*p)*Math.sin(2*(m-o))*Math.cos(2*(m+o))-35/24*p*Math.sin(3*(m-o))*Math.cos(3*(m+o)))}while(Math.abs(r-l-y)>=1e-5);const _=Math.cos(m),N=Math.sin(m),b=n*c/Math.sqrt(1-u*N*N),v=n*c*(1-u)/Math.pow(1-u*N*N,1.5),E=b/v-1,S=Math.tan(m),M=S*S,T=M*M,$=1/_,x=b*b*b,G=x*b*b,O=e-s,F=O*O,R=F*O,W=F*F,L=R*F;m=m-S/(2*v*b)*F+S/(24*v*x)*(5+3*M+E-9*M*E)*W-S/(720*v*G)*(61+90*M+45*T)*(W*F);const z=a+$/b*O-$/(6*x)*(b/v+2*M)*R+$/(120*G)*(5+28*M+24*T)*L-$/(G*b*b*5040)*(61+662*M+1320*T+T*M*720)*(L*F);let A=new w(m.toDegrees(),z.toDegrees(),0,f.datums.OSGB36);return t!=f.datums.OSGB36&&(A=A.convertDatum(t),A=new w(A.lat,A.lon,A.height,A.datum)),A}static parse(t){let e=(t=String(t).trim()).match(/^(\d+),\s*(\d+)$/);if(e)return new y(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 i=(r-2)%5*5+n%5,o=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=i+a[0],l=o+a[1];return new y(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),i=Math.floor(r/1e5);let o=19-i-(19-i)%5+Math.floor((n+10)/5),a=5*(19-i)%25+n%5;o>7&&o++,a>7&&a++;const s=String.fromCharCode(o+"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:i}=g.ellipsoid,o=g.trueOrigin.lat.toRadians(),a=g.trueOrigin.lon.toRadians(),s=-g.falseOrigin.easting,l=-g.falseOrigin.northing,c=g.scaleFactor,u=1-i*i/(n*n),h=(n-i)/(n+i),d=h*h,p=h*h*h,m=Math.cos(e),w=Math.sin(e),_=n*c/Math.sqrt(1-u*w*w),N=n*c*(1-u)/Math.pow(1-u*w*w,1.5),b=_/N-1,v=i*c*((1+h+5/4*d+5/4*p)*(e-o)-(3*h+3*h*h+21/8*p)*Math.sin(e-o)*Math.cos(e+o)+(15/8*d+15/8*p)*Math.sin(2*(e-o))*Math.cos(2*(e+o))-35/24*p*Math.sin(3*(e-o))*Math.cos(3*(e+o))),E=m*m*m,S=E*m*m,M=Math.tan(e)*Math.tan(e),T=M*M,$=r-a,x=$*$,G=x*$,O=G*$,F=O*$;let R=v+l+_/2*w*m*x+_/24*w*E*(5-M+9*b)*O+_/720*w*S*(61-58*M+T)*(F*$),W=s+_*m*$+_/6*E*(_/N-M)*G+_/120*S*(5-18*M+T+14*b-58*M*b)*F;R=Number(R.toFixed(3)),W=Number(W.toFixed(3));try{return new y(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 w(e.lat,e.lon,e.height,e.datum)}}function _(t){var e=t.ID,r=t.NAME1,n=t.POPULATED_PLACE,i=t.COUNTY_UNITARY,o=t.REGION,a=t.GEOMETRY_X,s=t.GEOMETRY_Y;return{id:e||"",place:"".concat(r).concat(n?", "+n:"").concat(i?", "+i:"",", ").concat(o),county:i||"",coordinates:[a,s]}}function N(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function o(r,n,i,o){var l=n&&n.prototype instanceof s?n:s,c=Object.create(l.prototype);return b(c,"_invoke",function(r,n,i){var o,s,l,c=0,u=i||[],h=!1,d={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,r){return o=e,s=0,l=t,d.n=r,a}};function p(r,n){for(s=r,l=n,e=0;!h&&c&&!i&&e<u.length;e++){var i,o=u[e],p=d.p,f=o[2];r>3?(i=f===n)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=p&&((i=r<2&&p<o[1])?(s=0,d.v=n,d.n=o[1]):p<f&&(i=r<3||o[0]>n||n>f)&&(o[4]=r,o[5]=n,d.n=f,s=0))}if(i||r>1)return a;throw h=!0,n}return function(i,u,f){if(c>1)throw TypeError("Generator is already running");for(h&&1===u&&p(u,f),s=u,l=f;(e=s<2?t:l)||!h;){o||(s?s<3?(s>1&&(d.n=-1),p(s,l)):d.n=l:d.v=l);try{if(c=2,o){if(s||(i="next"),e=o[i]){if(!(e=e.call(o,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=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=t}else if((e=(h=d.n<0)?l:r.call(n,d))!==a)break}catch(e){o=t,s=1,l=e}finally{c=1}}return{value:e,done:h}}}(r,i,o),!0),c}var a={};function s(){}function l(){}function c(){}e=Object.getPrototypeOf;var u=[][n]?e(e([][n]())):(b(e={},n,function(){return this}),e),h=c.prototype=s.prototype=Object.create(u);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,b(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return l.prototype=c,b(h,"constructor",c),b(c,"constructor",l),l.displayName="GeneratorFunction",b(c,i,"GeneratorFunction"),b(h),b(h,i,"Generator"),b(h,n,function(){return this}),b(h,"toString",function(){return"[object Generator]"}),(N=function(){return{w:o,m:d}})()}function b(t,e,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}b=function(t,e,r,n){function o(e,r){b(t,e,function(t){return this._invoke(e,r,t)})}e?i?i(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(o("next",0),o("throw",1),o("return",2))},b(t,e,r,n)}function v(t,e,r,n,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void r(t)}s.done?e(l):Promise.resolve(l).then(n,i)}var E=function(){var t,e=(t=N().m(function t(){var e,r,n,i,o,a,s,l,c,u,h,d,p,f,m=arguments;return N().w(function(t){for(;;)switch(t.p=t.n){case 0:if(e=m.length>0&&void 0!==m[0]?m[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=m.length>1?m[1]:void 0,o=i=m.length>4?m[4]:void 0,"EPSG:4326"!==(n=m.length>2?m[2]:void 0)){t.n=3;break}t.p=1,o=[(o=new w(i[1],i[0]).toOsGrid()).easting,o.northing].map(function(t){return Math.round(t)}),t.n=3;break;case 2:return t.p=2,p=t.v,console.log(p),t.a(2,null);case 3:if(e=e.replace("{easting}",Math.round(o[0])).replace("{northing}",Math.round(o[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=_(l.results[0].GAZETTEER_ENTRY),"EPSG:4326"===n&&(u=new y(c.coordinates[0],c.coordinates[1]),h=u.toLatLon(),c.coordinates=[h.lat,h.lon]),d="Approximate centre ".concat(null==c?void 0:c.place),t.a(2,l.results?d:null)}},t,null,[[4,6],[1,2]])}),function(){var e=this,r=arguments;return new Promise(function(n,i){var o=t.apply(e,r);function a(t){v(o,n,i,a,s,"next",t)}function s(t){v(o,n,i,a,s,"throw",t)}a(void 0)})});return function(){return e.apply(this,arguments)}}()}};
|
|
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
|
-
|
|
2
|
-
var e,r,t={},o={};function n(e){var r=o[e];if(void 0!==r)return r.exports;var i=o[e]={exports:{}};return t[e](i,i.exports,n),i.exports}n.m=t,n.d=(e,r)=>{for(var t in r)n.o(r,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce((r,t)=>(n.f[t](e,r),r),[])),n.u=e=>"../esm/"+e+".js",n.miniCssF=e=>{},n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;if("string"==typeof import.meta.url&&(e=import.meta.url),!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e+"../css/"})(),e={index:0},r=r=>{var t,o,{__webpack_esm_ids__:i,__webpack_esm_modules__:c,__webpack_esm_runtime__:u}=r,a=0;for(t in c)n.o(c,t)&&(n.m[t]=c[t]);for(u&&u(n);a<i.length;a++)o=i[a],n.o(e,o)&&e[o]&&e[o][0](),e[i[a]]=0},n.f.j=(t,o)=>{var i=n.o(e,t)?e[t]:void 0;if(0!==i)if(i)o.push(i[1]);else{var c=import("../css/"+n.u(t)).then(r,r=>{throw 0!==e[t]&&(e[t]=void 0),r});c=Promise.race([c,new Promise(r=>i=e[t]=[r])]),o.push(i[1]=c)}};var i={};function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function u(){var e,r,t="function"==typeof Symbol?Symbol:{},o=t.iterator||"@@iterator",n=t.toStringTag||"@@toStringTag";function i(t,o,n,i){var u=o&&o.prototype instanceof f?o:f,p=Object.create(u.prototype);return a(p,"_invoke",function(t,o,n){var i,u,a,f=0,p=n||[],s=!1,l={p:0,n:0,v:e,a:b,f:b.bind(e,4),d:function(r,t){return i=r,u=0,a=e,l.n=t,c}};function b(t,o){for(u=t,a=o,r=0;!s&&f&&!n&&r<p.length;r++){var n,i=p[r],b=l.p,y=i[2];t>3?(n=y===o)&&(a=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=b&&((n=t<2&&b<i[1])?(u=0,l.v=o,l.n=i[1]):b<y&&(n=t<3||i[0]>o||o>y)&&(i[4]=t,i[5]=o,l.n=y,u=0))}if(n||t>1)return c;throw s=!0,o}return function(n,p,y){if(f>1)throw TypeError("Generator is already running");for(s&&1===p&&b(p,y),u=p,a=y;(r=u<2?e:a)||!s;){i||(u?u<3?(u>1&&(l.n=-1),b(u,a)):l.n=a:l.v=a);try{if(f=2,i){if(u||(n="next"),r=i[n]){if(!(r=r.call(i,a)))throw TypeError("iterator result is not an object");if(!r.done)return r;a=r.value,u<2&&(u=0)}else 1===u&&(r=i.return)&&r.call(i),u<2&&(a=TypeError("The iterator does not provide a '"+n+"' method"),u=1);i=e}else if((r=(s=l.n<0)?a:t.call(o,l))!==c)break}catch(r){i=e,u=1,a=r}finally{f=1}}return{value:r,done:s}}}(t,n,i),!0),p}var c={};function f(){}function p(){}function s(){}r=Object.getPrototypeOf;var l=[][o]?r(r([][o]())):(a(r={},o,function(){return this}),r),b=s.prototype=f.prototype=Object.create(l);function y(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,a(e,n,"GeneratorFunction")),e.prototype=Object.create(b),e}return p.prototype=s,a(b,"constructor",s),a(s,"constructor",p),p.displayName="GeneratorFunction",a(s,n,"GeneratorFunction"),a(b),a(b,n,"Generator"),a(b,o,function(){return this}),a(b,"toString",function(){return"[object Generator]"}),(u=function(){return{w:i,m:y}})()}function a(e,r,t,o){var n=Object.defineProperty;try{n({},"",{})}catch(e){n=0}a=function(e,r,t,o){function i(r,t){a(e,r,function(e){return this._invoke(r,t,e)})}r?n?n(e,r,{value:t,enumerable:!o,configurable:!o,writable:!o}):e[r]=t:(i("next",0),i("throw",1),i("return",2))},a(e,r,t,o)}function f(e,r,t,o,n,i,c){try{var u=e[i](c),a=u.value}catch(e){return void t(e)}u.done?r(a):Promise.resolve(a).then(o,n)}function p(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 s(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?p(Object(t),!0).forEach(function(r){l(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):p(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function l(e,r,t){return(r=function(e){var r=function(e){if("object"!=c(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var t=r.call(e,"string");if("object"!=c(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==c(r)?r:r+""}(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function b(){var e,r;return s(s({},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),{},{load:(e=u().m(function e(){var r;return u().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,n.e("im-reverse-geocode").then(n.bind(n,"./providers/beta/open-names/src/reverseGeocode.js"));case 1:return r=e.v,e.a(2,r.reverseGeocode)}},e)}),r=function(){var r=this,t=arguments;return new Promise(function(o,n){var i=e.apply(r,t);function c(e){f(i,o,n,c,u,"next",e)}function u(e){f(i,o,n,c,u,"throw",e)}c(void 0)})},function(){return r.apply(this,arguments)})})}n.d(i,{A:()=>b});const y=i.A;export{y 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
|
+
})
|