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.4.1 to 1.4.2

2

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,l){if(!i[o]){if(!e[o]){var a="function"==typeof require&&require;if(!l&&a)return a(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 l,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"),l=t("events").EventEmitter,a=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"string"==typeof t?t:t.place_name},render:function(t){if("string"==typeof t){var e=t.split(","),i=e[0].toLowerCase().indexOf(this.query.toLowerCase()),n=this.query.length;return'<div class="mapboxgl-ctrl-geocoder--suggestion maplibregl-ctrl-geocoder--suggestion"><svg class="mapboxgl-ctrl-geocoder--suggestion-icon maplibre-ctrl-geocoder--suggestion-icon" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><path d="M22.8702 20.1258H21.4248L20.9125 19.6318C22.7055 17.546 23.785 14.8382 23.785 11.8925C23.785 5.32419 18.4608 0 11.8925 0C5.32419 0 0 5.32419 0 11.8925C0 18.4608 5.32419 23.785 11.8925 23.785C14.8382 23.785 17.546 22.7055 19.6318 20.9125L20.1258 21.4248V22.8702L29.2739 32L32 29.2739L22.8702 20.1258ZM11.8925 20.1258C7.33676 20.1258 3.65923 16.4483 3.65923 11.8925C3.65923 7.33676 7.33676 3.65923 11.8925 3.65923C16.4483 3.65923 20.1258 7.33676 20.1258 11.8925C20.1258 16.4483 16.4483 20.1258 11.8925 20.1258Z" fill="#687078"/></svg><div class="mapboxgl-ctrl-geocoder--suggestion-info maplibregl-ctrl-geocoder--suggestion-info"><div class="mapboxgl-ctrl-geocoder--suggestion-title maplibregl-ctrl-geocoder--suggestion-title">'+e[0].substring(0,i)+'<span class="mapboxgl-ctrl-geocoder--suggestion-match maplibregl-ctrl-geocoder--suggestion-match">'+e[0].substring(i,i+n)+"</span>"+e[0].substring(i+n)+'</div><div class="mapboxgl-ctrl-geocoder--suggestion-address maplibregl-ctrl-geocoder--suggestion-address">'+e.splice(1,e.length).join(",")+"</div></div></div>"}var s=t.place_name.split(",");return'<div class="mapboxgl-ctrl-geocoder--result maplibregl-ctrl-geocoder--result"><svg class="mapboxgl-ctrl-geocoder--result-icon maplibre-ctrl-geocoder--result-icon" viewBox="0 0 24 32" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 0C5.36571 0 0 5.38676 0 12.0471C0 21.0824 12 32 12 32C12 32 24 21.0824 24 12.0471C24 5.38676 18.6343 0 12 0ZM12 16.3496C9.63428 16.3496 7.71429 14.4221 7.71429 12.0471C7.71429 9.67207 9.63428 7.74454 12 7.74454C14.3657 7.74454 16.2857 9.67207 16.2857 12.0471C16.2857 14.4221 14.3657 16.3496 12 16.3496Z" fill="#687078"/></svg><div><div class="mapboxgl-ctrl-geocoder--result-title maplibregl-ctrl-geocoder--result-title">'+s[0]+'</div><div class="mapboxgl-ctrl-geocoder--result-address maplibregl-ctrl-geocoder--result-address">'+s.splice(1,s.length).join(",")+"</div></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>"},processResults:function(t,e,i){if(!e||0===e.length)return t;var n=t.map(function(t){return t.place_name}),s=e.filter(function(t){return!n.includes(t)});if(s.length+t.length>i){for(var r=Math.min(s.length,Math.floor(i/2));t.length+r<i;)r++;for(var o=[],l=0;l<r;l++)o.push(s[l]);for(var a=0;a<i-r;a++)o.push(t[a]);return o}return s.length>0?s.concat(t):t},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");var 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");var 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 void(null==this._typeahead.selected&&this.geocoderApi.getSuggestions?this._geocode(e.value,!0):null==this._typeahead.selected&&this.options.showResultMarkers&&this._fitBoundsForMarkers());this._typeahead.selected||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&&"string"==typeof t)this._geocode(t,!0);else if(t&&JSON.stringify(t)!==this.lastSelected){if(this._clearEl.style.display="none",this.options.flyTo){var e;if(this._removeResultMarkers(),t.properties&&a[t.properties.short_code])e=o({},this.options.flyTo),this._map&&this._map.fitBounds(a[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._typeahead.selected=null,this._eventEmitter.emit("result",{result:t})}},_getConfigForRequest:function(){var t=["bbox","limit","proximity","countries","types","language","reverseMode"],e=this;return t.reduce(function(t,i){return e.options[i]&&(["countries","types","language"].indexOf(i)>-1?t[i]=e.options[i].split(/[\s,]+/):t[i]=e.options[i],"proximity"===i&&e.options[i]&&"number"==typeof e.options[i].longitude&&"number"==typeof e.options[i].latitude&&(t[i]=[e.options[i].longitude,e.options[i].latitude])),t},{})},_geocode:function(t,e){this._loadingEl.style.display="block",this._eventEmitter.emit("loading",{query:t}),this.inputString=t;var i,n=null,s=this._getConfigForRequest();if(this.options.localGeocoderOnly)i=Promise.resolve();else if(this.options.reverseGeocode&&/(-?\d+\.?\d*)[, ]+(-?\d+\.?\d*)[ ]*$/.test(t)){var r=t.split(/[\s(,)?]+/).map(function(t){return parseFloat(t,10)}).reverse();s.types&&s.types[0],s=o(s,{query:r,limit:1}),"proximity"in s&&delete s.proximity,i=this.geocoderApi.reverseGeocode(s)}else s=o(s,{query:t}),i=this.geocoderApi.forwardGeocode(s);var l=[];this.options.localGeocoder&&((l=this.options.localGeocoder(t))||(l=[]));var a=[],h=[];return i.catch(function(t){n=t}.bind(this)).then(function(i){this._loadingEl.style.display="none";var n={};return n=i||{type:"FeatureCollection",features:[]},n.config=s,this.fresh&&(this.fresh=!1),n.features=n.features?l.concat(n.features):l,this.options.externalGeocoder?(a=this.options.externalGeocoder(t,n.features,s)||[],a.then(function(t){return n.features=n.features?t.concat(n.features):t,n},function(){return n})):this.geocoderApi.getSuggestions&&!e?(h=this._getSuggestions(t)||[],h.then(function(t){return t.length>0&&(n.suggestions=t),n},function(){return n})):n}.bind(this)).then(function(t){if(n)throw n;if(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);var i=this.options.processResults(t.features,t.suggestions,this.options.limit);this._eventEmitter.emit("processedResults",i),this._typeahead.update(i),this.options.showResultsWhileTyping&&!e||!this.options.showResultMarkers||this._fitBoundsForMarkers()}else 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||a.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)),i},_getSuggestions:function(t){return new Promise(function(e,i){this.geocoderApi.getSuggestions||i(),this._eventEmitter.emit("loadingSuggestions",{query:t});var n=null,s=[],r=this._getConfigForRequest();r=o(r,{query:t});var l;l=this.geocoderApi.getSuggestions(r),l.catch(function(t){n=t}.bind(this)).then(function(t){if(n)throw n;t.suggestions.length&&(s=t.suggestions),e(s),this._eventEmitter.emit("resultsSuggestions",t)}.bind(this)).catch(function(t){this._eventEmitter.emit("error",{error:t})}.bind(this))}.bind(this))},_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.filter(function(t){return"string"!=typeof t}).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={},l=o({},r,this.options.popup);n=new this._maplibregl.Popup(l).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 l(t,e,i,n,s){if(e)t.call(i,n,s);else for(var r=t.length,o=m(t,r),l=0;l<r;++l)o[l].call(i,n,s)}function a(t,e,i,n,s,r){if(e)t.call(i,n,s,r);else for(var o=t.length,l=m(t,o),a=0;a<o;++a)l[a].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,l;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),l=o[e]):(o=t._events=w(null),t._eventsCount=0),l){if("function"==typeof l?l=o[e]=n?[i,l]:[l,i]:n?l.unshift(i):l.push(i),!l.warned&&(r=s(t))&&r>0&&l.length>r){l.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+l.length+' "'+String(e)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=l.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",a.name,a.message)}}else l=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 C={};Object.defineProperty&&Object.defineProperty(C,"x",{value:0}),L=0===C.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:l(i,f,this,arguments[1],arguments[2]);break;case 4:a(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,l=0,a=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,a+=1+a):a=0,l+=a,r[r.length]=n;return s===t.length?(l=c===t?1/0:l,{rendered:r.join(""),score:l}):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 l=s;i.extract&&(l=i.extract(s));var a=n.match(t,l,i);return null!=a&&(e[e.length]={string:a.rendered,score:a.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(){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 a(t){var i=t-x,n=t-L,s=e-i;return C?w(s,v-n):s}function h(t){var i=t-x,n=t-L;return void 0===x||i>=e||i<0||C&&n>=v}function u(){var t=E();if(h(t))return c(t);_=setTimeout(u,a(t))}function c(t){return _=void 0,M&&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(C)return _=setTimeout(u,e),s(x)}return void 0===_&&(_=setTimeout(u,e)),y}var g,m,v,y,_,x,L=0,k=!1,C=!1,M=!0;if("function"!=typeof t)throw new TypeError(l);return e=o(e)||0,n(i)&&(k=!!i.leading,C="maxWait"in i,v=C?b(o(i.maxWait)||0,e):v,M="trailing"in i?!!i.trailing:M),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 a;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)?a:+t}var l="Expected a function",a=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)}).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 l(i){return t(i)[e]||r}n(l,"pattern",s),n(i,o,l)}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,
!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,l){if(!i[o]){if(!e[o]){var a="function"==typeof require&&require;if(!l&&a)return a(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 l,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"),l=t("events").EventEmitter,a=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"string"==typeof t?t:t.place_name},render:function(t){if("string"==typeof t){var e=t.split(","),i=e[0].toLowerCase().indexOf(this.query.toLowerCase()),n=this.query.length;return'<div class="mapboxgl-ctrl-geocoder--suggestion maplibregl-ctrl-geocoder--suggestion"><svg class="mapboxgl-ctrl-geocoder--suggestion-icon maplibre-ctrl-geocoder--suggestion-icon" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><path d="M22.8702 20.1258H21.4248L20.9125 19.6318C22.7055 17.546 23.785 14.8382 23.785 11.8925C23.785 5.32419 18.4608 0 11.8925 0C5.32419 0 0 5.32419 0 11.8925C0 18.4608 5.32419 23.785 11.8925 23.785C14.8382 23.785 17.546 22.7055 19.6318 20.9125L20.1258 21.4248V22.8702L29.2739 32L32 29.2739L22.8702 20.1258ZM11.8925 20.1258C7.33676 20.1258 3.65923 16.4483 3.65923 11.8925C3.65923 7.33676 7.33676 3.65923 11.8925 3.65923C16.4483 3.65923 20.1258 7.33676 20.1258 11.8925C20.1258 16.4483 16.4483 20.1258 11.8925 20.1258Z" fill="#687078"/></svg><div class="mapboxgl-ctrl-geocoder--suggestion-info maplibregl-ctrl-geocoder--suggestion-info"><div class="mapboxgl-ctrl-geocoder--suggestion-title maplibregl-ctrl-geocoder--suggestion-title">'+e[0].substring(0,i)+'<span class="mapboxgl-ctrl-geocoder--suggestion-match maplibregl-ctrl-geocoder--suggestion-match">'+e[0].substring(i,i+n)+"</span>"+e[0].substring(i+n)+'</div><div class="mapboxgl-ctrl-geocoder--suggestion-address maplibregl-ctrl-geocoder--suggestion-address">'+e.splice(1,e.length).join(",")+"</div></div></div>"}var s=t.place_name.split(",");return'<div class="mapboxgl-ctrl-geocoder--result maplibregl-ctrl-geocoder--result"><svg class="mapboxgl-ctrl-geocoder--result-icon maplibre-ctrl-geocoder--result-icon" viewBox="0 0 24 32" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 0C5.36571 0 0 5.38676 0 12.0471C0 21.0824 12 32 12 32C12 32 24 21.0824 24 12.0471C24 5.38676 18.6343 0 12 0ZM12 16.3496C9.63428 16.3496 7.71429 14.4221 7.71429 12.0471C7.71429 9.67207 9.63428 7.74454 12 7.74454C14.3657 7.74454 16.2857 9.67207 16.2857 12.0471C16.2857 14.4221 14.3657 16.3496 12 16.3496Z" fill="#687078"/></svg><div><div class="mapboxgl-ctrl-geocoder--result-title maplibregl-ctrl-geocoder--result-title">'+s[0]+'</div><div class="mapboxgl-ctrl-geocoder--result-address maplibregl-ctrl-geocoder--result-address">'+s.splice(1,s.length).join(",")+"</div></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>"},processResults:function(t,e,i){if(!e||0===e.length)return t;var n=t.map(function(t){return t.place_name}),s=e.filter(function(t){return!n.includes(t)});if(s.length+t.length>i){for(var r=Math.min(s.length,Math.floor(i/2));t.length+r<i;)r++;for(var o=[],l=0;l<r;l++)o.push(s[l]);for(var a=0;a<i-r;a++)o.push(t[a]);return o}return s.length>0?s.concat(t):t},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");var 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");var 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 void(null==this._typeahead.selected&&this.geocoderApi.getSuggestions?this._geocode(e.value,!0):null==this._typeahead.selected&&this.options.showResultMarkers&&this._fitBoundsForMarkers());this._typeahead.selected||this._geocode(e.value)}e.value.length>=this.options.minLength&&this.options.showResultsWhileTyping&&this._geocode(e.value)}},_showButton:function(){this._inputEl.value.length>0&&(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&&"string"==typeof t)this._geocode(t,!0);else if(t&&JSON.stringify(t)!==this.lastSelected){if(this._clearEl.style.display="none",this.options.flyTo){var e;if(this._removeResultMarkers(),t.properties&&a[t.properties.short_code])e=o({},this.options.flyTo),this._map&&this._map.fitBounds(a[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._typeahead.selected=null,this._eventEmitter.emit("result",{result:t})}},_getConfigForRequest:function(){var t=["bbox","limit","proximity","countries","types","language","reverseMode"],e=this;return t.reduce(function(t,i){return e.options[i]&&(["countries","types","language"].indexOf(i)>-1?t[i]=e.options[i].split(/[\s,]+/):t[i]=e.options[i],"proximity"===i&&e.options[i]&&"number"==typeof e.options[i].longitude&&"number"==typeof e.options[i].latitude&&(t[i]=[e.options[i].longitude,e.options[i].latitude])),t},{})},_geocode:function(t,e){this._loadingEl.style.display="block",this._eventEmitter.emit("loading",{query:t}),this.inputString=t;var i,n=null,s=this._getConfigForRequest();if(this.options.localGeocoderOnly)i=Promise.resolve();else if(this.options.reverseGeocode&&/(-?\d+\.?\d*)[, ]+(-?\d+\.?\d*)[ ]*$/.test(t)){var r=t.split(/[\s(,)?]+/).map(function(t){return parseFloat(t,10)}).reverse();s.types&&s.types[0],s=o(s,{query:r,limit:1}),"proximity"in s&&delete s.proximity,i=this.geocoderApi.reverseGeocode(s)}else s=o(s,{query:t}),i=this.geocoderApi.forwardGeocode(s);var l=[];this.options.localGeocoder&&((l=this.options.localGeocoder(t))||(l=[]));var a=[],h=[];return i.catch(function(t){n=t}.bind(this)).then(function(i){this._loadingEl.style.display="none";var n={};return n=i||{type:"FeatureCollection",features:[]},n.config=s,this.fresh&&(this.fresh=!1),n.features=n.features?l.concat(n.features):l,this.options.externalGeocoder?(a=this.options.externalGeocoder(t,n.features,s)||[],a.then(function(t){return n.features=n.features?t.concat(n.features):t,n},function(){return n})):this.geocoderApi.getSuggestions&&!e?(h=this._getSuggestions(t)||[],h.then(function(t){return t.length>0&&(n.suggestions=t),n},function(){return n})):n}.bind(this)).then(function(t){if(n)throw n;if(this.options.filter&&t.features.length&&(t.features=t.features.filter(this.options.filter)),t.features.length){this._clearEl.style.display="block";var i=this.options.processResults(t.features,t.suggestions,this.options.limit);this._typeahead.update(i),this.options.showResultsWhileTyping&&!e||!this.options.showResultMarkers||this._fitBoundsForMarkers(),this._eventEmitter.emit("results",t),this._eventEmitter.emit("processedResults",i)}else 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||a.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)),i},_getSuggestions:function(t){return new Promise(function(e,i){this.geocoderApi.getSuggestions||i(),this._eventEmitter.emit("loadingSuggestions",{query:t});var n=null,s=[],r=this._getConfigForRequest();r=o(r,{query:t});var l;l=this.geocoderApi.getSuggestions(r),l.catch(function(t){n=t}.bind(this)).then(function(t){if(n)throw n;t.suggestions.length&&(s=t.suggestions),e(s),this._eventEmitter.emit("resultsSuggestions",t)}.bind(this)).catch(function(t){this._eventEmitter.emit("error",{error:t})}.bind(this))}.bind(this))},_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.filter(function(t){return"string"!=typeof t}).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.toArray(),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={},l=o({},r,this.options.popup);n=new this._maplibregl.Popup(l).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 l(t,e,i,n,s){if(e)t.call(i,n,s);else for(var r=t.length,o=m(t,r),l=0;l<r;++l)o[l].call(i,n,s)}function a(t,e,i,n,s,r){if(e)t.call(i,n,s,r);else for(var o=t.length,l=m(t,o),a=0;a<o;++a)l[a].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,l;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),l=o[e]):(o=t._events=w(null),t._eventsCount=0),l){if("function"==typeof l?l=o[e]=n?[i,l]:[l,i]:n?l.unshift(i):l.push(i),!l.warned&&(r=s(t))&&r>0&&l.length>r){l.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+l.length+' "'+String(e)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=l.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",a.name,a.message)}}else l=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 C={};Object.defineProperty&&Object.defineProperty(C,"x",{value:0}),L=0===C.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:l(i,f,this,arguments[1],arguments[2]);break;case 4:a(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,l=0,a=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,a+=1+a):a=0,l+=a,r[r.length]=n;return s===t.length?(l=c===t?1/0:l,{rendered:r.join(""),score:l}):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 l=s;i.extract&&(l=i.extract(s));var a=n.match(t,l,i);return null!=a&&(e[e.length]={string:a.rendered,score:a.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(){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 a(t){var i=t-x,n=t-L,s=e-i;return C?w(s,v-n):s}function h(t){var i=t-x,n=t-L;return void 0===x||i>=e||i<0||C&&n>=v}function u(){var t=E();if(h(t))return c(t);_=setTimeout(u,a(t))}function c(t){return _=void 0,M&&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(C)return _=setTimeout(u,e),s(x)}return void 0===_&&(_=setTimeout(u,e)),y}var g,m,v,y,_,x,L=0,k=!1,C=!1,M=!0;if("function"!=typeof t)throw new TypeError(l);return e=o(e)||0,n(i)&&(k=!!i.leading,C="maxWait"in i,v=C?b(o(i.maxWait)||0,e):v,M="trailing"in i?!!i.trailing:M),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 a;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)?a:+t}var l="Expected a function",a=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)}).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 l(i){return t(i)[e]||r}n(l,"pattern",s),n(i,o,l)}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)});

@@ -502,3 +502,3 @@ "use strict";

_showButton: function () {
if (this._typeahead.selected) this._clearEl.style.display = "block";
if (this._inputEl.value.length > 0) this._clearEl.style.display = "block";
},

@@ -518,2 +518,6 @@

},
// Change events are fire by suggestions library whenever the enter key is pressed or input is blurred
// This can sometimes cause strange behavior as this function is called before our own onKeyDown handler and thus
// we cannot depend on some internal values of the suggestion state like `selected` as those will change or before
// our onKeyDown handler.
_onChange: function () {

@@ -776,3 +780,2 @@ var selected = this._typeahead.selected;

this._clearEl.style.display = "block";
this._eventEmitter.emit("results", res);

@@ -785,4 +788,2 @@ var processedResults = this.options.processResults(

this._eventEmitter.emit("processedResults", processedResults);
this._typeahead.update(processedResults);

@@ -794,2 +795,5 @@ if (

this._fitBoundsForMarkers();
this._eventEmitter.emit("results", res);
this._eventEmitter.emit("processedResults", processedResults);
} else {

@@ -1043,3 +1047,3 @@ this._clearEl.style.display = "none";

this._map.fitBounds(bounds, flyOptions);
this._map.fitBounds(bounds.toArray(), flyOptions);
}

@@ -1046,0 +1050,0 @@ }

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

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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