diff --git a/assets/css/bp-xprofile-custom-field-types.css b/assets/css/bp-xprofile-custom-field-types.css index 9b7f3fd..76b1c56 100644 --- a/assets/css/bp-xprofile-custom-field-types.css +++ b/assets/css/bp-xprofile-custom-field-types.css @@ -18,3 +18,22 @@ .bpxcftr-from-to-edit-field-numeric input[type="text"] { width: 4em !important; } + + +.field_type_leaflet .error { + color: red; +} + +.bpx-leaflet-map { + height: 150px; + margin-top: 10px; + width: 100%; +} +.bp-x-laeflet-label-wrapper { + display: flex; + justify-content: space-between; + align-items: center; +} +.bp-x-laeflet-label-wrapper label { + margin: initial !important; +} \ No newline at end of file diff --git a/assets/js/bp-xprofile-custom-field-types-admin.js b/assets/js/bp-xprofile-custom-field-types-admin.js index bf53b6d..a2d4515 100644 --- a/assets/js/bp-xprofile-custom-field-types-admin.js +++ b/assets/js/bp-xprofile-custom-field-types-admin.js @@ -1,7 +1,7 @@ jQuery( document).ready(function($) { var fieldWithOptions = ['checkbox_acceptance', 'select_custom_post_type', 'multiselect_custom_post_type', - 'select_custom_taxonomy', 'multiselect_custom_taxonomy', + 'select_custom_taxonomy', 'multiselect_custom_taxonomy','leaflet', 'decimal_number', 'number_minmax', 'slider','token', 'fromto', 'country', 'web', 'tags']; var $selectBox = $('#select2-box'); @@ -36,6 +36,28 @@ jQuery( document).ready(function($) { }); + // Clicking into the custom date format field should select the Custom radio button. + var $birthdate_format_custom_value = jQuery( '#bpxcftr-birthdate-date-format-custom-value' ); + var $birthdate_format_custom = jQuery( '#bpxcftr-birthdate-date-format-custom' ); + var $birthdate_format_sample = jQuery( '#bpxcftr-birthdate-date-format-custom-sample' ); + $birthdate_format_custom_value.on( 'focus', function() { + $birthdate_format_custom.prop( 'checked', 'checked' ); + } ); + + // Validate custom date field. + var $birthdate_format_spinner = jQuery( '#bpxcftr-birthdate-date-format-custom-spinner' ); + $birthdate_format_custom_value.on( 'change', function( e ) { + $birthdate_format_spinner.addClass( 'is-active' ); + jQuery.post( ajaxurl, { + action: 'date_format', + date: e.target.value + }, + function( response ) { + $birthdate_format_spinner.removeClass( 'is-active' ); + $birthdate_format_sample.html( response ); + } ); + } ); + /** * Toggle Select2 box based on preference. * @param selectedType diff --git a/assets/js/bp-xprofile-custom-field-types.js b/assets/js/bp-xprofile-custom-field-types.js index b276fdf..fb841cf 100644 --- a/assets/js/bp-xprofile-custom-field-types.js +++ b/assets/js/bp-xprofile-custom-field-types.js @@ -34,6 +34,6 @@ } ); - }); + }); })(jQuery); \ No newline at end of file diff --git a/assets/js/bp-xprofile-leaflet-field-type.js b/assets/js/bp-xprofile-leaflet-field-type.js new file mode 100644 index 0000000..a44bb71 --- /dev/null +++ b/assets/js/bp-xprofile-leaflet-field-type.js @@ -0,0 +1,99 @@ +(function ($) { + 'use strict'; + var bpx_leaflet_template = function(str, data) { + return str.replace(/\{ *([\w_]+) *\}/g, function (str, key) { + var value = data[key]; + + if (value === undefined) { + value = ''; + } else if (typeof value === 'function') { + value = value(data); + } + return value.trim(); + }); + }; + + var bpx_leaflet_setLocation = function(r,map,marker,$label,$hidden) { + if (r) { + var tpl = bpx_leaflet_template("{building} {road} {house_number}, {postcode} {city} {town} {village}, {county}, {country}", r.properties.address); + tpl = tpl.replace(/\s{2,}/g, " ").replace(/\s,/g,',').replace(/,{2,}/g,',').trim().replace(/^,/g,'').trim(); + var value = JSON.stringify(Object.assign({},r.center,{name : tpl})); + if (marker) { + marker + .setLatLng(r.center) + .setPopupContent(r.html) + .openPopup(); + } else { + marker = L.marker(r.center) + .bindPopup(r.html) + .addTo(map) + .openPopup(); + } + $label.text( tpl ); + $hidden.val(value); + } + return marker; + }; + + //Leaflet + $('.bpx-leaflet-map').each(function () { + var $divmap = $(this); + var $label = $(this).closest("fieldset").find("label"); + var $hidden = $(this).closest("fieldset").find("input[type=hidden]"); + var $buttonRemove = $(this).closest("fieldset").find("svg"); + var map; + var marker; + var lat = $divmap.data("latitude"); + var lng = $divmap.data("longitude"); + var zoom = $divmap.data("zoom"); + var value = null; + + + if ($hidden.val()!==null) { + // Set the map lat,Lng with the value + try { + value = JSON.parse($hidden.val()); + if (typeof value.lat !=='undefined' && typeof value.lng !=="undefined") { + lat = value.lat; + lng = value.lng; + } + } + catch (e) { + // Keep default value + } + } + map = L.map($divmap[0].id).setView([lat, lng ], zoom); + if (value!=null && typeof value.name !=='undefined') { + marker = new L.marker(value).bindPopup(value.name).addTo(map).openPopup(); + } + //var geocoder = L.Control.Geocoder.nominatim({htmlTemplate : hmtlTemplateGeocoder}); + var geocoder = L.Control.Geocoder.nominatim(); + var control = L.Control.geocoder({ + placeholder: 'Search here...', + geocoder: geocoder + }).addTo(map); + L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { + attribution: '© OpenStreetMap' + }).addTo(map); + // Click on map + map.on('click', function(e) { + geocoder.reverse(e.latlng, map.options.crs.scale(map.getZoom()), function(results) { + var r = results[0]; + marker = bpx_leaflet_setLocation(r,map,marker,$label,$hidden); + }); + }); + // Search location found + control.on('markgeocode',function(r) { + marker = bpx_leaflet_setLocation(r.geocode,map,marker,$label,$hidden); + }) + // Remove adresse + $buttonRemove.on('click',function() { + $label.text(""); + $hidden.val(""); + if (marker) { + map.removeLayer(marker); + } + marker = null; + }) + }); +})(jQuery); \ No newline at end of file diff --git a/assets/vendors/leaflet-control-geocoder/Control.Geocoder.css b/assets/vendors/leaflet-control-geocoder/Control.Geocoder.css new file mode 100644 index 0000000..5662d41 --- /dev/null +++ b/assets/vendors/leaflet-control-geocoder/Control.Geocoder.css @@ -0,0 +1,126 @@ +.leaflet-control-geocoder { + border-radius: 4px !important; + background: white !important; + min-width: 26px !important; + min-height: 26px !important; +} + +.leaflet-touch .leaflet-control-geocoder { + min-width: 30px !important; + min-height: 30px !important; +} + +.leaflet-control-geocoder a, +.leaflet-control-geocoder .leaflet-control-geocoder-icon { + border-bottom: none !important; + display: inline-block !important; +} + +.leaflet-control-geocoder .leaflet-control-geocoder-alternatives a { + width: inherit !important; + height: inherit !important; + line-height: inherit !important; +} + +.leaflet-control-geocoder a:hover, +.leaflet-control-geocoder .leaflet-control-geocoder-icon:hover { + border-bottom: none !important; + display: inline-block !important; +} + +.leaflet-control-geocoder-form { + display: none !important; + vertical-align: middle !important; +} +.leaflet-control-geocoder-expanded .leaflet-control-geocoder-form { + display: inline-block !important; +} +.leaflet-control-geocoder-form input { + font-size: 120% !important; + border: 0 !important; + background-color: transparent !important; + width: 246px !important; +} + +.leaflet-control-geocoder-icon { + border-radius: 4px !important; + width: 26px !important; + height: 26px !important; + border: none !important; + background-color: white !important; + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12.2 13l3.4 6.6c.6 1.1 2.5-.4 2-1.2l-4-6.2z'/%3E%3Ccircle cx='10.8' cy='8.9' r='3.9' fill='none' stroke='%23000' stroke-width='1.5'/%3E%3C/svg%3E") !important; + background-repeat: no-repeat !important; + background-position: center !important; + cursor: pointer !important; +} + +.leaflet-touch .leaflet-control-geocoder-icon { + width: 30px !important; + height: 30px !important; +} + +.leaflet-control-geocoder-throbber .leaflet-control-geocoder-icon { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' stroke='%23000' stroke-linecap='round' stroke-width='1.6' viewBox='0 0 24 24'%3E%3Cdefs/%3E%3Cg%3E%3Cpath stroke-opacity='.1' d='M14 8.4l3-5'/%3E%3Cpath stroke-opacity='.2' d='M15.6 10l5-3'/%3E%3Cpath stroke-opacity='.3' d='M16.2 12H22'/%3E%3Cpath stroke-opacity='.4' d='M15.6 14l5 3m-6.5-1.4l2.9 5'/%3E%3Cpath stroke-opacity='.5' d='M12 16.2V22m-2-6.4l-3 5'/%3E%3Cpath stroke-opacity='.6' d='M8.4 14l-5 3'/%3E%3Cpath stroke-opacity='.7' d='M7.8 12H2'/%3E%3Cpath stroke-opacity='.8' d='M8.4 10l-5-3'/%3E%3Cpath stroke-opacity='.9' d='M10 8.4l-3-5'/%3E%3Cpath d='M12 7.8V2'/%3E%3CanimateTransform attributeName='transform' calcMode='discrete' dur='1s' repeatCount='indefinite' type='rotate' values='0 12 12 !important;30 12 12 !important;60 12 12 !important;90 12 12 !important;120 12 12 !important;150 12 12 !important;180 12 12 !important;210 12 12 !important;240 12 12 !important;270 12 12 !important;300 12 12 !important;330 12 12'/%3E%3C/g%3E%3C/svg%3E") !important; +} + +.leaflet-control-geocoder-form-no-error { + display: none !important; +} + +.leaflet-control-geocoder-form input:focus { + outline: none !important; +} + +.leaflet-control-geocoder-form button { + display: none !important; +} +.leaflet-control-geocoder-error { + margin-top: 8px !important; + margin-left: 8px !important; + display: block !important; + color: #444 !important; +} +.leaflet-control-geocoder-alternatives { + display: block !important; + width: 272px !important; + list-style: none !important; + padding: 0 !important; + margin: 0 !important; +} + +.leaflet-control-geocoder-alternatives-minimized { + display: none !important; + height: 0 !important; +} +.leaflet-control-geocoder-alternatives li { + white-space: nowrap !important; + display: block !important; + overflow: hidden !important; + padding: 5px 8px !important; + text-overflow: ellipsis !important; + border-bottom: 1px solid #ccc !important; + cursor: pointer !important; +} + +.leaflet-control-geocoder-alternatives li a, +.leaflet-control-geocoder-alternatives li a:hover { + width: inherit !important; + height: inherit !important; + line-height: inherit !important; + background: inherit !important; + border-radius: inherit !important; + text-align: left !important; +} + +.leaflet-control-geocoder-alternatives li:last-child { + border-bottom: none !important; +} +.leaflet-control-geocoder-alternatives li:hover, +.leaflet-control-geocoder-selected { + background-color: #f5f5f5 !important; +} +.leaflet-control-geocoder-address-detail { +} +.leaflet-control-geocoder-address-context { + color: #666 !important; +} diff --git a/assets/vendors/leaflet-control-geocoder/Control.Geocoder.js b/assets/vendors/leaflet-control-geocoder/Control.Geocoder.js new file mode 100644 index 0000000..94d0f9c --- /dev/null +++ b/assets/vendors/leaflet-control-geocoder/Control.Geocoder.js @@ -0,0 +1,1971 @@ +var leafletControlGeocoder = (function (exports, L) { + + function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + Object.keys(e).forEach(function (k) { + if (k !== 'default') { + var d = Object.getOwnPropertyDescriptor(e, k); + Object.defineProperty(n, k, d.get ? d : { + enumerable: true, + get: function () { + return e[k]; + } + }); + } + }); + } + n['default'] = e; + return n; + } + + var L__namespace = /*#__PURE__*/_interopNamespace(L); + + function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + subClass.__proto__ = superClass; + } + + function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; + } + + /** + * @internal + */ + + function geocodingParams(options, params) { + return L__namespace.Util.extend(params, options.geocodingQueryParams); + } + /** + * @internal + */ + + function reverseParams(options, params) { + return L__namespace.Util.extend(params, options.reverseQueryParams); + } + + /** + * @internal + */ + + var lastCallbackId = 0; // Adapted from handlebars.js + // https://github.com/wycats/handlebars.js/ + + /** + * @internal + */ + + var badChars = /[&<>"'`]/g; + /** + * @internal + */ + + var possible = /[&<>"'`]/; + /** + * @internal + */ + + var escape = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + '`': '`' + }; + /** + * @internal + */ + + function escapeChar(chr) { + return escape[chr]; + } + /** + * @internal + */ + + + function htmlEscape(string) { + if (string == null) { + return ''; + } else if (!string) { + return string + ''; + } // Force a string conversion as this will be done by the append regardless and + // the regex test will do this transparently behind the scenes, causing issues if + // an object's to string has escaped characters in it. + + + string = '' + string; + + if (!possible.test(string)) { + return string; + } + + return string.replace(badChars, escapeChar); + } + /** + * @internal + */ + + function jsonp(url, params, callback, context, jsonpParam) { + var callbackId = '_l_geocoder_' + lastCallbackId++; + params[jsonpParam || 'callback'] = callbackId; + window[callbackId] = L__namespace.Util.bind(callback, context); + var script = document.createElement('script'); + script.type = 'text/javascript'; + script.src = url + getParamString(params); + script.id = callbackId; + document.getElementsByTagName('head')[0].appendChild(script); + } + /** + * @internal + */ + + function getJSON(url, params, callback) { + var xmlHttp = new XMLHttpRequest(); + + xmlHttp.onreadystatechange = function () { + if (xmlHttp.readyState !== 4) { + return; + } + + var message; + + if (xmlHttp.status !== 200 && xmlHttp.status !== 304) { + message = ''; + } else if (typeof xmlHttp.response === 'string') { + // IE doesn't parse JSON responses even with responseType: 'json'. + try { + message = JSON.parse(xmlHttp.response); + } catch (e) { + // Not a JSON response + message = xmlHttp.response; + } + } else { + message = xmlHttp.response; + } + + callback(message); + }; + + xmlHttp.open('GET', url + getParamString(params), true); + xmlHttp.responseType = 'json'; + xmlHttp.setRequestHeader('Accept', 'application/json'); + xmlHttp.send(null); + } + /** + * @internal + */ + + function template(str, data) { + return str.replace(/\{ *([\w_]+) *\}/g, function (str, key) { + var value = data[key]; + + if (value === undefined) { + value = ''; + } else if (typeof value === 'function') { + value = value(data); + } + + return htmlEscape(value); + }); + } + /** + * @internal + */ + + function getParamString(obj, existingUrl, uppercase) { + var params = []; + + for (var i in obj) { + var key = encodeURIComponent(uppercase ? i.toUpperCase() : i); + var value = obj[i]; + + if (!Array.isArray(value)) { + params.push(key + '=' + encodeURIComponent(String(value))); + } else { + for (var j = 0; j < value.length; j++) { + params.push(key + '=' + encodeURIComponent(value[j])); + } + } + } + + return (!existingUrl || existingUrl.indexOf('?') === -1 ? '?' : '&') + params.join('&'); + } + + /** + * Implementation of the [ArcGIS geocoder](https://developers.arcgis.com/features/geocoding/) + */ + + var ArcGis = /*#__PURE__*/function () { + function ArcGis(options) { + this.options = { + serviceUrl: 'https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer', + apiKey: '' + }; + L__namespace.Util.setOptions(this, options); + } + + var _proto = ArcGis.prototype; + + _proto.geocode = function geocode(query, cb, context) { + var params = geocodingParams(this.options, { + token: this.options.apiKey, + SingleLine: query, + outFields: 'Addr_Type', + forStorage: false, + maxLocations: 10, + f: 'json' + }); + getJSON(this.options.serviceUrl + '/findAddressCandidates', params, function (data) { + var results = []; + + if (data.candidates && data.candidates.length) { + for (var i = 0; i <= data.candidates.length - 1; i++) { + var loc = data.candidates[i]; + var latLng = L__namespace.latLng(loc.location.y, loc.location.x); + var latLngBounds = L__namespace.latLngBounds(L__namespace.latLng(loc.extent.ymax, loc.extent.xmax), L__namespace.latLng(loc.extent.ymin, loc.extent.xmin)); + results[i] = { + name: loc.address, + bbox: latLngBounds, + center: latLng + }; + } + } + + cb.call(context, results); + }); + }; + + _proto.suggest = function suggest(query, cb, context) { + return this.geocode(query, cb, context); + }; + + _proto.reverse = function reverse(location, scale, cb, context) { + var params = reverseParams(this.options, { + location: location.lng + ',' + location.lat, + distance: 100, + f: 'json' + }); + getJSON(this.options.serviceUrl + '/reverseGeocode', params, function (data) { + var result = []; + + if (data && !data.error) { + var center = L__namespace.latLng(data.location.y, data.location.x); + var bbox = L__namespace.latLngBounds(center, center); + result.push({ + name: data.address.Match_addr, + center: center, + bbox: bbox + }); + } + + cb.call(context, result); + }); + }; + + return ArcGis; + }(); + /** + * [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link ArcGis} + * @param options the options + */ + + function arcgis(options) { + return new ArcGis(options); + } + + /** + * Implementation of the [Bing Locations API](https://docs.microsoft.com/en-us/bingmaps/rest-services/locations/) + */ + + var Bing = /*#__PURE__*/function () { + function Bing(options) { + this.options = { + serviceUrl: 'https://dev.virtualearth.net/REST/v1/Locations' + }; + L__namespace.Util.setOptions(this, options); + } + + var _proto = Bing.prototype; + + _proto.geocode = function geocode(query, cb, context) { + var params = geocodingParams(this.options, { + query: query, + key: this.options.apiKey + }); + jsonp(this.options.apiKey, params, function (data) { + var results = []; + + if (data.resourceSets.length > 0) { + for (var i = data.resourceSets[0].resources.length - 1; i >= 0; i--) { + var resource = data.resourceSets[0].resources[i], + bbox = resource.bbox; + results[i] = { + name: resource.name, + bbox: L__namespace.latLngBounds([bbox[0], bbox[1]], [bbox[2], bbox[3]]), + center: L__namespace.latLng(resource.point.coordinates) + }; + } + } + + cb.call(context, results); + }, this, 'jsonp'); + }; + + _proto.reverse = function reverse(location, scale, cb, context) { + var params = reverseParams(this.options, { + key: this.options.apiKey + }); + jsonp(this.options.serviceUrl + location.lat + ',' + location.lng, params, function (data) { + var results = []; + + for (var i = data.resourceSets[0].resources.length - 1; i >= 0; i--) { + var resource = data.resourceSets[0].resources[i], + bbox = resource.bbox; + results[i] = { + name: resource.name, + bbox: L__namespace.latLngBounds([bbox[0], bbox[1]], [bbox[2], bbox[3]]), + center: L__namespace.latLng(resource.point.coordinates) + }; + } + + cb.call(context, results); + }, this, 'jsonp'); + }; + + return Bing; + }(); + /** + * [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link Bing} + * @param options the options + */ + + function bing(options) { + return new Bing(options); + } + + var Google = /*#__PURE__*/function () { + function Google(options) { + this.options = { + serviceUrl: 'https://maps.googleapis.com/maps/api/geocode/json' + }; + L__namespace.Util.setOptions(this, options); + } + + var _proto = Google.prototype; + + _proto.geocode = function geocode(query, cb, context) { + var params = geocodingParams(this.options, { + key: this.options.apiKey, + address: query + }); + getJSON(this.options.serviceUrl, params, function (data) { + var results = []; + + if (data.results && data.results.length) { + for (var i = 0; i <= data.results.length - 1; i++) { + var loc = data.results[i]; + var latLng = L__namespace.latLng(loc.geometry.location); + var latLngBounds = L__namespace.latLngBounds(L__namespace.latLng(loc.geometry.viewport.northeast), L__namespace.latLng(loc.geometry.viewport.southwest)); + results[i] = { + name: loc.formatted_address, + bbox: latLngBounds, + center: latLng, + properties: loc.address_components + }; + } + } + + cb.call(context, results); + }); + }; + + _proto.reverse = function reverse(location, scale, cb, context) { + var params = reverseParams(this.options, { + key: this.options.apiKey, + latlng: location.lat + ',' + location.lng + }); + getJSON(this.options.serviceUrl, params, function (data) { + var results = []; + + if (data.results && data.results.length) { + for (var i = 0; i <= data.results.length - 1; i++) { + var loc = data.results[i]; + var center = L__namespace.latLng(loc.geometry.location); + var bbox = L__namespace.latLngBounds(L__namespace.latLng(loc.geometry.viewport.northeast), L__namespace.latLng(loc.geometry.viewport.southwest)); + results[i] = { + name: loc.formatted_address, + bbox: bbox, + center: center, + properties: loc.address_components + }; + } + } + + cb.call(context, results); + }); + }; + + return Google; + }(); + /** + * [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link Google} + * @param options the options + */ + + function google(options) { + return new Google(options); + } + + /** + * Implementation of the [HERE Geocoder API](https://developer.here.com/documentation/geocoder/topics/introduction.html) + */ + + var HERE = /*#__PURE__*/function () { + function HERE(options) { + this.options = { + serviceUrl: 'https://geocoder.api.here.com/6.2/', + app_id: '', + app_code: '', + apiKey: '', + maxResults: 5 + }; + L__namespace.Util.setOptions(this, options); + if (options.apiKey) throw Error('apiKey is not supported, use app_id/app_code instead!'); + } + + var _proto = HERE.prototype; + + _proto.geocode = function geocode(query, cb, context) { + var params = geocodingParams(this.options, { + searchtext: query, + gen: 9, + app_id: this.options.app_id, + app_code: this.options.app_code, + jsonattributes: 1, + maxresults: this.options.maxResults + }); + this.getJSON(this.options.serviceUrl + 'geocode.json', params, cb, context); + }; + + _proto.reverse = function reverse(location, scale, cb, context) { + var prox = location.lat + ',' + location.lng; + + if (this.options.reverseGeocodeProxRadius) { + prox += ',' + this.options.reverseGeocodeProxRadius; + } + + var params = reverseParams(this.options, { + prox: prox, + mode: 'retrieveAddresses', + app_id: this.options.app_id, + app_code: this.options.app_code, + gen: 9, + jsonattributes: 1, + maxresults: this.options.maxResults + }); + this.getJSON(this.options.serviceUrl + 'reversegeocode.json', params, cb, context); + }; + + _proto.getJSON = function getJSON$1(url, params, cb, context) { + getJSON(url, params, function (data) { + var results = []; + + if (data.response.view && data.response.view.length) { + for (var i = 0; i <= data.response.view[0].result.length - 1; i++) { + var loc = data.response.view[0].result[i].location; + var center = L__namespace.latLng(loc.displayPosition.latitude, loc.displayPosition.longitude); + var bbox = L__namespace.latLngBounds(L__namespace.latLng(loc.mapView.topLeft.latitude, loc.mapView.topLeft.longitude), L__namespace.latLng(loc.mapView.bottomRight.latitude, loc.mapView.bottomRight.longitude)); + results[i] = { + name: loc.address.label, + properties: loc.address, + bbox: bbox, + center: center + }; + } + } + + cb.call(context, results); + }); + }; + + return HERE; + }(); + /** + * Implementation of the new [HERE Geocoder API](https://developer.here.com/documentation/geocoding-search-api/api-reference-swagger.html) + */ + + var HEREv2 = /*#__PURE__*/function () { + function HEREv2(options) { + this.options = { + serviceUrl: 'https://geocode.search.hereapi.com/v1', + apiKey: '', + app_id: '', + app_code: '', + maxResults: 10 + }; + L__namespace.Util.setOptions(this, options); + } + + var _proto2 = HEREv2.prototype; + + _proto2.geocode = function geocode(query, cb, context) { + var params = geocodingParams(this.options, { + q: query, + apiKey: this.options.apiKey, + limit: this.options.maxResults + }); + + if (!params.at && !params["in"]) { + throw Error('at / in parameters not found. Please define coordinates (at=latitude,longitude) or other (in) in your geocodingQueryParams.'); + } + + this.getJSON(this.options.serviceUrl + '/discover', params, cb, context); + }; + + _proto2.reverse = function reverse(location, scale, cb, context) { + var params = reverseParams(this.options, { + at: location.lat + ',' + location.lng, + limit: this.options.reverseGeocodeProxRadius, + apiKey: this.options.apiKey + }); + this.getJSON(this.options.serviceUrl + '/revgeocode', params, cb, context); + }; + + _proto2.getJSON = function getJSON$1(url, params, cb, context) { + getJSON(url, params, function (data) { + var results = []; + + if (data.items && data.items.length) { + for (var i = 0; i <= data.items.length - 1; i++) { + var item = data.items[i]; + var latLng = L__namespace.latLng(item.position.lat, item.position.lng); + var bbox = void 0; + + if (item.mapView) { + bbox = L__namespace.latLngBounds(L__namespace.latLng(item.mapView.south, item.mapView.west), L__namespace.latLng(item.mapView.north, item.mapView.east)); + } else { + // Using only position when not provided + bbox = L__namespace.latLngBounds(L__namespace.latLng(item.position.lat, item.position.lng), L__namespace.latLng(item.position.lat, item.position.lng)); + } + + results[i] = { + name: item.address.label, + properties: item.address, + bbox: bbox, + center: latLng + }; + } + } + + cb.call(context, results); + }); + }; + + return HEREv2; + }(); + /** + * [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link HERE} + * @param options the options + */ + + function here(options) { + if (options.apiKey) { + return new HEREv2(options); + } else { + return new HERE(options); + } + } + + /** + * Parses basic latitude/longitude strings such as `'50.06773 14.37742'`, `'N50.06773 W14.37742'`, `'S 50° 04.064 E 014° 22.645'`, or `'S 50° 4′ 03.828″, W 14° 22′ 38.712″'` + * @param query the latitude/longitude string to parse + * @returns the parsed latitude/longitude + */ + + function parseLatLng(query) { + var match; // regex from https://github.com/openstreetmap/openstreetmap-website/blob/master/app/controllers/geocoder_controller.rb + + if (match = query.match(/^([NS])\s*(\d{1,3}(?:\.\d*)?)\W*([EW])\s*(\d{1,3}(?:\.\d*)?)$/)) { + // [NSEW] decimal degrees + return L__namespace.latLng((/N/i.test(match[1]) ? 1 : -1) * +match[2], (/E/i.test(match[3]) ? 1 : -1) * +match[4]); + } else if (match = query.match(/^(\d{1,3}(?:\.\d*)?)\s*([NS])\W*(\d{1,3}(?:\.\d*)?)\s*([EW])$/)) { + // decimal degrees [NSEW] + return L__namespace.latLng((/N/i.test(match[2]) ? 1 : -1) * +match[1], (/E/i.test(match[4]) ? 1 : -1) * +match[3]); + } else if (match = query.match(/^([NS])\s*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\W*([EW])\s*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?$/)) { + // [NSEW] degrees, decimal minutes + return L__namespace.latLng((/N/i.test(match[1]) ? 1 : -1) * (+match[2] + +match[3] / 60), (/E/i.test(match[4]) ? 1 : -1) * (+match[5] + +match[6] / 60)); + } else if (match = query.match(/^(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\s*([NS])\W*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\s*([EW])$/)) { + // degrees, decimal minutes [NSEW] + return L__namespace.latLng((/N/i.test(match[3]) ? 1 : -1) * (+match[1] + +match[2] / 60), (/E/i.test(match[6]) ? 1 : -1) * (+match[4] + +match[5] / 60)); + } else if (match = query.match(/^([NS])\s*(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]?\W*([EW])\s*(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]?$/)) { + // [NSEW] degrees, minutes, decimal seconds + return L__namespace.latLng((/N/i.test(match[1]) ? 1 : -1) * (+match[2] + +match[3] / 60 + +match[4] / 3600), (/E/i.test(match[5]) ? 1 : -1) * (+match[6] + +match[7] / 60 + +match[8] / 3600)); + } else if (match = query.match(/^(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]\s*([NS])\W*(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]?\s*([EW])$/)) { + // degrees, minutes, decimal seconds [NSEW] + return L__namespace.latLng((/N/i.test(match[4]) ? 1 : -1) * (+match[1] + +match[2] / 60 + +match[3] / 3600), (/E/i.test(match[8]) ? 1 : -1) * (+match[5] + +match[6] / 60 + +match[7] / 3600)); + } else if (match = query.match(/^\s*([+-]?\d+(?:\.\d*)?)\s*[\s,]\s*([+-]?\d+(?:\.\d*)?)\s*$/)) { + return L__namespace.latLng(+match[1], +match[2]); + } + } + /** + * Parses basic latitude/longitude strings such as `'50.06773 14.37742'`, `'N50.06773 W14.37742'`, `'S 50° 04.064 E 014° 22.645'`, or `'S 50° 4′ 03.828″, W 14° 22′ 38.712″'` + */ + + var LatLng = /*#__PURE__*/function () { + function LatLng(options) { + this.options = { + next: undefined, + sizeInMeters: 10000 + }; + L__namespace.Util.setOptions(this, options); + } + + var _proto = LatLng.prototype; + + _proto.geocode = function geocode(query, cb, context) { + var center = parseLatLng(query); + + if (center) { + var results = [{ + name: query, + center: center, + bbox: center.toBounds(this.options.sizeInMeters) + }]; + cb.call(context, results); + } else if (this.options.next) { + this.options.next.geocode(query, cb, context); + } + }; + + return LatLng; + }(); + /** + * [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link LatLng} + * @param options the options + */ + + function latLng(options) { + return new LatLng(options); + } + + /** + * Implementation of the [Mapbox Geocoding](https://www.mapbox.com/api-documentation/#geocoding) + */ + + var Mapbox = /*#__PURE__*/function () { + function Mapbox(options) { + this.options = { + serviceUrl: 'https://api.mapbox.com/geocoding/v5/mapbox.places/' + }; + L__namespace.Util.setOptions(this, options); + } + + var _proto = Mapbox.prototype; + + _proto._getProperties = function _getProperties(loc) { + var properties = { + text: loc.text, + address: loc.address + }; + + for (var j = 0; j < (loc.context || []).length; j++) { + var id = loc.context[j].id.split('.')[0]; + properties[id] = loc.context[j].text; // Get country code when available + + if (loc.context[j].short_code) { + properties['countryShortCode'] = loc.context[j].short_code; + } + } + + return properties; + }; + + _proto.geocode = function geocode(query, cb, context) { + var _this = this; + + var params = geocodingParams(this.options, { + access_token: this.options.apiKey + }); + + if (params.proximity !== undefined && params.proximity.lat !== undefined && params.proximity.lng !== undefined) { + params.proximity = params.proximity.lng + ',' + params.proximity.lat; + } + + getJSON(this.options.serviceUrl + encodeURIComponent(query) + '.json', params, function (data) { + var results = []; + + if (data.features && data.features.length) { + for (var i = 0; i <= data.features.length - 1; i++) { + var loc = data.features[i]; + var center = L__namespace.latLng(loc.center.reverse()); + var bbox = void 0; + + if (loc.bbox) { + bbox = L__namespace.latLngBounds(L__namespace.latLng(loc.bbox.slice(0, 2).reverse()), L__namespace.latLng(loc.bbox.slice(2, 4).reverse())); + } else { + bbox = L__namespace.latLngBounds(center, center); + } + + results[i] = { + name: loc.place_name, + bbox: bbox, + center: center, + properties: _this._getProperties(loc) + }; + } + } + + cb.call(context, results); + }); + }; + + _proto.suggest = function suggest(query, cb, context) { + return this.geocode(query, cb, context); + }; + + _proto.reverse = function reverse(location, scale, cb, context) { + var _this2 = this; + + var url = this.options.serviceUrl + location.lng + ',' + location.lat + '.json'; + var param = reverseParams(this.options, { + access_token: this.options.apiKey + }); + getJSON(url, param, function (data) { + var results = []; + + if (data.features && data.features.length) { + for (var i = 0; i <= data.features.length - 1; i++) { + var loc = data.features[i]; + var center = L__namespace.latLng(loc.center.reverse()); + var bbox = void 0; + + if (loc.bbox) { + bbox = L__namespace.latLngBounds(L__namespace.latLng(loc.bbox.slice(0, 2).reverse()), L__namespace.latLng(loc.bbox.slice(2, 4).reverse())); + } else { + bbox = L__namespace.latLngBounds(center, center); + } + + results[i] = { + name: loc.place_name, + bbox: bbox, + center: center, + properties: _this2._getProperties(loc) + }; + } + } + + cb.call(context, results); + }); + }; + + return Mapbox; + }(); + /** + * [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link Mapbox} + * @param options the options + */ + + function mapbox(options) { + return new Mapbox(options); + } + + /** + * Implementation of the [MapQuest Geocoding API](http://developer.mapquest.com/web/products/dev-services/geocoding-ws) + */ + + var MapQuest = /*#__PURE__*/function () { + function MapQuest(options) { + this.options = { + serviceUrl: 'https://www.mapquestapi.com/geocoding/v1' + }; + L__namespace.Util.setOptions(this, options); // MapQuest seems to provide URI encoded API keys, + // so to avoid encoding them twice, we decode them here + + this.options.apiKey = decodeURIComponent(this.options.apiKey); + } + + var _proto = MapQuest.prototype; + + _proto._formatName = function _formatName() { + return [].slice.call(arguments).filter(function (s) { + return !!s; + }).join(', '); + }; + + _proto.geocode = function geocode(query, cb, context) { + var params = geocodingParams(this.options, { + key: this.options.apiKey, + location: query, + limit: 5, + outFormat: 'json' + }); + getJSON(this.options.serviceUrl + '/address', params, L__namespace.Util.bind(function (data) { + var results = []; + + if (data.results && data.results[0].locations) { + for (var i = data.results[0].locations.length - 1; i >= 0; i--) { + var loc = data.results[0].locations[i]; + var center = L__namespace.latLng(loc.latLng); + results[i] = { + name: this._formatName(loc.street, loc.adminArea4, loc.adminArea3, loc.adminArea1), + bbox: L__namespace.latLngBounds(center, center), + center: center + }; + } + } + + cb.call(context, results); + }, this)); + }; + + _proto.reverse = function reverse(location, scale, cb, context) { + var params = reverseParams(this.options, { + key: this.options.apiKey, + location: location.lat + ',' + location.lng, + outputFormat: 'json' + }); + getJSON(this.options.serviceUrl + '/reverse', params, L__namespace.Util.bind(function (data) { + var results = []; + + if (data.results && data.results[0].locations) { + for (var i = data.results[0].locations.length - 1; i >= 0; i--) { + var loc = data.results[0].locations[i]; + var center = L__namespace.latLng(loc.latLng); + results[i] = { + name: this._formatName(loc.street, loc.adminArea4, loc.adminArea3, loc.adminArea1), + bbox: L__namespace.latLngBounds(center, center), + center: center + }; + } + } + + cb.call(context, results); + }, this)); + }; + + return MapQuest; + }(); + /** + * [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link MapQuest} + * @param options the options + */ + + function mapQuest(options) { + return new MapQuest(options); + } + + /** + * Implementation of the [Neutrino API](https://www.neutrinoapi.com/api/geocode-address/) + */ + + var Neutrino = /*#__PURE__*/function () { + function Neutrino(options) { + this.options = { + userId: undefined, + apiKey: undefined, + serviceUrl: 'https://neutrinoapi.com/' + }; + L__namespace.Util.setOptions(this, options); + } // https://www.neutrinoapi.com/api/geocode-address/ + + + var _proto = Neutrino.prototype; + + _proto.geocode = function geocode(query, cb, context) { + var params = geocodingParams(this.options, { + apiKey: this.options.apiKey, + userId: this.options.userId, + //get three words and make a dot based string + address: query.split(/\s+/).join('.') + }); + getJSON(this.options.serviceUrl + 'geocode-address', params, function (data) { + var results = []; + + if (data.locations) { + data.geometry = data.locations[0]; + var center = L__namespace.latLng(data.geometry['latitude'], data.geometry['longitude']); + var bbox = L__namespace.latLngBounds(center, center); + results[0] = { + name: data.geometry.address, + bbox: bbox, + center: center + }; + } + + cb.call(context, results); + }); + }; + + _proto.suggest = function suggest(query, cb, context) { + return this.geocode(query, cb, context); + } // https://www.neutrinoapi.com/api/geocode-reverse/ + ; + + _proto.reverse = function reverse(location, scale, cb, context) { + var params = reverseParams(this.options, { + apiKey: this.options.apiKey, + userId: this.options.userId, + latitude: location.lat, + longitude: location.lng + }); + getJSON(this.options.serviceUrl + 'geocode-reverse', params, function (data) { + var results = []; + + if (data.status.status == 200 && data.found) { + var center = L__namespace.latLng(location.lat, location.lng); + var bbox = L__namespace.latLngBounds(center, center); + results[0] = { + name: data.address, + bbox: bbox, + center: center + }; + } + + cb.call(context, results); + }); + }; + + return Neutrino; + }(); + /** + * [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link Neutrino} + * @param options the options + */ + + function neutrino(options) { + return new Neutrino(options); + } + + /** + * Implementation of the [Nominatim](https://wiki.openstreetmap.org/wiki/Nominatim) geocoder. + * + * This is the default geocoding service used by the control, unless otherwise specified in the options. + * + * Unless using your own Nominatim installation, please refer to the [Nominatim usage policy](https://operations.osmfoundation.org/policies/nominatim/). + */ + + var Nominatim = /*#__PURE__*/function () { + function Nominatim(options) { + this.options = { + serviceUrl: 'https://nominatim.openstreetmap.org/', + htmlTemplate: function htmlTemplate(r) { + var address = r.address; + var className; + var parts = []; + + if (address.road || address.building) { + parts.push('{building} {road} {house_number}'); + } + + if (address.city || address.town || address.village || address.hamlet) { + className = parts.length > 0 ? 'leaflet-control-geocoder-address-detail' : ''; + parts.push('{postcode} {city} {town} {village} {hamlet}'); + } + + if (address.state || address.country) { + className = parts.length > 0 ? 'leaflet-control-geocoder-address-context' : ''; + parts.push('{state} {country}'); + } + + return template(parts.join('
'), address); + } + }; + L__namespace.Util.setOptions(this, options || {}); + } + + var _proto = Nominatim.prototype; + + _proto.geocode = function geocode(query, cb, context) { + var _this = this; + + var params = geocodingParams(this.options, { + q: query, + limit: 5, + format: 'json', + addressdetails: 1 + }); + getJSON(this.options.serviceUrl + 'search', params, function (data) { + var results = []; + + for (var i = data.length - 1; i >= 0; i--) { + var bbox = data[i].boundingbox; + + for (var j = 0; j < 4; j++) { + bbox[j] = +bbox[j]; + } + + results[i] = { + icon: data[i].icon, + name: data[i].display_name, + html: _this.options.htmlTemplate ? _this.options.htmlTemplate(data[i]) : undefined, + bbox: L__namespace.latLngBounds([bbox[0], bbox[2]], [bbox[1], bbox[3]]), + center: L__namespace.latLng(data[i].lat, data[i].lon), + properties: data[i] + }; + } + + cb.call(context, results); + }); + }; + + _proto.reverse = function reverse(location, scale, cb, context) { + var _this2 = this; + + var params = reverseParams(this.options, { + lat: location.lat, + lon: location.lng, + zoom: Math.round(Math.log(scale / 256) / Math.log(2)), + addressdetails: 1, + format: 'json' + }); + getJSON(this.options.serviceUrl + 'reverse', params, function (data) { + var result = []; + + if (data && data.lat && data.lon) { + var center = L__namespace.latLng(data.lat, data.lon); + var bbox = L__namespace.latLngBounds(center, center); + result.push({ + name: data.display_name, + html: _this2.options.htmlTemplate ? _this2.options.htmlTemplate(data) : undefined, + center: center, + bbox: bbox, + properties: data + }); + } + + cb.call(context, result); + }); + }; + + return Nominatim; + }(); + /** + * [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link Nominatim} + * @param options the options + */ + + function nominatim(options) { + return new Nominatim(options); + } + + /** + * Implementation of the [Plus codes](https://plus.codes/) (formerly OpenLocationCode) (requires [open-location-code](https://www.npmjs.com/package/open-location-code)) + */ + + var OpenLocationCode = /*#__PURE__*/function () { + function OpenLocationCode(options) { + L__namespace.Util.setOptions(this, options); + } + + var _proto = OpenLocationCode.prototype; + + _proto.geocode = function geocode(query, cb, context) { + try { + var decoded = this.options.OpenLocationCode.decode(query); + var result = { + name: query, + center: L__namespace.latLng(decoded.latitudeCenter, decoded.longitudeCenter), + bbox: L__namespace.latLngBounds(L__namespace.latLng(decoded.latitudeLo, decoded.longitudeLo), L__namespace.latLng(decoded.latitudeHi, decoded.longitudeHi)) + }; + cb.call(context, [result]); + } catch (e) { + console.warn(e); // eslint-disable-line no-console + + cb.call(context, []); + } + }; + + _proto.reverse = function reverse(location, scale, cb, context) { + try { + var code = this.options.OpenLocationCode.encode(location.lat, location.lng, this.options.codeLength); + var result = { + name: code, + center: L__namespace.latLng(location.lat, location.lng), + bbox: L__namespace.latLngBounds(L__namespace.latLng(location.lat, location.lng), L__namespace.latLng(location.lat, location.lng)) + }; + cb.call(context, [result]); + } catch (e) { + console.warn(e); // eslint-disable-line no-console + + cb.call(context, []); + } + }; + + return OpenLocationCode; + }(); + /** + * [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link OpenLocationCode} + * @param options the options + */ + + function openLocationCode(options) { + return new OpenLocationCode(options); + } + + /** + * Implementation of the [OpenCage Data API](https://opencagedata.com/) + */ + + var OpenCage = /*#__PURE__*/function () { + function OpenCage(options) { + this.options = { + serviceUrl: 'https://api.opencagedata.com/geocode/v1/json' + }; + L__namespace.Util.setOptions(this, options); + } + + var _proto = OpenCage.prototype; + + _proto.geocode = function geocode(query, cb, context) { + var params = geocodingParams(this.options, { + key: this.options.apiKey, + q: query + }); + getJSON(this.options.serviceUrl, params, function (data) { + var results = []; + + if (data.results && data.results.length) { + for (var i = 0; i < data.results.length; i++) { + var loc = data.results[i]; + var center = L__namespace.latLng(loc.geometry); + var bbox = void 0; + + if (loc.annotations && loc.annotations.bounds) { + bbox = L__namespace.latLngBounds(L__namespace.latLng(loc.annotations.bounds.northeast), L__namespace.latLng(loc.annotations.bounds.southwest)); + } else { + bbox = L__namespace.latLngBounds(center, center); + } + + results.push({ + name: loc.formatted, + bbox: bbox, + center: center + }); + } + } + + cb.call(context, results); + }); + }; + + _proto.suggest = function suggest(query, cb, context) { + return this.geocode(query, cb, context); + }; + + _proto.reverse = function reverse(location, scale, cb, context) { + var params = reverseParams(this.options, { + key: this.options.apiKey, + q: [location.lat, location.lng].join(',') + }); + getJSON(this.options.serviceUrl, params, function (data) { + var results = []; + + if (data.results && data.results.length) { + for (var i = 0; i < data.results.length; i++) { + var loc = data.results[i]; + var center = L__namespace.latLng(loc.geometry); + var bbox = void 0; + + if (loc.annotations && loc.annotations.bounds) { + bbox = L__namespace.latLngBounds(L__namespace.latLng(loc.annotations.bounds.northeast), L__namespace.latLng(loc.annotations.bounds.southwest)); + } else { + bbox = L__namespace.latLngBounds(center, center); + } + + results.push({ + name: loc.formatted, + bbox: bbox, + center: center + }); + } + } + + cb.call(context, results); + }); + }; + + return OpenCage; + }(); + function opencage(options) { + return new OpenCage(options); + } + + /** + * Implementation of the [Pelias](https://pelias.io/), [geocode.earth](https://geocode.earth/) geocoder (formerly Mapzen Search) + */ + + var Pelias = /*#__PURE__*/function () { + function Pelias(options) { + this.options = { + serviceUrl: 'https://api.geocode.earth/v1' + }; + this._lastSuggest = 0; + L__namespace.Util.setOptions(this, options); + } + + var _proto = Pelias.prototype; + + _proto.geocode = function geocode(query, cb, context) { + var _this = this; + + var params = geocodingParams(this.options, { + api_key: this.options.apiKey, + text: query + }); + getJSON(this.options.serviceUrl + '/search', params, function (data) { + cb.call(context, _this._parseResults(data, 'bbox')); + }); + }; + + _proto.suggest = function suggest(query, cb, context) { + var _this2 = this; + + var params = geocodingParams(this.options, { + api_key: this.options.apiKey, + text: query + }); + getJSON(this.options.serviceUrl + '/autocomplete', params, function (data) { + if (data.geocoding.timestamp > _this2._lastSuggest) { + _this2._lastSuggest = data.geocoding.timestamp; + cb.call(context, _this2._parseResults(data, 'bbox')); + } + }); + }; + + _proto.reverse = function reverse(location, scale, cb, context) { + var _this3 = this; + + var params = reverseParams(this.options, { + api_key: this.options.apiKey, + 'point.lat': location.lat, + 'point.lon': location.lng + }); + getJSON(this.options.serviceUrl + '/reverse', params, function (data) { + cb.call(context, _this3._parseResults(data, 'bounds')); + }); + }; + + _proto._parseResults = function _parseResults(data, bboxname) { + var results = []; + L__namespace.geoJSON(data, { + pointToLayer: function pointToLayer(feature, latlng) { + return L__namespace.circleMarker(latlng); + }, + onEachFeature: function onEachFeature(feature, layer) { + var result = {}; + var bbox; + var center; + + if (layer.getBounds) { + bbox = layer.getBounds(); + center = bbox.getCenter(); + } else if (layer.feature.bbox) { + center = layer.getLatLng(); + bbox = L__namespace.latLngBounds(L__namespace.GeoJSON.coordsToLatLng(layer.feature.bbox.slice(0, 2)), L__namespace.GeoJSON.coordsToLatLng(layer.feature.bbox.slice(2, 4))); + } else { + center = layer.getLatLng(); + bbox = L__namespace.latLngBounds(center, center); + } + + result.name = layer.feature.properties.label; + result.center = center; + result[bboxname] = bbox; + result.properties = layer.feature.properties; + results.push(result); + } + }); + return results; + }; + + return Pelias; + }(); + /** + * [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link Pelias} + * @param options the options + */ + + function pelias(options) { + return new Pelias(options); + } + var GeocodeEarth = Pelias; + var geocodeEarth = pelias; + /** + * r.i.p. + * @deprecated + */ + + var Mapzen = Pelias; + /** + * r.i.p. + * @deprecated + */ + + var mapzen = pelias; + /** + * Implementation of the [Openrouteservice](https://openrouteservice.org/dev/#/api-docs/geocode) geocoder + */ + + var Openrouteservice = /*#__PURE__*/function (_Pelias) { + _inheritsLoose(Openrouteservice, _Pelias); + + function Openrouteservice(options) { + return _Pelias.call(this, L__namespace.Util.extend({ + serviceUrl: 'https://api.openrouteservice.org/geocode' + }, options)) || this; + } + + return Openrouteservice; + }(Pelias); + /** + * [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link Openrouteservice} + * @param options the options + */ + + function openrouteservice(options) { + return new Openrouteservice(options); + } + + /** + * Implementation of the [Photon](http://photon.komoot.de/) geocoder + */ + + var Photon = /*#__PURE__*/function () { + function Photon(options) { + this.options = { + serviceUrl: 'https://photon.komoot.io/api/', + reverseUrl: 'https://photon.komoot.io/reverse/', + nameProperties: ['name', 'street', 'suburb', 'hamlet', 'town', 'city', 'state', 'country'] + }; + L__namespace.Util.setOptions(this, options); + } + + var _proto = Photon.prototype; + + _proto.geocode = function geocode(query, cb, context) { + var params = geocodingParams(this.options, { + q: query + }); + getJSON(this.options.serviceUrl, params, L__namespace.Util.bind(function (data) { + cb.call(context, this._decodeFeatures(data)); + }, this)); + }; + + _proto.suggest = function suggest(query, cb, context) { + return this.geocode(query, cb, context); + }; + + _proto.reverse = function reverse(latLng, scale, cb, context) { + var params = reverseParams(this.options, { + lat: latLng.lat, + lon: latLng.lng + }); + getJSON(this.options.reverseUrl, params, L__namespace.Util.bind(function (data) { + cb.call(context, this._decodeFeatures(data)); + }, this)); + }; + + _proto._decodeFeatures = function _decodeFeatures(data) { + var results = []; + + if (data && data.features) { + for (var i = 0; i < data.features.length; i++) { + var f = data.features[i]; + var c = f.geometry.coordinates; + var center = L__namespace.latLng(c[1], c[0]); + var extent = f.properties.extent; + var bbox = extent ? L__namespace.latLngBounds([extent[1], extent[0]], [extent[3], extent[2]]) : L__namespace.latLngBounds(center, center); + results.push({ + name: this._decodeFeatureName(f), + html: this.options.htmlTemplate ? this.options.htmlTemplate(f) : undefined, + center: center, + bbox: bbox, + properties: f.properties + }); + } + } + + return results; + }; + + _proto._decodeFeatureName = function _decodeFeatureName(f) { + return (this.options.nameProperties || []).map(function (p) { + return f.properties[p]; + }).filter(function (v) { + return !!v; + }).join(', '); + }; + + return Photon; + }(); + /** + * [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link Photon} + * @param options the options + */ + + function photon(options) { + return new Photon(options); + } + + /** + * Implementation of the What3Words service + */ + + var What3Words = /*#__PURE__*/function () { + function What3Words(options) { + this.options = { + serviceUrl: 'https://api.what3words.com/v2/' + }; + L__namespace.Util.setOptions(this, options); + } + + var _proto = What3Words.prototype; + + _proto.geocode = function geocode(query, cb, context) { + //get three words and make a dot based string + getJSON(this.options.serviceUrl + 'forward', geocodingParams(this.options, { + key: this.options.apiKey, + addr: query.split(/\s+/).join('.') + }), function (data) { + var results = []; + + if (data.geometry) { + var latLng = L__namespace.latLng(data.geometry['lat'], data.geometry['lng']); + var latLngBounds = L__namespace.latLngBounds(latLng, latLng); + results[0] = { + name: data.words, + bbox: latLngBounds, + center: latLng + }; + } + + cb.call(context, results); + }); + }; + + _proto.suggest = function suggest(query, cb, context) { + return this.geocode(query, cb, context); + }; + + _proto.reverse = function reverse(location, scale, cb, context) { + getJSON(this.options.serviceUrl + 'reverse', reverseParams(this.options, { + key: this.options.apiKey, + coords: [location.lat, location.lng].join(',') + }), function (data) { + var results = []; + + if (data.status.status == 200) { + var center = L__namespace.latLng(data.geometry['lat'], data.geometry['lng']); + var bbox = L__namespace.latLngBounds(center, center); + results[0] = { + name: data.words, + bbox: bbox, + center: center + }; + } + + cb.call(context, results); + }); + }; + + return What3Words; + }(); + /** + * [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link What3Words} + * @param options the options + */ + + function what3words(options) { + return new What3Words(options); + } + + var geocoders = { + __proto__: null, + geocodingParams: geocodingParams, + reverseParams: reverseParams, + ArcGis: ArcGis, + arcgis: arcgis, + Bing: Bing, + bing: bing, + Google: Google, + google: google, + HERE: HERE, + HEREv2: HEREv2, + here: here, + parseLatLng: parseLatLng, + LatLng: LatLng, + latLng: latLng, + Mapbox: Mapbox, + mapbox: mapbox, + MapQuest: MapQuest, + mapQuest: mapQuest, + Neutrino: Neutrino, + neutrino: neutrino, + Nominatim: Nominatim, + nominatim: nominatim, + OpenLocationCode: OpenLocationCode, + openLocationCode: openLocationCode, + OpenCage: OpenCage, + opencage: opencage, + Pelias: Pelias, + pelias: pelias, + GeocodeEarth: GeocodeEarth, + geocodeEarth: geocodeEarth, + Mapzen: Mapzen, + mapzen: mapzen, + Openrouteservice: Openrouteservice, + openrouteservice: openrouteservice, + Photon: Photon, + photon: photon, + What3Words: What3Words, + what3words: what3words + }; + + /** + * Leaflet mixins https://leafletjs.com/reference-1.7.1.html#class-includes + * for TypeScript https://www.typescriptlang.org/docs/handbook/mixins.html + * @internal + */ + + var EventedControl = // eslint-disable-next-line @typescript-eslint/no-unused-vars + function EventedControl() {// empty + }; + + L__namespace.Util.extend(EventedControl.prototype, L__namespace.Control.prototype); + L__namespace.Util.extend(EventedControl.prototype, L__namespace.Evented.prototype); + /** + * This is the geocoder control. It works like any other [Leaflet control](https://leafletjs.com/reference.html#control), and is added to the map. + */ + + var GeocoderControl = /*#__PURE__*/function (_EventedControl) { + _inheritsLoose(GeocoderControl, _EventedControl); + + /** + * Instantiates a geocoder control (to be invoked using `new`) + * @param options the options + */ + function GeocoderControl(options) { + var _this; + + _this = _EventedControl.call(this, options) || this; + _this.options = { + showUniqueResult: true, + showResultIcons: false, + collapsed: true, + expand: 'touch', + position: 'topright', + placeholder: 'Search...', + errorMessage: 'Nothing found.', + iconLabel: 'Initiate a new search', + query: '', + queryMinLength: 1, + suggestMinLength: 3, + suggestTimeout: 250, + defaultMarkGeocode: true + }; + _this._requestCount = 0; + L__namespace.Util.setOptions(_assertThisInitialized(_this), options); + + if (!_this.options.geocoder) { + _this.options.geocoder = new Nominatim(); + } + + return _this; + } + + var _proto = GeocoderControl.prototype; + + _proto.addThrobberClass = function addThrobberClass() { + L__namespace.DomUtil.addClass(this._container, 'leaflet-control-geocoder-throbber'); + }; + + _proto.removeThrobberClass = function removeThrobberClass() { + L__namespace.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-throbber'); + } + /** + * Returns the container DOM element for the control and add listeners on relevant map events. + * @param map the map instance + * @see https://leafletjs.com/reference.html#control-onadd + */ + ; + + _proto.onAdd = function onAdd(map) { + var _this2 = this; + + var className = 'leaflet-control-geocoder'; + var container = L__namespace.DomUtil.create('div', className + ' leaflet-bar'); + var icon = L__namespace.DomUtil.create('button', className + '-icon', container); + var form = this._form = L__namespace.DomUtil.create('div', className + '-form', container); + this._map = map; + this._container = container; + icon.innerHTML = ' '; + icon.type = 'button'; + icon.setAttribute('aria-label', this.options.iconLabel); + var input = this._input = L__namespace.DomUtil.create('input', '', form); + input.type = 'text'; + input.value = this.options.query; + input.placeholder = this.options.placeholder; + L__namespace.DomEvent.disableClickPropagation(input); + this._errorElement = L__namespace.DomUtil.create('div', className + '-form-no-error', container); + this._errorElement.innerHTML = this.options.errorMessage; + this._alts = L__namespace.DomUtil.create('ul', className + '-alternatives leaflet-control-geocoder-alternatives-minimized', container); + L__namespace.DomEvent.disableClickPropagation(this._alts); + L__namespace.DomEvent.addListener(input, 'keydown', this._keydown, this); + + if (this.options.geocoder.suggest) { + L__namespace.DomEvent.addListener(input, 'input', this._change, this); + } + + L__namespace.DomEvent.addListener(input, 'blur', function () { + if (_this2.options.collapsed && !_this2._preventBlurCollapse) { + _this2._collapse(); + } + + _this2._preventBlurCollapse = false; + }); + + if (this.options.collapsed) { + if (this.options.expand === 'click') { + L__namespace.DomEvent.addListener(container, 'click', function (e) { + if (e.button === 0 && e.detail !== 2) { + _this2._toggle(); + } + }); + } else if (this.options.expand === 'touch') { + L__namespace.DomEvent.addListener(container, L__namespace.Browser.touch ? 'touchstart mousedown' : 'mousedown', function (e) { + _this2._toggle(); + + e.preventDefault(); // mobile: clicking focuses the icon, so UI expands and immediately collapses + + e.stopPropagation(); + }, this); + } else { + L__namespace.DomEvent.addListener(container, 'mouseover', this._expand, this); + L__namespace.DomEvent.addListener(container, 'mouseout', this._collapse, this); + + this._map.on('movestart', this._collapse, this); + } + } else { + this._expand(); + + if (L__namespace.Browser.touch) { + L__namespace.DomEvent.addListener(container, 'touchstart', function () { + return _this2._geocode(); + }); + } else { + L__namespace.DomEvent.addListener(container, 'click', function () { + return _this2._geocode(); + }); + } + } + + if (this.options.defaultMarkGeocode) { + this.on('markgeocode', this.markGeocode, this); + } + + this.on('startgeocode', this.addThrobberClass, this); + this.on('finishgeocode', this.removeThrobberClass, this); + this.on('startsuggest', this.addThrobberClass, this); + this.on('finishsuggest', this.removeThrobberClass, this); + L__namespace.DomEvent.disableClickPropagation(container); + return container; + } + /** + * Sets the query string on the text input + * @param string the query string + */ + ; + + _proto.setQuery = function setQuery(string) { + this._input.value = string; + return this; + }; + + _proto._geocodeResult = function _geocodeResult(results, suggest) { + if (!suggest && this.options.showUniqueResult && results.length === 1) { + this._geocodeResultSelected(results[0]); + } else if (results.length > 0) { + this._alts.innerHTML = ''; + this._results = results; + L__namespace.DomUtil.removeClass(this._alts, 'leaflet-control-geocoder-alternatives-minimized'); + L__namespace.DomUtil.addClass(this._container, 'leaflet-control-geocoder-options-open'); + + for (var i = 0; i < results.length; i++) { + this._alts.appendChild(this._createAlt(results[i], i)); + } + } else { + L__namespace.DomUtil.addClass(this._container, 'leaflet-control-geocoder-options-error'); + L__namespace.DomUtil.addClass(this._errorElement, 'leaflet-control-geocoder-error'); + } + } + /** + * Marks a geocoding result on the map + * @param result the geocoding result + */ + ; + + _proto.markGeocode = function markGeocode(event) { + var result = event.geocode; + + this._map.fitBounds(result.bbox); + + if (this._geocodeMarker) { + this._map.removeLayer(this._geocodeMarker); + } + + this._geocodeMarker = new L__namespace.Marker(result.center).bindPopup(result.html || result.name).addTo(this._map).openPopup(); + return this; + }; + + _proto._geocode = function _geocode(suggest) { + var _this3 = this; + + var value = this._input.value; + + if (!suggest && value.length < this.options.queryMinLength) { + return; + } + + var requestCount = ++this._requestCount; + + var cb = function cb(results) { + if (requestCount === _this3._requestCount) { + var _event = { + input: value, + results: results + }; + + _this3.fire(suggest ? 'finishsuggest' : 'finishgeocode', _event); + + _this3._geocodeResult(results, suggest); + } + }; + + this._lastGeocode = value; + + if (!suggest) { + this._clearResults(); + } + + var event = { + input: value + }; + this.fire(suggest ? 'startsuggest' : 'startgeocode', event); + + if (suggest) { + this.options.geocoder.suggest(value, cb); + } else { + this.options.geocoder.geocode(value, cb); + } + }; + + _proto._geocodeResultSelected = function _geocodeResultSelected(geocode) { + var event = { + geocode: geocode + }; + this.fire('markgeocode', event); + }; + + _proto._toggle = function _toggle() { + if (L__namespace.DomUtil.hasClass(this._container, 'leaflet-control-geocoder-expanded')) { + this._collapse(); + } else { + this._expand(); + } + }; + + _proto._expand = function _expand() { + L__namespace.DomUtil.addClass(this._container, 'leaflet-control-geocoder-expanded'); + + this._input.select(); + + this.fire('expand'); + }; + + _proto._collapse = function _collapse() { + L__namespace.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-expanded'); + L__namespace.DomUtil.addClass(this._alts, 'leaflet-control-geocoder-alternatives-minimized'); + L__namespace.DomUtil.removeClass(this._errorElement, 'leaflet-control-geocoder-error'); + L__namespace.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-options-open'); + L__namespace.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-options-error'); + + this._input.blur(); // mobile: keyboard shouldn't stay expanded + + + this.fire('collapse'); + }; + + _proto._clearResults = function _clearResults() { + L__namespace.DomUtil.addClass(this._alts, 'leaflet-control-geocoder-alternatives-minimized'); + this._selection = null; + L__namespace.DomUtil.removeClass(this._errorElement, 'leaflet-control-geocoder-error'); + L__namespace.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-options-open'); + L__namespace.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-options-error'); + }; + + _proto._createAlt = function _createAlt(result, index) { + var _this4 = this; + + var li = L__namespace.DomUtil.create('li', ''), + a = L__namespace.DomUtil.create('a', '', li), + icon = this.options.showResultIcons && result.icon ? L__namespace.DomUtil.create('img', '', a) : null, + text = result.html ? undefined : document.createTextNode(result.name), + mouseDownHandler = function mouseDownHandler(e) { + // In some browsers, a click will fire on the map if the control is + // collapsed directly after mousedown. To work around this, we + // wait until the click is completed, and _then_ collapse the + // control. Messy, but this is the workaround I could come up with + // for #142. + _this4._preventBlurCollapse = true; + L__namespace.DomEvent.stop(e); + + _this4._geocodeResultSelected(result); + + L__namespace.DomEvent.on(li, 'click touchend', function () { + if (_this4.options.collapsed) { + _this4._collapse(); + } else { + _this4._clearResults(); + } + }); + }; + + if (icon) { + icon.src = result.icon; + } + + li.setAttribute('data-result-index', String(index)); + + if (result.html) { + a.innerHTML = a.innerHTML + result.html; + } else if (text) { + a.appendChild(text); + } // Use mousedown and not click, since click will fire _after_ blur, + // causing the control to have collapsed and removed the items + // before the click can fire. + + + L__namespace.DomEvent.addListener(li, 'mousedown touchstart', mouseDownHandler, this); + return li; + }; + + _proto._keydown = function _keydown(e) { + var _this5 = this; + + var select = function select(dir) { + if (_this5._selection) { + L__namespace.DomUtil.removeClass(_this5._selection, 'leaflet-control-geocoder-selected'); + _this5._selection = _this5._selection[dir > 0 ? 'nextSibling' : 'previousSibling']; + } + + if (!_this5._selection) { + _this5._selection = _this5._alts[dir > 0 ? 'firstChild' : 'lastChild']; + } + + if (_this5._selection) { + L__namespace.DomUtil.addClass(_this5._selection, 'leaflet-control-geocoder-selected'); + } + }; + + switch (e.keyCode) { + // Escape + case 27: + if (this.options.collapsed) { + this._collapse(); + } else { + this._clearResults(); + } + + break; + // Up + + case 38: + select(-1); + break; + // Up + + case 40: + select(1); + break; + // Enter + + case 13: + if (this._selection) { + var index = parseInt(this._selection.getAttribute('data-result-index'), 10); + + this._geocodeResultSelected(this._results[index]); + + this._clearResults(); + } else { + this._geocode(); + } + + break; + + default: + return; + } + + L__namespace.DomEvent.preventDefault(e); + }; + + _proto._change = function _change() { + var _this6 = this; + + var v = this._input.value; + + if (v !== this._lastGeocode) { + clearTimeout(this._suggestTimeout); + + if (v.length >= this.options.suggestMinLength) { + this._suggestTimeout = setTimeout(function () { + return _this6._geocode(true); + }, this.options.suggestTimeout); + } else { + this._clearResults(); + } + } + }; + + return GeocoderControl; + }(EventedControl); + /** + * [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link GeocoderControl} + * @param options the options + */ + + function geocoder(options) { + return new GeocoderControl(options); + } + + /* @preserve + * Leaflet Control Geocoder + * https://github.com/perliedman/leaflet-control-geocoder + * + * Copyright (c) 2012 sa3m (https://github.com/sa3m) + * Copyright (c) 2018 Per Liedman + * All rights reserved. + */ + L__namespace.Util.extend(GeocoderControl, geocoders); + L__namespace.Util.extend(L__namespace.Control, { + Geocoder: GeocoderControl, + geocoder: geocoder + }); + + exports.Geocoder = GeocoderControl; + exports.default = GeocoderControl; + exports.geocoder = geocoder; + exports.geocoders = geocoders; + + return exports; + +}({}, L)); +//# sourceMappingURL=Control.Geocoder.js.map diff --git a/assets/vendors/leaflet-control-geocoder/Control.Geocoder.js.map b/assets/vendors/leaflet-control-geocoder/Control.Geocoder.js.map new file mode 100644 index 0000000..63ed869 --- /dev/null +++ b/assets/vendors/leaflet-control-geocoder/Control.Geocoder.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Control.Geocoder.js","sources":["../src/geocoders/api.ts","../src/util.ts","../src/geocoders/arcgis.ts","../src/geocoders/bing.ts","../src/geocoders/google.ts","../src/geocoders/here.ts","../src/geocoders/latlng.ts","../src/geocoders/mapbox.ts","../src/geocoders/mapquest.ts","../src/geocoders/neutrino.ts","../src/geocoders/nominatim.ts","../src/geocoders/open-location-code.ts","../src/geocoders/opencage.ts","../src/geocoders/pelias.ts","../src/geocoders/photon.ts","../src/geocoders/what3words.ts","../src/control.ts","../src/index.ts"],"sourcesContent":["import * as L from 'leaflet';\r\n\r\n/**\r\n * An object that represents a result from a geocoding query\r\n */\r\nexport interface GeocodingResult {\r\n /**\r\n * Name of found location\r\n */\r\n name: string;\r\n /**\r\n * The bounds of the location\r\n */\r\n bbox: L.LatLngBounds;\r\n /**\r\n * The center coordinate of the location\r\n */\r\n center: L.LatLng;\r\n /**\r\n * URL for icon representing result; optional\r\n */\r\n icon?: string;\r\n /**\r\n * HTML formatted representation of the name\r\n */\r\n html?: string;\r\n /**\r\n * Additional properties returned by the geocoder\r\n */\r\n properties?: any;\r\n}\r\n\r\n/**\r\n * A callback function used in {@link IGeocoder.geocode} and {@link IGeocoder.suggest} and {@link IGeocoder.reverse}\r\n */\r\nexport type GeocodingCallback = (result: GeocodingResult[]) => void;\r\n\r\n/**\r\n * An interface implemented to respond to geocoding queries\r\n */\r\nexport interface IGeocoder {\r\n /**\r\n * Performs a geocoding query and returns the results to the callback in the provided context\r\n * @param query the query\r\n * @param cb the callback function\r\n * @param context the `this` context in the callback\r\n */\r\n geocode(query: string, cb: GeocodingCallback, context?: any): void;\r\n /**\r\n * Performs a geocoding query suggestion (this happens while typing) and returns the results to the callback in the provided context\r\n * @param query the query\r\n * @param cb the callback function\r\n * @param context the `this` context in the callback\r\n */\r\n suggest?(query: string, cb: GeocodingCallback, context?: any): void;\r\n /**\r\n * Performs a reverse geocoding query and returns the results to the callback in the provided context\r\n * @param location the coordinate to reverse geocode\r\n * @param scale the map scale possibly used for reverse geocoding\r\n * @param cb the callback function\r\n * @param context the `this` context in the callback\r\n */\r\n reverse?(location: L.LatLngLiteral, scale: number, cb: GeocodingCallback, context?: any): void;\r\n}\r\n\r\nexport interface GeocoderOptions {\r\n /**\r\n * URL of the service\r\n */\r\n serviceUrl: string;\r\n /**\r\n * Additional URL parameters (strings) that will be added to geocoding requests\r\n */\r\n geocodingQueryParams?: Record;\r\n /**\r\n * Additional URL parameters (strings) that will be added to reverse geocoding requests\r\n */\r\n reverseQueryParams?: Record;\r\n /**\r\n * API key to use this service\r\n */\r\n apiKey?: string;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function geocodingParams(\r\n options: GeocoderOptions,\r\n params: Record\r\n): Record {\r\n return L.Util.extend(params, options.geocodingQueryParams);\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function reverseParams(\r\n options: GeocoderOptions,\r\n params: Record\r\n): Record {\r\n return L.Util.extend(params, options.reverseQueryParams);\r\n}\r\n","import * as L from 'leaflet';\r\n/**\r\n * @internal\r\n */\r\nlet lastCallbackId = 0;\r\n\r\n// Adapted from handlebars.js\r\n// https://github.com/wycats/handlebars.js/\r\n/**\r\n * @internal\r\n */\r\nconst badChars = /[&<>\"'`]/g;\r\n/**\r\n * @internal\r\n */\r\nconst possible = /[&<>\"'`]/;\r\n/**\r\n * @internal\r\n */\r\nconst escape: Record = {\r\n '&': '&',\r\n '<': '<',\r\n '>': '>',\r\n '\"': '"',\r\n \"'\": ''',\r\n '`': '`'\r\n};\r\n\r\n/**\r\n * @internal\r\n */\r\nfunction escapeChar(chr: string) {\r\n return escape[chr];\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function htmlEscape(string?: string): string {\r\n if (string == null) {\r\n return '';\r\n } else if (!string) {\r\n return string + '';\r\n }\r\n\r\n // Force a string conversion as this will be done by the append regardless and\r\n // the regex test will do this transparently behind the scenes, causing issues if\r\n // an object's to string has escaped characters in it.\r\n string = '' + string;\r\n\r\n if (!possible.test(string)) {\r\n return string;\r\n }\r\n return string.replace(badChars, escapeChar);\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function jsonp(\r\n url: string,\r\n params: Record,\r\n callback: (message: any) => void,\r\n context: any,\r\n jsonpParam?: string\r\n) {\r\n const callbackId = '_l_geocoder_' + lastCallbackId++;\r\n params[jsonpParam || 'callback'] = callbackId;\r\n (window as any)[callbackId] = L.Util.bind(callback, context);\r\n const script = document.createElement('script');\r\n script.type = 'text/javascript';\r\n script.src = url + getParamString(params);\r\n script.id = callbackId;\r\n document.getElementsByTagName('head')[0].appendChild(script);\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function getJSON(\r\n url: string,\r\n params: Record,\r\n callback: (message: any) => void\r\n): void {\r\n const xmlHttp = new XMLHttpRequest();\r\n xmlHttp.onreadystatechange = function() {\r\n if (xmlHttp.readyState !== 4) {\r\n return;\r\n }\r\n let message;\r\n if (xmlHttp.status !== 200 && xmlHttp.status !== 304) {\r\n message = '';\r\n } else if (typeof xmlHttp.response === 'string') {\r\n // IE doesn't parse JSON responses even with responseType: 'json'.\r\n try {\r\n message = JSON.parse(xmlHttp.response);\r\n } catch (e) {\r\n // Not a JSON response\r\n message = xmlHttp.response;\r\n }\r\n } else {\r\n message = xmlHttp.response;\r\n }\r\n callback(message);\r\n };\r\n xmlHttp.open('GET', url + getParamString(params), true);\r\n xmlHttp.responseType = 'json';\r\n xmlHttp.setRequestHeader('Accept', 'application/json');\r\n xmlHttp.send(null);\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function template(str: string, data: Record): string {\r\n return str.replace(/\\{ *([\\w_]+) *\\}/g, (str, key) => {\r\n let value = data[key];\r\n if (value === undefined) {\r\n value = '';\r\n } else if (typeof value === 'function') {\r\n value = value(data);\r\n }\r\n return htmlEscape(value);\r\n });\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function getParamString(\r\n obj: Record,\r\n existingUrl?: string,\r\n uppercase?: boolean\r\n): string {\r\n const params = [];\r\n for (const i in obj) {\r\n const key = encodeURIComponent(uppercase ? i.toUpperCase() : i);\r\n const value = obj[i];\r\n if (!Array.isArray(value)) {\r\n params.push(key + '=' + encodeURIComponent(String(value)));\r\n } else {\r\n for (let j = 0; j < value.length; j++) {\r\n params.push(key + '=' + encodeURIComponent(value[j]));\r\n }\r\n }\r\n }\r\n return (!existingUrl || existingUrl.indexOf('?') === -1 ? '?' : '&') + params.join('&');\r\n}\r\n","import * as L from 'leaflet';\r\nimport { getJSON } from '../util';\r\nimport {\r\n IGeocoder,\r\n GeocoderOptions,\r\n GeocodingCallback,\r\n geocodingParams,\r\n GeocodingResult,\r\n reverseParams\r\n} from './api';\r\n\r\nexport interface ArcGisOptions extends GeocoderOptions {}\r\n\r\n/**\r\n * Implementation of the [ArcGIS geocoder](https://developers.arcgis.com/features/geocoding/)\r\n */\r\nexport class ArcGis implements IGeocoder {\r\n options: ArcGisOptions = {\r\n serviceUrl: 'https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer',\r\n apiKey: ''\r\n };\r\n\r\n constructor(options?: Partial) {\r\n L.Util.setOptions(this, options);\r\n }\r\n\r\n geocode(query: string, cb: GeocodingCallback, context?: any): void {\r\n const params = geocodingParams(this.options, {\r\n token: this.options.apiKey,\r\n SingleLine: query,\r\n outFields: 'Addr_Type',\r\n forStorage: false,\r\n maxLocations: 10,\r\n f: 'json'\r\n });\r\n\r\n getJSON(this.options.serviceUrl + '/findAddressCandidates', params, data => {\r\n const results: GeocodingResult[] = [];\r\n if (data.candidates && data.candidates.length) {\r\n for (let i = 0; i <= data.candidates.length - 1; i++) {\r\n const loc = data.candidates[i];\r\n const latLng = L.latLng(loc.location.y, loc.location.x);\r\n const latLngBounds = L.latLngBounds(\r\n L.latLng(loc.extent.ymax, loc.extent.xmax),\r\n L.latLng(loc.extent.ymin, loc.extent.xmin)\r\n );\r\n results[i] = {\r\n name: loc.address,\r\n bbox: latLngBounds,\r\n center: latLng\r\n };\r\n }\r\n }\r\n\r\n cb.call(context, results);\r\n });\r\n }\r\n\r\n suggest(query: string, cb: GeocodingCallback, context?: any): void {\r\n return this.geocode(query, cb, context);\r\n }\r\n\r\n reverse(location: L.LatLngLiteral, scale: number, cb: GeocodingCallback, context?: any): void {\r\n const params = reverseParams(this.options, {\r\n location: location.lng + ',' + location.lat,\r\n distance: 100,\r\n f: 'json'\r\n });\r\n getJSON(this.options.serviceUrl + '/reverseGeocode', params, data => {\r\n const result: GeocodingResult[] = [];\r\n if (data && !data.error) {\r\n const center = L.latLng(data.location.y, data.location.x);\r\n const bbox = L.latLngBounds(center, center);\r\n result.push({\r\n name: data.address.Match_addr,\r\n center: center,\r\n bbox: bbox\r\n });\r\n }\r\n\r\n cb.call(context, result);\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link ArcGis}\r\n * @param options the options\r\n */\r\nexport function arcgis(options?: Partial) {\r\n return new ArcGis(options);\r\n}\r\n","import * as L from 'leaflet';\r\nimport { jsonp } from '../util';\r\nimport {\r\n IGeocoder,\r\n GeocoderOptions,\r\n GeocodingCallback,\r\n geocodingParams,\r\n GeocodingResult,\r\n reverseParams\r\n} from './api';\r\n\r\nexport interface BingOptions extends GeocoderOptions {}\r\n\r\n/**\r\n * Implementation of the [Bing Locations API](https://docs.microsoft.com/en-us/bingmaps/rest-services/locations/)\r\n */\r\nexport class Bing implements IGeocoder {\r\n options: BingOptions = {\r\n serviceUrl: 'https://dev.virtualearth.net/REST/v1/Locations'\r\n };\r\n\r\n constructor(options?: Partial) {\r\n L.Util.setOptions(this, options);\r\n }\r\n\r\n geocode(query: string, cb: GeocodingCallback, context?: any): void {\r\n const params = geocodingParams(this.options, {\r\n query: query,\r\n key: this.options.apiKey\r\n });\r\n jsonp(\r\n this.options.apiKey,\r\n params,\r\n data => {\r\n const results: GeocodingResult[] = [];\r\n if (data.resourceSets.length > 0) {\r\n for (let i = data.resourceSets[0].resources.length - 1; i >= 0; i--) {\r\n const resource = data.resourceSets[0].resources[i],\r\n bbox = resource.bbox;\r\n results[i] = {\r\n name: resource.name,\r\n bbox: L.latLngBounds([bbox[0], bbox[1]], [bbox[2], bbox[3]]),\r\n center: L.latLng(resource.point.coordinates)\r\n };\r\n }\r\n }\r\n cb.call(context, results);\r\n },\r\n this,\r\n 'jsonp'\r\n );\r\n }\r\n\r\n reverse(location: L.LatLngLiteral, scale: number, cb: GeocodingCallback, context?: any): void {\r\n const params = reverseParams(this.options, {\r\n key: this.options.apiKey\r\n });\r\n jsonp(\r\n this.options.serviceUrl + location.lat + ',' + location.lng,\r\n params,\r\n data => {\r\n const results: GeocodingResult[] = [];\r\n for (let i = data.resourceSets[0].resources.length - 1; i >= 0; i--) {\r\n const resource = data.resourceSets[0].resources[i],\r\n bbox = resource.bbox;\r\n results[i] = {\r\n name: resource.name,\r\n bbox: L.latLngBounds([bbox[0], bbox[1]], [bbox[2], bbox[3]]),\r\n center: L.latLng(resource.point.coordinates)\r\n };\r\n }\r\n cb.call(context, results);\r\n },\r\n this,\r\n 'jsonp'\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link Bing}\r\n * @param options the options\r\n */\r\nexport function bing(options?: Partial) {\r\n return new Bing(options);\r\n}\r\n","import * as L from 'leaflet';\r\nimport { getJSON } from '../util';\r\nimport {\r\n IGeocoder,\r\n GeocoderOptions,\r\n GeocodingCallback,\r\n geocodingParams,\r\n GeocodingResult,\r\n reverseParams\r\n} from './api';\r\n\r\n/**\r\n * Implementation of the [Google Geocoding API](https://developers.google.com/maps/documentation/geocoding/)\r\n */\r\nexport interface GoogleOptions extends GeocoderOptions {}\r\n\r\nexport class Google implements IGeocoder {\r\n options: GoogleOptions = {\r\n serviceUrl: 'https://maps.googleapis.com/maps/api/geocode/json'\r\n };\r\n\r\n constructor(options?: Partial) {\r\n L.Util.setOptions(this, options);\r\n }\r\n\r\n geocode(query: string, cb: GeocodingCallback, context?: any): void {\r\n const params = geocodingParams(this.options, {\r\n key: this.options.apiKey,\r\n address: query\r\n });\r\n getJSON(this.options.serviceUrl, params, data => {\r\n const results: GeocodingResult[] = [];\r\n if (data.results && data.results.length) {\r\n for (let i = 0; i <= data.results.length - 1; i++) {\r\n const loc = data.results[i];\r\n const latLng = L.latLng(loc.geometry.location);\r\n const latLngBounds = L.latLngBounds(\r\n L.latLng(loc.geometry.viewport.northeast),\r\n L.latLng(loc.geometry.viewport.southwest)\r\n );\r\n results[i] = {\r\n name: loc.formatted_address,\r\n bbox: latLngBounds,\r\n center: latLng,\r\n properties: loc.address_components\r\n };\r\n }\r\n }\r\n\r\n cb.call(context, results);\r\n });\r\n }\r\n\r\n reverse(location: L.LatLngLiteral, scale: number, cb: GeocodingCallback, context?: any): void {\r\n const params = reverseParams(this.options, {\r\n key: this.options.apiKey,\r\n latlng: location.lat + ',' + location.lng\r\n });\r\n getJSON(this.options.serviceUrl, params, data => {\r\n const results: GeocodingResult[] = [];\r\n if (data.results && data.results.length) {\r\n for (let i = 0; i <= data.results.length - 1; i++) {\r\n const loc = data.results[i];\r\n const center = L.latLng(loc.geometry.location);\r\n const bbox = L.latLngBounds(\r\n L.latLng(loc.geometry.viewport.northeast),\r\n L.latLng(loc.geometry.viewport.southwest)\r\n );\r\n results[i] = {\r\n name: loc.formatted_address,\r\n bbox: bbox,\r\n center: center,\r\n properties: loc.address_components\r\n };\r\n }\r\n }\r\n\r\n cb.call(context, results);\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link Google}\r\n * @param options the options\r\n */\r\nexport function google(options?: Partial) {\r\n return new Google(options);\r\n}\r\n","import * as L from 'leaflet';\r\nimport { getJSON } from '../util';\r\nimport {\r\n IGeocoder,\r\n GeocoderOptions,\r\n GeocodingCallback,\r\n geocodingParams,\r\n GeocodingResult,\r\n reverseParams\r\n} from './api';\r\n\r\nexport interface HereOptions extends GeocoderOptions {\r\n /**\r\n * Use `apiKey` and the new `HEREv2` geocoder\r\n * @deprecated\r\n */\r\n app_id: string;\r\n /**\r\n * Use `apiKey` and the new `HEREv2` geocoder\r\n * @deprecated\r\n */\r\n app_code: string;\r\n reverseGeocodeProxRadius?: any;\r\n apiKey: string;\r\n maxResults: number;\r\n}\r\n\r\n/**\r\n * Implementation of the [HERE Geocoder API](https://developer.here.com/documentation/geocoder/topics/introduction.html)\r\n */\r\nexport class HERE implements IGeocoder {\r\n options: HereOptions = {\r\n serviceUrl: 'https://geocoder.api.here.com/6.2/',\r\n app_id: '',\r\n app_code: '',\r\n apiKey: '',\r\n maxResults: 5\r\n };\r\n\r\n constructor(options?: Partial) {\r\n L.Util.setOptions(this, options);\r\n if (options.apiKey) throw Error('apiKey is not supported, use app_id/app_code instead!');\r\n }\r\n\r\n geocode(query: string, cb: GeocodingCallback, context?: any): void {\r\n const params = geocodingParams(this.options, {\r\n searchtext: query,\r\n gen: 9,\r\n app_id: this.options.app_id,\r\n app_code: this.options.app_code,\r\n jsonattributes: 1,\r\n maxresults: this.options.maxResults\r\n });\r\n this.getJSON(this.options.serviceUrl + 'geocode.json', params, cb, context);\r\n }\r\n\r\n reverse(location: L.LatLngLiteral, scale: number, cb: GeocodingCallback, context?: any): void {\r\n let prox = location.lat + ',' + location.lng;\r\n if (this.options.reverseGeocodeProxRadius) {\r\n prox += ',' + this.options.reverseGeocodeProxRadius;\r\n }\r\n const params = reverseParams(this.options, {\r\n prox,\r\n mode: 'retrieveAddresses',\r\n app_id: this.options.app_id,\r\n app_code: this.options.app_code,\r\n gen: 9,\r\n jsonattributes: 1,\r\n maxresults: this.options.maxResults\r\n });\r\n this.getJSON(this.options.serviceUrl + 'reversegeocode.json', params, cb, context);\r\n }\r\n\r\n getJSON(url: string, params: any, cb: GeocodingCallback, context?: any) {\r\n getJSON(url, params, data => {\r\n const results: GeocodingResult[] = [];\r\n\r\n if (data.response.view && data.response.view.length) {\r\n for (let i = 0; i <= data.response.view[0].result.length - 1; i++) {\r\n const loc = data.response.view[0].result[i].location;\r\n const center = L.latLng(loc.displayPosition.latitude, loc.displayPosition.longitude);\r\n const bbox = L.latLngBounds(\r\n L.latLng(loc.mapView.topLeft.latitude, loc.mapView.topLeft.longitude),\r\n L.latLng(loc.mapView.bottomRight.latitude, loc.mapView.bottomRight.longitude)\r\n );\r\n results[i] = {\r\n name: loc.address.label,\r\n properties: loc.address,\r\n bbox: bbox,\r\n center: center\r\n };\r\n }\r\n }\r\n cb.call(context, results);\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Implementation of the new [HERE Geocoder API](https://developer.here.com/documentation/geocoding-search-api/api-reference-swagger.html)\r\n */\r\nexport class HEREv2 implements IGeocoder {\r\n options: HereOptions = {\r\n serviceUrl: 'https://geocode.search.hereapi.com/v1',\r\n apiKey: '',\r\n app_id: '',\r\n app_code: '',\r\n maxResults: 10\r\n };\r\n\r\n constructor(options?: Partial) {\r\n L.Util.setOptions(this, options);\r\n }\r\n\r\n geocode(query: string, cb: GeocodingCallback, context?: any): void {\r\n const params = geocodingParams(this.options, {\r\n q: query,\r\n apiKey: this.options.apiKey,\r\n limit: this.options.maxResults\r\n });\r\n\r\n if (!params.at && !params.in) {\r\n throw Error(\r\n 'at / in parameters not found. Please define coordinates (at=latitude,longitude) or other (in) in your geocodingQueryParams.'\r\n );\r\n }\r\n\r\n this.getJSON(this.options.serviceUrl + '/discover', params, cb, context);\r\n }\r\n\r\n reverse(location: L.LatLngLiteral, scale: number, cb: GeocodingCallback, context?: any): void {\r\n const params = reverseParams(this.options, {\r\n at: location.lat + ',' + location.lng,\r\n limit: this.options.reverseGeocodeProxRadius,\r\n apiKey: this.options.apiKey\r\n });\r\n this.getJSON(this.options.serviceUrl + '/revgeocode', params, cb, context);\r\n }\r\n\r\n getJSON(url: string, params: any, cb: GeocodingCallback, context?: any) {\r\n getJSON(url, params, data => {\r\n const results: GeocodingResult[] = [];\r\n\r\n if (data.items && data.items.length) {\r\n for (let i = 0; i <= data.items.length - 1; i++) {\r\n const item = data.items[i];\r\n const latLng = L.latLng(item.position.lat, item.position.lng);\r\n let bbox: L.LatLngBounds;\r\n if (item.mapView) {\r\n bbox = L.latLngBounds(\r\n L.latLng(item.mapView.south, item.mapView.west),\r\n L.latLng(item.mapView.north, item.mapView.east)\r\n );\r\n } else {\r\n // Using only position when not provided\r\n bbox = L.latLngBounds(\r\n L.latLng(item.position.lat, item.position.lng),\r\n L.latLng(item.position.lat, item.position.lng)\r\n );\r\n }\r\n results[i] = {\r\n name: item.address.label,\r\n properties: item.address,\r\n bbox: bbox,\r\n center: latLng\r\n };\r\n }\r\n }\r\n cb.call(context, results);\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link HERE}\r\n * @param options the options\r\n */\r\nexport function here(options?: Partial) {\r\n if (options.apiKey) {\r\n return new HEREv2(options);\r\n } else {\r\n return new HERE(options);\r\n }\r\n}\r\n","import * as L from 'leaflet';\r\nimport { IGeocoder, GeocodingCallback, GeocodingResult } from './api';\r\n\r\nexport interface LatLngOptions {\r\n /**\r\n * The next geocoder to use for non-supported queries\r\n */\r\n next?: IGeocoder;\r\n /**\r\n * The size in meters used for passing to `LatLng.toBounds`\r\n */\r\n sizeInMeters: number;\r\n}\r\n\r\n/**\r\n * Parses basic latitude/longitude strings such as `'50.06773 14.37742'`, `'N50.06773 W14.37742'`, `'S 50° 04.064 E 014° 22.645'`, or `'S 50° 4′ 03.828″, W 14° 22′ 38.712″'`\r\n * @param query the latitude/longitude string to parse\r\n * @returns the parsed latitude/longitude\r\n */\r\nexport function parseLatLng(query: string): L.LatLng | undefined {\r\n let match;\r\n // regex from https://github.com/openstreetmap/openstreetmap-website/blob/master/app/controllers/geocoder_controller.rb\r\n if ((match = query.match(/^([NS])\\s*(\\d{1,3}(?:\\.\\d*)?)\\W*([EW])\\s*(\\d{1,3}(?:\\.\\d*)?)$/))) {\r\n // [NSEW] decimal degrees\r\n return L.latLng(\r\n (/N/i.test(match[1]) ? 1 : -1) * +match[2],\r\n (/E/i.test(match[3]) ? 1 : -1) * +match[4]\r\n );\r\n } else if (\r\n (match = query.match(/^(\\d{1,3}(?:\\.\\d*)?)\\s*([NS])\\W*(\\d{1,3}(?:\\.\\d*)?)\\s*([EW])$/))\r\n ) {\r\n // decimal degrees [NSEW]\r\n return L.latLng(\r\n (/N/i.test(match[2]) ? 1 : -1) * +match[1],\r\n (/E/i.test(match[4]) ? 1 : -1) * +match[3]\r\n );\r\n } else if (\r\n (match = query.match(\r\n /^([NS])\\s*(\\d{1,3})°?\\s*(\\d{1,3}(?:\\.\\d*)?)?['′]?\\W*([EW])\\s*(\\d{1,3})°?\\s*(\\d{1,3}(?:\\.\\d*)?)?['′]?$/\r\n ))\r\n ) {\r\n // [NSEW] degrees, decimal minutes\r\n return L.latLng(\r\n (/N/i.test(match[1]) ? 1 : -1) * (+match[2] + +match[3] / 60),\r\n (/E/i.test(match[4]) ? 1 : -1) * (+match[5] + +match[6] / 60)\r\n );\r\n } else if (\r\n (match = query.match(\r\n /^(\\d{1,3})°?\\s*(\\d{1,3}(?:\\.\\d*)?)?['′]?\\s*([NS])\\W*(\\d{1,3})°?\\s*(\\d{1,3}(?:\\.\\d*)?)?['′]?\\s*([EW])$/\r\n ))\r\n ) {\r\n // degrees, decimal minutes [NSEW]\r\n return L.latLng(\r\n (/N/i.test(match[3]) ? 1 : -1) * (+match[1] + +match[2] / 60),\r\n (/E/i.test(match[6]) ? 1 : -1) * (+match[4] + +match[5] / 60)\r\n );\r\n } else if (\r\n (match = query.match(\r\n /^([NS])\\s*(\\d{1,3})°?\\s*(\\d{1,2})['′]?\\s*(\\d{1,3}(?:\\.\\d*)?)?[\"″]?\\W*([EW])\\s*(\\d{1,3})°?\\s*(\\d{1,2})['′]?\\s*(\\d{1,3}(?:\\.\\d*)?)?[\"″]?$/\r\n ))\r\n ) {\r\n // [NSEW] degrees, minutes, decimal seconds\r\n return L.latLng(\r\n (/N/i.test(match[1]) ? 1 : -1) * (+match[2] + +match[3] / 60 + +match[4] / 3600),\r\n (/E/i.test(match[5]) ? 1 : -1) * (+match[6] + +match[7] / 60 + +match[8] / 3600)\r\n );\r\n } else if (\r\n (match = query.match(\r\n /^(\\d{1,3})°?\\s*(\\d{1,2})['′]?\\s*(\\d{1,3}(?:\\.\\d*)?)?[\"″]\\s*([NS])\\W*(\\d{1,3})°?\\s*(\\d{1,2})['′]?\\s*(\\d{1,3}(?:\\.\\d*)?)?[\"″]?\\s*([EW])$/\r\n ))\r\n ) {\r\n // degrees, minutes, decimal seconds [NSEW]\r\n return L.latLng(\r\n (/N/i.test(match[4]) ? 1 : -1) * (+match[1] + +match[2] / 60 + +match[3] / 3600),\r\n (/E/i.test(match[8]) ? 1 : -1) * (+match[5] + +match[6] / 60 + +match[7] / 3600)\r\n );\r\n } else if ((match = query.match(/^\\s*([+-]?\\d+(?:\\.\\d*)?)\\s*[\\s,]\\s*([+-]?\\d+(?:\\.\\d*)?)\\s*$/))) {\r\n return L.latLng(+match[1], +match[2]);\r\n }\r\n}\r\n\r\n/**\r\n * Parses basic latitude/longitude strings such as `'50.06773 14.37742'`, `'N50.06773 W14.37742'`, `'S 50° 04.064 E 014° 22.645'`, or `'S 50° 4′ 03.828″, W 14° 22′ 38.712″'`\r\n */\r\nexport class LatLng implements IGeocoder {\r\n options: LatLngOptions = {\r\n next: undefined,\r\n sizeInMeters: 10000\r\n };\r\n\r\n constructor(options?: Partial) {\r\n L.Util.setOptions(this, options);\r\n }\r\n\r\n geocode(query: string, cb: GeocodingCallback, context?: any) {\r\n const center = parseLatLng(query);\r\n if (center) {\r\n const results: GeocodingResult[] = [\r\n {\r\n name: query,\r\n center: center,\r\n bbox: center.toBounds(this.options.sizeInMeters)\r\n }\r\n ];\r\n cb.call(context, results);\r\n } else if (this.options.next) {\r\n this.options.next.geocode(query, cb, context);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link LatLng}\r\n * @param options the options\r\n */\r\nexport function latLng(options?: Partial) {\r\n return new LatLng(options);\r\n}\r\n","import * as L from 'leaflet';\r\nimport { getJSON } from '../util';\r\nimport {\r\n IGeocoder,\r\n GeocoderOptions,\r\n GeocodingCallback,\r\n geocodingParams,\r\n GeocodingResult,\r\n reverseParams\r\n} from './api';\r\n\r\nexport interface MapboxOptions extends GeocoderOptions {}\r\n\r\n/**\r\n * Implementation of the [Mapbox Geocoding](https://www.mapbox.com/api-documentation/#geocoding)\r\n */\r\nexport class Mapbox implements IGeocoder {\r\n options: MapboxOptions = {\r\n serviceUrl: 'https://api.mapbox.com/geocoding/v5/mapbox.places/'\r\n };\r\n\r\n constructor(options?: Partial) {\r\n L.Util.setOptions(this, options);\r\n }\r\n\r\n _getProperties(loc) {\r\n const properties = {\r\n text: loc.text,\r\n address: loc.address\r\n };\r\n\r\n for (let j = 0; j < (loc.context || []).length; j++) {\r\n const id = loc.context[j].id.split('.')[0];\r\n properties[id] = loc.context[j].text;\r\n\r\n // Get country code when available\r\n if (loc.context[j].short_code) {\r\n properties['countryShortCode'] = loc.context[j].short_code;\r\n }\r\n }\r\n return properties;\r\n }\r\n\r\n geocode(query: string, cb: GeocodingCallback, context?: any): void {\r\n const params: any = geocodingParams(this.options, {\r\n access_token: this.options.apiKey\r\n });\r\n if (\r\n params.proximity !== undefined &&\r\n params.proximity.lat !== undefined &&\r\n params.proximity.lng !== undefined\r\n ) {\r\n params.proximity = params.proximity.lng + ',' + params.proximity.lat;\r\n }\r\n getJSON(this.options.serviceUrl + encodeURIComponent(query) + '.json', params, data => {\r\n const results: GeocodingResult[] = [];\r\n if (data.features && data.features.length) {\r\n for (let i = 0; i <= data.features.length - 1; i++) {\r\n const loc = data.features[i];\r\n const center = L.latLng(loc.center.reverse());\r\n let bbox: L.LatLngBounds;\r\n if (loc.bbox) {\r\n bbox = L.latLngBounds(\r\n L.latLng(loc.bbox.slice(0, 2).reverse()),\r\n L.latLng(loc.bbox.slice(2, 4).reverse())\r\n );\r\n } else {\r\n bbox = L.latLngBounds(center, center);\r\n }\r\n\r\n results[i] = {\r\n name: loc.place_name,\r\n bbox: bbox,\r\n center: center,\r\n properties: this._getProperties(loc)\r\n };\r\n }\r\n }\r\n\r\n cb.call(context, results);\r\n });\r\n }\r\n\r\n suggest(query: string, cb: GeocodingCallback, context?: any): void {\r\n return this.geocode(query, cb, context);\r\n }\r\n\r\n reverse(location: L.LatLngLiteral, scale: number, cb: GeocodingCallback, context?: any): void {\r\n const url = this.options.serviceUrl + location.lng + ',' + location.lat + '.json';\r\n const param = reverseParams(this.options, {\r\n access_token: this.options.apiKey\r\n });\r\n getJSON(url, param, data => {\r\n const results: GeocodingResult[] = [];\r\n if (data.features && data.features.length) {\r\n for (let i = 0; i <= data.features.length - 1; i++) {\r\n const loc = data.features[i];\r\n const center = L.latLng(loc.center.reverse());\r\n let bbox: L.LatLngBounds;\r\n if (loc.bbox) {\r\n bbox = L.latLngBounds(\r\n L.latLng(loc.bbox.slice(0, 2).reverse()),\r\n L.latLng(loc.bbox.slice(2, 4).reverse())\r\n );\r\n } else {\r\n bbox = L.latLngBounds(center, center);\r\n }\r\n results[i] = {\r\n name: loc.place_name,\r\n bbox: bbox,\r\n center: center,\r\n properties: this._getProperties(loc)\r\n };\r\n }\r\n }\r\n\r\n cb.call(context, results);\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link Mapbox}\r\n * @param options the options\r\n */\r\nexport function mapbox(options?: Partial) {\r\n return new Mapbox(options);\r\n}\r\n","import * as L from 'leaflet';\r\nimport { getJSON } from '../util';\r\nimport {\r\n IGeocoder,\r\n GeocoderOptions,\r\n GeocodingCallback,\r\n geocodingParams,\r\n GeocodingResult,\r\n reverseParams\r\n} from './api';\r\n\r\nexport interface MapQuestOptions extends GeocoderOptions {}\r\n\r\n/**\r\n * Implementation of the [MapQuest Geocoding API](http://developer.mapquest.com/web/products/dev-services/geocoding-ws)\r\n */\r\nexport class MapQuest implements IGeocoder {\r\n options: MapQuestOptions = {\r\n serviceUrl: 'https://www.mapquestapi.com/geocoding/v1'\r\n };\r\n\r\n constructor(options?: Partial) {\r\n L.Util.setOptions(this, options);\r\n // MapQuest seems to provide URI encoded API keys,\r\n // so to avoid encoding them twice, we decode them here\r\n this.options.apiKey = decodeURIComponent(this.options.apiKey);\r\n }\r\n\r\n _formatName(...parts: string[]) {\r\n return parts.filter(s => !!s).join(', ');\r\n }\r\n\r\n geocode(query: string, cb: GeocodingCallback, context?: any): void {\r\n const params = geocodingParams(this.options, {\r\n key: this.options.apiKey,\r\n location: query,\r\n limit: 5,\r\n outFormat: 'json'\r\n });\r\n getJSON(\r\n this.options.serviceUrl + '/address',\r\n params,\r\n L.Util.bind(function(data) {\r\n const results: GeocodingResult[] = [];\r\n if (data.results && data.results[0].locations) {\r\n for (let i = data.results[0].locations.length - 1; i >= 0; i--) {\r\n const loc = data.results[0].locations[i];\r\n const center = L.latLng(loc.latLng);\r\n results[i] = {\r\n name: this._formatName(loc.street, loc.adminArea4, loc.adminArea3, loc.adminArea1),\r\n bbox: L.latLngBounds(center, center),\r\n center: center\r\n };\r\n }\r\n }\r\n\r\n cb.call(context, results);\r\n }, this)\r\n );\r\n }\r\n\r\n reverse(location: L.LatLngLiteral, scale: number, cb: GeocodingCallback, context?: any): void {\r\n const params = reverseParams(this.options, {\r\n key: this.options.apiKey,\r\n location: location.lat + ',' + location.lng,\r\n outputFormat: 'json'\r\n });\r\n getJSON(\r\n this.options.serviceUrl + '/reverse',\r\n params,\r\n L.Util.bind(function(data) {\r\n const results: GeocodingResult[] = [];\r\n if (data.results && data.results[0].locations) {\r\n for (let i = data.results[0].locations.length - 1; i >= 0; i--) {\r\n const loc = data.results[0].locations[i];\r\n const center = L.latLng(loc.latLng);\r\n results[i] = {\r\n name: this._formatName(loc.street, loc.adminArea4, loc.adminArea3, loc.adminArea1),\r\n bbox: L.latLngBounds(center, center),\r\n center: center\r\n };\r\n }\r\n }\r\n\r\n cb.call(context, results);\r\n }, this)\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link MapQuest}\r\n * @param options the options\r\n */\r\nexport function mapQuest(options?: Partial) {\r\n return new MapQuest(options);\r\n}\r\n","import * as L from 'leaflet';\r\nimport { getJSON } from '../util';\r\nimport {\r\n IGeocoder,\r\n GeocoderOptions,\r\n GeocodingCallback,\r\n geocodingParams,\r\n GeocodingResult,\r\n reverseParams\r\n} from './api';\r\n\r\nexport interface NeutrinoOptions extends GeocoderOptions {\r\n userId: string;\r\n}\r\n\r\n/**\r\n * Implementation of the [Neutrino API](https://www.neutrinoapi.com/api/geocode-address/)\r\n */\r\nexport class Neutrino implements IGeocoder {\r\n options: NeutrinoOptions = {\r\n userId: undefined,\r\n apiKey: undefined,\r\n serviceUrl: 'https://neutrinoapi.com/'\r\n };\r\n\r\n constructor(options?: Partial) {\r\n L.Util.setOptions(this, options);\r\n }\r\n\r\n // https://www.neutrinoapi.com/api/geocode-address/\r\n geocode(query: string, cb: GeocodingCallback, context?: any): void {\r\n const params = geocodingParams(this.options, {\r\n apiKey: this.options.apiKey,\r\n userId: this.options.userId,\r\n //get three words and make a dot based string\r\n address: query.split(/\\s+/).join('.')\r\n });\r\n getJSON(this.options.serviceUrl + 'geocode-address', params, data => {\r\n const results: GeocodingResult[] = [];\r\n if (data.locations) {\r\n data.geometry = data.locations[0];\r\n const center = L.latLng(data.geometry['latitude'], data.geometry['longitude']);\r\n const bbox = L.latLngBounds(center, center);\r\n results[0] = {\r\n name: data.geometry.address,\r\n bbox: bbox,\r\n center: center\r\n };\r\n }\r\n\r\n cb.call(context, results);\r\n });\r\n }\r\n\r\n suggest(query: string, cb: GeocodingCallback, context?: any): void {\r\n return this.geocode(query, cb, context);\r\n }\r\n\r\n // https://www.neutrinoapi.com/api/geocode-reverse/\r\n reverse(location: L.LatLngLiteral, scale: number, cb: GeocodingCallback, context?: any): void {\r\n const params = reverseParams(this.options, {\r\n apiKey: this.options.apiKey,\r\n userId: this.options.userId,\r\n latitude: location.lat,\r\n longitude: location.lng\r\n });\r\n getJSON(this.options.serviceUrl + 'geocode-reverse', params, data => {\r\n const results: GeocodingResult[] = [];\r\n if (data.status.status == 200 && data.found) {\r\n const center = L.latLng(location.lat, location.lng);\r\n const bbox = L.latLngBounds(center, center);\r\n results[0] = {\r\n name: data.address,\r\n bbox: bbox,\r\n center: center\r\n };\r\n }\r\n cb.call(context, results);\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link Neutrino}\r\n * @param options the options\r\n */\r\nexport function neutrino(options?: Partial) {\r\n return new Neutrino(options);\r\n}\r\n","import * as L from 'leaflet';\r\nimport { template, getJSON } from '../util';\r\nimport {\r\n IGeocoder,\r\n GeocoderOptions,\r\n GeocodingCallback,\r\n geocodingParams,\r\n GeocodingResult,\r\n reverseParams\r\n} from './api';\r\n\r\nexport interface NominatimResult {\r\n place_id: number;\r\n licence: string;\r\n osm_type: string;\r\n osm_id: number;\r\n boundingbox: string[];\r\n lat: string;\r\n lon: string;\r\n display_name: string;\r\n class: string;\r\n type: string;\r\n importance: number;\r\n icon?: string;\r\n address: NominatimAddress;\r\n}\r\n\r\nexport interface NominatimAddress {\r\n building?: string;\r\n city_district?: string;\r\n city?: string;\r\n country_code?: string;\r\n country?: string;\r\n county?: string;\r\n hamlet?: string;\r\n house_number?: string;\r\n neighbourhood?: string;\r\n postcode?: string;\r\n road?: string;\r\n state_district?: string;\r\n state?: string;\r\n suburb?: string;\r\n village?: string;\r\n}\r\n\r\nexport interface NominatimOptions extends GeocoderOptions {\r\n /**\r\n * Additional URL parameters (strings) that will be added to geocoding requests; can be used to restrict results to a specific country for example, by providing the [`countrycodes`](https://wiki.openstreetmap.org/wiki/Nominatim#Parameters) parameter to Nominatim\r\n */\r\n geocodingQueryParams?: Record;\r\n /**\r\n * A function that takes an GeocodingResult as argument and returns an HTML formatted string that represents the result. Default function breaks up address in parts from most to least specific, in attempt to increase readability compared to Nominatim's naming\r\n */\r\n htmlTemplate: (r: NominatimResult) => string;\r\n}\r\n\r\n/**\r\n * Implementation of the [Nominatim](https://wiki.openstreetmap.org/wiki/Nominatim) geocoder.\r\n *\r\n * This is the default geocoding service used by the control, unless otherwise specified in the options.\r\n *\r\n * Unless using your own Nominatim installation, please refer to the [Nominatim usage policy](https://operations.osmfoundation.org/policies/nominatim/).\r\n */\r\nexport class Nominatim implements IGeocoder {\r\n options: NominatimOptions = {\r\n serviceUrl: 'https://nominatim.openstreetmap.org/',\r\n htmlTemplate: function(r: NominatimResult) {\r\n const address = r.address;\r\n let className: string;\r\n const parts = [];\r\n if (address.road || address.building) {\r\n parts.push('{building} {road} {house_number}');\r\n }\r\n\r\n if (address.city || (address as any).town || address.village || address.hamlet) {\r\n className = parts.length > 0 ? 'leaflet-control-geocoder-address-detail' : '';\r\n parts.push(\r\n '{postcode} {city} {town} {village} {hamlet}'\r\n );\r\n }\r\n\r\n if (address.state || address.country) {\r\n className = parts.length > 0 ? 'leaflet-control-geocoder-address-context' : '';\r\n parts.push('{state} {country}');\r\n }\r\n\r\n return template(parts.join('
'), address);\r\n }\r\n };\r\n\r\n constructor(options?: Partial) {\r\n L.Util.setOptions(this, options || {});\r\n }\r\n\r\n geocode(query: string, cb: GeocodingCallback, context?: any) {\r\n const params = geocodingParams(this.options, {\r\n q: query,\r\n limit: 5,\r\n format: 'json',\r\n addressdetails: 1\r\n });\r\n getJSON(this.options.serviceUrl + 'search', params, data => {\r\n const results: GeocodingResult[] = [];\r\n for (let i = data.length - 1; i >= 0; i--) {\r\n const bbox = data[i].boundingbox;\r\n for (let j = 0; j < 4; j++) bbox[j] = +bbox[j];\r\n results[i] = {\r\n icon: data[i].icon,\r\n name: data[i].display_name,\r\n html: this.options.htmlTemplate ? this.options.htmlTemplate(data[i]) : undefined,\r\n bbox: L.latLngBounds([bbox[0], bbox[2]], [bbox[1], bbox[3]]),\r\n center: L.latLng(data[i].lat, data[i].lon),\r\n properties: data[i]\r\n };\r\n }\r\n cb.call(context, results);\r\n });\r\n }\r\n\r\n reverse(location: L.LatLngLiteral, scale: number, cb: GeocodingCallback, context?: any) {\r\n const params = reverseParams(this.options, {\r\n lat: location.lat,\r\n lon: location.lng,\r\n zoom: Math.round(Math.log(scale / 256) / Math.log(2)),\r\n addressdetails: 1,\r\n format: 'json'\r\n });\r\n getJSON(this.options.serviceUrl + 'reverse', params, data => {\r\n const result: GeocodingResult[] = [];\r\n if (data && data.lat && data.lon) {\r\n const center = L.latLng(data.lat, data.lon);\r\n const bbox = L.latLngBounds(center, center);\r\n result.push({\r\n name: data.display_name,\r\n html: this.options.htmlTemplate ? this.options.htmlTemplate(data) : undefined,\r\n center: center,\r\n bbox: bbox,\r\n properties: data\r\n });\r\n }\r\n cb.call(context, result);\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link Nominatim}\r\n * @param options the options\r\n */\r\nexport function nominatim(options?: Partial) {\r\n return new Nominatim(options);\r\n}\r\n","import * as L from 'leaflet';\r\nimport { IGeocoder, GeocodingCallback, GeocodingResult } from './api';\r\n\r\nexport interface OpenLocationCodeOptions {\r\n OpenLocationCode: OpenLocationCodeApi;\r\n codeLength?: number;\r\n}\r\n\r\nexport interface OpenLocationCodeApi {\r\n encode(latitude: number, longitude: number, codeLength?: number): string;\r\n decode(code: string): CodeArea;\r\n}\r\n\r\nexport interface CodeArea {\r\n latitudeLo: number;\r\n longitudeLo: number;\r\n latitudeHi: number;\r\n longitudeHi: number;\r\n latitudeCenter: number;\r\n longitudeCenter: number;\r\n codeLength: number;\r\n}\r\n\r\n/**\r\n * Implementation of the [Plus codes](https://plus.codes/) (formerly OpenLocationCode) (requires [open-location-code](https://www.npmjs.com/package/open-location-code))\r\n */\r\nexport class OpenLocationCode implements IGeocoder {\r\n options: OpenLocationCodeOptions;\r\n constructor(options?: Partial) {\r\n L.Util.setOptions(this, options);\r\n }\r\n\r\n geocode(query: string, cb: GeocodingCallback, context?: any) {\r\n try {\r\n const decoded = this.options.OpenLocationCode.decode(query);\r\n const result: GeocodingResult = {\r\n name: query,\r\n center: L.latLng(decoded.latitudeCenter, decoded.longitudeCenter),\r\n bbox: L.latLngBounds(\r\n L.latLng(decoded.latitudeLo, decoded.longitudeLo),\r\n L.latLng(decoded.latitudeHi, decoded.longitudeHi)\r\n )\r\n };\r\n cb.call(context, [result]);\r\n } catch (e) {\r\n console.warn(e); // eslint-disable-line no-console\r\n cb.call(context, []);\r\n }\r\n }\r\n reverse(location: L.LatLngLiteral, scale: number, cb: GeocodingCallback, context?: any) {\r\n try {\r\n const code = this.options.OpenLocationCode.encode(\r\n location.lat,\r\n location.lng,\r\n this.options.codeLength\r\n );\r\n const result = {\r\n name: code,\r\n center: L.latLng(location.lat, location.lng),\r\n bbox: L.latLngBounds(\r\n L.latLng(location.lat, location.lng),\r\n L.latLng(location.lat, location.lng)\r\n )\r\n };\r\n cb.call(context, [result]);\r\n } catch (e) {\r\n console.warn(e); // eslint-disable-line no-console\r\n cb.call(context, []);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link OpenLocationCode}\r\n * @param options the options\r\n */\r\nexport function openLocationCode(options?: Partial) {\r\n return new OpenLocationCode(options);\r\n}\r\n","import * as L from 'leaflet';\r\nimport { getJSON } from '../util';\r\nimport {\r\n IGeocoder,\r\n GeocoderOptions,\r\n GeocodingCallback,\r\n geocodingParams,\r\n GeocodingResult,\r\n reverseParams\r\n} from './api';\r\n\r\nexport interface OpenCageOptions extends GeocoderOptions {}\r\n\r\n/**\r\n * Implementation of the [OpenCage Data API](https://opencagedata.com/)\r\n */\r\nexport class OpenCage implements IGeocoder {\r\n options: OpenCageOptions = {\r\n serviceUrl: 'https://api.opencagedata.com/geocode/v1/json'\r\n };\r\n\r\n constructor(options?: Partial) {\r\n L.Util.setOptions(this, options);\r\n }\r\n\r\n geocode(query: string, cb: GeocodingCallback, context?: any): void {\r\n const params = geocodingParams(this.options, {\r\n key: this.options.apiKey,\r\n q: query\r\n });\r\n getJSON(this.options.serviceUrl, params, data => {\r\n const results: GeocodingResult[] = [];\r\n if (data.results && data.results.length) {\r\n for (let i = 0; i < data.results.length; i++) {\r\n const loc = data.results[i];\r\n const center = L.latLng(loc.geometry);\r\n let bbox: L.LatLngBounds;\r\n if (loc.annotations && loc.annotations.bounds) {\r\n bbox = L.latLngBounds(\r\n L.latLng(loc.annotations.bounds.northeast),\r\n L.latLng(loc.annotations.bounds.southwest)\r\n );\r\n } else {\r\n bbox = L.latLngBounds(center, center);\r\n }\r\n results.push({\r\n name: loc.formatted,\r\n bbox: bbox,\r\n center: center\r\n });\r\n }\r\n }\r\n cb.call(context, results);\r\n });\r\n }\r\n\r\n suggest(query: string, cb: GeocodingCallback, context?: any): void {\r\n return this.geocode(query, cb, context);\r\n }\r\n\r\n reverse(location: L.LatLngLiteral, scale: number, cb: GeocodingCallback, context?: any): void {\r\n const params = reverseParams(this.options, {\r\n key: this.options.apiKey,\r\n q: [location.lat, location.lng].join(',')\r\n });\r\n getJSON(this.options.serviceUrl, params, data => {\r\n const results: GeocodingResult[] = [];\r\n if (data.results && data.results.length) {\r\n for (let i = 0; i < data.results.length; i++) {\r\n const loc = data.results[i];\r\n const center = L.latLng(loc.geometry);\r\n let bbox: L.LatLngBounds;\r\n if (loc.annotations && loc.annotations.bounds) {\r\n bbox = L.latLngBounds(\r\n L.latLng(loc.annotations.bounds.northeast),\r\n L.latLng(loc.annotations.bounds.southwest)\r\n );\r\n } else {\r\n bbox = L.latLngBounds(center, center);\r\n }\r\n results.push({\r\n name: loc.formatted,\r\n bbox: bbox,\r\n center: center\r\n });\r\n }\r\n }\r\n cb.call(context, results);\r\n });\r\n }\r\n}\r\n\r\nexport function opencage(options?: Partial) {\r\n return new OpenCage(options);\r\n}\r\n","import * as L from 'leaflet';\r\nimport { getJSON } from '../util';\r\nimport {\r\n IGeocoder,\r\n GeocoderOptions,\r\n GeocodingCallback,\r\n geocodingParams,\r\n GeocodingResult,\r\n reverseParams\r\n} from './api';\r\n\r\nexport interface PeliasOptions extends GeocoderOptions {}\r\n\r\n/**\r\n * Implementation of the [Pelias](https://pelias.io/), [geocode.earth](https://geocode.earth/) geocoder (formerly Mapzen Search)\r\n */\r\nexport class Pelias implements IGeocoder {\r\n options: PeliasOptions = {\r\n serviceUrl: 'https://api.geocode.earth/v1'\r\n };\r\n\r\n private _lastSuggest = 0;\r\n\r\n constructor(options?: Partial) {\r\n L.Util.setOptions(this, options);\r\n }\r\n\r\n geocode(query: string, cb: GeocodingCallback, context?: any): void {\r\n const params = geocodingParams(this.options, {\r\n api_key: this.options.apiKey,\r\n text: query\r\n });\r\n getJSON(this.options.serviceUrl + '/search', params, data => {\r\n cb.call(context, this._parseResults(data, 'bbox'));\r\n });\r\n }\r\n\r\n suggest(query: string, cb: GeocodingCallback, context?: any): void {\r\n const params = geocodingParams(this.options, {\r\n api_key: this.options.apiKey,\r\n text: query\r\n });\r\n getJSON(this.options.serviceUrl + '/autocomplete', params, data => {\r\n if (data.geocoding.timestamp > this._lastSuggest) {\r\n this._lastSuggest = data.geocoding.timestamp;\r\n cb.call(context, this._parseResults(data, 'bbox'));\r\n }\r\n });\r\n }\r\n\r\n reverse(location: L.LatLngLiteral, scale: number, cb: GeocodingCallback, context?: any): void {\r\n const params = reverseParams(this.options, {\r\n api_key: this.options.apiKey,\r\n 'point.lat': location.lat,\r\n 'point.lon': location.lng\r\n });\r\n getJSON(this.options.serviceUrl + '/reverse', params, data => {\r\n cb.call(context, this._parseResults(data, 'bounds'));\r\n });\r\n }\r\n\r\n _parseResults(data, bboxname) {\r\n const results: GeocodingResult[] = [];\r\n L.geoJSON(data, {\r\n pointToLayer: function(feature, latlng) {\r\n return L.circleMarker(latlng);\r\n },\r\n onEachFeature: function(feature, layer: any) {\r\n const result = {} as GeocodingResult;\r\n let bbox;\r\n let center;\r\n\r\n if (layer.getBounds) {\r\n bbox = layer.getBounds();\r\n center = bbox.getCenter();\r\n } else if (layer.feature.bbox) {\r\n center = layer.getLatLng();\r\n bbox = L.latLngBounds(\r\n L.GeoJSON.coordsToLatLng(layer.feature.bbox.slice(0, 2)),\r\n L.GeoJSON.coordsToLatLng(layer.feature.bbox.slice(2, 4))\r\n );\r\n } else {\r\n center = layer.getLatLng();\r\n bbox = L.latLngBounds(center, center);\r\n }\r\n\r\n result.name = layer.feature.properties.label;\r\n result.center = center;\r\n result[bboxname] = bbox;\r\n result.properties = layer.feature.properties;\r\n results.push(result);\r\n }\r\n });\r\n return results;\r\n }\r\n}\r\n\r\n/**\r\n * [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link Pelias}\r\n * @param options the options\r\n */\r\nexport function pelias(options?: Partial) {\r\n return new Pelias(options);\r\n}\r\n\r\nexport const GeocodeEarth = Pelias;\r\nexport const geocodeEarth = pelias;\r\n\r\n/**\r\n * r.i.p.\r\n * @deprecated\r\n */\r\nexport const Mapzen = Pelias;\r\n/**\r\n * r.i.p.\r\n * @deprecated\r\n */\r\nexport const mapzen = pelias;\r\n\r\n/**\r\n * Implementation of the [Openrouteservice](https://openrouteservice.org/dev/#/api-docs/geocode) geocoder\r\n */\r\nexport class Openrouteservice extends Pelias {\r\n constructor(options?: Partial) {\r\n super(\r\n L.Util.extend(\r\n {\r\n serviceUrl: 'https://api.openrouteservice.org/geocode'\r\n },\r\n options\r\n )\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link Openrouteservice}\r\n * @param options the options\r\n */\r\nexport function openrouteservice(options?: Partial) {\r\n return new Openrouteservice(options);\r\n}\r\n","import * as L from 'leaflet';\r\nimport { getJSON } from '../util';\r\nimport {\r\n IGeocoder,\r\n GeocoderOptions,\r\n GeocodingCallback,\r\n geocodingParams,\r\n GeocodingResult,\r\n reverseParams\r\n} from './api';\r\n\r\nexport interface PhotonOptions extends GeocoderOptions {\r\n reverseUrl: string;\r\n nameProperties: string[];\r\n htmlTemplate?: (r: any) => string;\r\n}\r\n\r\n/**\r\n * Implementation of the [Photon](http://photon.komoot.de/) geocoder\r\n */\r\nexport class Photon implements IGeocoder {\r\n options: PhotonOptions = {\r\n serviceUrl: 'https://photon.komoot.io/api/',\r\n reverseUrl: 'https://photon.komoot.io/reverse/',\r\n nameProperties: ['name', 'street', 'suburb', 'hamlet', 'town', 'city', 'state', 'country']\r\n };\r\n\r\n constructor(options?: Partial) {\r\n L.Util.setOptions(this, options);\r\n }\r\n\r\n geocode(query: string, cb: GeocodingCallback, context?: any): void {\r\n const params = geocodingParams(this.options, { q: query });\r\n getJSON(\r\n this.options.serviceUrl,\r\n params,\r\n L.Util.bind(function(data) {\r\n cb.call(context, this._decodeFeatures(data));\r\n }, this)\r\n );\r\n }\r\n\r\n suggest(query: string, cb: GeocodingCallback, context?: any): void {\r\n return this.geocode(query, cb, context);\r\n }\r\n\r\n reverse(latLng: L.LatLngLiteral, scale: number, cb: GeocodingCallback, context?: any): void {\r\n const params = reverseParams(this.options, {\r\n lat: latLng.lat,\r\n lon: latLng.lng\r\n });\r\n getJSON(\r\n this.options.reverseUrl,\r\n params,\r\n L.Util.bind(function(data) {\r\n cb.call(context, this._decodeFeatures(data));\r\n }, this)\r\n );\r\n }\r\n\r\n _decodeFeatures(data: GeoJSON.FeatureCollection) {\r\n const results: GeocodingResult[] = [];\r\n\r\n if (data && data.features) {\r\n for (let i = 0; i < data.features.length; i++) {\r\n const f = data.features[i];\r\n const c = f.geometry.coordinates;\r\n const center = L.latLng(c[1], c[0]);\r\n const extent = f.properties.extent;\r\n\r\n const bbox = extent\r\n ? L.latLngBounds([extent[1], extent[0]], [extent[3], extent[2]])\r\n : L.latLngBounds(center, center);\r\n\r\n results.push({\r\n name: this._decodeFeatureName(f),\r\n html: this.options.htmlTemplate ? this.options.htmlTemplate(f) : undefined,\r\n center: center,\r\n bbox: bbox,\r\n properties: f.properties\r\n });\r\n }\r\n }\r\n\r\n return results;\r\n }\r\n\r\n _decodeFeatureName(f: GeoJSON.Feature) {\r\n return (this.options.nameProperties || [])\r\n .map(p => {\r\n return f.properties[p];\r\n })\r\n .filter(v => {\r\n return !!v;\r\n })\r\n .join(', ');\r\n }\r\n}\r\n\r\n/**\r\n * [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link Photon}\r\n * @param options the options\r\n */\r\nexport function photon(options?: Partial) {\r\n return new Photon(options);\r\n}\r\n","import * as L from 'leaflet';\r\nimport { getJSON } from '../util';\r\nimport {\r\n IGeocoder,\r\n GeocoderOptions,\r\n GeocodingCallback,\r\n geocodingParams,\r\n GeocodingResult,\r\n reverseParams\r\n} from './api';\r\n\r\nexport interface What3WordsOptions extends GeocoderOptions {}\r\n\r\n/**\r\n * Implementation of the What3Words service\r\n */\r\nexport class What3Words implements IGeocoder {\r\n options: What3WordsOptions = {\r\n serviceUrl: 'https://api.what3words.com/v2/'\r\n };\r\n\r\n constructor(options: Partial) {\r\n L.Util.setOptions(this, options);\r\n }\r\n\r\n geocode(query: string, cb: GeocodingCallback, context?: any): void {\r\n //get three words and make a dot based string\r\n getJSON(\r\n this.options.serviceUrl + 'forward',\r\n geocodingParams(this.options, {\r\n key: this.options.apiKey,\r\n addr: query.split(/\\s+/).join('.')\r\n }),\r\n data => {\r\n const results: GeocodingResult[] = [];\r\n if (data.geometry) {\r\n const latLng = L.latLng(data.geometry['lat'], data.geometry['lng']);\r\n const latLngBounds = L.latLngBounds(latLng, latLng);\r\n results[0] = {\r\n name: data.words,\r\n bbox: latLngBounds,\r\n center: latLng\r\n };\r\n }\r\n\r\n cb.call(context, results);\r\n }\r\n );\r\n }\r\n\r\n suggest(query: string, cb: GeocodingCallback, context?: any): void {\r\n return this.geocode(query, cb, context);\r\n }\r\n\r\n reverse(location: L.LatLngLiteral, scale: number, cb: GeocodingCallback, context?: any): void {\r\n getJSON(\r\n this.options.serviceUrl + 'reverse',\r\n reverseParams(this.options, {\r\n key: this.options.apiKey,\r\n coords: [location.lat, location.lng].join(',')\r\n }),\r\n data => {\r\n const results: GeocodingResult[] = [];\r\n if (data.status.status == 200) {\r\n const center = L.latLng(data.geometry['lat'], data.geometry['lng']);\r\n const bbox = L.latLngBounds(center, center);\r\n results[0] = {\r\n name: data.words,\r\n bbox: bbox,\r\n center: center\r\n };\r\n }\r\n cb.call(context, results);\r\n }\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link What3Words}\r\n * @param options the options\r\n */\r\nexport function what3words(options: Partial) {\r\n return new What3Words(options);\r\n}\r\n","import * as L from 'leaflet';\r\nimport { Nominatim } from './geocoders/index';\r\nimport { IGeocoder, GeocodingResult } from './geocoders/api';\r\n\r\nexport interface GeocoderControlOptions extends L.ControlOptions {\r\n /**\r\n * Collapse control unless hovered/clicked\r\n */\r\n collapsed: boolean;\r\n /**\r\n * How to expand a collapsed control: `touch` or `click` or `hover`\r\n */\r\n expand: 'touch' | 'click' | 'hover';\r\n /**\r\n * Placeholder text for text input\r\n */\r\n placeholder: string;\r\n /**\r\n * Message when no result found / geocoding error occurs\r\n */\r\n errorMessage: string;\r\n /**\r\n * Accessibility label for the search icon used by screen readers\r\n */\r\n iconLabel: string;\r\n /**\r\n * Object to perform the actual geocoding queries\r\n */\r\n geocoder?: IGeocoder;\r\n /**\r\n * Immediately show the unique result without prompting for alternatives\r\n */\r\n showUniqueResult: boolean;\r\n /**\r\n * Show icons for geocoding results (if available); supported by Nominatim\r\n */\r\n showResultIcons: boolean;\r\n /**\r\n * Minimum number characters before suggest functionality is used (if available from geocoder)\r\n */\r\n suggestMinLength: number;\r\n /**\r\n * Number of milliseconds after typing stopped before suggest functionality is used (if available from geocoder)\r\n */\r\n suggestTimeout: number;\r\n /**\r\n * Initial query string for text input\r\n */\r\n query: string;\r\n /**\r\n * Minimum number of characters in search text before performing a query\r\n */\r\n queryMinLength: number;\r\n /**\r\n * Whether to mark a geocoding result on the map by default\r\n */\r\n defaultMarkGeocode: boolean;\r\n}\r\n\r\n/**\r\n * Event is fired when selecting a geocode result.\r\n * By default, the control will center the map on it and place a marker at its location.\r\n * To remove the control's default handler for marking a result, set {@link GeocoderControlOptions.defaultMarkGeocode} to `false`.\r\n */\r\nexport type MarkGeocodeEvent = { geocode: GeocodingResult };\r\nexport type MarkGeocodeEventHandlerFn = (event: MarkGeocodeEvent) => void;\r\n\r\n/**\r\n * Event is fired before invoking {@link IGeocoder.geocode} (or {@link IGeocoder.suggest}).\r\n * The event data contains the query string as `input`.\r\n */\r\nexport type StartGeocodeEvent = { input: string };\r\nexport type StartGeocodeEventHandlerFn = (event: StartGeocodeEvent) => void;\r\n\r\n/**\r\n * Event is fired before after receiving results from {@link IGeocoder.geocode} (or {@link IGeocoder.suggest}).\r\n * The event data contains the query string as `input` and the geocoding `results`.\r\n */\r\nexport type FinishGeocodeEvent = { input: string; results: GeocodingResult[] };\r\nexport type FinishGeocodeEventHandlerFn = (event: FinishGeocodeEvent) => void;\r\n\r\ndeclare module 'leaflet' {\r\n interface Evented {\r\n on(type: 'markgeocode', fn: MarkGeocodeEventHandlerFn, context?: any): this;\r\n on(type: 'startgeocode', fn: StartGeocodeEventHandlerFn, context?: any): this;\r\n on(type: 'startsuggest', fn: StartGeocodeEventHandlerFn, context?: any): this;\r\n on(type: 'finishsuggest', fn: FinishGeocodeEventHandlerFn, context?: any): this;\r\n on(type: 'finishgeocode', fn: FinishGeocodeEventHandlerFn, context?: any): this;\r\n }\r\n}\r\n\r\n/**\r\n * Leaflet mixins https://leafletjs.com/reference-1.7.1.html#class-includes\r\n * for TypeScript https://www.typescriptlang.org/docs/handbook/mixins.html\r\n * @internal\r\n */\r\nclass EventedControl {\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n constructor(...args: any[]) {\r\n // empty\r\n }\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\ninterface EventedControl extends L.Control, L.Evented {}\r\nL.Util.extend(EventedControl.prototype, L.Control.prototype);\r\nL.Util.extend(EventedControl.prototype, L.Evented.prototype);\r\n\r\n/**\r\n * This is the geocoder control. It works like any other [Leaflet control](https://leafletjs.com/reference.html#control), and is added to the map.\r\n */\r\nexport class GeocoderControl extends EventedControl {\r\n options: GeocoderControlOptions = {\r\n showUniqueResult: true,\r\n showResultIcons: false,\r\n collapsed: true,\r\n expand: 'touch',\r\n position: 'topright',\r\n placeholder: 'Search...',\r\n errorMessage: 'Nothing found.',\r\n iconLabel: 'Initiate a new search',\r\n query: '',\r\n queryMinLength: 1,\r\n suggestMinLength: 3,\r\n suggestTimeout: 250,\r\n defaultMarkGeocode: true\r\n };\r\n\r\n private _alts: HTMLUListElement;\r\n private _container: HTMLDivElement;\r\n private _errorElement: HTMLDivElement;\r\n private _form: HTMLDivElement;\r\n private _geocodeMarker: L.Marker;\r\n private _input: HTMLInputElement;\r\n private _lastGeocode: string;\r\n private _map: L.Map;\r\n private _preventBlurCollapse: boolean;\r\n private _requestCount = 0;\r\n private _results: any;\r\n private _selection: any;\r\n private _suggestTimeout: any;\r\n\r\n /**\r\n * Instantiates a geocoder control (to be invoked using `new`)\r\n * @param options the options\r\n */\r\n constructor(options?: Partial) {\r\n super(options);\r\n L.Util.setOptions(this, options);\r\n if (!this.options.geocoder) {\r\n this.options.geocoder = new Nominatim();\r\n }\r\n }\r\n\r\n addThrobberClass() {\r\n L.DomUtil.addClass(this._container, 'leaflet-control-geocoder-throbber');\r\n }\r\n\r\n removeThrobberClass() {\r\n L.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-throbber');\r\n }\r\n\r\n /**\r\n * Returns the container DOM element for the control and add listeners on relevant map events.\r\n * @param map the map instance\r\n * @see https://leafletjs.com/reference.html#control-onadd\r\n */\r\n onAdd(map: L.Map) {\r\n const className = 'leaflet-control-geocoder';\r\n const container = L.DomUtil.create('div', className + ' leaflet-bar') as HTMLDivElement;\r\n const icon = L.DomUtil.create('button', className + '-icon', container) as HTMLButtonElement;\r\n const form = (this._form = L.DomUtil.create(\r\n 'div',\r\n className + '-form',\r\n container\r\n ) as HTMLDivElement);\r\n\r\n this._map = map;\r\n this._container = container;\r\n\r\n icon.innerHTML = ' ';\r\n icon.type = 'button';\r\n icon.setAttribute('aria-label', this.options.iconLabel);\r\n\r\n const input = (this._input = L.DomUtil.create('input', '', form) as HTMLInputElement);\r\n input.type = 'text';\r\n input.value = this.options.query;\r\n input.placeholder = this.options.placeholder;\r\n L.DomEvent.disableClickPropagation(input);\r\n\r\n this._errorElement = L.DomUtil.create(\r\n 'div',\r\n className + '-form-no-error',\r\n container\r\n ) as HTMLDivElement;\r\n this._errorElement.innerHTML = this.options.errorMessage;\r\n\r\n this._alts = L.DomUtil.create(\r\n 'ul',\r\n className + '-alternatives leaflet-control-geocoder-alternatives-minimized',\r\n container\r\n ) as HTMLUListElement;\r\n L.DomEvent.disableClickPropagation(this._alts);\r\n\r\n L.DomEvent.addListener(input, 'keydown', this._keydown, this);\r\n if (this.options.geocoder.suggest) {\r\n L.DomEvent.addListener(input, 'input', this._change, this);\r\n }\r\n L.DomEvent.addListener(input, 'blur', () => {\r\n if (this.options.collapsed && !this._preventBlurCollapse) {\r\n this._collapse();\r\n }\r\n this._preventBlurCollapse = false;\r\n });\r\n\r\n if (this.options.collapsed) {\r\n if (this.options.expand === 'click') {\r\n L.DomEvent.addListener(container, 'click', (e: Event) => {\r\n if ((e as MouseEvent).button === 0 && (e as MouseEvent).detail !== 2) {\r\n this._toggle();\r\n }\r\n });\r\n } else if (this.options.expand === 'touch') {\r\n L.DomEvent.addListener(\r\n container,\r\n L.Browser.touch ? 'touchstart mousedown' : 'mousedown',\r\n (e: Event) => {\r\n this._toggle();\r\n e.preventDefault(); // mobile: clicking focuses the icon, so UI expands and immediately collapses\r\n e.stopPropagation();\r\n },\r\n this\r\n );\r\n } else {\r\n L.DomEvent.addListener(container, 'mouseover', this._expand, this);\r\n L.DomEvent.addListener(container, 'mouseout', this._collapse, this);\r\n this._map.on('movestart', this._collapse, this);\r\n }\r\n } else {\r\n this._expand();\r\n if (L.Browser.touch) {\r\n L.DomEvent.addListener(container, 'touchstart', () => this._geocode());\r\n } else {\r\n L.DomEvent.addListener(container, 'click', () => this._geocode());\r\n }\r\n }\r\n\r\n if (this.options.defaultMarkGeocode) {\r\n this.on('markgeocode', this.markGeocode, this);\r\n }\r\n\r\n this.on('startgeocode', this.addThrobberClass, this);\r\n this.on('finishgeocode', this.removeThrobberClass, this);\r\n this.on('startsuggest', this.addThrobberClass, this);\r\n this.on('finishsuggest', this.removeThrobberClass, this);\r\n\r\n L.DomEvent.disableClickPropagation(container);\r\n\r\n return container;\r\n }\r\n\r\n /**\r\n * Sets the query string on the text input\r\n * @param string the query string\r\n */\r\n setQuery(string: string): this {\r\n this._input.value = string;\r\n return this;\r\n }\r\n\r\n private _geocodeResult(results: GeocodingResult[], suggest: boolean) {\r\n if (!suggest && this.options.showUniqueResult && results.length === 1) {\r\n this._geocodeResultSelected(results[0]);\r\n } else if (results.length > 0) {\r\n this._alts.innerHTML = '';\r\n this._results = results;\r\n L.DomUtil.removeClass(this._alts, 'leaflet-control-geocoder-alternatives-minimized');\r\n L.DomUtil.addClass(this._container, 'leaflet-control-geocoder-options-open');\r\n for (let i = 0; i < results.length; i++) {\r\n this._alts.appendChild(this._createAlt(results[i], i));\r\n }\r\n } else {\r\n L.DomUtil.addClass(this._container, 'leaflet-control-geocoder-options-error');\r\n L.DomUtil.addClass(this._errorElement, 'leaflet-control-geocoder-error');\r\n }\r\n }\r\n\r\n /**\r\n * Marks a geocoding result on the map\r\n * @param result the geocoding result\r\n */\r\n markGeocode(event: MarkGeocodeEvent) {\r\n const result = event.geocode;\r\n\r\n this._map.fitBounds(result.bbox);\r\n\r\n if (this._geocodeMarker) {\r\n this._map.removeLayer(this._geocodeMarker);\r\n }\r\n\r\n this._geocodeMarker = new L.Marker(result.center)\r\n .bindPopup(result.html || result.name)\r\n .addTo(this._map)\r\n .openPopup();\r\n\r\n return this;\r\n }\r\n\r\n private _geocode(suggest?: boolean) {\r\n const value = this._input.value;\r\n if (!suggest && value.length < this.options.queryMinLength) {\r\n return;\r\n }\r\n\r\n const requestCount = ++this._requestCount;\r\n const cb = (results: GeocodingResult[]) => {\r\n if (requestCount === this._requestCount) {\r\n const event: FinishGeocodeEvent = { input: value, results };\r\n this.fire(suggest ? 'finishsuggest' : 'finishgeocode', event);\r\n this._geocodeResult(results, suggest);\r\n }\r\n };\r\n\r\n this._lastGeocode = value;\r\n if (!suggest) {\r\n this._clearResults();\r\n }\r\n\r\n const event: StartGeocodeEvent = { input: value };\r\n this.fire(suggest ? 'startsuggest' : 'startgeocode', event);\r\n if (suggest) {\r\n this.options.geocoder.suggest(value, cb);\r\n } else {\r\n this.options.geocoder.geocode(value, cb);\r\n }\r\n }\r\n\r\n private _geocodeResultSelected(geocode: GeocodingResult) {\r\n const event: MarkGeocodeEvent = { geocode };\r\n this.fire('markgeocode', event);\r\n }\r\n\r\n private _toggle() {\r\n if (L.DomUtil.hasClass(this._container, 'leaflet-control-geocoder-expanded')) {\r\n this._collapse();\r\n } else {\r\n this._expand();\r\n }\r\n }\r\n\r\n private _expand() {\r\n L.DomUtil.addClass(this._container, 'leaflet-control-geocoder-expanded');\r\n this._input.select();\r\n this.fire('expand');\r\n }\r\n\r\n private _collapse() {\r\n L.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-expanded');\r\n L.DomUtil.addClass(this._alts, 'leaflet-control-geocoder-alternatives-minimized');\r\n L.DomUtil.removeClass(this._errorElement, 'leaflet-control-geocoder-error');\r\n L.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-options-open');\r\n L.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-options-error');\r\n this._input.blur(); // mobile: keyboard shouldn't stay expanded\r\n this.fire('collapse');\r\n }\r\n\r\n private _clearResults() {\r\n L.DomUtil.addClass(this._alts, 'leaflet-control-geocoder-alternatives-minimized');\r\n this._selection = null;\r\n L.DomUtil.removeClass(this._errorElement, 'leaflet-control-geocoder-error');\r\n L.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-options-open');\r\n L.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-options-error');\r\n }\r\n\r\n private _createAlt(result: GeocodingResult, index: number) {\r\n const li = L.DomUtil.create('li', ''),\r\n a = L.DomUtil.create('a', '', li),\r\n icon =\r\n this.options.showResultIcons && result.icon\r\n ? (L.DomUtil.create('img', '', a) as HTMLImageElement)\r\n : null,\r\n text = result.html ? undefined : document.createTextNode(result.name),\r\n mouseDownHandler = (e: Event) => {\r\n // In some browsers, a click will fire on the map if the control is\r\n // collapsed directly after mousedown. To work around this, we\r\n // wait until the click is completed, and _then_ collapse the\r\n // control. Messy, but this is the workaround I could come up with\r\n // for #142.\r\n this._preventBlurCollapse = true;\r\n L.DomEvent.stop(e);\r\n this._geocodeResultSelected(result);\r\n L.DomEvent.on(li, 'click touchend', () => {\r\n if (this.options.collapsed) {\r\n this._collapse();\r\n } else {\r\n this._clearResults();\r\n }\r\n });\r\n };\r\n\r\n if (icon) {\r\n icon.src = result.icon;\r\n }\r\n\r\n li.setAttribute('data-result-index', String(index));\r\n\r\n if (result.html) {\r\n a.innerHTML = a.innerHTML + result.html;\r\n } else if (text) {\r\n a.appendChild(text);\r\n }\r\n\r\n // Use mousedown and not click, since click will fire _after_ blur,\r\n // causing the control to have collapsed and removed the items\r\n // before the click can fire.\r\n L.DomEvent.addListener(li, 'mousedown touchstart', mouseDownHandler, this);\r\n\r\n return li;\r\n }\r\n\r\n private _keydown(e: KeyboardEvent) {\r\n const select = (dir: number) => {\r\n if (this._selection) {\r\n L.DomUtil.removeClass(this._selection, 'leaflet-control-geocoder-selected');\r\n this._selection = this._selection[dir > 0 ? 'nextSibling' : 'previousSibling'];\r\n }\r\n if (!this._selection) {\r\n this._selection = this._alts[dir > 0 ? 'firstChild' : 'lastChild'];\r\n }\r\n\r\n if (this._selection) {\r\n L.DomUtil.addClass(this._selection, 'leaflet-control-geocoder-selected');\r\n }\r\n };\r\n\r\n switch (e.keyCode) {\r\n // Escape\r\n case 27:\r\n if (this.options.collapsed) {\r\n this._collapse();\r\n } else {\r\n this._clearResults();\r\n }\r\n break;\r\n // Up\r\n case 38:\r\n select(-1);\r\n break;\r\n // Up\r\n case 40:\r\n select(1);\r\n break;\r\n // Enter\r\n case 13:\r\n if (this._selection) {\r\n const index = parseInt(this._selection.getAttribute('data-result-index'), 10);\r\n this._geocodeResultSelected(this._results[index]);\r\n this._clearResults();\r\n } else {\r\n this._geocode();\r\n }\r\n break;\r\n default:\r\n return;\r\n }\r\n\r\n L.DomEvent.preventDefault(e);\r\n }\r\n\r\n private _change() {\r\n const v = this._input.value;\r\n if (v !== this._lastGeocode) {\r\n clearTimeout(this._suggestTimeout);\r\n if (v.length >= this.options.suggestMinLength) {\r\n this._suggestTimeout = setTimeout(() => this._geocode(true), this.options.suggestTimeout);\r\n } else {\r\n this._clearResults();\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link GeocoderControl}\r\n * @param options the options\r\n */\r\nexport function geocoder(options?: Partial) {\r\n return new GeocoderControl(options);\r\n}\r\n","/* @preserve\r\n * Leaflet Control Geocoder\r\n * https://github.com/perliedman/leaflet-control-geocoder\r\n *\r\n * Copyright (c) 2012 sa3m (https://github.com/sa3m)\r\n * Copyright (c) 2018 Per Liedman\r\n * All rights reserved.\r\n */\r\nimport * as L from 'leaflet';\r\nimport { GeocoderControl as Geocoder, geocoder } from './control';\r\nimport * as geocoders from './geocoders/index';\r\n\r\nL.Util.extend(Geocoder, geocoders);\r\nexport default Geocoder;\r\nexport { Geocoder, geocoder, geocoders };\r\n\r\nL.Util.extend(L.Control, {\r\n Geocoder: Geocoder,\r\n geocoder: geocoder\r\n});\r\n"],"names":["geocodingParams","options","params","L","Util","extend","geocodingQueryParams","reverseParams","reverseQueryParams","lastCallbackId","badChars","possible","escape","escapeChar","chr","htmlEscape","string","test","replace","jsonp","url","callback","context","jsonpParam","callbackId","window","bind","script","document","createElement","type","src","getParamString","id","getElementsByTagName","appendChild","getJSON","xmlHttp","XMLHttpRequest","onreadystatechange","readyState","message","status","response","JSON","parse","e","open","responseType","setRequestHeader","send","template","str","data","key","value","undefined","obj","existingUrl","uppercase","i","encodeURIComponent","toUpperCase","Array","isArray","push","String","j","length","indexOf","join","ArcGis","serviceUrl","apiKey","setOptions","geocode","query","cb","token","SingleLine","outFields","forStorage","maxLocations","f","results","candidates","loc","latLng","location","y","x","latLngBounds","extent","ymax","xmax","ymin","xmin","name","address","bbox","center","call","suggest","reverse","scale","lng","lat","distance","result","error","Match_addr","arcgis","Bing","resourceSets","resources","resource","point","coordinates","bing","Google","geometry","viewport","northeast","southwest","formatted_address","properties","address_components","latlng","google","HERE","app_id","app_code","maxResults","Error","searchtext","gen","jsonattributes","maxresults","prox","reverseGeocodeProxRadius","mode","view","displayPosition","latitude","longitude","mapView","topLeft","bottomRight","label","HEREv2","q","limit","at","items","item","position","south","west","north","east","here","parseLatLng","match","LatLng","next","sizeInMeters","toBounds","Mapbox","_getProperties","text","split","short_code","access_token","proximity","features","slice","place_name","param","mapbox","MapQuest","decodeURIComponent","_formatName","filter","s","outFormat","locations","street","adminArea4","adminArea3","adminArea1","outputFormat","mapQuest","Neutrino","userId","found","neutrino","Nominatim","htmlTemplate","r","className","parts","road","building","city","town","village","hamlet","state","country","format","addressdetails","boundingbox","icon","display_name","html","lon","zoom","Math","round","log","nominatim","OpenLocationCode","decoded","decode","latitudeCenter","longitudeCenter","latitudeLo","longitudeLo","latitudeHi","longitudeHi","console","warn","code","encode","codeLength","openLocationCode","OpenCage","annotations","bounds","formatted","opencage","Pelias","api_key","_parseResults","geocoding","timestamp","_lastSuggest","bboxname","geoJSON","pointToLayer","feature","circleMarker","onEachFeature","layer","getBounds","getCenter","getLatLng","GeoJSON","coordsToLatLng","pelias","GeocodeEarth","geocodeEarth","Mapzen","mapzen","Openrouteservice","openrouteservice","Photon","reverseUrl","nameProperties","_decodeFeatures","c","_decodeFeatureName","map","p","v","photon","What3Words","addr","words","coords","what3words","EventedControl","prototype","Control","Evented","GeocoderControl","showUniqueResult","showResultIcons","collapsed","expand","placeholder","errorMessage","iconLabel","queryMinLength","suggestMinLength","suggestTimeout","defaultMarkGeocode","geocoder","addThrobberClass","DomUtil","addClass","_container","removeThrobberClass","removeClass","onAdd","container","create","form","_form","_map","innerHTML","setAttribute","input","_input","DomEvent","disableClickPropagation","_errorElement","_alts","addListener","_keydown","_change","_preventBlurCollapse","_collapse","button","detail","_toggle","Browser","touch","preventDefault","stopPropagation","_expand","on","_geocode","markGeocode","setQuery","_geocodeResult","_geocodeResultSelected","_results","_createAlt","event","fitBounds","_geocodeMarker","removeLayer","Marker","bindPopup","addTo","openPopup","requestCount","_requestCount","fire","_lastGeocode","_clearResults","hasClass","select","blur","_selection","index","li","a","createTextNode","mouseDownHandler","stop","dir","keyCode","parseInt","getAttribute","clearTimeout","_suggestTimeout","setTimeout","Geocoder","geocoders"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoFA;;;;WAGgBA,gBACdC,SACAC;EAEA,SAAOC,YAAC,CAACC,IAAF,CAAOC,MAAP,CAAcH,MAAd,EAAsBD,OAAO,CAACK,oBAA9B,CAAP;EACD;EAED;;;;WAGgBC,cACdN,SACAC;EAEA,SAAOC,YAAC,CAACC,IAAF,CAAOC,MAAP,CAAcH,MAAd,EAAsBD,OAAO,CAACO,kBAA9B,CAAP;EACD;;ECrGD;;;;EAGA,IAAIC,cAAc,GAAG,CAArB;EAGA;;EACA;;;;EAGA,IAAMC,QAAQ,GAAG,WAAjB;EACA;;;;EAGA,IAAMC,QAAQ,GAAG,UAAjB;EACA;;;;EAGA,IAAMC,MAAM,GAA2B;EACrC,OAAK,OADgC;EAErC,OAAK,MAFgC;EAGrC,OAAK,MAHgC;EAIrC,OAAK,QAJgC;EAKrC,OAAK,QALgC;EAMrC,OAAK;EANgC,CAAvC;EASA;;;;EAGA,SAASC,UAAT,CAAoBC,GAApB;EACE,SAAOF,MAAM,CAACE,GAAD,CAAb;EACD;EAED;;;;;WAGgBC,WAAWC;EACzB,MAAIA,MAAM,IAAI,IAAd,EAAoB;EAClB,WAAO,EAAP;EACD,GAFD,MAEO,IAAI,CAACA,MAAL,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end of file diff --git a/assets/vendors/leaflet-control-geocoder/Control.Geocoder.min.js b/assets/vendors/leaflet-control-geocoder/Control.Geocoder.min.js new file mode 100644 index 0000000..674e8ee --- /dev/null +++ b/assets/vendors/leaflet-control-geocoder/Control.Geocoder.min.js @@ -0,0 +1,2 @@ +var leafletControlGeocoder=function(t,e){function o(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(o){if("default"!==o){var n=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,n.get?n:{enumerable:!0,get:function(){return t[o]}})}}),e.default=t,e}var n=o(e);function s(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}function i(t,e){return n.Util.extend(e,t.geocodingQueryParams)}function r(t,e){return n.Util.extend(e,t.reverseQueryParams)}var a=0,l=/[&<>"'`]/g,c=/[&<>"'`]/,u={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"};function p(t){return u[t]}function d(t,e,o,s,i){var r="_l_geocoder_"+a++;e[i||"callback"]=r,window[r]=n.Util.bind(o,s);var l=document.createElement("script");l.type="text/javascript",l.src=t+g(e),l.id=r,document.getElementsByTagName("head")[0].appendChild(l)}function h(t,e,o){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){var t;if(200!==n.status&&304!==n.status)t="";else if("string"==typeof n.response)try{t=JSON.parse(n.response)}catch(e){t=n.response}else t=n.response;o(t)}},n.open("GET",t+g(e),!0),n.responseType="json",n.setRequestHeader("Accept","application/json"),n.send(null)}function g(t,e,o){var n=[];for(var s in t){var i=encodeURIComponent(o?s.toUpperCase():s),r=t[s];if(Array.isArray(r))for(var a=0;a0)for(var i=t.resourceSets[0].resources.length-1;i>=0;i--){var r=t.resourceSets[0].resources[i],a=r.bbox;s[i]={name:r.name,bbox:n.latLngBounds([a[0],a[1]],[a[2],a[3]]),center:n.latLng(r.point.coordinates)}}e.call(o,s)},this,"jsonp")},e.reverse=function(t,e,o,s){var i=r(this.options,{key:this.options.apiKey});d(this.options.serviceUrl+t.lat+","+t.lng,i,function(t){for(var e=[],i=t.resourceSets[0].resources.length-1;i>=0;i--){var r=t.resourceSets[0].resources[i],a=r.bbox;e[i]={name:r.name,bbox:n.latLngBounds([a[0],a[1]],[a[2],a[3]]),center:n.latLng(r.point.coordinates)}}o.call(s,e)},this,"jsonp")},t}(),m=function(){function t(t){this.options={serviceUrl:"https://maps.googleapis.com/maps/api/geocode/json"},n.Util.setOptions(this,t)}var e=t.prototype;return e.geocode=function(t,e,o){var s=i(this.options,{key:this.options.apiKey,address:t});h(this.options.serviceUrl,s,function(t){var s=[];if(t.results&&t.results.length)for(var i=0;i<=t.results.length-1;i++){var r=t.results[i],a=n.latLng(r.geometry.location),l=n.latLngBounds(n.latLng(r.geometry.viewport.northeast),n.latLng(r.geometry.viewport.southwest));s[i]={name:r.formatted_address,bbox:l,center:a,properties:r.address_components}}e.call(o,s)})},e.reverse=function(t,e,o,s){var i=r(this.options,{key:this.options.apiKey,latlng:t.lat+","+t.lng});h(this.options.serviceUrl,i,function(t){var e=[];if(t.results&&t.results.length)for(var i=0;i<=t.results.length-1;i++){var r=t.results[i],a=n.latLng(r.geometry.location),l=n.latLngBounds(n.latLng(r.geometry.viewport.northeast),n.latLng(r.geometry.viewport.southwest));e[i]={name:r.formatted_address,bbox:l,center:a,properties:r.address_components}}o.call(s,e)})},t}(),_=function(){function t(t){if(this.options={serviceUrl:"https://geocoder.api.here.com/6.2/",app_id:"",app_code:"",apiKey:"",maxResults:5},n.Util.setOptions(this,t),t.apiKey)throw Error("apiKey is not supported, use app_id/app_code instead!")}var e=t.prototype;return e.geocode=function(t,e,o){var n=i(this.options,{searchtext:t,gen:9,app_id:this.options.app_id,app_code:this.options.app_code,jsonattributes:1,maxresults:this.options.maxResults});this.getJSON(this.options.serviceUrl+"geocode.json",n,e,o)},e.reverse=function(t,e,o,n){var s=t.lat+","+t.lng;this.options.reverseGeocodeProxRadius&&(s+=","+this.options.reverseGeocodeProxRadius);var i=r(this.options,{prox:s,mode:"retrieveAddresses",app_id:this.options.app_id,app_code:this.options.app_code,gen:9,jsonattributes:1,maxresults:this.options.maxResults});this.getJSON(this.options.serviceUrl+"reversegeocode.json",i,o,n)},e.getJSON=function(t,e,o,s){h(t,e,function(t){var e=[];if(t.response.view&&t.response.view.length)for(var i=0;i<=t.response.view[0].result.length-1;i++){var r=t.response.view[0].result[i].location,a=n.latLng(r.displayPosition.latitude,r.displayPosition.longitude),l=n.latLngBounds(n.latLng(r.mapView.topLeft.latitude,r.mapView.topLeft.longitude),n.latLng(r.mapView.bottomRight.latitude,r.mapView.bottomRight.longitude));e[i]={name:r.address.label,properties:r.address,bbox:l,center:a}}o.call(s,e)})},t}(),b=function(){function t(t){this.options={serviceUrl:"https://geocode.search.hereapi.com/v1",apiKey:"",app_id:"",app_code:"",maxResults:10},n.Util.setOptions(this,t)}var e=t.prototype;return e.geocode=function(t,e,o){var n=i(this.options,{q:t,apiKey:this.options.apiKey,limit:this.options.maxResults});if(!n.at&&!n.in)throw Error("at / in parameters not found. Please define coordinates (at=latitude,longitude) or other (in) in your geocodingQueryParams.");this.getJSON(this.options.serviceUrl+"/discover",n,e,o)},e.reverse=function(t,e,o,n){var s=r(this.options,{at:t.lat+","+t.lng,limit:this.options.reverseGeocodeProxRadius,apiKey:this.options.apiKey});this.getJSON(this.options.serviceUrl+"/revgeocode",s,o,n)},e.getJSON=function(t,e,o,s){h(t,e,function(t){var e=[];if(t.items&&t.items.length)for(var i=0;i<=t.items.length-1;i++){var r,a=t.items[i],l=n.latLng(a.position.lat,a.position.lng);r=a.mapView?n.latLngBounds(n.latLng(a.mapView.south,a.mapView.west),n.latLng(a.mapView.north,a.mapView.east)):n.latLngBounds(n.latLng(a.position.lat,a.position.lng),n.latLng(a.position.lat,a.position.lng)),e[i]={name:a.address.label,properties:a.address,bbox:r,center:l}}o.call(s,e)})},t}();function y(t){var e;return(e=t.match(/^([NS])\s*(\d{1,3}(?:\.\d*)?)\W*([EW])\s*(\d{1,3}(?:\.\d*)?)$/))?n.latLng((/N/i.test(e[1])?1:-1)*+e[2],(/E/i.test(e[3])?1:-1)*+e[4]):(e=t.match(/^(\d{1,3}(?:\.\d*)?)\s*([NS])\W*(\d{1,3}(?:\.\d*)?)\s*([EW])$/))?n.latLng((/N/i.test(e[2])?1:-1)*+e[1],(/E/i.test(e[4])?1:-1)*+e[3]):(e=t.match(/^([NS])\s*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\W*([EW])\s*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?$/))?n.latLng((/N/i.test(e[1])?1:-1)*(+e[2]+ +e[3]/60),(/E/i.test(e[4])?1:-1)*(+e[5]+ +e[6]/60)):(e=t.match(/^(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\s*([NS])\W*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\s*([EW])$/))?n.latLng((/N/i.test(e[3])?1:-1)*(+e[1]+ +e[2]/60),(/E/i.test(e[6])?1:-1)*(+e[4]+ +e[5]/60)):(e=t.match(/^([NS])\s*(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]?\W*([EW])\s*(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]?$/))?n.latLng((/N/i.test(e[1])?1:-1)*(+e[2]+ +e[3]/60+ +e[4]/3600),(/E/i.test(e[5])?1:-1)*(+e[6]+ +e[7]/60+ +e[8]/3600)):(e=t.match(/^(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]\s*([NS])\W*(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]?\s*([EW])$/))?n.latLng((/N/i.test(e[4])?1:-1)*(+e[1]+ +e[2]/60+ +e[3]/3600),(/E/i.test(e[8])?1:-1)*(+e[5]+ +e[6]/60+ +e[7]/3600)):(e=t.match(/^\s*([+-]?\d+(?:\.\d*)?)\s*[\s,]\s*([+-]?\d+(?:\.\d*)?)\s*$/))?n.latLng(+e[1],+e[2]):void 0}var L=function(){function t(t){this.options={next:void 0,sizeInMeters:1e4},n.Util.setOptions(this,t)}return t.prototype.geocode=function(t,e,o){var n=y(t);if(n){var s=[{name:t,center:n,bbox:n.toBounds(this.options.sizeInMeters)}];e.call(o,s)}else this.options.next&&this.options.next.geocode(t,e,o)},t}(),x=function(){function t(t){this.options={serviceUrl:"https://api.mapbox.com/geocoding/v5/mapbox.places/"},n.Util.setOptions(this,t)}var e=t.prototype;return e._getProperties=function(t){for(var e={text:t.text,address:t.address},o=0;o<(t.context||[]).length;o++)e[t.context[o].id.split(".")[0]]=t.context[o].text,t.context[o].short_code&&(e.countryShortCode=t.context[o].short_code);return e},e.geocode=function(t,e,o){var s=this,r=i(this.options,{access_token:this.options.apiKey});void 0!==r.proximity&&void 0!==r.proximity.lat&&void 0!==r.proximity.lng&&(r.proximity=r.proximity.lng+","+r.proximity.lat),h(this.options.serviceUrl+encodeURIComponent(t)+".json",r,function(t){var i=[];if(t.features&&t.features.length)for(var r=0;r<=t.features.length-1;r++){var a,l=t.features[r],c=n.latLng(l.center.reverse());a=l.bbox?n.latLngBounds(n.latLng(l.bbox.slice(0,2).reverse()),n.latLng(l.bbox.slice(2,4).reverse())):n.latLngBounds(c,c),i[r]={name:l.place_name,bbox:a,center:c,properties:s._getProperties(l)}}e.call(o,i)})},e.suggest=function(t,e,o){return this.geocode(t,e,o)},e.reverse=function(t,e,o,s){var i=this;h(this.options.serviceUrl+t.lng+","+t.lat+".json",r(this.options,{access_token:this.options.apiKey}),function(t){var e=[];if(t.features&&t.features.length)for(var r=0;r<=t.features.length-1;r++){var a,l=t.features[r],c=n.latLng(l.center.reverse());a=l.bbox?n.latLngBounds(n.latLng(l.bbox.slice(0,2).reverse()),n.latLng(l.bbox.slice(2,4).reverse())):n.latLngBounds(c,c),e[r]={name:l.place_name,bbox:a,center:c,properties:i._getProperties(l)}}o.call(s,e)})},t}(),U=function(){function t(t){this.options={serviceUrl:"https://www.mapquestapi.com/geocoding/v1"},n.Util.setOptions(this,t),this.options.apiKey=decodeURIComponent(this.options.apiKey)}var e=t.prototype;return e._formatName=function(){return[].slice.call(arguments).filter(function(t){return!!t}).join(", ")},e.geocode=function(t,e,o){var s=i(this.options,{key:this.options.apiKey,location:t,limit:5,outFormat:"json"});h(this.options.serviceUrl+"/address",s,n.Util.bind(function(t){var s=[];if(t.results&&t.results[0].locations)for(var i=t.results[0].locations.length-1;i>=0;i--){var r=t.results[0].locations[i],a=n.latLng(r.latLng);s[i]={name:this._formatName(r.street,r.adminArea4,r.adminArea3,r.adminArea1),bbox:n.latLngBounds(a,a),center:a}}e.call(o,s)},this))},e.reverse=function(t,e,o,s){var i=r(this.options,{key:this.options.apiKey,location:t.lat+","+t.lng,outputFormat:"json"});h(this.options.serviceUrl+"/reverse",i,n.Util.bind(function(t){var e=[];if(t.results&&t.results[0].locations)for(var i=t.results[0].locations.length-1;i>=0;i--){var r=t.results[0].locations[i],a=n.latLng(r.latLng);e[i]={name:this._formatName(r.street,r.adminArea4,r.adminArea3,r.adminArea1),bbox:n.latLngBounds(a,a),center:a}}o.call(s,e)},this))},t}(),w=function(){function t(t){this.options={userId:void 0,apiKey:void 0,serviceUrl:"https://neutrinoapi.com/"},n.Util.setOptions(this,t)}var e=t.prototype;return e.geocode=function(t,e,o){var s=i(this.options,{apiKey:this.options.apiKey,userId:this.options.userId,address:t.split(/\s+/).join(".")});h(this.options.serviceUrl+"geocode-address",s,function(t){var s=[];if(t.locations){t.geometry=t.locations[0];var i=n.latLng(t.geometry.latitude,t.geometry.longitude),r=n.latLngBounds(i,i);s[0]={name:t.geometry.address,bbox:r,center:i}}e.call(o,s)})},e.suggest=function(t,e,o){return this.geocode(t,e,o)},e.reverse=function(t,e,o,s){var i=r(this.options,{apiKey:this.options.apiKey,userId:this.options.userId,latitude:t.lat,longitude:t.lng});h(this.options.serviceUrl+"geocode-reverse",i,function(e){var i=[];if(200==e.status.status&&e.found){var r=n.latLng(t.lat,t.lng),a=n.latLngBounds(r,r);i[0]={name:e.address,bbox:a,center:r}}o.call(s,i)})},t}(),C=function(){function t(t){this.options={serviceUrl:"https://nominatim.openstreetmap.org/",htmlTemplate:function(t){var e,o,n=t.address,s=[];return(n.road||n.building)&&s.push("{building} {road} {house_number}"),(n.city||n.town||n.village||n.hamlet)&&s.push('{postcode} {city} {town} {village} {hamlet}'),(n.state||n.country)&&s.push('{state} {country}'),e=s.join("
"),o=n,e.replace(/\{ *([\w_]+) *\}/g,function(t,e){var n,s=o[e];return void 0===s?s="":"function"==typeof s&&(s=s(o)),null==(n=s)?"":n?c.test(n=""+n)?n.replace(l,p):n:n+""})}},n.Util.setOptions(this,t||{})}var e=t.prototype;return e.geocode=function(t,e,o){var s=this,r=i(this.options,{q:t,limit:5,format:"json",addressdetails:1});h(this.options.serviceUrl+"search",r,function(t){for(var i=[],r=t.length-1;r>=0;r--){for(var a=t[r].boundingbox,l=0;l<4;l++)a[l]=+a[l];i[r]={icon:t[r].icon,name:t[r].display_name,html:s.options.htmlTemplate?s.options.htmlTemplate(t[r]):void 0,bbox:n.latLngBounds([a[0],a[2]],[a[1],a[3]]),center:n.latLng(t[r].lat,t[r].lon),properties:t[r]}}e.call(o,i)})},e.reverse=function(t,e,o,s){var i=this,a=r(this.options,{lat:t.lat,lon:t.lng,zoom:Math.round(Math.log(e/256)/Math.log(2)),addressdetails:1,format:"json"});h(this.options.serviceUrl+"reverse",a,function(t){var e=[];if(t&&t.lat&&t.lon){var r=n.latLng(t.lat,t.lon),a=n.latLngBounds(r,r);e.push({name:t.display_name,html:i.options.htmlTemplate?i.options.htmlTemplate(t):void 0,center:r,bbox:a,properties:t})}o.call(s,e)})},t}(),E=function(){function t(t){n.Util.setOptions(this,t)}var e=t.prototype;return e.geocode=function(t,e,o){try{var s=this.options.OpenLocationCode.decode(t),i={name:t,center:n.latLng(s.latitudeCenter,s.longitudeCenter),bbox:n.latLngBounds(n.latLng(s.latitudeLo,s.longitudeLo),n.latLng(s.latitudeHi,s.longitudeHi))};e.call(o,[i])}catch(t){console.warn(t),e.call(o,[])}},e.reverse=function(t,e,o,s){try{var i={name:this.options.OpenLocationCode.encode(t.lat,t.lng,this.options.codeLength),center:n.latLng(t.lat,t.lng),bbox:n.latLngBounds(n.latLng(t.lat,t.lng),n.latLng(t.lat,t.lng))};o.call(s,[i])}catch(t){console.warn(t),o.call(s,[])}},t}(),k=function(){function t(t){this.options={serviceUrl:"https://api.opencagedata.com/geocode/v1/json"},n.Util.setOptions(this,t)}var e=t.prototype;return e.geocode=function(t,e,o){var s=i(this.options,{key:this.options.apiKey,q:t});h(this.options.serviceUrl,s,function(t){var s=[];if(t.results&&t.results.length)for(var i=0;in._lastSuggest&&(n._lastSuggest=t.geocoding.timestamp,e.call(o,n._parseResults(t,"bbox")))})},e.reverse=function(t,e,o,n){var s=this,i=r(this.options,{api_key:this.options.apiKey,"point.lat":t.lat,"point.lon":t.lng});h(this.options.serviceUrl+"/reverse",i,function(t){o.call(n,s._parseResults(t,"bounds"))})},e._parseResults=function(t,e){var o=[];return n.geoJSON(t,{pointToLayer:function(t,e){return n.circleMarker(e)},onEachFeature:function(t,s){var i,r,a={};s.getBounds?r=(i=s.getBounds()).getCenter():s.feature.bbox?(r=s.getLatLng(),i=n.latLngBounds(n.GeoJSON.coordsToLatLng(s.feature.bbox.slice(0,2)),n.GeoJSON.coordsToLatLng(s.feature.bbox.slice(2,4)))):(r=s.getLatLng(),i=n.latLngBounds(r,r)),a.name=s.feature.properties.label,a.center=r,a[e]=i,a.properties=s.feature.properties,o.push(a)}}),o},t}();function B(t){return new D(t)}var R=D,S=B,O=D,K=B,T=function(t){function e(e){return t.call(this,n.Util.extend({serviceUrl:"https://api.openrouteservice.org/geocode"},e))||this}return s(e,t),e}(D),j=function(){function t(t){this.options={serviceUrl:"https://photon.komoot.io/api/",reverseUrl:"https://photon.komoot.io/reverse/",nameProperties:["name","street","suburb","hamlet","town","city","state","country"]},n.Util.setOptions(this,t)}var e=t.prototype;return e.geocode=function(t,e,o){var s=i(this.options,{q:t});h(this.options.serviceUrl,s,n.Util.bind(function(t){e.call(o,this._decodeFeatures(t))},this))},e.suggest=function(t,e,o){return this.geocode(t,e,o)},e.reverse=function(t,e,o,s){var i=r(this.options,{lat:t.lat,lon:t.lng});h(this.options.reverseUrl,i,n.Util.bind(function(t){o.call(s,this._decodeFeatures(t))},this))},e._decodeFeatures=function(t){var e=[];if(t&&t.features)for(var o=0;o0){this._alts.innerHTML="",this._results=t,n.DomUtil.removeClass(this._alts,"leaflet-control-geocoder-alternatives-minimized"),n.DomUtil.addClass(this._container,"leaflet-control-geocoder-options-open");for(var o=0;o0?"nextSibling":"previousSibling"]),e._selection||(e._selection=e._alts[t>0?"firstChild":"lastChild"]),e._selection&&n.DomUtil.addClass(e._selection,"leaflet-control-geocoder-selected")};switch(t.keyCode){case 27:this.options.collapsed?this._collapse():this._clearResults();break;case 38:o(-1);break;case 40:o(1);break;case 13:if(this._selection){var s=parseInt(this._selection.getAttribute("data-result-index"),10);this._geocodeResultSelected(this._results[s]),this._clearResults()}else this._geocode();break;default:return}n.DomEvent.preventDefault(t)},o._change=function(){var t=this,e=this._input.value;e!==this._lastGeocode&&(clearTimeout(this._suggestTimeout),e.length>=this.options.suggestMinLength?this._suggestTimeout=setTimeout(function(){return t._geocode(!0)},this.options.suggestTimeout):this._clearResults())},e}(P);function q(t){return new G(t)}return n.Util.extend(G,M),n.Util.extend(n.Control,{Geocoder:G,geocoder:q}),t.Geocoder=G,t.default=G,t.geocoder=q,t.geocoders=M,t}({},L); +//# sourceMappingURL=Control.Geocoder.min.js.map diff --git a/bp-xprofile-custom-field-types.php b/bp-xprofile-custom-field-types.php index b274e39..3cbd83d 100644 --- a/bp-xprofile-custom-field-types.php +++ b/bp-xprofile-custom-field-types.php @@ -13,7 +13,7 @@ * Plugin Name: BuddyPress Xprofile Custom Field Types * Plugin URI: https://buddydev.com/plugins/buddypress-xprofile-custom-field-types/ * Description: Have all the extra field types at your disposal. - * Version: 1.2.6 + * Version: 1.2.7 * Requires PHP: 5.3 * Author: BuddyDev * Author URI: https://buddydev.com @@ -46,7 +46,7 @@ class BP_Xprofile_CFTR { * * @var string */ - private $version = '1.2.6'; + private $version = '1.2.7'; /** * Class instance diff --git a/readme.txt b/readme.txt index 47d89be..e1fbff5 100644 --- a/readme.txt +++ b/readme.txt @@ -2,8 +2,8 @@ Contributors: buddydev, sbrajesh, raviousprime Tags: buddypress, xprofile, fields, buddypress-profile-field-types Requires at least: 5.0 -Tested up to: 6.2 -Stable tag: 1.2.6 +Tested up to: 6.3 +Stable tag: 1.2.7 License: GLPv2 or later Buddypress Xprofile Custom Field Types adds extra custom profile fields to BuddyPress. Field types are: Birthdate, Email, Url etc. @@ -111,10 +111,14 @@ We will love to work with you. Please let us know if you need any of our [servic 3. profile view screenshot-3.png == Changelog == += 1.2.7 = + * Fix issue of core date field with birthday date field + = 1.2.6 = * Fix issue with Tags type oon PHp 8.0+ = 1.2.5 = +>>>>>>> upstream/master * Updated compatibility with BP Profile Search plugin for Country field type. Props @dontdream * *Upgrade note*:- If you are using Country field with BP profile search, Please verify that the interface works. diff --git a/src/bootstrap/class-assets-loader.php b/src/bootstrap/class-assets-loader.php index c9dcc9a..51cf552 100644 --- a/src/bootstrap/class-assets-loader.php +++ b/src/bootstrap/class-assets-loader.php @@ -52,9 +52,9 @@ public function setup() { */ public function register_front_assets() { - if ( ! $this->should_load_front_assets() ) { - return; - } + // if ( ! $this->should_load_front_assets() ) { + // return; + // } $this->register(); } @@ -66,9 +66,9 @@ public function load_assets() { // css should be always loaded. wp_enqueue_style( 'bp-xprofile-custom-field-types' ); - if ( ! $this->should_load_front_assets() ) { - return; - } + // if ( ! $this->should_load_front_assets() ) { + // return; + // } $this->enqueue_vendors(); $this->enqueue_front(); } @@ -128,7 +128,9 @@ private function register() { */ public function enqueue_front() { wp_enqueue_script( 'bp-xprofile-custom-field-types' ); - + wp_enqueue_script( 'leaflet' ); + wp_enqueue_script( 'leaflet-control-geocoder' ); + wp_enqueue_script( 'bp-xprofile-leaflet-field-type' ); wp_localize_script( 'bp-xprofile-custom-field-types', 'BPXprofileCFTR', $this->data ); } @@ -137,8 +139,12 @@ public function enqueue_front() { */ public function enqueue_vendors() { wp_enqueue_style( 'select2' ); + wp_enqueue_style('leaflet-control-geocoder'); + wp_enqueue_style( 'leaflet' ); wp_enqueue_script( 'modernizr' ); wp_enqueue_script( 'jscolor' ); + wp_enqueue_script( 'leaflet-control-geocoder' ); + wp_enqueue_script( 'leaflet' ); wp_enqueue_script( 'select2' ); wp_enqueue_script( 'select2-i18n' ); } @@ -148,9 +154,7 @@ public function enqueue_vendors() { */ public function enqueue_admin() { wp_enqueue_script( 'bp-xprofile-custom-field-types-admin' ); - wp_localize_script( 'bp-xprofile-custom-field-types', 'BPXprofileCFTR', $this->data ); - wp_localize_script( 'bp-xprofile-custom-field-types-admin', 'BPXprofileCFTRAdmin', $this->data ); } @@ -175,6 +179,15 @@ private function register_vendors() { wp_register_script( 'modernizr', $url . 'assets/vendors/modernizr.js', array(), $version, false ); wp_register_script( 'jscolor', $url . 'assets/vendors/jscolor/jscolor.js', array(), '1.4.1', true ); + // Leaflet Js and Leaflet geocoder + wp_register_script( 'leaflet', 'https://unpkg.com/leaflet@1.9.1/dist/leaflet.js' ); + wp_register_style( 'leaflet', 'https://unpkg.com/leaflet@1.9.1/dist/leaflet.css' ); + wp_register_script( 'leaflet-control-geocoder', $url . 'assets/vendors/leaflet-control-geocoder/Control.Geocoder.js', array("leaflet"), '2.4.0', true ); + wp_register_style( 'leaflet-control-geocoder', $url . 'assets/vendors/leaflet-control-geocoder/Control.Geocoder.css', array(), '2.4.0' ); + wp_register_script( 'leaflet-control-geocoder', $url . 'assets/vendors/leaflet-control-geocoder/Control.Geocoder.js', array("leaflet"), '2.4.0', true ); + wp_register_script( 'bp-xprofile-leaflet-field-type', $url . 'assets/js/bp-xprofile-leaflet-field-type.js', array("leaflet"), '1.0.0', true ); + + wp_register_script( 'select2', $url . 'assets/vendors/select2/select2.full.min.js', array( 'jquery' ), '4.0.12', true ); $locale = apply_filters( 'bpxcftr_select2_js_locale', get_locale() ); diff --git a/src/core/bp-xprofile-custom-field-types-functions.php b/src/core/bp-xprofile-custom-field-types-functions.php index cf87eea..0d94466 100644 --- a/src/core/bp-xprofile-custom-field-types-functions.php +++ b/src/core/bp-xprofile-custom-field-types-functions.php @@ -28,6 +28,7 @@ function bpxcftr_get_field_types() { 'web' => 'BPXProfileCFTR\Field_Types\Field_Type_Web', 'datepicker' => 'BPXProfileCFTR\Field_Types\Field_Type_Datepicker', 'select_custom_post_type' => 'BPXProfileCFTR\Field_Types\Field_Type_Select_Post_Type', + 'leaflet' => 'BPXProfileCFTR\Field_Types\Field_Type_Leaflet', 'country' => 'BPXProfileCFTR\Field_Types\Field_Type_Country', 'multiselect_custom_post_type' => 'BPXProfileCFTR\Field_Types\Field_Type_Multi_Select_Post_Type', 'select_custom_taxonomy' => 'BPXProfileCFTR\Field_Types\Field_Type_Select_Taxonomy', diff --git a/src/field-types/class-field-type-birthdate.php b/src/field-types/class-field-type-birthdate.php index d68cc8a..97d9968 100644 --- a/src/field-types/class-field-type-birthdate.php +++ b/src/field-types/class-field-type-birthdate.php @@ -96,7 +96,7 @@ public function admin_new_field_html( \BP_XProfile_Field $current_field, $contro - +

@@ -297,7 +297,7 @@ public static function get_age_label( $field_id ) { * @return bool True on success. */ public function admin_save_settings( $field_id, $settings ) { - $existing_settings = self::get_field_settings( $field_id ); + $existing_settings = self::get_field_settings( $field_id ); $saved_settings = array(); $prefix = 'bpxcftr_birthdate_'; diff --git a/src/field-types/class-field-type-leaflet.php b/src/field-types/class-field-type-leaflet.php new file mode 100644 index 0000000..9b1d4b9 --- /dev/null +++ b/src/field-types/class-field-type-leaflet.php @@ -0,0 +1,247 @@ +name = _x( 'Leaflet location field', 'xprofile field type', 'bp-xprofile-custom-field-types' ); + $this->category = _x( 'Custom Fields', 'xprofile field type category', 'bp-xprofile-custom-field-types' ); + + $this->do_settings_section = true; + $this->field_prefixe = "bpxcftr_leaflet_"; + $this->accepts_null_value = true; + $this->validation_regex = array('{"lat":\d+\.?\d+,"lng":\d+\.?\d+,"name":".+"}'); // Valid format {"lat":45.12345,"lng":5.12345,"name":"Adress, City, Country"} + + do_action( 'bp_xprofile_field_type_leaflet', $this ); + } + + /** + * Edit field html. + * + * @param array $raw_properties properties. + */ + public function edit_field_html( array $raw_properties = array() ) { + global $field; + + // Défault values + $latitude = bp_xprofile_get_meta( $field->id, 'field', $this->field_prefixe.'latitude', true ); + $longitude = bp_xprofile_get_meta( $field->id, 'field', $this->field_prefixe.'longitude', true ); + $zoom = bp_xprofile_get_meta( $field->id, 'field', $this->field_prefixe.'zoom', true ); + $height = bp_xprofile_get_meta( $field->id, 'field', $this->field_prefixe.'height', true ); + $city = ""; + + + try { + $value = bp_get_the_profile_field_edit_value(); + $value = json_decode(html_entity_decode($value)); + if ($value!=null) { + $latitude = $value->lat; + $longitude = $value->lng; + $city = $value->name; + } + } + catch (\Exception $e) { + $value=null; + } + + $html = $this->get_edit_field_html_elements( + array_merge( + array( + 'type' => 'hidden', + 'value' => bp_get_the_profile_field_edit_value(), + ), + $raw_properties + ) + ); + ?> + + + + + + + + + /> +
+ + +
+
+ + +

+ + + get_edit_field_html_elements( + array_merge( + array( 'type' => 'text' ), + $raw_properties + ) + ); + ?> + + /> + + Users->Profile Fields->New|Edit entry. + * + * @param \BP_XProfile_Field $current_field object. + * @param string $control_type type. + */ + public function admin_new_field_html( \BP_XProfile_Field $current_field, $control_type = '' ) { + + $type = array_search( get_class( $this ), bp_xprofile_get_field_types() ); + + if ( false === $type ) { + return; + } + + $class = $current_field->type != $type ? 'display: none;' : ''; + $current_latitude = bp_xprofile_get_meta( $current_field->id, 'field', $this->field_prefixe.'latitude', true ); + $current_longitude = bp_xprofile_get_meta( $current_field->id, 'field', $this->field_prefixe.'longitude', true ); + $current_zoom = bp_xprofile_get_meta( $current_field->id, 'field', $this->field_prefixe.'zoom', true ); + $height = bp_xprofile_get_meta( $current_field->id, 'field', $this->field_prefixe.'height', true ); + + + ?> +
+

+
+

+ + +

+

+ + +

+

+ + +

+

+ + +

+
+
+ lat) && !empty($valueStd->lng) && !empty($valueStd->name); + if (!$validated) { + bp_core_add_message('Incorrect address','error'); + bp_core_redirect( $redirect_url ); + } + } + + return $validated; + } + catch (\Exception $e) { + return false; + } + + } + + /** + * Modify the appearance of value. + * + * @param string $field_value Original value of field. + * @param int $field_id Id of field. + * + * @return string Value formatted + */ + public static function display_filter( $field_value, $field_id = 0 ) { + try { + if (empty( $field_value )) {return "";} + $value = json_decode(html_entity_decode($field_value)); + if ($value!=null) { + $latitude = $value->lat; + $longitude = $value->lng; + $city = $value->name; + return $city; + } + return ""; + } catch (\Exception $e) { + return "-- ERROR--"; + } + + } + + + /** + * Save settings from the field edit screen in the Dashboard. + * + * @param int $field_id ID of the field. + * @param array $settings Array of settings posted($_POST['field-settings'] ). + * @return bool True on success. + */ + public function admin_save_settings( $field_id, $settings ) { + + $saved_settings = array_filter($_POST,function($key) { return substr($key,0,strlen($this->field_prefixe))===$this->field_prefixe;}, ARRAY_FILTER_USE_KEY); + + foreach ( $saved_settings as $setting_key => $setting_value ) { + bp_xprofile_update_meta( $field_id, 'field', $setting_key, $setting_value ); + } + + return true; + } +}