New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@maplibre/maplibre-gl-geocoder

Package Overview
Dependencies
Maintainers
3
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@maplibre/maplibre-gl-geocoder - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

21

CHANGELOG.md
## master
## 1.1.1
### Features / Improvements 🚀
- Switch from `suggestions` library to `suggestions-list`, change enter key logic to support selecting list items with enter key [#14](https://github.com/maplibre/maplibre-gl-geocoder/pull/14)
- Added debounce option [#15](https://github.com/maplibre/maplibre-gl-geocoder/pull/10)
### Bug fixes 🐛
- Use the correct debounce parameter [#13](https://github.com/maplibre/maplibre-gl-geocoder/pull/13)
## 1.1.1
### Features / Improvements 🚀
- Add optional debounceSearch parameter to decide how long to wait before sending Geocoder input box query to server
### Bug fixes 🐛
- N/A
## 1.1.0

@@ -4,0 +25,0 @@

4

dist/maplibre-gl-geocoder.min.js

@@ -1,2 +0,2 @@

!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.MaplibreGeocoder=t()}}(function(){return function(){function t(e,i,n){function s(o,a){if(!i[o]){if(!e[o]){var l="function"==typeof require&&require;if(!a&&l)return l(o,!0);if(r)return r(o,!0);var h=new Error("Cannot find module '"+o+"'");throw h.code="MODULE_NOT_FOUND",h}var u=i[o]={exports:{}};e[o][0].call(u.exports,function(t){return s(e[o][1][t]||t)},u,u.exports,t,e,i,n)}return i[o].exports}for(var r="function"==typeof require&&require,o=0;o<n.length;o++)s(n[o]);return s}return t}()({1:[function(t,e,i){e.exports={fr:{name:"France",bbox:[[-4.59235,41.380007],[9.560016,51.148506]]},us:{name:"United States",bbox:[[-171.791111,18.91619],[-66.96466,71.357764]]},ru:{name:"Russia",bbox:[[19.66064,41.151416],[190.10042,81.2504]]},ca:{name:"Canada",bbox:[[-140.99778,41.675105],[-52.648099,83.23324]]}}},{}],2:[function(t,e,i){"use strict";function n(t,e){this._eventEmitter=new a,this.options=o({},this.options,e),this.inputString="",this.fresh=!0,this.lastSelected=null,this.geocoderApi=t}var s=t("suggestions"),r=t("lodash.debounce"),o=t("xtend"),a=t("events").EventEmitter,l=t("./exceptions"),h=t("./localization"),u=t("subtag");n.prototype={options:{zoom:16,flyTo:!0,trackProximity:!0,showResultsWhileTyping:!1,minLength:2,reverseGeocode:!1,limit:5,enableEventLogging:!0,marker:!0,popup:!1,maplibregl:null,collapsed:!1,clearAndBlurOnEsc:!1,clearOnBlur:!1,getItemValue:function(t){return t.place_name},render:function(t){var e=t.place_name.split(",");return'<div class="mapboxgl-ctrl-geocoder--suggestion maplibregl-ctrl-geocoder--suggestion"><div class="mapboxgl-ctrl-geocoder--suggestion-title maplibregl-ctrl-geocoder--suggestion-title">'+e[0]+'</div><div class="mapboxgl-ctrl-geocoder--suggestion-address maplibregl-ctrl-geocoder--suggestion-address">'+e.splice(1,e.length).join(",")+"</div></div>"},popupRender:function(t){var e=t.place_name.split(",");return'<div class="mapboxgl-ctrl-geocoder--suggestion maplibre-ctrl-geocoder--suggestion popup-suggestion"><div class="mapboxgl-ctrl-geocoder--suggestion-title maplibre-ctrl-geocoder--suggestion-title popup-suggestion-title">'+e[0]+'</div><div class="mapboxgl-ctrl-geocoder--suggestion-address maplibre-ctrl-geocoder--suggestion-address popup-suggestion-address">'+e.splice(1,e.length).join(",")+"</div></div>"},showResultMarkers:!1},addTo:function(t){function e(t,e){if(!document.body.contains(e))throw new Error("Element provided to #addTo() exists, but is not in the DOM");const i=t.onAdd();e.appendChild(i)}if(t._controlContainer)t.addControl(this);else if(t instanceof HTMLElement)e(this,t);else{if("string"!=typeof t)throw new Error("Error: addTo must be a maplibre-gl-js map, an html element, or a CSS selector query for a single html element");const i=document.querySelectorAll(t);if(0===i.length)throw new Error("Element ",t,"not found.");if(i.length>1)throw new Error("Geocoder can only be added to a single html element");e(this,i[0])}},onAdd:function(t){if(t&&"string"!=typeof t&&(this._map=t),this.setLanguage(),this.options.localGeocoderOnly&&!this.options.localGeocoder)throw new Error("A localGeocoder function must be specified to use localGeocoderOnly mode");this._onChange=this._onChange.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onPaste=this._onPaste.bind(this),this._onBlur=this._onBlur.bind(this),this._showButton=this._showButton.bind(this),this._hideButton=this._hideButton.bind(this),this._onQueryResult=this._onQueryResult.bind(this),this.clear=this.clear.bind(this),this._updateProximity=this._updateProximity.bind(this),this._collapse=this._collapse.bind(this),this._unCollapse=this._unCollapse.bind(this),this._clear=this._clear.bind(this),this._clearOnBlur=this._clearOnBlur.bind(this);var e=this.container=document.createElement("div");e.className="mapboxgl-ctrl-geocoder mapboxgl-ctrl maplibregl-ctrl-geocoder maplibregl-ctrl";var i=this.createIcon("search",'<path d="M7.4 2.5c-2.7 0-4.9 2.2-4.9 4.9s2.2 4.9 4.9 4.9c1 0 1.8-.2 2.5-.8l3.7 3.7c.2.2.4.3.8.3.7 0 1.1-.4 1.1-1.1 0-.3-.1-.5-.3-.8L11.4 10c.4-.8.8-1.6.8-2.5.1-2.8-2.1-5-4.8-5zm0 1.6c1.8 0 3.2 1.4 3.2 3.2s-1.4 3.2-3.2 3.2-3.3-1.3-3.3-3.1 1.4-3.3 3.3-3.3z"/>');this._inputEl=document.createElement("input"),this._inputEl.type="text",this._inputEl.className="mapboxgl-ctrl-geocoder--input maplibregl-ctrl-geocoder--input",this.setPlaceholder(),this.options.collapsed&&(this._collapse(),this.container.addEventListener("mouseenter",this._unCollapse),this.container.addEventListener("mouseleave",this._collapse),this._inputEl.addEventListener("focus",this._unCollapse)),(this.options.collapsed||this.options.clearOnBlur)&&this._inputEl.addEventListener("blur",this._onBlur),this._inputEl.addEventListener("keydown",r(this._onKeyDown,200)),this._inputEl.addEventListener("paste",this._onPaste),this._inputEl.addEventListener("change",this._onChange),this.container.addEventListener("mouseenter",this._showButton),this.container.addEventListener("mouseleave",this._hideButton);var n=document.createElement("div");n.classList.add("mapboxgl-ctrl-geocoder--pin-right","maplibregl-ctrl-geocoder--pin-right"),this._clearEl=document.createElement("button"),this._clearEl.setAttribute("aria-label","Clear"),this._clearEl.addEventListener("click",this.clear),this._clearEl.className="mapboxgl-ctrl-geocoder--button maplibregl-ctrl-geocoder--button";var o=this.createIcon("close",'<path d="M3.8 2.5c-.6 0-1.3.7-1.3 1.3 0 .3.2.7.5.8L7.2 9 3 13.2c-.3.3-.5.7-.5 1 0 .6.7 1.3 1.3 1.3.3 0 .7-.2 1-.5L9 10.8l4.2 4.2c.2.3.7.3 1 .3.6 0 1.3-.7 1.3-1.3 0-.3-.2-.7-.3-1l-4.4-4L15 4.6c.3-.2.5-.5.5-.8 0-.7-.7-1.3-1.3-1.3-.3 0-.7.2-1 .3L9 7.1 4.8 2.8c-.3-.1-.7-.3-1-.3z"/>');return this._clearEl.appendChild(o),this._loadingEl=this.createIcon("loading",'<path fill="#333" d="M4.4 4.4l.8.8c2.1-2.1 5.5-2.1 7.6 0l.8-.8c-2.5-2.5-6.7-2.5-9.2 0z"/><path opacity=".1" d="M12.8 12.9c-2.1 2.1-5.5 2.1-7.6 0-2.1-2.1-2.1-5.5 0-7.7l-.8-.8c-2.5 2.5-2.5 6.7 0 9.2s6.6 2.5 9.2 0 2.5-6.6 0-9.2l-.8.8c2.2 2.1 2.2 5.6 0 7.7z"/>'),n.appendChild(this._clearEl),n.appendChild(this._loadingEl),e.appendChild(i),e.appendChild(this._inputEl),e.appendChild(n),this._typeahead=new s(this._inputEl,[],{filter:!1,minLength:this.options.minLength,limit:this.options.limit}),this.setRenderFunction(this.options.render),this._typeahead.getItemValue=this.options.getItemValue,this.mapMarker=null,this.resultMarkers=[],this._handleMarker=this._handleMarker.bind(this),this._handleResultMarkers=this._handleResultMarkers.bind(this),this._map&&(this.options.trackProximity&&(this._updateProximity(),this._map.on("moveend",this._updateProximity)),this._maplibregl=this.options.maplibregl,!this._maplibregl&&this.options.marker&&(console.error("No maplibregl detected in options. Map markers are disabled. Please set options.maplibregl."),this.options.marker=!1)),e},createIcon:function(t,e){var i=document.createElementNS("http://www.w3.org/2000/svg","svg");if(i.setAttribute("class","mapboxgl-ctrl-geocoder--icon mapboxgl-ctrl-geocoder--icon-"+t+" maplibregl-ctrl-geocoder--icon maplibregl-ctrl-geocoder--icon-"+t),i.setAttribute("viewBox","0 0 18 18"),i.setAttribute("xml:space","preserve"),i.setAttribute("width",18),i.setAttribute("height",18),"innerHTML"in i)i.innerHTML=e;else{var n=document.createElement("div");n.innerHTML="<svg>"+e.valueOf().toString()+"</svg>";var s=n.firstChild,r=s.firstChild;i.appendChild(r)}return i},onRemove:function(){return this.container.parentNode.removeChild(this.container),this.options.trackProximity&&this._map&&this._map.off("moveend",this._updateProximity),this._removeMarker(),this._map=null,this},_onPaste:function(t){var e=(t.clipboardData||window.clipboardData).getData("text");e.length>=this.options.minLength&&this.options.showResultsWhileTyping&&this._geocode(e)},_onKeyDown:function(t){if(27===t.keyCode&&this.options.clearAndBlurOnEsc)return this._clear(t),this._inputEl.blur();var e=t.target&&t.target.shadowRoot?t.target.shadowRoot.activeElement:t.target;if(!(e?e.value:""))return this.fresh=!0,9!==t.keyCode&&this.clear(t),this._clearEl.style.display="none";if(!t.metaKey&&-1===[9,27,37,39,38,40].indexOf(t.keyCode)){if(13===t.keyCode){if(this.options.showResultsWhileTyping)return this.options.showResultMarkers&&this._fitBoundsForMarkers(),this._inputEl.value=this._typeahead.query,this.lastSelected=null,void(this._typeahead.selected=null);this._geocode(e.value)}e.value.length>=this.options.minLength&&this.options.showResultsWhileTyping&&this._geocode(e.value)}},_showButton:function(){this._typeahead.selected&&(this._clearEl.style.display="block")},_hideButton:function(){this._typeahead.selected&&(this._clearEl.style.display="none")},_onBlur:function(t){this.options.clearOnBlur&&this._clearOnBlur(t),this.options.collapsed&&this._collapse()},_onChange:function(){var t=this._typeahead.selected;if(t&&JSON.stringify(t)!==this.lastSelected){if(this._clearEl.style.display="none",this.options.flyTo){var e;if(this._removeResultMarkers(),t.properties&&l[t.properties.short_code])e=o({},this.options.flyTo),this._map&&this._map.fitBounds(l[t.properties.short_code].bbox,e);else if(t.bbox){var i=t.bbox;e=o({},this.options.flyTo),this._map&&this._map.fitBounds([[i[0],i[1]],[i[2],i[3]]],e)}else{var n={zoom:this.options.zoom};e=o({},n,this.options.flyTo),t.center?e.center=t.center:t.geometry&&t.geometry.type&&"Point"===t.geometry.type&&t.geometry.coordinates&&(e.center=t.geometry.coordinates),this._map&&this._map.flyTo(e)}}this.options.marker&&this._maplibregl&&this._handleMarker(t),this._inputEl.focus(),this._inputEl.scrollLeft=0,this._inputEl.setSelectionRange(0,0),this.lastSelected=JSON.stringify(t),this._eventEmitter.emit("result",{result:t})}},_geocode:function(t){this._loadingEl.style.display="block",this._eventEmitter.emit("loading",{query:t}),this.inputString=t;var e,i=["bbox","limit","proximity","countries","types","language","reverseMode"],n=this,s=null,r=i.reduce(function(t,e){return n.options[e]&&(["countries","types","language"].indexOf(e)>-1?t[e]=n.options[e].split(/[\s,]+/):t[e]=n.options[e],"proximity"===e&&n.options[e]&&"number"==typeof n.options[e].longitude&&"number"==typeof n.options[e].latitude&&(t[e]=[n.options[e].longitude,n.options[e].latitude])),t},{});if(this.options.localGeocoderOnly)e=Promise.resolve();else if(this.options.reverseGeocode&&/(-?\d+\.?\d*)[, ]+(-?\d+\.?\d*)[ ]*$/.test(t)){var a=t.split(/[\s(,)?]+/).map(function(t){return parseFloat(t,10)}).reverse();r.types&&r.types[0],r=o(r,{query:a,limit:1}),"proximity"in r&&delete r.proximity,e=this.geocoderApi.reverseGeocode(r)}else r=o(r,{query:t}),e=this.geocoderApi.forwardGeocode(r);var l=[];this.options.localGeocoder&&((l=this.options.localGeocoder(t))||(l=[]));var h=[];return e.catch(function(t){s=t}.bind(this)).then(function(e){this._loadingEl.style.display="none";var i={};return i=e||{type:"FeatureCollection",features:[]},i.config=r,this.fresh&&(this.fresh=!1),i.features=i.features?l.concat(i.features):l,this.options.externalGeocoder?(h=this.options.externalGeocoder(t,i.features,r)||[],h.then(function(t){return i.features=i.features?t.concat(i.features):t,i},function(){return i})):i}.bind(this)).then(function(t){if(s)throw s;this.options.filter&&t.features.length&&(t.features=t.features.filter(this.options.filter)),t.features.length?(this._clearEl.style.display="block",this._eventEmitter.emit("results",t),this._typeahead.update(t.features),!this.options.showResultsWhileTyping&&this.options.showResultMarkers&&this._fitBoundsForMarkers()):(this._clearEl.style.display="none",this._typeahead.selected=null,this._renderNoResults(),this._eventEmitter.emit("results",t))}.bind(this)).catch(function(t){this._loadingEl.style.display="none",l.length&&this.options.localGeocoder||h.length&&this.options.externalGeocoder?(this._clearEl.style.display="block",this._typeahead.update(l)):(this._clearEl.style.display="none",this._typeahead.selected=null,this._renderError()),this._eventEmitter.emit("results",{features:l}),this._eventEmitter.emit("error",{error:t})}.bind(this)),e},_clear:function(t){t&&t.preventDefault(),this._inputEl.value="",this._typeahead.selected=null,this._typeahead.clear(),this._onChange(),this._clearEl.style.display="none",this._removeMarker(),this._removeResultMarkers(),this.lastSelected=null,this._eventEmitter.emit("clear"),this.fresh=!0},clear:function(t){this._clear(t),this._inputEl.focus()},_clearOnBlur:function(t){var e=this;t.relatedTarget&&e._clear(t)},_onQueryResult:function(t){var e=t;if(e.features.length){var i=e.features[0];this._typeahead.selected=i,this._inputEl.value=i.place_name,this._onChange()}},_updateProximity:function(){if(this._map)if(this._map.getZoom()>9){var t=this._map.getCenter().wrap();this.setProximity({longitude:t.lng,latitude:t.lat})}else this.setProximity(null)},_collapse:function(){this._inputEl.value||this._inputEl===document.activeElement||this.container.classList.add("mapboxgl-ctrl-geocoder--collapsed","maplibregl-ctrl-geocoder--collapsed")},_unCollapse:function(){this.container.classList.remove("mapboxgl-ctrl-geocoder--collapsed","maplibregl-ctrl-geocoder--collapsed")},query:function(t){return this._geocode(t).then(this._onQueryResult),this},_renderError:function(){this._renderMessage("<div class='mapbox-gl-geocoder--error maplibre-gl-geocoder--error'>There was an error reaching the server</div>")},_renderNoResults:function(){this._renderMessage("<div class='mapbox-gl-geocoder--error mapbox-gl-geocoder--no-results maplibre-gl-geocoder--error maplibre-gl-geocoder--no-results'>No results found</div>")},_renderMessage:function(t){this._typeahead.update([]),this._typeahead.selected=null,this._typeahead.clear(),this._typeahead.renderError(t)},_getPlaceholderText:function(){if(this.options.placeholder)return this.options.placeholder;if(this.options.language){var t=this.options.language.split(",")[0],e=u.language(t),i=h.placeholder[e];if(i)return i}return"Search"},_fitBoundsForMarkers:function(){if(!(this._typeahead.data.length<1)){var t=this._typeahead.data.slice(0,this.options.limit);if(this._clearEl.style.display="none",this.options.flyTo&&this._maplibregl&&this._map){var e={padding:100},i=o({},e,this.options.flyTo),n=new this._maplibregl.LngLatBounds;t.forEach(function(t){n.extend(t.geometry.coordinates)}),this._map.fitBounds(n,i)}return t.length>0&&this._maplibregl&&this._handleResultMarkers(t),this}},setInput:function(t){return this._inputEl.value=t,this._typeahead.selected=null,this._typeahead.clear(),t.length>=this.options.minLength&&this.options.showResultsWhileTyping&&this._geocode(t),this},setProximity:function(t){return this.options.proximity=t,this},getProximity:function(){return this.options.proximity},setRenderFunction:function(t){return t&&"function"==typeof t&&(this._typeahead.render=t),this},getRenderFunction:function(){return this._typeahead.render},setLanguage:function(t){var e=navigator.language||navigator.userLanguage||navigator.browserLanguage;return this.options.language=t||this.options.language||e,this},getLanguage:function(){return this.options.language},getZoom:function(){return this.options.zoom},setZoom:function(t){return this.options.zoom=t,this},getFlyTo:function(){return this.options.flyTo},setFlyTo:function(t){return this.options.flyTo=t,this},getPlaceholder:function(){return this.options.placeholder},setPlaceholder:function(t){return this.placeholder=t||this._getPlaceholderText(),this._inputEl.placeholder=this.placeholder,this._inputEl.setAttribute("aria-label",this.placeholder),this},getBbox:function(){return this.options.bbox},setBbox:function(t){return this.options.bbox=t,this},getCountries:function(){return this.options.countries},setCountries:function(t){return this.options.countries=t,this},getTypes:function(){return this.options.types},setTypes:function(t){return this.options.types=t,this},getMinLength:function(){return this.options.minLength},setMinLength:function(t){return this.options.minLength=t,this._typeahead&&(this._typeahead.options.minLength=t),this},getLimit:function(){return this.options.limit},setLimit:function(t){return this.options.limit=t,this._typeahead&&(this._typeahead.options.limit=t),this},getFilter:function(){return this.options.filter},setFilter:function(t){return this.options.filter=t,this},setGeocoderApi:function(t){return this.geocoderApi=t,this},getGeocoderApi:function(){return this.geocoderApi},_handleMarker:function(t){if(this._map){this._removeMarker();var e={color:"#4668F2"},i=o({},e,this.options.marker);this.mapMarker=new this._maplibregl.Marker(i);var n;if(this.options.popup){var s={},r=o({},s,this.options.popup);n=new this._maplibregl.Popup(r).setHTML(this.options.popupRender(t))}return t.center?(this.mapMarker.setLngLat(t.center).addTo(this._map),this.options.popup&&this.mapMarker.setPopup(n)):t.geometry&&t.geometry.type&&"Point"===t.geometry.type&&t.geometry.coordinates&&(this.mapMarker.setLngLat(t.geometry.coordinates).addTo(this._map),this.options.popup&&this.mapMarker.setPopup(n)),this}},_removeMarker:function(){this.mapMarker&&(this.mapMarker.remove(),this.mapMarker=null)},_handleResultMarkers:function(t){if(this._map){this._removeResultMarkers();var e={color:"#4668F2"},i=o({},e,this.options.showResultMarkers);return t.forEach(function(t){if(this.options.showResultMarkers&&this.options.showResultMarkers.element){var e=this.options.showResultMarkers.element.cloneNode(!0);i=o(i,{element:e})}var n,s=new this._maplibregl.Marker(o({},i,{element:e}));if(this.options.popup){var r={},a=o({},r,this.options.popup);n=new this._maplibregl.Popup(a).setHTML(this.options.popupRender(t))}t.center?(s.setLngLat(t.center).addTo(this._map),this.options.popup&&s.setPopup(n)):t.geometry&&t.geometry.type&&"Point"===t.geometry.type&&t.geometry.coordinates&&(s.setLngLat(t.geometry.coordinates).addTo(this._map),this.options.popup&&s.setPopup(n)),this.resultMarkers.push(s)}.bind(this)),this}},_removeResultMarkers:function(){this.resultMarkers&&this.resultMarkers.length>0&&(this.resultMarkers.forEach(function(t){t.remove()}),this.resultMarkers=[])},on:function(t,e){return this._eventEmitter.on(t,e),this},off:function(t,e){return this._eventEmitter.removeListener(t,e),this}},e.exports=n},{"./exceptions":1,"./localization":3,events:4,"lodash.debounce":6,subtag:7,suggestions:8,xtend:11}],3:[function(t,e,i){"use strict";var n={de:"Suche",it:"Ricerca",en:"Search",nl:"Zoeken",fr:"Chercher",ca:"Cerca",he:"לחפש",ja:"サーチ",lv:"Meklēt",pt:"Procurar",sr:"Претрага",zh:"搜索",cs:"Vyhledávání",hu:"Keresés",ka:"ძიება",nb:"Søke",sk:"Vyhľadávanie",th:"ค้นหา",fi:"Hae",is:"Leita",ko:"수색",pl:"Szukaj",sl:"Iskanje",fa:"جستجو",ru:"Поиск"};e.exports={placeholder:n}},{}],4:[function(t,e,i){function n(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=E(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}function s(t){return void 0===t._maxListeners?n.defaultMaxListeners:t._maxListeners}function r(t,e,i){if(e)t.call(i);else for(var n=t.length,s=m(t,n),r=0;r<n;++r)s[r].call(i)}function o(t,e,i,n){if(e)t.call(i,n);else for(var s=t.length,r=m(t,s),o=0;o<s;++o)r[o].call(i,n)}function a(t,e,i,n,s){if(e)t.call(i,n,s);else for(var r=t.length,o=m(t,r),a=0;a<r;++a)o[a].call(i,n,s)}function l(t,e,i,n,s,r){if(e)t.call(i,n,s,r);else for(var o=t.length,a=m(t,o),l=0;l<o;++l)a[l].call(i,n,s,r)}function h(t,e,i,n){if(e)t.apply(i,n);else for(var s=t.length,r=m(t,s),o=0;o<s;++o)r[o].apply(i,n)}function u(t,e,i,n){var r,o,a;if("function"!=typeof i)throw new TypeError('"listener" argument must be a function');if(o=t._events,o?(o.newListener&&(t.emit("newListener",e,i.listener?i.listener:i),o=t._events),a=o[e]):(o=t._events=E(null),t._eventsCount=0),a){if("function"==typeof a?a=o[e]=n?[i,a]:[a,i]:n?a.unshift(i):a.push(i),!a.warned&&(r=s(t))&&r>0&&a.length>r){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+' "'+String(e)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=a.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",l.name,l.message)}}else a=o[e]=i,++t._eventsCount;return t}function c(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var t=new Array(arguments.length),e=0;e<t.length;++e)t[e]=arguments[e];this.listener.apply(this.target,t)}}function p(t,e,i){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:i},s=x.call(c,n);return s.listener=i,n.wrapFn=s,s}function d(t,e,i){var n=t._events;if(!n)return[];var s=n[e];return s?"function"==typeof s?i?[s.listener||s]:[s]:i?y(s):m(s,s.length):[]}function f(t){var e=this._events;if(e){var i=e[t];if("function"==typeof i)return 1;if(i)return i.length}return 0}function g(t,e){for(var i=e,n=i+1,s=t.length;n<s;i+=1,n+=1)t[i]=t[n];t.pop()}function m(t,e){for(var i=new Array(e),n=0;n<e;++n)i[n]=t[n];return i}function y(t){for(var e=new Array(t.length),i=0;i<e.length;++i)e[i]=t[i].listener||t[i];return e}function v(t){var e=function(){};return e.prototype=t,new e}function _(t){var e=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.push(i);return i}function b(t){var e=this;return function(){return e.apply(t,arguments)}}var E=Object.create||v,w=Object.keys||_,x=Function.prototype.bind||b;e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0;var L,k=10;try{var M={};Object.defineProperty&&Object.defineProperty(M,"x",{value:0}),L=0===M.x}catch(t){L=!1}L?Object.defineProperty(n,"defaultMaxListeners",{enumerable:!0,get:function(){return k},set:function(t){if("number"!=typeof t||t<0||t!==t)throw new TypeError('"defaultMaxListeners" must be a positive number');k=t}}):n.defaultMaxListeners=k,n.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||isNaN(t))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=t,this},n.prototype.getMaxListeners=function(){return s(this)},n.prototype.emit=function(t){var e,i,n,s,u,c,p="error"===t;if(c=this._events)p=p&&null==c.error;else if(!p)return!1;if(p){if(arguments.length>1&&(e=arguments[1]),e instanceof Error)throw e;var d=new Error('Unhandled "error" event. ('+e+")");throw d.context=e,d}if(!(i=c[t]))return!1;var f="function"==typeof i;switch(n=arguments.length){case 1:r(i,f,this);break;case 2:o(i,f,this,arguments[1]);break;case 3:a(i,f,this,arguments[1],arguments[2]);break;case 4:l(i,f,this,arguments[1],arguments[2],arguments[3]);break;default:for(s=new Array(n-1),u=1;u<n;u++)s[u-1]=arguments[u];h(i,f,this,s)}return!0},n.prototype.addListener=function(t,e){return u(this,t,e,!1)},n.prototype.on=n.prototype.addListener,n.prototype.prependListener=function(t,e){return u(this,t,e,!0)},n.prototype.once=function(t,e){if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');return this.on(t,p(this,t,e)),this},n.prototype.prependOnceListener=function(t,e){if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');return this.prependListener(t,p(this,t,e)),this},n.prototype.removeListener=function(t,e){var i,n,s,r,o;if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');if(!(n=this._events))return this;if(!(i=n[t]))return this;if(i===e||i.listener===e)0==--this._eventsCount?this._events=E(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,i.listener||e));else if("function"!=typeof i){for(s=-1,r=i.length-1;r>=0;r--)if(i[r]===e||i[r].listener===e){o=i[r].listener,s=r;break}if(s<0)return this;0===s?i.shift():g(i,s),1===i.length&&(n[t]=i[0]),n.removeListener&&this.emit("removeListener",t,o||e)}return this},n.prototype.removeAllListeners=function(t){var e,i,n;if(!(i=this._events))return this;if(!i.removeListener)return 0===arguments.length?(this._events=E(null),this._eventsCount=0):i[t]&&(0==--this._eventsCount?this._events=E(null):delete i[t]),this;if(0===arguments.length){var s,r=w(i);for(n=0;n<r.length;++n)"removeListener"!==(s=r[n])&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=E(null),this._eventsCount=0,this}if("function"==typeof(e=i[t]))this.removeListener(t,e);else if(e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},n.prototype.listeners=function(t){return d(this,t,!0)},n.prototype.rawListeners=function(t){return d(this,t,!1)},n.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):f.call(t,e)},n.prototype.listenerCount=f,n.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],5:[function(t,e,i){!function(){var t=this,n={};void 0!==i?e.exports=n:t.fuzzy=n,n.simpleFilter=function(t,e){return e.filter(function(e){return n.test(t,e)})},n.test=function(t,e){return null!==n.match(t,e)},n.match=function(t,e,i){i=i||{};var n,s=0,r=[],o=e.length,a=0,l=0,h=i.pre||"",u=i.post||"",c=i.caseSensitive&&e||e.toLowerCase();t=i.caseSensitive&&t||t.toLowerCase();for(var p=0;p<o;p++)n=e[p],c[p]===t[s]?(n=h+n+u,s+=1,l+=1+l):l=0,a+=l,r[r.length]=n;return s===t.length?(a=c===t?1/0:a,{rendered:r.join(""),score:a}):null},n.filter=function(t,e,i){return e&&0!==e.length?"string"!=typeof t?e:(i=i||{},e.reduce(function(e,s,r,o){var a=s;i.extract&&(a=i.extract(s));var l=n.match(t,a,i);return null!=l&&(e[e.length]={string:l.rendered,score:l.score,index:r,original:s}),e},[]).sort(function(t,e){var i=e.score-t.score;return i||t.index-e.index})):[]}}()},{}],6:[function(t,e,i){(function(t){function i(t,e,i){function s(e){var i=g,n=m;return g=m=void 0,L=e,v=t.apply(n,i)}function r(t){return L=t,_=setTimeout(u,e),k?s(t):v}function l(t){var i=t-x,n=t-L,s=e-i;return M?E(s,y-n):s}function h(t){var i=t-x,n=t-L;return void 0===x||i>=e||i<0||M&&n>=y}function u(){var t=w();if(h(t))return c(t);_=setTimeout(u,l(t))}function c(t){return _=void 0,C&&g?s(t):(g=m=void 0,v)}function p(){void 0!==_&&clearTimeout(_),L=0,g=x=m=_=void 0}function d(){return void 0===_?v:c(w())}function f(){var t=w(),i=h(t);if(g=arguments,m=this,x=t,i){if(void 0===_)return r(x);if(M)return _=setTimeout(u,e),s(x)}return void 0===_&&(_=setTimeout(u,e)),v}var g,m,y,v,_,x,L=0,k=!1,M=!1,C=!0;if("function"!=typeof t)throw new TypeError(a);return e=o(e)||0,n(i)&&(k=!!i.leading,M="maxWait"in i,y=M?b(o(i.maxWait)||0,e):y,C="trailing"in i?!!i.trailing:C),f.cancel=p,f.flush=d,f}function n(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function s(t){return!!t&&"object"==typeof t}function r(t){return"symbol"==typeof t||s(t)&&_.call(t)==h}function o(t){if("number"==typeof t)return t;if(r(t))return l;if(n(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=n(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(u,"");var i=p.test(t);return i||d.test(t)?f(t.slice(2),i?2:8):c.test(t)?l:+t}var a="Expected a function",l=NaN,h="[object Symbol]",u=/^\s+|\s+$/g,c=/^[-+]0x[0-9a-f]+$/i,p=/^0b[01]+$/i,d=/^0o[0-7]+$/i,f=parseInt,g="object"==typeof t&&t&&t.Object===Object&&t,m="object"==typeof self&&self&&self.Object===Object&&self,y=g||m||Function("return this")(),v=Object.prototype,_=v.toString,b=Math.max,E=Math.min,w=function(){return y.Date.now()};e.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],7:[function(t,e,i){!function(t,i,n){void 0!==e&&e.exports?e.exports=n():t.subtag=n()}(this,0,function(){function t(t){return t.match(o)||[]}function e(e){return t(e).filter(function(t,e){return t&&e})}function i(e){return e=t(e),{language:e[1]||r,extlang:e[2]||r,script:e[3]||r,region:e[4]||r}}function n(t,e,i){Object.defineProperty(t,e,{value:i,enumerable:!0})}function s(e,s,o){function a(i){return t(i)[e]||r}n(a,"pattern",s),n(i,o,a)}var r="",o=/^([a-zA-Z]{2,3})(?:[_-]+([a-zA-Z]{3})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{4})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{2}|[0-9]{3})(?=$|[_-]+))?/;return s(1,/^[a-zA-Z]{2,3}$/,"language"),s(2,/^[a-zA-Z]{3}$/,"extlang"),s(3,/^[a-zA-Z]{4}$/,"script"),s(4,/^[a-zA-Z]{2}$|^[0-9]{3}$/,"region"),n(i,"split",e),i})},{}],8:[function(t,e,i){"use strict";var n=t("./src/suggestions");window.Suggestions=e.exports=n},{"./src/suggestions":10}],9:[function(t,e,i){"Use strict";var n=function(t){return this.component=t,this.items=[],this.active=0,this.wrapper=document.createElement("div"),this.wrapper.className="suggestions-wrapper",this.element=document.createElement("ul"),this.element.className="suggestions",this.wrapper.appendChild(this.element),this.selectingListItem=!1,t.el.parentNode.insertBefore(this.wrapper,t.el.nextSibling),this};n.prototype.show=function(){this.element.style.display="block"},n.prototype.hide=function(){this.element.style.display="none"},n.prototype.add=function(t){this.items.push(t)},n.prototype.clear=function(){this.items=[],this.active=0},n.prototype.isEmpty=function(){return!this.items.length},n.prototype.isVisible=function(){return"block"===this.element.style.display},n.prototype.draw=function(){if(this.element.innerHTML="",0===this.items.length)return void this.hide();for(var t=0;t<this.items.length;t++)this.drawItem(this.items[t],this.active===t);this.show()},n.prototype.drawItem=function(t,e){var i=document.createElement("li"),n=document.createElement("a");e&&(i.className+=" active"),n.innerHTML=t.string,i.appendChild(n),this.element.appendChild(i),i.addEventListener("mousedown",function(){this.selectingListItem=!0}.bind(this)),i.addEventListener("mouseup",function(){this.handleMouseUp.call(this,t)}.bind(this))},n.prototype.handleMouseUp=function(t){this.selectingListItem=!1,this.component.value(t.original),this.clear(),this.draw()},n.prototype.move=function(t){this.active=t,this.draw()},n.prototype.previous=function(){this.move(0===this.active?this.items.length-1:this.active-1)},n.prototype.next=function(){this.move(this.active===this.items.length-1?0:this.active+1)},n.prototype.drawError=function(t){var e=document.createElement("li");e.innerHTML=t,this.element.appendChild(e),this.show()},e.exports=n},{}],10:[function(t,e,i){"use strict";var n=t("xtend"),s=t("fuzzy"),r=t("./list"),o=function(t,e,i){return i=i||{},this.options=n({minLength:2,limit:5,filter:!0},i),this.el=t,this.data=e||[],this.list=new r(this),this.query="",this.selected=null,this.list.draw(),this.el.addEventListener("keyup",function(t){this.handleKeyUp(t.keyCode)}.bind(this),!1),this.el.addEventListener("keydown",function(t){this.handleKeyDown(t)}.bind(this)),this.el.addEventListener("focus",function(){this.handleFocus()}.bind(this)),this.el.addEventListener("blur",function(){this.handleBlur()}.bind(this)),this.el.addEventListener("paste",function(t){this.handlePaste(t)}.bind(this)),this.render=this.options.render?this.options.render.bind(this):this.render.bind(this),this.getItemValue=this.options.getItemValue?this.options.getItemValue.bind(this):this.getItemValue.bind(this),this};o.prototype.handleKeyUp=function(t){40!==t&&38!==t&&27!==t&&13!==t&&9!==t&&this.handleInputChange(this.el.value)},o.prototype.handleKeyDown=function(t){switch(t.keyCode){case 13:case 9:this.list.isEmpty()||(this.list.isVisible()&&t.preventDefault(),this.value(this.list.items[this.list.active].original),this.list.hide());break;case 27:this.list.isEmpty()||this.list.hide();break;case 38:this.list.previous();break;case 40:this.list.next()}},o.prototype.handleBlur=function(){this.list.selectingListItem||this.list.hide()},o.prototype.handlePaste=function(t){if(t.clipboardData)this.handleInputChange(t.clipboardData.getData("Text"));else{var e=this;setTimeout(function(){e.handleInputChange(t.target.value)},100)}},
o.prototype.handleInputChange=function(t){if(this.query=this.normalize(t),this.list.clear(),this.query.length<this.options.minLength)return void this.list.draw();this.getCandidates(function(t){for(var e=0;e<t.length&&(this.list.add(t[e]),e!==this.options.limit-1);e++);this.list.draw()}.bind(this))},o.prototype.handleFocus=function(){this.list.isEmpty()||this.list.show(),this.list.selectingListItem=!1},o.prototype.update=function(t){this.data=t,this.handleKeyUp()},o.prototype.clear=function(){this.data=[],this.list.clear()},o.prototype.normalize=function(t){return t=t.toLowerCase()},o.prototype.match=function(t,e){return t.indexOf(e)>-1},o.prototype.value=function(t){if(this.selected=t,this.el.value=this.getItemValue(t),document.createEvent){var e=document.createEvent("HTMLEvents");e.initEvent("change",!0,!1),this.el.dispatchEvent(e)}else this.el.fireEvent("onchange")},o.prototype.getCandidates=function(t){var e,i={pre:"<strong>",post:"</strong>",extract:function(t){return this.getItemValue(t)}.bind(this)};this.options.filter?(e=s.filter(this.query,this.data,i),e=e.map(function(t){return{original:t.original,string:this.render(t.original,t.string)}}.bind(this))):e=this.data.map(function(t){return{original:t,string:this.render(t)}}.bind(this)),t(e)},o.prototype.getItemValue=function(t){return t},o.prototype.render=function(t,e){if(e)return e;for(var i=t.original?this.getItemValue(t.original):this.getItemValue(t),n=this.normalize(i),s=n.lastIndexOf(this.query);s>-1;){var r=s+this.query.length;i=i.slice(0,s)+"<strong>"+i.slice(s,r)+"</strong>"+i.slice(r),s=n.slice(0,s).lastIndexOf(this.query)}return i},o.prototype.renderError=function(t){this.list.drawError(t)},e.exports=o},{"./list":9,fuzzy:5,xtend:11}],11:[function(t,e,i){function n(){for(var t={},e=0;e<arguments.length;e++){var i=arguments[e];for(var n in i)s.call(i,n)&&(t[n]=i[n])}return t}e.exports=n;var s=Object.prototype.hasOwnProperty},{}]},{},[2])(2)});
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.MaplibreGeocoder=t()}}(function(){return function(){function t(e,i,n){function s(o,a){if(!i[o]){if(!e[o]){var l="function"==typeof require&&require;if(!a&&l)return l(o,!0);if(r)return r(o,!0);var h=new Error("Cannot find module '"+o+"'");throw h.code="MODULE_NOT_FOUND",h}var u=i[o]={exports:{}};e[o][0].call(u.exports,function(t){return s(e[o][1][t]||t)},u,u.exports,t,e,i,n)}return i[o].exports}for(var r="function"==typeof require&&require,o=0;o<n.length;o++)s(n[o]);return s}return t}()({1:[function(t,e,i){e.exports={fr:{name:"France",bbox:[[-4.59235,41.380007],[9.560016,51.148506]]},us:{name:"United States",bbox:[[-171.791111,18.91619],[-66.96466,71.357764]]},ru:{name:"Russia",bbox:[[19.66064,41.151416],[190.10042,81.2504]]},ca:{name:"Canada",bbox:[[-140.99778,41.675105],[-52.648099,83.23324]]}}},{}],2:[function(t,e,i){"use strict";function n(t,e){this._eventEmitter=new a,this.options=o({},this.options,e),this.inputString="",this.fresh=!0,this.lastSelected=null,this.geocoderApi=t}var s=t("suggestions-list"),r=t("lodash.debounce"),o=t("xtend"),a=t("events").EventEmitter,l=t("./exceptions"),h=t("./localization"),u=t("subtag");n.prototype={options:{zoom:16,flyTo:!0,trackProximity:!0,showResultsWhileTyping:!1,minLength:2,reverseGeocode:!1,limit:5,enableEventLogging:!0,marker:!0,popup:!1,maplibregl:null,collapsed:!1,clearAndBlurOnEsc:!1,clearOnBlur:!1,getItemValue:function(t){return t.place_name},render:function(t){var e=t.place_name.split(",");return'<div class="mapboxgl-ctrl-geocoder--suggestion maplibregl-ctrl-geocoder--suggestion"><div class="mapboxgl-ctrl-geocoder--suggestion-title maplibregl-ctrl-geocoder--suggestion-title">'+e[0]+'</div><div class="mapboxgl-ctrl-geocoder--suggestion-address maplibregl-ctrl-geocoder--suggestion-address">'+e.splice(1,e.length).join(",")+"</div></div>"},popupRender:function(t){var e=t.place_name.split(",");return'<div class="mapboxgl-ctrl-geocoder--suggestion maplibre-ctrl-geocoder--suggestion popup-suggestion"><div class="mapboxgl-ctrl-geocoder--suggestion-title maplibre-ctrl-geocoder--suggestion-title popup-suggestion-title">'+e[0]+'</div><div class="mapboxgl-ctrl-geocoder--suggestion-address maplibre-ctrl-geocoder--suggestion-address popup-suggestion-address">'+e.splice(1,e.length).join(",")+"</div></div>"},showResultMarkers:!0,debounceSearch:200},addTo:function(t){function e(t,e){if(!document.body.contains(e))throw new Error("Element provided to #addTo() exists, but is not in the DOM");const i=t.onAdd();e.appendChild(i)}if(t._controlContainer)t.addControl(this);else if(t instanceof HTMLElement)e(this,t);else{if("string"!=typeof t)throw new Error("Error: addTo must be a maplibre-gl-js map, an html element, or a CSS selector query for a single html element");const i=document.querySelectorAll(t);if(0===i.length)throw new Error("Element ",t,"not found.");if(i.length>1)throw new Error("Geocoder can only be added to a single html element");e(this,i[0])}},onAdd:function(t){if(t&&"string"!=typeof t&&(this._map=t),this.setLanguage(),this.options.localGeocoderOnly&&!this.options.localGeocoder)throw new Error("A localGeocoder function must be specified to use localGeocoderOnly mode");this._onChange=this._onChange.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onPaste=this._onPaste.bind(this),this._onBlur=this._onBlur.bind(this),this._showButton=this._showButton.bind(this),this._hideButton=this._hideButton.bind(this),this._onQueryResult=this._onQueryResult.bind(this),this.clear=this.clear.bind(this),this._updateProximity=this._updateProximity.bind(this),this._collapse=this._collapse.bind(this),this._unCollapse=this._unCollapse.bind(this),this._clear=this._clear.bind(this),this._clearOnBlur=this._clearOnBlur.bind(this);var e=this.container=document.createElement("div");e.className="mapboxgl-ctrl-geocoder mapboxgl-ctrl maplibregl-ctrl-geocoder maplibregl-ctrl";var i=this.createIcon("search",'<path d="M7.4 2.5c-2.7 0-4.9 2.2-4.9 4.9s2.2 4.9 4.9 4.9c1 0 1.8-.2 2.5-.8l3.7 3.7c.2.2.4.3.8.3.7 0 1.1-.4 1.1-1.1 0-.3-.1-.5-.3-.8L11.4 10c.4-.8.8-1.6.8-2.5.1-2.8-2.1-5-4.8-5zm0 1.6c1.8 0 3.2 1.4 3.2 3.2s-1.4 3.2-3.2 3.2-3.3-1.3-3.3-3.1 1.4-3.3 3.3-3.3z"/>');this._inputEl=document.createElement("input"),this._inputEl.type="text",this._inputEl.className="mapboxgl-ctrl-geocoder--input maplibregl-ctrl-geocoder--input",this.setPlaceholder(),this.options.collapsed&&(this._collapse(),this.container.addEventListener("mouseenter",this._unCollapse),this.container.addEventListener("mouseleave",this._collapse),this._inputEl.addEventListener("focus",this._unCollapse)),(this.options.collapsed||this.options.clearOnBlur)&&this._inputEl.addEventListener("blur",this._onBlur),this._inputEl.addEventListener("keydown",r(this._onKeyDown,this.options.debounceSearch)),this._inputEl.addEventListener("paste",this._onPaste),this._inputEl.addEventListener("change",this._onChange),this.container.addEventListener("mouseenter",this._showButton),this.container.addEventListener("mouseleave",this._hideButton);var n=document.createElement("div");n.classList.add("mapboxgl-ctrl-geocoder--pin-right","maplibregl-ctrl-geocoder--pin-right"),this._clearEl=document.createElement("button"),this._clearEl.setAttribute("aria-label","Clear"),this._clearEl.addEventListener("click",this.clear),this._clearEl.className="mapboxgl-ctrl-geocoder--button maplibregl-ctrl-geocoder--button";var o=this.createIcon("close",'<path d="M3.8 2.5c-.6 0-1.3.7-1.3 1.3 0 .3.2.7.5.8L7.2 9 3 13.2c-.3.3-.5.7-.5 1 0 .6.7 1.3 1.3 1.3.3 0 .7-.2 1-.5L9 10.8l4.2 4.2c.2.3.7.3 1 .3.6 0 1.3-.7 1.3-1.3 0-.3-.2-.7-.3-1l-4.4-4L15 4.6c.3-.2.5-.5.5-.8 0-.7-.7-1.3-1.3-1.3-.3 0-.7.2-1 .3L9 7.1 4.8 2.8c-.3-.1-.7-.3-1-.3z"/>');return this._clearEl.appendChild(o),this._loadingEl=this.createIcon("loading",'<path fill="#333" d="M4.4 4.4l.8.8c2.1-2.1 5.5-2.1 7.6 0l.8-.8c-2.5-2.5-6.7-2.5-9.2 0z"/><path opacity=".1" d="M12.8 12.9c-2.1 2.1-5.5 2.1-7.6 0-2.1-2.1-2.1-5.5 0-7.7l-.8-.8c-2.5 2.5-2.5 6.7 0 9.2s6.6 2.5 9.2 0 2.5-6.6 0-9.2l-.8.8c2.2 2.1 2.2 5.6 0 7.7z"/>'),n.appendChild(this._clearEl),n.appendChild(this._loadingEl),e.appendChild(i),e.appendChild(this._inputEl),e.appendChild(n),this._typeahead=new s(this._inputEl,[],{filter:!1,minLength:this.options.minLength,limit:this.options.limit,noInitialSelection:!0}),this.setRenderFunction(this.options.render),this._typeahead.getItemValue=this.options.getItemValue,this.mapMarker=null,this.resultMarkers=[],this._handleMarker=this._handleMarker.bind(this),this._handleResultMarkers=this._handleResultMarkers.bind(this),this._map&&(this.options.trackProximity&&(this._updateProximity(),this._map.on("moveend",this._updateProximity)),this._maplibregl=this.options.maplibregl,!this._maplibregl&&this.options.marker&&(console.error("No maplibregl detected in options. Map markers are disabled. Please set options.maplibregl."),this.options.marker=!1)),e},createIcon:function(t,e){var i=document.createElementNS("http://www.w3.org/2000/svg","svg");if(i.setAttribute("class","mapboxgl-ctrl-geocoder--icon mapboxgl-ctrl-geocoder--icon-"+t+" maplibregl-ctrl-geocoder--icon maplibregl-ctrl-geocoder--icon-"+t),i.setAttribute("viewBox","0 0 18 18"),i.setAttribute("xml:space","preserve"),i.setAttribute("width",18),i.setAttribute("height",18),"innerHTML"in i)i.innerHTML=e;else{var n=document.createElement("div");n.innerHTML="<svg>"+e.valueOf().toString()+"</svg>";var s=n.firstChild,r=s.firstChild;i.appendChild(r)}return i},onRemove:function(){return this.container.parentNode.removeChild(this.container),this.options.trackProximity&&this._map&&this._map.off("moveend",this._updateProximity),this._removeMarker(),this._map=null,this},_onPaste:function(t){var e=(t.clipboardData||window.clipboardData).getData("text");e.length>=this.options.minLength&&this.options.showResultsWhileTyping&&this._geocode(e)},_onKeyDown:function(t){if(27===t.keyCode&&this.options.clearAndBlurOnEsc)return this._clear(t),this._inputEl.blur();var e=t.target&&t.target.shadowRoot?t.target.shadowRoot.activeElement:t.target;if(!(e?e.value:""))return this.fresh=!0,9!==t.keyCode&&this.clear(t),this._clearEl.style.display="none";if(!t.metaKey&&-1===[9,27,37,39,38,40].indexOf(t.keyCode)){if(13===t.keyCode){if(this.options.showResultsWhileTyping)return this.options.showResultMarkers&&this._fitBoundsForMarkers(),this._inputEl.value=this._typeahead.query,this.lastSelected=null,void(this._typeahead.selected=null);this._typeahead.list.selectingListItem||this._geocode(e.value)}e.value.length>=this.options.minLength&&this.options.showResultsWhileTyping&&this._geocode(e.value)}},_showButton:function(){this._typeahead.selected&&(this._clearEl.style.display="block")},_hideButton:function(){this._typeahead.selected&&(this._clearEl.style.display="none")},_onBlur:function(t){this.options.clearOnBlur&&this._clearOnBlur(t),this.options.collapsed&&this._collapse()},_onChange:function(){var t=this._typeahead.selected;if(t&&JSON.stringify(t)!==this.lastSelected){if(this._clearEl.style.display="none",this.options.flyTo){var e;if(this._removeResultMarkers(),t.properties&&l[t.properties.short_code])e=o({},this.options.flyTo),this._map&&this._map.fitBounds(l[t.properties.short_code].bbox,e);else if(t.bbox){var i=t.bbox;e=o({},this.options.flyTo),this._map&&this._map.fitBounds([[i[0],i[1]],[i[2],i[3]]],e)}else{var n={zoom:this.options.zoom};e=o({},n,this.options.flyTo),t.center?e.center=t.center:t.geometry&&t.geometry.type&&"Point"===t.geometry.type&&t.geometry.coordinates&&(e.center=t.geometry.coordinates),this._map&&this._map.flyTo(e)}}this.options.marker&&this._maplibregl&&this._handleMarker(t),this._inputEl.focus(),this._inputEl.scrollLeft=0,this._inputEl.setSelectionRange(0,0),this.lastSelected=JSON.stringify(t),this._eventEmitter.emit("result",{result:t})}},_geocode:function(t){this._loadingEl.style.display="block",this._eventEmitter.emit("loading",{query:t}),this.inputString=t;var e,i=["bbox","limit","proximity","countries","types","language","reverseMode"],n=this,s=null,r=i.reduce(function(t,e){return n.options[e]&&(["countries","types","language"].indexOf(e)>-1?t[e]=n.options[e].split(/[\s,]+/):t[e]=n.options[e],"proximity"===e&&n.options[e]&&"number"==typeof n.options[e].longitude&&"number"==typeof n.options[e].latitude&&(t[e]=[n.options[e].longitude,n.options[e].latitude])),t},{});if(this.options.localGeocoderOnly)e=Promise.resolve();else if(this.options.reverseGeocode&&/(-?\d+\.?\d*)[, ]+(-?\d+\.?\d*)[ ]*$/.test(t)){var a=t.split(/[\s(,)?]+/).map(function(t){return parseFloat(t,10)}).reverse();r.types&&r.types[0],r=o(r,{query:a,limit:1}),"proximity"in r&&delete r.proximity,e=this.geocoderApi.reverseGeocode(r)}else r=o(r,{query:t}),e=this.geocoderApi.forwardGeocode(r);var l=[];this.options.localGeocoder&&((l=this.options.localGeocoder(t))||(l=[]));var h=[];return e.catch(function(t){s=t}.bind(this)).then(function(e){this._loadingEl.style.display="none";var i={};return i=e||{type:"FeatureCollection",features:[]},i.config=r,this.fresh&&(this.fresh=!1),i.features=i.features?l.concat(i.features):l,this.options.externalGeocoder?(h=this.options.externalGeocoder(t,i.features,r)||[],h.then(function(t){return i.features=i.features?t.concat(i.features):t,i},function(){return i})):i}.bind(this)).then(function(t){if(s)throw s;this.options.filter&&t.features.length&&(t.features=t.features.filter(this.options.filter)),t.features.length?(this._clearEl.style.display="block",this._eventEmitter.emit("results",t),this._typeahead.update(t.features),!this.options.showResultsWhileTyping&&this.options.showResultMarkers&&this._fitBoundsForMarkers()):(this._clearEl.style.display="none",this._typeahead.selected=null,this._renderNoResults(),this._eventEmitter.emit("results",t))}.bind(this)).catch(function(t){this._loadingEl.style.display="none",l.length&&this.options.localGeocoder||h.length&&this.options.externalGeocoder?(this._clearEl.style.display="block",this._typeahead.update(l)):(this._clearEl.style.display="none",this._typeahead.selected=null,this._renderError()),this._eventEmitter.emit("results",{features:l}),this._eventEmitter.emit("error",{error:t})}.bind(this)),e},_clear:function(t){t&&t.preventDefault(),this._inputEl.value="",this._typeahead.selected=null,this._typeahead.clear(),this._onChange(),this._clearEl.style.display="none",this._removeMarker(),this._removeResultMarkers(),this.lastSelected=null,this._eventEmitter.emit("clear"),this.fresh=!0},clear:function(t){this._clear(t),this._inputEl.focus()},_clearOnBlur:function(t){var e=this;t.relatedTarget&&e._clear(t)},_onQueryResult:function(t){var e=t;if(e.features.length){var i=e.features[0];this._typeahead.selected=i,this._inputEl.value=i.place_name,this._onChange()}},_updateProximity:function(){if(this._map)if(this._map.getZoom()>9){var t=this._map.getCenter().wrap();this.setProximity({longitude:t.lng,latitude:t.lat})}else this.setProximity(null)},_collapse:function(){this._inputEl.value||this._inputEl===document.activeElement||this.container.classList.add("mapboxgl-ctrl-geocoder--collapsed","maplibregl-ctrl-geocoder--collapsed")},_unCollapse:function(){this.container.classList.remove("mapboxgl-ctrl-geocoder--collapsed","maplibregl-ctrl-geocoder--collapsed")},query:function(t){return this._geocode(t).then(this._onQueryResult),this},_renderError:function(){this._renderMessage("<div class='mapbox-gl-geocoder--error maplibre-gl-geocoder--error'>There was an error reaching the server</div>")},_renderNoResults:function(){this._renderMessage("<div class='mapbox-gl-geocoder--error mapbox-gl-geocoder--no-results maplibre-gl-geocoder--error maplibre-gl-geocoder--no-results'>No results found</div>")},_renderMessage:function(t){this._typeahead.update([]),this._typeahead.selected=null,this._typeahead.clear(),this._typeahead.renderError(t)},_getPlaceholderText:function(){if(this.options.placeholder)return this.options.placeholder;if(this.options.language){var t=this.options.language.split(",")[0],e=u.language(t),i=h.placeholder[e];if(i)return i}return"Search"},_fitBoundsForMarkers:function(){if(!(this._typeahead.data.length<1)){var t=this._typeahead.data.slice(0,this.options.limit);if(this._clearEl.style.display="none",this.options.flyTo&&this._maplibregl&&this._map){var e={padding:100},i=o({},e,this.options.flyTo),n=new this._maplibregl.LngLatBounds;t.forEach(function(t){n.extend(t.geometry.coordinates)}),this._map.fitBounds(n,i)}return t.length>0&&this._maplibregl&&this._handleResultMarkers(t),this}},setInput:function(t){return this._inputEl.value=t,this._typeahead.selected=null,this._typeahead.clear(),t.length>=this.options.minLength&&this.options.showResultsWhileTyping&&this._geocode(t),this},setProximity:function(t){return this.options.proximity=t,this},getProximity:function(){return this.options.proximity},setRenderFunction:function(t){return t&&"function"==typeof t&&(this._typeahead.render=t),this},getRenderFunction:function(){return this._typeahead.render},setLanguage:function(t){var e=navigator.language||navigator.userLanguage||navigator.browserLanguage;return this.options.language=t||this.options.language||e,this},getLanguage:function(){return this.options.language},getZoom:function(){return this.options.zoom},setZoom:function(t){return this.options.zoom=t,this},getFlyTo:function(){return this.options.flyTo},setFlyTo:function(t){return this.options.flyTo=t,this},getPlaceholder:function(){return this.options.placeholder},setPlaceholder:function(t){return this.placeholder=t||this._getPlaceholderText(),this._inputEl.placeholder=this.placeholder,this._inputEl.setAttribute("aria-label",this.placeholder),this},getBbox:function(){return this.options.bbox},setBbox:function(t){return this.options.bbox=t,this},getCountries:function(){return this.options.countries},setCountries:function(t){return this.options.countries=t,this},getTypes:function(){return this.options.types},setTypes:function(t){return this.options.types=t,this},getMinLength:function(){return this.options.minLength},setMinLength:function(t){return this.options.minLength=t,this._typeahead&&(this._typeahead.options.minLength=t),this},getLimit:function(){return this.options.limit},setLimit:function(t){return this.options.limit=t,this._typeahead&&(this._typeahead.options.limit=t),this},getFilter:function(){return this.options.filter},setFilter:function(t){return this.options.filter=t,this},setGeocoderApi:function(t){return this.geocoderApi=t,this},getGeocoderApi:function(){return this.geocoderApi},_handleMarker:function(t){if(this._map){this._removeMarker();var e={color:"#4668F2"},i=o({},e,this.options.marker);this.mapMarker=new this._maplibregl.Marker(i);var n;if(this.options.popup){var s={},r=o({},s,this.options.popup);n=new this._maplibregl.Popup(r).setHTML(this.options.popupRender(t))}return t.center?(this.mapMarker.setLngLat(t.center).addTo(this._map),this.options.popup&&this.mapMarker.setPopup(n)):t.geometry&&t.geometry.type&&"Point"===t.geometry.type&&t.geometry.coordinates&&(this.mapMarker.setLngLat(t.geometry.coordinates).addTo(this._map),this.options.popup&&this.mapMarker.setPopup(n)),this}},_removeMarker:function(){this.mapMarker&&(this.mapMarker.remove(),this.mapMarker=null)},_handleResultMarkers:function(t){if(this._map){this._removeResultMarkers();var e={color:"#4668F2"},i=o({},e,this.options.showResultMarkers);return t.forEach(function(t){if(this.options.showResultMarkers&&this.options.showResultMarkers.element){var e=this.options.showResultMarkers.element.cloneNode(!0);i=o(i,{element:e})}var n,s=new this._maplibregl.Marker(o({},i,{element:e}));if(this.options.popup){var r={},a=o({},r,this.options.popup);n=new this._maplibregl.Popup(a).setHTML(this.options.popupRender(t))}t.center?(s.setLngLat(t.center).addTo(this._map),this.options.popup&&s.setPopup(n)):t.geometry&&t.geometry.type&&"Point"===t.geometry.type&&t.geometry.coordinates&&(s.setLngLat(t.geometry.coordinates).addTo(this._map),this.options.popup&&s.setPopup(n)),this.resultMarkers.push(s)}.bind(this)),this}},_removeResultMarkers:function(){this.resultMarkers&&this.resultMarkers.length>0&&(this.resultMarkers.forEach(function(t){t.remove()}),this.resultMarkers=[])},on:function(t,e){return this._eventEmitter.on(t,e),this},off:function(t,e){return this._eventEmitter.removeListener(t,e),this}},e.exports=n},{"./exceptions":1,"./localization":3,events:4,"lodash.debounce":6,subtag:7,"suggestions-list":8,xtend:11}],3:[function(t,e,i){"use strict";var n={de:"Suche",it:"Ricerca",en:"Search",nl:"Zoeken",fr:"Chercher",ca:"Cerca",he:"לחפש",ja:"サーチ",lv:"Meklēt",pt:"Procurar",sr:"Претрага",zh:"搜索",cs:"Vyhledávání",hu:"Keresés",ka:"ძიება",nb:"Søke",sk:"Vyhľadávanie",th:"ค้นหา",fi:"Hae",is:"Leita",ko:"수색",pl:"Szukaj",sl:"Iskanje",fa:"جستجو",ru:"Поиск"};e.exports={placeholder:n}},{}],4:[function(t,e,i){function n(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=w(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}function s(t){return void 0===t._maxListeners?n.defaultMaxListeners:t._maxListeners}function r(t,e,i){if(e)t.call(i);else for(var n=t.length,s=m(t,n),r=0;r<n;++r)s[r].call(i)}function o(t,e,i,n){if(e)t.call(i,n);else for(var s=t.length,r=m(t,s),o=0;o<s;++o)r[o].call(i,n)}function a(t,e,i,n,s){if(e)t.call(i,n,s);else for(var r=t.length,o=m(t,r),a=0;a<r;++a)o[a].call(i,n,s)}function l(t,e,i,n,s,r){if(e)t.call(i,n,s,r);else for(var o=t.length,a=m(t,o),l=0;l<o;++l)a[l].call(i,n,s,r)}function h(t,e,i,n){if(e)t.apply(i,n);else for(var s=t.length,r=m(t,s),o=0;o<s;++o)r[o].apply(i,n)}function u(t,e,i,n){var r,o,a;if("function"!=typeof i)throw new TypeError('"listener" argument must be a function');if(o=t._events,o?(o.newListener&&(t.emit("newListener",e,i.listener?i.listener:i),o=t._events),a=o[e]):(o=t._events=w(null),t._eventsCount=0),a){if("function"==typeof a?a=o[e]=n?[i,a]:[a,i]:n?a.unshift(i):a.push(i),!a.warned&&(r=s(t))&&r>0&&a.length>r){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+' "'+String(e)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=a.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",l.name,l.message)}}else a=o[e]=i,++t._eventsCount;return t}function c(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var t=new Array(arguments.length),e=0;e<t.length;++e)t[e]=arguments[e];this.listener.apply(this.target,t)}}function p(t,e,i){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:i},s=x.call(c,n);return s.listener=i,n.wrapFn=s,s}function d(t,e,i){var n=t._events;if(!n)return[];var s=n[e];return s?"function"==typeof s?i?[s.listener||s]:[s]:i?v(s):m(s,s.length):[]}function f(t){var e=this._events;if(e){var i=e[t];if("function"==typeof i)return 1;if(i)return i.length}return 0}function g(t,e){for(var i=e,n=i+1,s=t.length;n<s;i+=1,n+=1)t[i]=t[n];t.pop()}function m(t,e){for(var i=new Array(e),n=0;n<e;++n)i[n]=t[n];return i}function v(t){for(var e=new Array(t.length),i=0;i<e.length;++i)e[i]=t[i].listener||t[i];return e}function y(t){var e=function(){};return e.prototype=t,new e}function _(t){var e=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.push(i);return i}function b(t){var e=this;return function(){return e.apply(t,arguments)}}var w=Object.create||y,E=Object.keys||_,x=Function.prototype.bind||b;e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0;var L,k=10;try{var M={};Object.defineProperty&&Object.defineProperty(M,"x",{value:0}),L=0===M.x}catch(t){L=!1}L?Object.defineProperty(n,"defaultMaxListeners",{enumerable:!0,get:function(){return k},set:function(t){if("number"!=typeof t||t<0||t!==t)throw new TypeError('"defaultMaxListeners" must be a positive number');k=t}}):n.defaultMaxListeners=k,n.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||isNaN(t))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=t,this},n.prototype.getMaxListeners=function(){return s(this)},n.prototype.emit=function(t){var e,i,n,s,u,c,p="error"===t;if(c=this._events)p=p&&null==c.error;else if(!p)return!1;if(p){if(arguments.length>1&&(e=arguments[1]),e instanceof Error)throw e;var d=new Error('Unhandled "error" event. ('+e+")");throw d.context=e,d}if(!(i=c[t]))return!1;var f="function"==typeof i;switch(n=arguments.length){case 1:r(i,f,this);break;case 2:o(i,f,this,arguments[1]);break;case 3:a(i,f,this,arguments[1],arguments[2]);break;case 4:l(i,f,this,arguments[1],arguments[2],arguments[3]);break;default:for(s=new Array(n-1),u=1;u<n;u++)s[u-1]=arguments[u];h(i,f,this,s)}return!0},n.prototype.addListener=function(t,e){return u(this,t,e,!1)},n.prototype.on=n.prototype.addListener,n.prototype.prependListener=function(t,e){return u(this,t,e,!0)},n.prototype.once=function(t,e){if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');return this.on(t,p(this,t,e)),this},n.prototype.prependOnceListener=function(t,e){if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');return this.prependListener(t,p(this,t,e)),this},n.prototype.removeListener=function(t,e){var i,n,s,r,o;if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');if(!(n=this._events))return this;if(!(i=n[t]))return this;if(i===e||i.listener===e)0==--this._eventsCount?this._events=w(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,i.listener||e));else if("function"!=typeof i){for(s=-1,r=i.length-1;r>=0;r--)if(i[r]===e||i[r].listener===e){o=i[r].listener,s=r;break}if(s<0)return this;0===s?i.shift():g(i,s),1===i.length&&(n[t]=i[0]),n.removeListener&&this.emit("removeListener",t,o||e)}return this},n.prototype.removeAllListeners=function(t){var e,i,n;if(!(i=this._events))return this;if(!i.removeListener)return 0===arguments.length?(this._events=w(null),this._eventsCount=0):i[t]&&(0==--this._eventsCount?this._events=w(null):delete i[t]),this;if(0===arguments.length){var s,r=E(i);for(n=0;n<r.length;++n)"removeListener"!==(s=r[n])&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=w(null),this._eventsCount=0,this}if("function"==typeof(e=i[t]))this.removeListener(t,e);else if(e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},n.prototype.listeners=function(t){return d(this,t,!0)},n.prototype.rawListeners=function(t){return d(this,t,!1)},n.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):f.call(t,e)},n.prototype.listenerCount=f,n.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],5:[function(t,e,i){!function(){var t=this,n={};void 0!==i?e.exports=n:t.fuzzy=n,n.simpleFilter=function(t,e){return e.filter(function(e){return n.test(t,e)})},n.test=function(t,e){return null!==n.match(t,e)},n.match=function(t,e,i){i=i||{};var n,s=0,r=[],o=e.length,a=0,l=0,h=i.pre||"",u=i.post||"",c=i.caseSensitive&&e||e.toLowerCase();t=i.caseSensitive&&t||t.toLowerCase();for(var p=0;p<o;p++)n=e[p],c[p]===t[s]?(n=h+n+u,s+=1,l+=1+l):l=0,a+=l,r[r.length]=n;return s===t.length?(a=c===t?1/0:a,{rendered:r.join(""),score:a}):null},n.filter=function(t,e,i){return e&&0!==e.length?"string"!=typeof t?e:(i=i||{},e.reduce(function(e,s,r,o){var a=s;i.extract&&(a=i.extract(s));var l=n.match(t,a,i);return null!=l&&(e[e.length]={string:l.rendered,score:l.score,index:r,original:s}),e},[]).sort(function(t,e){var i=e.score-t.score;return i||t.index-e.index})):[]}}()},{}],6:[function(t,e,i){(function(t){function i(t,e,i){function s(e){var i=g,n=m;return g=m=void 0,L=e,y=t.apply(n,i)}function r(t){return L=t,_=setTimeout(u,e),k?s(t):y}function l(t){var i=t-x,n=t-L,s=e-i;return M?w(s,v-n):s}function h(t){var i=t-x,n=t-L;return void 0===x||i>=e||i<0||M&&n>=v}function u(){var t=E();if(h(t))return c(t);_=setTimeout(u,l(t))}function c(t){return _=void 0,C&&g?s(t):(g=m=void 0,y)}function p(){void 0!==_&&clearTimeout(_),L=0,g=x=m=_=void 0}function d(){return void 0===_?y:c(E())}function f(){var t=E(),i=h(t);if(g=arguments,m=this,x=t,i){if(void 0===_)return r(x);if(M)return _=setTimeout(u,e),s(x)}return void 0===_&&(_=setTimeout(u,e)),y}var g,m,v,y,_,x,L=0,k=!1,M=!1,C=!0;if("function"!=typeof t)throw new TypeError(a);return e=o(e)||0,n(i)&&(k=!!i.leading,M="maxWait"in i,v=M?b(o(i.maxWait)||0,e):v,C="trailing"in i?!!i.trailing:C),f.cancel=p,f.flush=d,f}function n(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function s(t){return!!t&&"object"==typeof t}function r(t){return"symbol"==typeof t||s(t)&&_.call(t)==h}function o(t){if("number"==typeof t)return t;if(r(t))return l;if(n(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=n(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(u,"");var i=p.test(t);return i||d.test(t)?f(t.slice(2),i?2:8):c.test(t)?l:+t}var a="Expected a function",l=NaN,h="[object Symbol]",u=/^\s+|\s+$/g,c=/^[-+]0x[0-9a-f]+$/i,p=/^0b[01]+$/i,d=/^0o[0-7]+$/i,f=parseInt,g="object"==typeof t&&t&&t.Object===Object&&t,m="object"==typeof self&&self&&self.Object===Object&&self,v=g||m||Function("return this")(),y=Object.prototype,_=y.toString,b=Math.max,w=Math.min,E=function(){return v.Date.now()};e.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],7:[function(t,e,i){!function(t,i,n){void 0!==e&&e.exports?e.exports=n():t.subtag=n()}(this,0,function(){function t(t){return t.match(o)||[]}function e(e){return t(e).filter(function(t,e){return t&&e})}function i(e){return e=t(e),{language:e[1]||r,extlang:e[2]||r,script:e[3]||r,region:e[4]||r}}function n(t,e,i){Object.defineProperty(t,e,{value:i,enumerable:!0})}function s(e,s,o){function a(i){return t(i)[e]||r}n(a,"pattern",s),n(i,o,a)}var r="",o=/^([a-zA-Z]{2,3})(?:[_-]+([a-zA-Z]{3})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{4})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{2}|[0-9]{3})(?=$|[_-]+))?/;return s(1,/^[a-zA-Z]{2,3}$/,"language"),s(2,/^[a-zA-Z]{3}$/,"extlang"),s(3,/^[a-zA-Z]{4}$/,"script"),s(4,/^[a-zA-Z]{2}$|^[0-9]{3}$/,"region"),n(i,"split",e),i})},{}],8:[function(t,e,i){"use strict";var n=t("./src/suggestions");e.exports=n,"undefined"!=typeof window&&(window.Suggestions=n)},{"./src/suggestions":10}],9:[function(t,e,i){"use strict";var n=function(t){return this.component=t,this.items=[],this.active=t.options.noInitialSelection?-1:0,this.wrapper=document.createElement("div"),this.wrapper.className="suggestions-wrapper",this.element=document.createElement("ul"),this.element.className="suggestions",this.wrapper.appendChild(this.element),this.selectingListItem=!1,t.el.parentNode.insertBefore(this.wrapper,t.el.nextSibling),this};n.prototype.show=function(){this.element.style.display="block"},n.prototype.hide=function(){this.element.style.display="none"},n.prototype.add=function(t){this.items.push(t)},n.prototype.clear=function(){this.items=[],this.active=this.component.options.noInitialSelection?-1:0},n.prototype.isEmpty=function(){return!this.items.length},n.prototype.isVisible=function(){return"block"===this.element.style.display},n.prototype.draw=function(){if(this.element.innerHTML="",0===this.items.length)return void this.hide();for(var t=0;t<this.items.length;t++)this.drawItem(this.items[t],this.active===t);this.show()},n.prototype.drawItem=function(t,e){var i=document.createElement("li"),n=document.createElement("a");e&&(i.className+=" active"),n.innerHTML=t.string,i.appendChild(n),this.element.appendChild(i),i.addEventListener("mousedown",function(){this.selectingListItem=!0}.bind(this)),i.addEventListener("mouseup",function(){this.handleMouseUp.call(this,t)}.bind(this))},n.prototype.handleMouseUp=function(t){this.selectingListItem=!1,this.component.value(t.original),this.clear(),this.draw()},n.prototype.move=function(t){this.active=t,this.draw()},n.prototype.previous=function(){this.move(this.active<=0?this.items.length-1:this.active-1)},n.prototype.next=function(){this.move(this.active>=this.items.length-1?0:this.active+1)},n.prototype.drawError=function(t){var e=document.createElement("li");e.innerHTML=t,this.element.appendChild(e),this.show()},e.exports=n},{}],10:[function(t,e,i){"use strict";var n=t("xtend"),s=t("fuzzy"),r=t("./list"),o=function(t,e,i){return i=i||{},this.options=n({minLength:2,limit:5,filter:!0,hideOnBlur:!0,noInitialSelection:!0},i),this.el=t,this.data=e||[],this.list=new r(this),this.query="",this.selected=null,this.list.draw(),this.el.addEventListener("keyup",function(t){this.handleKeyUp(t.keyCode,t)}.bind(this),!1),this.el.addEventListener("keydown",function(t){this.handleKeyDown(t)}.bind(this)),this.el.addEventListener("focus",function(){this.handleFocus()}.bind(this)),this.el.addEventListener("blur",function(){this.handleBlur()}.bind(this)),this.el.addEventListener("paste",function(t){this.handlePaste(t)}.bind(this)),this.render=this.options.render?this.options.render.bind(this):this.render.bind(this),this.getItemValue=this.options.getItemValue?this.options.getItemValue.bind(this):this.getItemValue.bind(this),this};o.prototype.handleKeyUp=function(t,e){if(40!==t&&38!==t&&27!==t&&9!==t)return 13===t?void(this.list.items[this.list.active]&&(this.list.handleMouseUp(this.list.items[this.list.active]),e.stopPropagation())):void this.handleInputChange(this.el.value)},o.prototype.handleKeyDown=function(t){switch(t.keyCode){case 13:this.list.active>=0&&(this.list.selectingListItem=!0);break;case 9:this.list.isEmpty()||(this.list.isVisible()&&t.preventDefault(),
this.value(this.list.active>=0?this.list.items[this.list.active].original:null),this.list.hide());break;case 27:this.list.isEmpty()||this.list.hide();break;case 38:this.list.previous();break;case 40:this.list.next()}},o.prototype.handleBlur=function(){!this.list.selectingListItem&&this.options.hideOnBlur&&this.list.hide()},o.prototype.handlePaste=function(t){if(t.clipboardData)this.handleInputChange(t.clipboardData.getData("Text"));else{var e=this;setTimeout(function(){e.handleInputChange(t.target.value)},100)}},o.prototype.handleInputChange=function(t){if(this.query=this.normalize(t),this.list.clear(),this.query.length<this.options.minLength)return void this.list.draw();this.getCandidates(function(t){for(var e=0;e<t.length&&(this.list.add(t[e]),e!==this.options.limit-1);e++);this.list.draw()}.bind(this))},o.prototype.handleFocus=function(){this.list.isEmpty()||this.list.show(),this.list.selectingListItem=!1},o.prototype.update=function(t){this.data=t,this.handleKeyUp()},o.prototype.clear=function(){this.data=[],this.list.clear()},o.prototype.normalize=function(t){return t=t.toLowerCase()},o.prototype.match=function(t,e){return t.indexOf(e)>-1},o.prototype.value=function(t){if(this.selected=t,this.el.value=this.getItemValue(t||{place_name:this.query}),document.createEvent){var e=document.createEvent("HTMLEvents");e.initEvent("change",!0,!1),this.el.dispatchEvent(e)}else this.el.fireEvent("onchange")},o.prototype.getCandidates=function(t){var e,i={pre:"<strong>",post:"</strong>",extract:function(t){return this.getItemValue(t)}.bind(this)};this.options.filter?(e=s.filter(this.query,this.data,i),e=e.map(function(t){return{original:t.original,string:this.render(t.original,t.string)}}.bind(this))):e=this.data.map(function(t){return{original:t,string:this.render(t)}}.bind(this)),t(e)},o.prototype.getItemValue=function(t){return t},o.prototype.render=function(t,e){if(e)return e;for(var i=t.original?this.getItemValue(t.original):this.getItemValue(t),n=this.normalize(i),s=n.lastIndexOf(this.query);s>-1;){var r=s+this.query.length;i=i.slice(0,s)+"<strong>"+i.slice(s,r)+"</strong>"+i.slice(r),s=n.slice(0,s).lastIndexOf(this.query)}return i},o.prototype.renderError=function(t){this.list.drawError(t)},e.exports=o},{"./list":9,fuzzy:5,xtend:11}],11:[function(t,e,i){function n(){for(var t={},e=0;e<arguments.length;e++){var i=arguments[e];for(var n in i)s.call(i,n)&&(t[n]=i[n])}return t}e.exports=n;var s=Object.prototype.hasOwnProperty},{}]},{},[2])(2)});
"use strict";
var Typeahead = require("suggestions");
var Typeahead = require("suggestions-list");
var debounce = require("lodash.debounce");

@@ -54,2 +54,3 @@ var extend = require("xtend");

* @param {Boolean} [options.showResultsWhileTyping=false] If `false`, indicates that search will only occur on enter key press. If `true`, indicates that the Geocoder will search on the input box being updated above the minLength option.
* @param {Number} [options.debounceSearch=200] Sets the amount of time, in milliseconds, to wait before querying the server when a user types into the Geocoder input box. This parameter may be useful for reducing the total number of API calls made for a single query.
* @example

@@ -115,3 +116,4 @@ *

},
showResultMarkers: false,
showResultMarkers: true,
debounceSearch: 200,
},

@@ -234,3 +236,4 @@

this._inputEl.addEventListener("keydown", debounce(this._onKeyDown, 200));
this._inputEl.addEventListener("keydown", debounce(this._onKeyDown, this.options.debounceSearch));
this._inputEl.addEventListener("paste", this._onPaste);

@@ -275,2 +278,3 @@ this._inputEl.addEventListener("change", this._onChange);

limit: this.options.limit,
noInitialSelection: true,
});

@@ -386,3 +390,4 @@

if (!this.options.showResultsWhileTyping) {
this._geocode(target.value);
if (!this._typeahead.list.selectingListItem)
this._geocode(target.value);
} else {

@@ -389,0 +394,0 @@ if (this.options.showResultMarkers) {

{
"name": "@maplibre/maplibre-gl-geocoder",
"version": "1.1.0",
"version": "1.2.0",
"description": "A geocoder control for Maplibre GL JS",

@@ -66,3 +66,3 @@ "main": "lib/index.js",

"subtag": "^0.5.0",
"suggestions": "^1.6.0",
"suggestions-list": "^0.0.2",
"xtend": "^4.0.1"

@@ -69,0 +69,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc