vendor: 12,190 bytes, line 1
1(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("leaflet")):typeof define==`function`&&define.amd?define([`exports`,`leaflet`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e[`leaflet-control-geocoder`]={},e.L))})(this,function(e,t){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,ee=Object.prototype.hasOwnProperty,s=(e,t)=>{let n={};for(var i in e)r(n,i,{get:e[i],enumerable:!0});return t||r(n,Symbol.toStringTag,{value:`Module`}),n},c=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var s=a(t),c=0,l=s.length,u;c<l;c++)u=s[c],!ee.call(e,u)&&u!==n&&r(e,u,{get:(e=>t[e]).bind(null,u),enumerable:!(o=i(t,u))||o.enumerable});return e};t=((e,t,i)=>(i=e==null?{}:n(o(e)),c(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)))(t,1);var l=class extends Error{constructor(e){super(e),this.name=`SuggestUnsupportedError`}};function u(e,t){return Object.assign(t,e.geocodingQueryParams)}function d(e,t){return Object.assign(t,e.reverseQueryParams)}var f=/[&<>"'`]/g,p=/[&<>"'`]/,m={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`,"`":```};function te(e){return m[e]}function ne(e){return e==null?``:e?(e=``+e,p.test(e)?e.replace(f,te):e):e+``}function h(e,t){let n={Accept:`application/json`},r=new URL(e);return Object.entries(t).forEach(([e,t])=>{(Array.isArray(t)?t:[t]).forEach(t=>{r.searchParams.append(e,t)})}),fetch(r.toString(),{headers:n}).then(e=>e.json())}function g(e,t){return e.replace(/\{ *([\w_]+) *\}/g,(e,n)=>{let r=t[n];return r===void 0?r=``:typeof r==`function`&&(r=r(t)),ne(r)})}var _=class{options={serviceUrl:`https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer`,apiKey:``};constructor(e){t.Util.setOptions(this,e)}async geocode(e){let n=u(this.options,{token:this.options.apiKey,SingleLine:e,outFields:`Addr_Type`,forStorage:!1,maxLocations:10,f:`json`});return(await h(this.options.serviceUrl+`/findAddressCandidates`,n)).candidates.map(e=>{let n=new t.LatLng(e.location.y,e.location.x),r=new t.LatLngBounds(new t.LatLng(e.extent.ymax,e.extent.xmax),new t.LatLng(e.extent.ymin,e.extent.xmin));return{name:e.address,bbox:r,center:n}})}suggest(e){return this.geocode(e)}async reverse(e,n){let r=d(this.options,{location:e.lng+`,`+e.lat,distance:100,f:`json`}),i=await h(this.options.serviceUrl+`/reverseGeocode`,r);if(!i||i.error)return[];let a=new t.LatLng(i.location.y,i.location.x),o=new t.LatLngBounds(a,a);return[{name:i.address.Match_addr,center:a,bbox:o}]}};function re(e){return new _(e)}var v=class{options={serviceUrl:`https://dev.virtualearth.net/REST/v1/Locations/`};constructor(e){t.Util.setOptions(this,e)}async geocode(e){let t=u(this.options,{query:e,key:this.options.apiKey}),n=await h(this.options.serviceUrl,t);return this._parseResults(n)}async reverse(e,t){let n=d(this.options,{key:this.options.apiKey}),r=await h(this.options.serviceUrl+e.lat+`,`+e.lng,n);return this._parseResults(r)}_parseResults(e){return e.resourceSets[0].resources.map(e=>{let n=e.bbox;return{name:e.name,bbox:new t.LatLngBounds([n[0],n[1]],[n[2],n[3]]),center:new t.LatLng(...e.point.coordinates)}})}};function y(e){return new v(e)}var b=class{options={apiKey:``,serviceUrl:`https://atlas.microsoft.com/search`};constructor(e){if(t.Util.setOptions(this,e),!this.options.apiKey)throw Error(`Azure Maps Geocoder requires an API key.`)}async geocode(e){let n={"api-version":`1.0`,query:e,"subscription-key":this.options.apiKey};return((await h(this.options.serviceUrl+`/address/json`,n)).results||[]).map(e=>({name:e.address.freeformAddress,bbox:new t.LatLngBounds([e.viewport.topLeftPoint.lat,e.viewport.topLeftPoint.lon],[e.viewport.btmRightPoint.lat,e.viewport.btmRightPoint.lon]),center:new t.LatLng(e.position.lat,e.position.lon)}))}async reverse(e,n){let r={"api-version":`1.0`,query:e.lat+`,`+e.lng,"subscription-key":this.options.apiKey};return((await h(this.options.serviceUrl+`/address/reverse/json`,r)).addresses||[]).map(n=>({name:n.address.freeformAddress,bbox:new t.LatLngBounds([n.viewport.topLeftPoint.lat,n.viewport.topLeftPoint.lon],[n.viewport.btmRightPoint.lat,n.viewport.btmRightPoint.lon]),center:new t.LatLng(e.lat,e.lng)}))}};function ie(e){return new b(e)}var x=class{options={serviceUrl:`https://maps.googleapis.com/maps/api/geocode/json`};constructor(e){t.Util.setOptions(this,e)}async geocode(e){let t=u(this.options,{key:this.options.apiKey,address:e}),n=await h(this.options.serviceUrl,t);return this._parseResults(n)}async reverse(e,t){let n=d(this.options,{key:this.options.apiKey,latlng:e.lat+`,`+e.lng}),r=await h(this.options.serviceUrl,n);return this._parseResults(r)}_parseResults(e){return(e.results||[])?.map(e=>{let n=new t.LatLng(e.geometry.location.lat,e.geometry.location.lng),r=new t.LatLngBounds(new t.LatLng(e.geometry.viewport.northeast.lat,e.geometry.viewport.northeast.lng),new t.LatLng(e.geometry.viewport.southwest.lat,e.geometry.viewport.southwest.lng));return{name:e.formatted_address,bbox:r,center:n,properties:e.address_components}})}};function S(e){return new x(e)}var C=class{options={serviceUrl:`https://geocoder.api.here.com/6.2/`,app_id:``,app_code:``,apiKey:``,maxResults:5};constructor(e){if(t.Util.setOptions(this,e),e?.apiKey)throw Error(`apiKey is not supported, use app_id/app_code instead!`)}geocode(e){let t=u(this.options,{searchtext:e,gen:9,app_id:this.options.app_id,app_code:this.options.app_code,jsonattributes:1,maxresults:this.options.maxResults});return this.getJSON(this.options.serviceUrl+`geocode.json`,t)}reverse(e,t){let n=e.lat+`,`+e.lng;this.options.reverseGeocodeProxRadius&&(n+=`,`+this.options.reverseGeocodeProxRadius);let r=d(this.options,{prox:n,mode:`retrieveAddresses`,app_id:this.options.app_id,app_code:this.options.app_code,gen:9,jsonattributes:1,maxresults:this.options.maxResults});return this.getJSON(this.options.serviceUrl+`reversegeocode.json`,r)}async getJSON(e,n){return((await h(e,n))?.response?.view?.[0]?.result||[]).map(e=>{let n=e.location,r=new t.LatLng(n.displayPosition.latitude,n.displayPosition.longitude),i=new t.LatLngBounds(new t.LatLng(n.mapView.topLeft.latitude,n.mapView.topLeft.longitude),new t.LatLng(n.mapView.bottomRight.latitude,n.mapView.bottomRight.longitude));return{name:n.address.label,properties:n.address,bbox:i,center:r}})}},w=class{options={serviceUrl:`https://geocode.search.hereapi.com/v1`,apiKey:``,app_id:``,app_code:``,maxResults:10};constructor(e){t.Util.setOptions(this,e)}geocode(e){let t=u(this.options,{q:e,apiKey:this.options.apiKey,limit:this.options.maxResults});if(!t.at&&!t.in)throw Error(`at / in parameters not found. Please define coordinates (at=latitude,longitude) or other (in) in your geocodingQueryParams.`);return this.getJSON(this.options.serviceUrl+`/discover`,t)}reverse(e,t){let n=d(this.options,{at:e.lat+`,`+e.lng,limit:this.options.reverseGeocodeProxRadius,apiKey:this.options.apiKey});return this.getJSON(this.options.serviceUrl+`/revgeocode`,n)}async getJSON(e,n){return((await h(e,n)).items||[]).map(e=>{let n=new t.LatLng(e.position.lat,e.position.lng),r;return r=e.mapView?new t.LatLngBounds(new t.LatLng(e.mapView.south,e.mapView.west),new t.LatLng(e.mapView.north,e.mapView.east)):new t.LatLngBounds(new t.LatLng(e.position.lat,e.position.lng),new t.LatLng(e.position.lat,e.position.lng)),{name:e.address.label,properties:e.address,bbox:r,center:n}})}};function T(e){return e?.apiKey?new w(e):new C(e)}function E(e){let n;if(n=e.match(/^([NS])\s*(\d{1,3}(?:\.\d*)?)\W*([EW])\s*(\d{1,3}(?:\.\d*)?)$/))return new t.LatLng((/N/i.test(n[1])?1:-1)*n[2],(/E/i.test(n[3])?1:-1)*n[4]);if(n=e.match(/^(\d{1,3}(?:\.\d*)?)\s*([NS])\W*(\d{1,3}(?:\.\d*)?)\s*([EW])$/))return new t.LatLng((/N/i.test(n[2])?1:-1)*n[1],(/E/i.test(n[4])?1:-1)*n[3]);if(n=e.match(/^([NS])\s*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['â²]?\W*([EW])\s*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['â²]?$/))return new t.LatLng((/N/i.test(n[1])?1:-1)*(+n[2]+n[3]/60),(/E/i.test(n[4])?1:-1)*(+n[5]+n[6]/60));if(n=e.match(/^(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['â²]?\s*([NS])\W*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['â²]?\s*([EW])$/))return new t.LatLng((/N/i.test(n[3])?1:-1)*(+n[1]+n[2]/60),(/E/i.test(n[6])?1:-1)*(+n[4]+n[5]/60));if(n=e.match(/^([NS])\s*(\d{1,3})°?\s*(\d{1,2})['â²]?\s*(\d{1,3}(?:\.\d*)?)?["â³]?\W*([EW])\s*(\d{1,3})°?\s*(\d{1,2})['â²]?\s*(\d{1,3}(?:\.\d*)?)?["â³]?$/))return new t.LatLng((/N/i.test(n[1])?1:-1)*(+n[2]+n[3]/60+n[4]/3600),(/E/i.test(n[5])?1:-1)*(+n[6]+n[7]/60+n[8]/3600));if(n=e.match(/^(\d{1,3})°?\s*(\d{1,2})['â²]?\s*(\d{1,3}(?:\.\d*)?)?["â³]\s*([NS])\W*(\d{1,3})°?\s*(\d{1,2})['â²]?\s*(\d{1,3}(?:\.\d*)?)?["â³]?\s*([EW])$/))return new t.LatLng((/N/i.test(n[4])?1:-1)*(+n[1]+n[2]/60+n[3]/3600),(/E/i.test(n[8])?1:-1)*(+n[5]+n[6]/60+n[7]/3600));if(n=e.match(/^\s*([+-]?\d+(?:\.\d*)?)\s*[\s,]\s*([+-]?\d+(?:\.\d*)?)\s*$/))return new t.LatLng(+n[1],+n[2])}var D=class{options={next:void 0,sizeInMeters:1e4};constructor(e){t.Util.setOptions(this,e)}async geocode(e){let t=E(e);return t?[{name:e,center:t,bbox:t.toBounds(this.options.sizeInMeters)}]:this.options.next?this.options.next.geocode(e):[]}};function O(e){return new D(e)}var k=class{options={serviceUrl:`https://api.mapbox.com/geocoding/v5/mapbox.places/`};constructor(e){t.Util.setOptions(this,e)}_getProperties(e){let t={text:e.text,address:e.address};return(e.context||[]).forEach(e=>{let n=e.id.split(`.`)[0];t[n]=e.text,e.short_code&&(t.countryShortCode=e.short_code)}),t}async geocode(e){let t=this.options.serviceUrl+encodeURIComponent(e)+`.json`,n=u(this.options,{access_token:this.options.apiKey});n.proximity!==void 0&&n.proximity.lat!==void 0&&n.proximity.lng!==void 0&&(n.proximity=n.proximity.lng+`,`+n.proximity.lat);let r=await h(t,n);return this._parseResults(r)}suggest(e){return this.geocode(e)}async reverse(e,t){let n=await h(this.options.serviceUrl+e.lng+`,`+e.lat+`.json`,d(this.options,{access_token:this.options.apiKey}));return this._parseResults(n)}_parseResults(e){return e.features?.length?e.features.map(e=>{let n=new t.LatLng(...e.center.reverse()),r;return r=e.bbox?new t.LatLngBounds(new t.LatLng(...e.bbox.slice(0,2).reverse()),new t.LatLng(...e.bbox.slice(2,4).reverse())):new t.LatLngBounds(n,n),{name:e.place_name,bbox:r,center:n,properties:this._getProperties(e)}}):[]}};function ae(e){return new k(e)}var A=class{options={serviceUrl:`https://www.mapquestapi.com/geocoding/v1`};constructor(e){t.Util.setOptions(this,e),this.options.apiKey=decodeURIComponent(this.options.apiKey)}_formatName(...e){return e.filter(e=>!!e).join(`, `)}async geocode(e){let t=u(this.options,{key:this.options.apiKey,location:e,limit:5,outFormat:`json`}),n=await h(this.options.serviceUrl+`/address`,t);return this._parseResults(n)}async reverse(e,t){let n=d(this.options,{key:this.options.apiKey,location:e.lat+`,`+e.lng,outputFormat:`json`}),r=await h(this.options.serviceUrl+`/reverse`,n);return this._parseResults(r)}_parseResults(e){return(e.results?.[0]?.locations||[]).map(e=>{let n=new t.LatLng(e.latLng.lat,e.latLng.lng);return{name:this._formatName(e.street,e.adminArea4,e.adminArea3,e.adminArea1),bbox:new t.LatLngBounds(n,n),center:n}})}};function oe(e){return new A(e)}var j=class{options={userId:``,apiKey:``,serviceUrl:`https://neutrinoapi.com/`};constructor(e){t.Util.setOptions(this,e)}async geocode(e){let n=u(this.options,{apiKey:this.options.apiKey,userId:this.options.userId,address:e.split(/\s+/).join(`.`)}),r=await h(this.options.serviceUrl+`geocode-address`,n);if(!r.locations)return[];r.geometry=r.locations[0];let i=new t.LatLng(r.geometry.latitude,r.geometry.longitude),a=new t.LatLngBounds(i,i);return[{name:r.geometry.address,bbox:a,center:i}]}suggest(e){return this.geocode(e)}async reverse(e,n){let r=d(this.options,{apiKey:this.options.apiKey,userId:this.options.userId,latitude:e.lat,longitude:e.lng}),i=await h(this.options.serviceUrl+`geocode-reverse`,r);if(i.status.status!==200||!i.found)return[];let a=new t.LatLng(e.lat,e.lng),o=new t.LatLngBounds(a,a);return[{name:i.address,bbox:o,center:a}]}};function M(e){return new j(e)}var N=1e3,P=`
1/geosuche
vendor: 14,330 bytes, lines 1-2
1/`,F=class{options={serviceUrl:P,htmlTemplate(e){let t=e.address,n,r=[];return(t.road||t.building)&&r.push(`{building} {road} {house_number}`),(t.city||t.town||t.village||t.hamlet)&&(n=r.length>0?`leaflet-control-geocoder-address-detail`:``,r.push(`<span class="`+n+`">{postcode} {city} {town} {village} {hamlet}</span>`)),(t.state||t.country)&&(n=r.length>0?`leaflet-control-geocoder-address-context`:``,r.push(`<span class="`+n+`">{state} {country}</span>`)),g(r.join(`<br/>`),t)}};_lastRequestStart=Promise.resolve(0);_cache=new Map;constructor(e){t.Util.setOptions(this,e||{})}_getJSON(e,t){let n=this.options.serviceUrl+e,r=n+JSON.stringify(t),i=this._cache.get(r);return i||(i=this._rateLimit().then(()=>h(n,t)),i.catch(()=>this._cache.delete(r)),this._cache.set(r,i)),i}_rateLimit(){let{hostname:e}=new URL(this.options.serviceUrl);if(e!==new URL(P).hostname)return Promise.resolve();let t=this._lastRequestStart.then(async e=>{let t=N-(Date.now()-e);return t>0&&await new Promise(e=>setTimeout(e,t)),Date.now()});return this._lastRequestStart=t,t}async geocode(e){let n=u(this.options,{q:e,limit:5,format:`json`,addressdetails:1});return(await this._getJSON(`search`,n)).map(e=>{let n=e.boundingbox;return{icon:e.icon,name:e.display_name,html:this.options.htmlTemplate?this.options.htmlTemplate(e):void 0,bbox:new t.LatLngBounds([+n[0],+n[2]],[+n[1],+n[3]]),center:new t.LatLng(+e.lat,+e.lon),properties:e}})}async suggest(e){throw new l(`Nominatim forbids auto-complete search: "you must not implement such a service on the client side using the API". See https://operations.osmfoundation.org/policies/nominatim/`)}async reverse(e,n){let r=d(this.options,{lat:e.lat,lon:e.lng,zoom:Math.round(Math.log(n/256)/Math.log(2)),addressdetails:1,format:`json`}),i=await this._getJSON(`reverse`,r);if(!i?.lat||!i?.lon)return[];let a=new t.LatLng(+i.lat,+i.lon),o=new t.LatLngBounds(a,a);return[{name:i.display_name,html:this.options.htmlTemplate?this.options.htmlTemplate(i):void 0,center:a,bbox:o,properties:i}]}};function I(e){return new F(e)}var L=class{options={};constructor(e){t.Util.setOptions(this,e)}async geocode(e){try{let n=this.options.OpenLocationCode.decode(e);return[{name:e,center:new t.LatLng(n.latitudeCenter,n.longitudeCenter),bbox:new t.LatLngBounds(new t.LatLng(n.latitudeLo,n.longitudeLo),new t.LatLng(n.latitudeHi,n.longitudeHi))}]}catch(e){return console.warn(e),[]}}async reverse(e,n){try{return[{name:this.options.OpenLocationCode.encode(e.lat,e.lng,this.options.codeLength),center:new t.LatLng(e.lat,e.lng),bbox:new t.LatLngBounds(new t.LatLng(e.lat,e.lng),new t.LatLng(e.lat,e.lng))}]}catch(e){return console.warn(e),[]}}};function R(e){return new L(e)}var z=class{options={serviceUrl:`https://api.opencagedata.com/geocode/v1/json`};constructor(e){t.Util.setOptions(this,e)}async geocode(e){let t=u(this.options,{key:this.options.apiKey,q:e}),n=await h(this.options.serviceUrl,t);return this._parseResults(n)}suggest(e){return this.geocode(e)}async reverse(e,t){let n=d(this.options,{key:this.options.apiKey,q:[e.lat,e.lng].join(`,`)}),r=await h(this.options.serviceUrl,n);return this._parseResults(r)}_parseResults(e){return(e.results||[]).map(e=>{let n=new t.LatLng(e.geometry.lat,e.geometry.lng),r=e.annotations&&e.annotations.bounds?new t.LatLngBounds(new t.LatLng(e.annotations.bounds.northeast.lat,e.annotations.bounds.northeast.lng),new t.LatLng(e.annotations.bounds.southwest.lat,e.annotations.bounds.southwest.lng)):new t.LatLngBounds(n,n);return{name:e.formatted,bbox:r,center:n,properties:e}})}};function B(e){return new z(e)}var V=class{options={serviceUrl:`https://api.geocode.earth/v1`};constructor(e){t.Util.setOptions(this,e)}async geocode(e){let t=u(this.options,{api_key:this.options.apiKey,text:e}),n=await h(this.options.serviceUrl+`/search`,t);return this._parseResults(n)}async suggest(e){let t=u(this.options,{api_key:this.options.apiKey,text:e}),n=await h(this.options.serviceUrl+`/autocomplete`,t);return this._parseResults(n)}async reverse(e,t){let n=d(this.options,{api_key:this.options.apiKey,"point.lat":e.lat,"point.lon":e.lng}),r=await h(this.options.serviceUrl+`/reverse`,n);return this._parseResults(r)}_parseResults(e){return(e.features||[]).map(e=>{let n=e.geometry.coordinates,r=new t.LatLng(n[1],n[0]),i=Array.isArray(e.bbox)&&e.bbox.length===4?new t.LatLngBounds([e.bbox[1],e.bbox[0]],[e.bbox[3],e.bbox[2]]):new t.LatLngBounds(r,r);return{name:e.properties.label,center:r,bbox:i,properties:e.properties}})}};function H(e){return new V(e)}var U=V,W=H,G=V,K=H,q=class extends V{constructor(e){super(Object.assign({serviceUrl:`https://api.openrouteservice.org/geocode`},e))}};function se(e){return new q(e)}var J=class{options={serviceUrl:`https://photon.komoot.io/api/`,reverseUrl:`https://photon.komoot.io/reverse/`,nameProperties:[`name`,`street`,`suburb`,`hamlet`,`town`,`city`,`state`,`country`]};constructor(e){t.Util.setOptions(this,e)}async geocode(e,t){let n=u(this.options,{q:e}),r=t?.map?.getCenter?.();r&&(n.lat=r.lat,n.lon=r.lng);let i=t?.map?.getZoom?.();i&&(n.zoom=i);let a=await h(this.options.serviceUrl,n);return this._parseResults(a)}suggest(e){return this.geocode(e)}async reverse(e,t){let n=d(this.options,{lat:e.lat,lon:e.lng}),r=await h(this.options.reverseUrl,n);return this._parseResults(r)}_parseResults(e){return(e.features||[]).map(e=>{let n=e.geometry.coordinates,r=new t.LatLng(n[1],n[0]),i=e.properties?.extent,a=i?new t.LatLngBounds([i[1],i[0]],[i[3],i[2]]):new t.LatLngBounds(r,r);return{name:this._decodeFeatureName(e),html:this.options.htmlTemplate?this.options.htmlTemplate(e):void 0,center:r,bbox:a,properties:e.properties}})}_decodeFeatureName(e){return(this.options.nameProperties||[]).map(t=>e.properties?.[t]).filter(e=>!!e).join(`, `)}};function ce(e){return new J(e)}var Y=class{options={serviceUrl:`https://api.what3words.com/v2/`};constructor(e){t.Util.setOptions(this,e)}async geocode(e){let n=await h(this.options.serviceUrl+`forward`,u(this.options,{key:this.options.apiKey,addr:e.split(/\s+/).join(`.`)}));if(!n.geometry)return[];let r=new t.LatLng(n.geometry.lat,n.geometry.lng),i=new t.LatLngBounds(r,r);return[{name:n.words,bbox:i,center:r}]}suggest(e){return this.geocode(e)}async reverse(e,n){let r=await h(this.options.serviceUrl+`reverse`,d(this.options,{key:this.options.apiKey,coords:[e.lat,e.lng].join(`,`)}));if(r.status.status!=200)return[];let i=new t.LatLng(r.geometry.lat,r.geometry.lng),a=new t.LatLngBounds(i,i);return[{name:r.words,bbox:a,center:i}]}};function le(e){return new Y(e)}var X=s({ArcGis:()=>_,AzureMaps:()=>b,Bing:()=>v,GeocodeEarth:()=>U,Google:()=>x,HERE:()=>C,HEREv2:()=>w,LatLng:()=>D,MapQuest:()=>A,Mapbox:()=>k,Mapzen:()=>G,Neutrino:()=>j,Nominatim:()=>F,OpenCage:()=>z,OpenLocationCode:()=>L,Openrouteservice:()=>q,Pelias:()=>V,Photon:()=>J,SuggestUnsupportedError:()=>l,What3Words:()=>Y,arcgis:()=>re,azure:()=>ie,bing:()=>y,geocodeEarth:()=>W,geocodingParams:()=>u,google:()=>S,here:()=>T,latLng:()=>O,mapQuest:()=>oe,mapbox:()=>ae,mapzen:()=>K,neutrino:()=>M,nominatim:()=>I,openLocationCode:()=>R,opencage:()=>B,openrouteservice:()=>se,parseLatLng:()=>E,pelias:()=>H,photon:()=>ce,reverseParams:()=>d,what3words:()=>le}),Z=class{constructor(...e){}};Object.getOwnPropertyNames(t.Control.prototype).forEach(e=>Z.prototype[e]=t.Control.prototype[e]),Object.getOwnPropertyNames(t.Evented.prototype).forEach(e=>Z.prototype[e]=t.Evented.prototype[e]);var Q=class extends Z{options={showUniqueResult:!0,showResultIcons:!1,collapsed:!0,expand:`touch`,position:`topright`,placeholder:`Search...`,errorMessage:`Nothing found.`,iconLabel:`Initiate a new search`,query:``,queryMinLength:1,suggestMinLength:3,suggestTimeout:250,defaultMarkGeocode:!0};_alts;_container;_errorElement;_geocodeMarker;_input;_lastGeocode;_map;_preventBlurCollapse;_requestCount=0;_results;_selection;_suggestTimeout;_suggestUnsupported=!1;constructor(e){super(e),t.Util.setOptions(this,e),this.options.geocoder||(this.options.geocoder=new F)}addThrobberClass(){this._container.classList.add(`leaflet-control-geocoder-throbber`)}removeThrobberClass(){this._container.classList.remove(`leaflet-control-geocoder-throbber`)}onAdd(e){let n=t.DomUtil.create(`div`,`leaflet-control-geocoder leaflet-bar`),r=t.DomUtil.create(`button`,`leaflet-control-geocoder-icon`,n),i=t.DomUtil.create(`div`,`leaflet-control-geocoder-form`,n);this._map=e,this._container=n,r.innerHTML=` `,r.type=`button`,r.setAttribute(`aria-label`,this.options.iconLabel);let a=this._input=t.DomUtil.create(`input`,``,i);return a.type=`search`,a.value=this.options.query,a.placeholder=this.options.placeholder,t.DomEvent.disableClickPropagation(a),this._errorElement=t.DomUtil.create(`div`,`leaflet-control-geocoder-form-no-error`,n),this._errorElement.innerHTML=this.options.errorMessage,this._alts=t.DomUtil.create(`ul`,`leaflet-control-geocoder-alternatives leaflet-control-geocoder-alternatives-minimized`,n),t.DomEvent.disableClickPropagation(this._alts),t.DomEvent.on(a,`keydown`,this._keydown,this),this.options.geocoder?.suggest&&t.DomEvent.on(a,`input`,this._change,this),t.DomEvent.on(a,`blur`,()=>{this.options.collapsed&&!this._preventBlurCollapse&&this._collapse(),this._preventBlurCollapse=!1}),this.options.collapsed?this.options.expand===`click`?t.DomEvent.on(n,`click`,e=>{e.button===0&&e.detail!==2&&this._toggle()}):this.options.expand===`touch`?t.DomEvent.on(n,t.Browser.touch?`touchstart mousedown`:`mousedown`,e=>{this._toggle(),e.preventDefault(),e.stopPropagation()},this):(t.DomEvent.on(n,`mouseover`,this._expand,this),t.DomEvent.on(n,`mouseout`,this._collapse,this),this._map.on(`movestart`,this._collapse,this)):(this._expand(),t.Browser.touch?t.DomEvent.on(n,`touchstart`,()=>this._geocode()):t.DomEvent.on(n,`click`,()=>this._geocode())),this.options.defaultMarkGeocode&&this.on(`markgeocode`,this.markGeocode,this),this.on(`startgeocode`,this.addThrobberClass,this),this.on(`finishgeocode`,this.removeThrobberClass,this),this.on(`startsuggest`,this.addThrobberClass,this),this.on(`finishsuggest`,this.removeThrobberClass,this),t.DomEvent.disableClickPropagation(n),n}setQuery(e){return this._input.value=e,this}_geocodeResult(e,t){!t&&this.options.showUniqueResult&&e.length===1?this._geocodeResultSelected(e[0]):e.length>0?(this._alts.innerHTML=``,this._results=e,this._alts.classList.remove(`leaflet-control-geocoder-alternatives-minimized`),this._container.classList.add(`leaflet-control-geocoder-options-open`),this._results.forEach((e,t)=>this._alts.appendChild(this._createAlt(e,t)))):(this._container.classList.add(`leaflet-control-geocoder-options-error`),this._errorElement.classList.add(`leaflet-control-geocoder-error`))}markGeocode(e){let n=e.geocode;return this._map.fitBounds(n.bbox),this._geocodeMarker&&this._map.removeLayer(this._geocodeMarker),this._geocodeMarker=new t.Marker(n.center).bindPopup(n.html||n.name).addTo(this._map).openPopup(),this}async _geocode(e=!1){let n=this._input.value;if(!e&&n.length<this.options.queryMinLength)return;let r=++this._requestCount;this._lastGeocode=n,e||this._clearResults();let i={input:n};this.fire(e?`startsuggest`:`startgeocode`,i);let a={map:this._map},o;if(e)try{o=await this.options.geocoder.suggest(n,a)}catch(e){if(e instanceof l){this._suggestUnsupported=!0,t.DomEvent.off(this._input,`input`,this._change,this);return}throw e}else o=await this.options.geocoder.geocode(n,a);if(r===this._requestCount){let t={input:n,results:o};this.fire(e?`finishsuggest`:`finishgeocode`,t),this._geocodeResult(o,e)}}_geocodeResultSelected(e){let t={geocode:e};this.fire(`markgeocode`,t)}_toggle(){this._container.classList.contains(`leaflet-control-geocoder-expanded`)?this._collapse():this._expand()}_expand(){this._container.classList.add(`leaflet-control-geocoder-expanded`),this._input.select(),this.fire(`expand`)}_collapse(){this._container.classList.remove(`leaflet-control-geocoder-expanded`),this._alts.classList.add(`leaflet-control-geocoder-alternatives-minimized`),this._errorElement.classList.remove(`leaflet-control-geocoder-error`),this._container.classList.remove(`leaflet-control-geocoder-options-open`),this._container.classList.remove(`leaflet-control-geocoder-options-error`),this._input.blur(),this.fire(`collapse`)}_clearResults(){this._alts.classList.add(`leaflet-control-geocoder-alternatives-minimized`),this._selection=null,this._errorElement.classList.remove(`leaflet-control-geocoder-error`),this._container.classList.remove(`leaflet-control-geocoder-options-open`),this._container.classList.remove(`leaflet-control-geocoder-options-error`)}_createAlt(e,n){let r=t.DomUtil.create(`li`,``),i=t.DomUtil.create(`a`,``,r),a=this.options.showResultIcons&&e.icon?t.DomUtil.create(`img`,``,i):null,o=e.html?void 0:document.createTextNode(e.name);return a&&(a.src=e.icon),r.setAttribute(`data-result-index`,String(n)),e.html?i.innerHTML+=e.html:o&&i.appendChild(o),t.DomEvent.on(r,`mousedown touchstart`,n=>{this._preventBlurCollapse=!0,t.DomEvent.stop(n),this._geocodeResultSelected(e),t.DomEvent.on(r,`click touchend`,()=>{this.options.collapsed?this._collapse():this._clearResults()})},this),r}_keydown(e){let n=e=>{this._selection&&=(this._selection.classList.remove(`leaflet-control-geocoder-selected`),this._selection[e>0?`nextSibling`:`previousSibling`]),this._selection||=this._alts[e>0?`firstChild`:`lastChild`],this._selection&&this._selection.classList.add(`leaflet-control-geocoder-selected`)};switch(e.key){case`Escape`:this.options.collapsed?this._collapse():this._clearResults();break;case`ArrowUp`:n(-1);break;case`ArrowDown`:n(1);break;case`Enter`:if(this._selection){let e=parseInt(this._selection.getAttribute(`data-result-index`),10);this._geocodeResultSelected(this._results[e]),this._clearResults()}else this._geocode();break;default:return}t.DomEvent.preventDefault(e)}_change(){if(this._suggestUnsupported)return;let e=this._input.value;e!==this._lastGeocode&&(clearTimeout(this._suggestTimeout),e.length>=this.options.suggestMinLength?this._suggestTimeout=setTimeout(()=>this._geocode(!0),this.options.suggestTimeout):this._clearResults())}};function $(e){return new Q(e)}Object.assign(Q,X);var ue=Q;Object.assign(t.Control,{Geocoder:Q,geocoder:$}),e.Geocoder=Q,e.default=ue,e.geocoder=$,Object.defineProperty(e,"geocoders",{enumerable:!0,get:function(){return X}})}); 2//# sourceMappingURL=Control.Geocoder.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.