ws-voice-infinity-global-module 1.0.83 → 1.0.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/assets/images/svg/footer-r41-master-plan-background.svg +11 -0
- package/lib/assets/localSave/Control.Geocoder.min.js +1 -1
- package/lib/assets/localSave/leaflet.js +5 -5
- package/lib/assets/localSave/lz-string.js +1 -1
- package/lib/index.css +2 -2
- package/lib/module/components/footer/footer.js +1 -1
- package/lib/module/components/footer/templates/r41/footerTemplate.js +1 -1
- package/lib/module/services/topNavMainPageService.js +1 -1
- package/lib/module/services/topNavService.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<svg width="650" height="302" viewBox="0 0 650 302" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#clip0_709_327)">
|
|
3
|
+
<path d="M395.946 101.027C339.189 125.351 287.838 160.486 243.243 203.729L263.513 75.351L266.216 72.6483L268.919 71.297L395.946 101.027ZM786.486 2.37803L783.784 -0.324669H779.73L666.216 63.1888C728.378 71.297 787.838 90.2159 841.892 118.594L786.486 2.37803ZM83.7838 264.54L81.0811 267.243V271.297L117.568 395.621C139.189 337.513 171.622 283.459 210.811 237.513L83.7838 264.54ZM1163.51 363.189V359.135L1162.16 356.432L1040.54 307.783C1071.62 359.135 1094.59 417.243 1105.41 479.405L1163.51 363.189ZM36.4865 784.81V788.865L37.8378 791.567L158.108 840.216C127.027 788.865 104.054 730.756 93.2432 668.594L36.4865 784.81ZM1116.22 883.459L1118.92 880.756L1120.27 876.702L1083.78 752.378C1062.16 810.486 1029.73 864.54 990.541 910.486L1116.22 883.459ZM931.081 1076.7L933.784 1075.35L936.486 1072.65L956.757 944.27C912.162 987.513 860.811 1021.3 804.054 1046.97L931.081 1076.7ZM413.513 1145.62L416.216 1146.97H420.27L533.784 1083.46C471.622 1075.35 412.162 1056.43 358.108 1028.05L413.513 1145.62ZM620.27 60.4861L518.919 -21.9463H514.865H513.513L439.189 84.8105C490.54 68.5942 544.595 59.1348 600 59.1348C606.757 59.1348 613.513 59.1348 620.27 60.4861ZM185.135 878.054L183.784 1007.78L185.135 1010.49L187.838 1011.84L317.568 1003.73C267.568 971.297 221.622 928.054 185.135 878.054ZM1014.86 269.946L1016.22 140.216L1014.86 136.162L1012.16 134.81L882.432 142.919C933.784 176.702 978.378 219.946 1014.86 269.946ZM579.73 1087.51L681.081 1169.95H685.135L687.838 1168.59L762.162 1061.84C710.811 1078.05 656.757 1087.51 601.351 1087.51C593.243 1088.86 586.486 1087.51 579.73 1087.51ZM1097.3 707.783L1200 628.054L1201.35 624V619.946L1113.51 524C1114.86 540.216 1116.22 556.432 1116.22 572.648C1114.86 619.946 1108.11 665.892 1097.3 707.783ZM104.054 438.865L1.35135 518.594L0 522.648V526.702L87.8378 622.648C86.4865 606.432 85.1351 590.216 85.1351 574C85.1351 526.702 91.8919 482.108 104.054 438.865Z" fill="#143A84"/>
|
|
4
|
+
<path d="M477.027 1161.84L554.054 1118.59L621.622 1174L477.027 1161.84ZM794.595 1084.81L879.73 1105.08L743.243 1156.43L794.595 1084.81ZM233.784 1049.68L321.622 1044.27L359.459 1124L233.784 1049.68ZM997.297 949.676L1083.78 930.757L983.784 1036.16L997.297 949.676ZM63.5135 844.27L144.595 876.703L143.243 964.541L63.5135 844.27ZM1120.27 740.216L1189.19 686.162L1144.59 824L1120.27 740.216ZM0 584.811L59.4595 649.676L20.2703 728.054L0 584.811ZM1140.54 498.324L1179.73 419.946L1200 564.541L1140.54 498.324ZM54.0541 322.649L79.7297 406.432L10.8108 460.486L54.0541 322.649ZM1054.05 271.297L1055.41 183.459L1136.49 305.081L1054.05 271.297ZM217.568 111.838L204.054 198.324L117.568 217.243L217.568 111.838ZM840.54 24L966.216 98.3243L878.378 103.73L840.54 24ZM320.27 42.9189L456.757 -8.43243L405.405 63.1892L320.27 42.9189ZM578.378 -26L722.973 -13.8378L645.946 29.4054L578.378 -26Z" fill="#1B4AA4"/>
|
|
5
|
+
</g>
|
|
6
|
+
<defs>
|
|
7
|
+
<clipPath id="clip0_709_327">
|
|
8
|
+
<rect width="1200" height="1200" fill="white" transform="translate(0 -26)"/>
|
|
9
|
+
</clipPath>
|
|
10
|
+
</defs>
|
|
11
|
+
</svg>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";window.L=window.L||{},window.L.Control=window.L.Control||{},window.L.Control.Geocoder=function(e){function t(e){return d[e]}function o(t,o,s,n,r){var l="_l_geocoder_"+a++;o[r||"callback"]=l,window[l]=e.Util.bind(s,n);var c=document.createElement("script");c.type="text/javascript",c.src=t+i(o),c.id=l,document.getElementsByTagName("head")[0].appendChild(c)}function s(e,t,o){var s=new XMLHttpRequest;s.onreadystatechange=function(){if(4===s.readyState){var e;if(200!==s.status&&304!==s.status)e="";else if("string"==typeof s.response)try{e=JSON.parse(s.response)}catch(t){e=s.response}else e=s.response;o(e)}},s.open("GET",e+i(t),!0),s.responseType="json",s.setRequestHeader("Accept","application/json"),s.send(null)}function n(e,o){return e.replace(/\{ *([\w_]+) *\}/g,function(e,s){var n=o[s];return void 0===n?n="":"function"==typeof n&&(n=n(o)),function(e){return null==e?"":e?(e=""+e,c.test(e)?e.replace(l,t):e):e+""}(n)})}function i(t,o,s){var n=[];for(var i in t){var r=encodeURIComponent(s?i.toUpperCase():i),a=t[i];if(e.Util.isArray(a))for(var l=0;l<a.length;l++)n.push(r+"="+encodeURIComponent(a[l]));else n.push(r+"="+encodeURIComponent(a))}return(o&&-1!==o.indexOf("?")?"&":"?")+n.join("&")}function r(e,t){return new x(e,t)}e=e&&e.hasOwnProperty("default")?e["default"]:e;var a=0,l=/[&<>"'`]/g,c=/[&<>"'`]/,d={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},u=e.Class.extend({options:{service_url:"https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer"},initialize:function(t,o){e.setOptions(this,o),this._accessToken=t},geocode:function(t,o,n){var i={SingleLine:t,outFields:"Addr_Type",forStorage:!1,maxLocations:10,f:"json"};this._key&&this._key.length&&(i.token=this._key),s(this.options.service_url+"/findAddressCandidates",e.extend(i,this.options.geocodingQueryParams),function(t){var s,i,r,a=[];if(t.candidates&&t.candidates.length)for(var l=0;l<=t.candidates.length-1;l++)s=t.candidates[l],i=e.latLng(s.location.y,s.location.x),r=e.latLngBounds(e.latLng(s.extent.ymax,s.extent.xmax),e.latLng(s.extent.ymin,s.extent.xmin)),a[l]={name:s.address,bbox:r,center:i};o.call(n,a)})},suggest:function(e,t,o){return this.geocode(e,t,o)},reverse:function(t,o,n,i){var r={location:encodeURIComponent(t.lng)+","+encodeURIComponent(t.lat),distance:100,f:"json"};s(this.options.service_url+"/reverseGeocode",r,function(t){var o,s=[];t&&!t.error&&(o=e.latLng(t.location.y,t.location.x),s.push({name:t.address.Match_addr,center:o,bounds:e.latLngBounds(o,o)})),n.call(i,s)})}}),p=e.Class.extend({initialize:function(e){this.key=e},geocode:function(t,s,n){o("https://dev.virtualearth.net/REST/v1/Locations",{query:t,key:this.key},function(t){var o=[];if(0<t.resourceSets.length)for(var i=t.resourceSets[0].resources.length-1;0<=i;i--){var r=t.resourceSets[0].resources[i],a=r.bbox;o[i]={name:r.name,bbox:e.latLngBounds([a[0],a[1]],[a[2],a[3]]),center:e.latLng(r.point.coordinates)}}s.call(n,o)},this,"jsonp")},reverse:function(t,s,n,i){o("//dev.virtualearth.net/REST/v1/Locations/"+t.lat+","+t.lng,{key:this.key},function(t){for(var o=[],s=t.resourceSets[0].resources.length-1;0<=s;s--){var r=t.resourceSets[0].resources[s],a=r.bbox;o[s]={name:r.name,bbox:e.latLngBounds([a[0],a[1]],[a[2],a[3]]),center:e.latLng(r.point.coordinates)}}n.call(i,o)},this,"jsonp")}}),h=e.Class.extend({options:{serviceUrl:"https://maps.googleapis.com/maps/api/geocode/json",geocodingQueryParams:{},reverseQueryParams:{}},initialize:function(t,o){this._key=t,e.setOptions(this,o),this.options.serviceUrl=this.options.service_url||this.options.serviceUrl},geocode:function(t,o,n){var i={address:t};this._key&&this._key.length&&(i.key=this._key),i=e.Util.extend(i,this.options.geocodingQueryParams),s(this.options.serviceUrl,i,function(t){var s,i,r,a=[];if(t.results&&t.results.length)for(var l=0;l<=t.results.length-1;l++)s=t.results[l],i=e.latLng(s.geometry.location),r=e.latLngBounds(e.latLng(s.geometry.viewport.northeast),e.latLng(s.geometry.viewport.southwest)),a[l]={name:s.formatted_address,bbox:r,center:i,properties:s.address_components};o.call(n,a)})},reverse:function(t,o,n,i){var r={latlng:encodeURIComponent(t.lat)+","+encodeURIComponent(t.lng)};r=e.Util.extend(r,this.options.reverseQueryParams),this._key&&this._key.length&&(r.key=this._key),s(this.options.serviceUrl,r,function(t){var o,s,r,a=[];if(t.results&&t.results.length)for(var l=0;l<=t.results.length-1;l++)o=t.results[l],s=e.latLng(o.geometry.location),r=e.latLngBounds(e.latLng(o.geometry.viewport.northeast),e.latLng(o.geometry.viewport.southwest)),a[l]={name:o.formatted_address,bbox:r,center:s,properties:o.address_components};n.call(i,a)})}}),g=e.Class.extend({options:{geocodeUrl:"https://geocoder.api.here.com/6.2/geocode.json",reverseGeocodeUrl:"https://reverse.geocoder.api.here.com/6.2/reversegeocode.json",app_id:"<insert your app_id here>",app_code:"<insert your app_code here>",geocodingQueryParams:{},reverseQueryParams:{},reverseGeocodeProxRadius:null},initialize:function(t){e.setOptions(this,t)},geocode:function(t,o,s){var n={searchtext:t,gen:9,app_id:this.options.app_id,app_code:this.options.app_code,jsonattributes:1};n=e.Util.extend(n,this.options.geocodingQueryParams),this.getJSON(this.options.geocodeUrl,n,o,s)},reverse:function(t,o,s,n){var i=this.options.reverseGeocodeProxRadius?this.options.reverseGeocodeProxRadius:null,r=i?","+encodeURIComponent(i):"",a={prox:encodeURIComponent(t.lat)+","+encodeURIComponent(t.lng)+r,mode:"retrieveAddresses",app_id:this.options.app_id,app_code:this.options.app_code,gen:9,jsonattributes:1};a=e.Util.extend(a,this.options.reverseQueryParams),this.getJSON(this.options.reverseGeocodeUrl,a,s,n)},getJSON:function(t,o,n,i){s(t,o,function(t){var o,s,r,a=[];if(t.response.view&&t.response.view.length)for(var l=0;l<=t.response.view[0].result.length-1;l++)o=t.response.view[0].result[l].location,s=e.latLng(o.displayPosition.latitude,o.displayPosition.longitude),r=e.latLngBounds(e.latLng(o.mapView.topLeft.latitude,o.mapView.topLeft.longitude),e.latLng(o.mapView.bottomRight.latitude,o.mapView.bottomRight.longitude)),a[l]={name:o.address.label,bbox:r,center:s};n.call(i,a)})}}),m=e.Class.extend({options:{next:void 0,sizeInMeters:1e4},initialize:function(t){e.Util.setOptions(this,t)},geocode:function(t,o,s){var n,i;if((n=t.match(/^([NS])\s*(\d{1,3}(?:\.\d*)?)\W*([EW])\s*(\d{1,3}(?:\.\d*)?)$/))?i=e.latLng((/N/i.test(n[1])?1:-1)*parseFloat(n[2]),(/E/i.test(n[3])?1:-1)*parseFloat(n[4])):(n=t.match(/^(\d{1,3}(?:\.\d*)?)\s*([NS])\W*(\d{1,3}(?:\.\d*)?)\s*([EW])$/))?i=e.latLng((/N/i.test(n[2])?1:-1)*parseFloat(n[1]),(/E/i.test(n[4])?1:-1)*parseFloat(n[3])):(n=t.match(/^([NS])\s*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\W*([EW])\s*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?$/))?i=e.latLng((/N/i.test(n[1])?1:-1)*(parseFloat(n[2])+parseFloat(n[3]/60)),(/E/i.test(n[4])?1:-1)*(parseFloat(n[5])+parseFloat(n[6]/60))):(n=t.match(/^(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\s*([NS])\W*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\s*([EW])$/))?i=e.latLng((/N/i.test(n[3])?1:-1)*(parseFloat(n[1])+parseFloat(n[2]/60)),(/E/i.test(n[6])?1:-1)*(parseFloat(n[4])+parseFloat(n[5]/60))):(n=t.match(/^([NS])\s*(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]?\W*([EW])\s*(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]?$/))?i=e.latLng((/N/i.test(n[1])?1:-1)*(parseFloat(n[2])+parseFloat(n[3]/60+parseFloat(n[4]/3600))),(/E/i.test(n[5])?1:-1)*(parseFloat(n[6])+parseFloat(n[7]/60)+parseFloat(n[8]/3600))):(n=t.match(/^(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]\s*([NS])\W*(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]?\s*([EW])$/))?i=e.latLng((/N/i.test(n[4])?1:-1)*(parseFloat(n[1])+parseFloat(n[2]/60+parseFloat(n[3]/3600))),(/E/i.test(n[8])?1:-1)*(parseFloat(n[5])+parseFloat(n[6]/60)+parseFloat(n[7]/3600))):(n=t.match(/^\s*([+-]?\d+(?:\.\d*)?)\s*[\s,]\s*([+-]?\d+(?:\.\d*)?)\s*$/))&&(i=e.latLng(parseFloat(n[1]),parseFloat(n[2]))),i){var r=[{name:t,center:i,bbox:i.toBounds(this.options.sizeInMeters)}];o.call(s,r)}else this.options.next&&this.options.next.geocode(t,o,s)}}),f=e.Class.extend({options:{serviceUrl:"https://api.mapbox.com/geocoding/v5/mapbox.places/",geocodingQueryParams:{},reverseQueryParams:{}},initialize:function(t,o){e.setOptions(this,o),this.options.geocodingQueryParams.access_token=t,this.options.reverseQueryParams.access_token=t},geocode:function(t,o,n){var i=this.options.geocodingQueryParams;void 0!==i.proximity&&void 0!==i.proximity.lat&&void 0!==i.proximity.lng&&(i.proximity=i.proximity.lng+","+i.proximity.lat),s(this.options.serviceUrl+encodeURIComponent(t)+".json",i,function(t){var s,i,r,a=[];if(t.features&&t.features.length)for(var l=0;l<=t.features.length-1;l++){s=t.features[l],i=e.latLng(s.center.reverse()),r=s.bbox?e.latLngBounds(e.latLng(s.bbox.slice(0,2).reverse()),e.latLng(s.bbox.slice(2,4).reverse())):e.latLngBounds(i,i);for(var c={text:s.text,address:s.address},d=0;d<(s.context||[]).length;d++)c[s.context[d].id.split(".")[0]]=s.context[d].text;a[l]={name:s.place_name,bbox:r,center:i,properties:c}}o.call(n,a)})},suggest:function(e,t,o){return this.geocode(e,t,o)},reverse:function(t,o,n,i){s(this.options.serviceUrl+encodeURIComponent(t.lng)+","+encodeURIComponent(t.lat)+".json",this.options.reverseQueryParams,function(t){var o,s,r,a=[];if(t.features&&t.features.length)for(var l=0;l<=t.features.length-1;l++)o=t.features[l],s=e.latLng(o.center.reverse()),r=o.bbox?e.latLngBounds(e.latLng(o.bbox.slice(0,2).reverse()),e.latLng(o.bbox.slice(2,4).reverse())):e.latLngBounds(s,s),a[l]={name:o.place_name,bbox:r,center:s};n.call(i,a)})}}),v=e.Class.extend({options:{serviceUrl:"https://www.mapquestapi.com/geocoding/v1"},initialize:function(t,o){this._key=decodeURIComponent(t),e.Util.setOptions(this,o)},_formatName:function(){var e,t=[];for(e=0;e<arguments.length;e++)arguments[e]&&t.push(arguments[e]);return t.join(", ")},geocode:function(t,o,n){s(this.options.serviceUrl+"/address",{key:this._key,location:t,limit:5,outFormat:"json"},e.bind(function(t){var s,i,r=[];if(t.results&&t.results[0].locations)for(var a=t.results[0].locations.length-1;0<=a;a--)s=t.results[0].locations[a],i=e.latLng(s.latLng),r[a]={name:this._formatName(s.street,s.adminArea4,s.adminArea3,s.adminArea1),bbox:e.latLngBounds(i,i),center:i};o.call(n,r)},this))},reverse:function(t,o,n,i){s(this.options.serviceUrl+"/reverse",{key:this._key,location:t.lat+","+t.lng,outputFormat:"json"},e.bind(function(t){var o,s,r=[];if(t.results&&t.results[0].locations)for(var a=t.results[0].locations.length-1;0<=a;a--)o=t.results[0].locations[a],s=e.latLng(o.latLng),r[a]={name:this._formatName(o.street,o.adminArea4,o.adminArea3,o.adminArea1),bbox:e.latLngBounds(s,s),center:s};n.call(i,r)},this))}}),_=e.Class.extend({options:{userId:"<insert your userId here>",apiKey:"<insert your apiKey here>",serviceUrl:"https://neutrinoapi.com/"},initialize:function(t){e.Util.setOptions(this,t)},geocode:function(t,o,n){s(this.options.serviceUrl+"geocode-address",{apiKey:this.options.apiKey,userId:this.options.userId,address:t.split(/\s+/).join(".")},function(t){var s,i,r=[];t.locations&&(t.geometry=t.locations[0],s=e.latLng(t.geometry.latitude,t.geometry.longitude),i=e.latLngBounds(s,s),r[0]={name:t.geometry.address,bbox:i,center:s}),o.call(n,r)})},suggest:function(e,t,o){return this.geocode(e,t,o)},reverse:function(t,o,n,i){s(this.options.serviceUrl+"geocode-reverse",{apiKey:this.options.apiKey,userId:this.options.userId,latitude:t.lat,longitude:t.lng},function(o){var s,r,a=[];200==o.status.status&&o.found&&(s=e.latLng(t.lat,t.lng),r=e.latLngBounds(s,s),a[0]={name:o.address,bbox:r,center:s}),n.call(i,a)})}}),b=e.Class.extend({options:{serviceUrl:"https://nominatim.openstreetmap.org/",geocodingQueryParams:{},reverseQueryParams:{},htmlTemplate:function(e){var t=e.address,o=[];return(t.road||t.building)&&o.push("{building} {road} {house_number}"),(t.city||t.town||t.village||t.hamlet)&&o.push('<span class="'+(0<o.length?"leaflet-control-geocoder-address-detail":"")+'">{postcode} {city} {town} {village} {hamlet}</span>'),(t.state||t.country)&&o.push('<span class="'+(0<o.length?"leaflet-control-geocoder-address-context":"")+'">{state} {country}</span>'),n(o.join("<br/>"),t)}},initialize:function(t){e.Util.setOptions(this,t)},geocode:function(t,o,n){s(this.options.serviceUrl+"search",e.extend({q:t,limit:5,format:"json",addressdetails:1},this.options.geocodingQueryParams),e.bind(function(t){for(var s=[],i=t.length-1;0<=i;i--){for(var r=t[i].boundingbox,a=0;a<4;a++)r[a]=parseFloat(r[a]);s[i]={icon:t[i].icon,name:t[i].display_name,html:this.options.htmlTemplate?this.options.htmlTemplate(t[i]):void 0,bbox:e.latLngBounds([r[0],r[2]],[r[1],r[3]]),center:e.latLng(t[i].lat,t[i].lon),properties:t[i]}}o.call(n,s)},this))},reverse:function(t,o,n,i){s(this.options.serviceUrl+"reverse",e.extend({lat:t.lat,lon:t.lng,zoom:Math.round(Math.log(o/256)/Math.log(2)),addressdetails:1,format:"json"},this.options.reverseQueryParams),e.bind(function(t){var o,s=[];t&&t.lat&&t.lon&&(o=e.latLng(t.lat,t.lon),s.push({name:t.display_name,html:this.options.htmlTemplate?this.options.htmlTemplate(t):void 0,center:o,bounds:e.latLngBounds(o,o),properties:t})),n.call(i,s)},this))}}),L=e.Class.extend({options:{OpenLocationCode:void 0,codeLength:void 0},initialize:function(t){e.setOptions(this,t)},geocode:function(t,o,s){try{var n=this.options.OpenLocationCode.decode(t),i={name:t,center:e.latLng(n.latitudeCenter,n.longitudeCenter),bbox:e.latLngBounds(e.latLng(n.latitudeLo,n.longitudeLo),e.latLng(n.latitudeHi,n.longitudeHi))};o.call(s,[i])}catch(t){console.warn(t),o.call(s,[])}},reverse:function(t,o,s,n){try{var i={name:this.options.OpenLocationCode.encode(t.lat,t.lng,this.options.codeLength),center:e.latLng(t.lat,t.lng),bbox:e.latLngBounds(e.latLng(t.lat,t.lng),e.latLng(t.lat,t.lng))};s.call(n,[i])}catch(t){console.warn(t),s.call(n,[])}}}),y=e.Class.extend({options:{serviceUrl:"https://api.opencagedata.com/geocode/v1/json"},initialize:function(e){this._accessToken=e},geocode:function(t,o,n){s(this.options.serviceUrl,{key:this._accessToken,q:t},function(t){var s,i,r,a=[];if(t.results&&t.results.length)for(var l=0;l<t.results.length;l++)r=t.results[l],s=e.latLng(r.geometry),i=r.annotations&&r.annotations.bounds?e.latLngBounds(e.latLng(r.annotations.bounds.northeast),e.latLng(r.annotations.bounds.southwest)):e.latLngBounds(s,s),a.push({name:r.formatted,bbox:i,center:s});o.call(n,a)})},suggest:function(e,t,o){return this.geocode(e,t,o)},reverse:function(t,o,n,i){s(this.options.serviceUrl,{key:this._accessToken,q:[t.lat,t.lng].join(",")},function(t){var o,s,r,a=[];if(t.results&&t.results.length)for(var l=0;l<t.results.length;l++)r=t.results[l],o=e.latLng(r.geometry),s=r.annotations&&r.annotations.bounds?e.latLngBounds(e.latLng(r.annotations.bounds.northeast),e.latLng(r.annotations.bounds.southwest)):e.latLngBounds(o,o),a.push({name:r.formatted,bbox:s,center:o});n.call(i,a)})}}),x=e.Class.extend({options:{serviceUrl:"https://api.geocode.earth/v1",geocodingQueryParams:{},reverseQueryParams:{}},initialize:function(t,o){e.Util.setOptions(this,o),this._apiKey=t,this._lastSuggest=0},geocode:function(t,o,n){var i=this;s(this.options.serviceUrl+"/search",e.extend({api_key:this._apiKey,text:t},this.options.geocodingQueryParams),function(e){o.call(n,i._parseResults(e,"bbox"))})},suggest:function(t,o,n){var i=this;s(this.options.serviceUrl+"/autocomplete",e.extend({api_key:this._apiKey,text:t},this.options.geocodingQueryParams),e.bind(function(e){e.geocoding.timestamp>this._lastSuggest&&(this._lastSuggest=e.geocoding.timestamp,o.call(n,i._parseResults(e,"bbox")))},this))},reverse:function(t,o,n,i){var r=this;s(this.options.serviceUrl+"/reverse",e.extend({api_key:this._apiKey,"point.lat":t.lat,"point.lon":t.lng},this.options.reverseQueryParams),function(e){n.call(i,r._parseResults(e,"bounds"))})},_parseResults:function(t,o){var s=[];return e.geoJson(t,{pointToLayer:function(t,o){return e.circleMarker(o)},onEachFeature:function(t,n){var i,r,a={};n.getBounds?r=(i=n.getBounds()).getCenter():i=n.feature.bbox?(r=n.getLatLng(),e.latLngBounds(e.GeoJSON.coordsToLatLng(n.feature.bbox.slice(0,2)),e.GeoJSON.coordsToLatLng(n.feature.bbox.slice(2,4)))):(r=n.getLatLng(),e.latLngBounds(r,r)),a.name=n.feature.properties.label,a.center=r,a[o]=i,a.properties=n.feature.properties,s.push(a)}}),s}}),U=x,C=r,k=x,w=r,D=k.extend({options:{serviceUrl:"https://api.openrouteservice.org/geocode"}}),E=e.Class.extend({options:{serviceUrl:"https://photon.komoot.de/api/",reverseUrl:"https://photon.komoot.de/reverse/",nameProperties:["name","street","suburb","hamlet","town","city","state","country"]},initialize:function(t){e.setOptions(this,t)},geocode:function(t,o,n){var i=e.extend({q:t},this.options.geocodingQueryParams);s(this.options.serviceUrl,i,e.bind(function(e){o.call(n,this._decodeFeatures(e))},this))},suggest:function(e,t,o){return this.geocode(e,t,o)},reverse:function(t,o,n,i){var r=e.extend({lat:t.lat,lon:t.lng},this.options.reverseQueryParams);s(this.options.reverseUrl,r,e.bind(function(e){n.call(i,this._decodeFeatures(e))},this))},_decodeFeatures:function(t){var o,s,n,i,r,a,l=[];if(t&&t.features)for(o=0;o<t.features.length;o++)n=(s=t.features[o]).geometry.coordinates,i=e.latLng(n[1],n[0]),a=(r=s.properties.extent)?e.latLngBounds([r[1],r[0]],[r[3],r[2]]):e.latLngBounds(i,i),l.push({name:this._decodeFeatureName(s),html:this.options.htmlTemplate?this.options.htmlTemplate(s):void 0,center:i,bbox:a,properties:s.properties});return l},_decodeFeatureName:function(e){return(this.options.nameProperties||[]).map(function(t){return e.properties[t]}).filter(function(e){return!!e}).join(", ")}}),R=e.Class.extend({options:{serviceUrl:"https://api.what3words.com/v2/"},initialize:function(e){this._accessToken=e},geocode:function(t,o,n){s(this.options.serviceUrl+"forward",{key:this._accessToken,addr:t.split(/\s+/).join(".")},function(t){var s,i,r=[];t.geometry&&(s=e.latLng(t.geometry.lat,t.geometry.lng),i=e.latLngBounds(s,s),r[0]={name:t.words,bbox:i,center:s}),o.call(n,r)})},suggest:function(e,t,o){return this.geocode(e,t,o)},reverse:function(t,o,n,i){s(this.options.serviceUrl+"reverse",{key:this._accessToken,coords:[t.lat,t.lng].join(",")},function(t){var o,s,r=[];200==t.status.status&&(o=e.latLng(t.geometry.lat,t.geometry.lng),s=e.latLngBounds(o,o),r[0]={name:t.words,bbox:s,center:o}),n.call(i,r)})}}),P=Object.freeze({ArcGis:u,arcgis:function(e,t){return new u(e,t)},Bing:p,bing:function(e){return new p(e)},Google:h,google:function(e,t){return new h(e,t)},HERE:g,here:function(e){return new g(e)},LatLng:m,latLng:function(e){return new m(e)},Mapbox:f,mapbox:function(e,t){return new f(e,t)},MapQuest:v,mapQuest:function(e,t){return new v(e,t)},Neutrino:_,neutrino:function(e){return new _(e)},Nominatim:b,nominatim:function(e){return new b(e)},OpenLocationCode:L,openLocationCode:function(e){return new L(e)},OpenCage:y,opencage:function(e){return new y(e)},Pelias:x,pelias:r,GeocodeEarth:U,geocodeEarth:C,Mapzen:k,mapzen:w,Openrouteservice:D,openrouteservice:function(e,t){return new D(e,t)},Photon:E,photon:function(e){return new E(e)},What3Words:R,what3words:function(e){return new R(e)}}),T=e.Control.extend({options:{showUniqueResult:!0,showResultIcons:!1,collapsed:!0,expand:"touch",position:"topright",placeholder:"Search...",errorMessage:"Nothing found.",queryMinLength:1,suggestMinLength:3,suggestTimeout:250,defaultMarkGeocode:!0},includes:e.Evented.prototype||e.Mixin.Events,initialize:function(t){e.Util.setOptions(this,t),this.options.geocoder||(this.options.geocoder=new b),this._requestCount=0},addThrobberClass:function(){e.DomUtil.addClass(this._container,"leaflet-control-geocoder-throbber")},removeThrobberClass:function(){e.DomUtil.removeClass(this._container,"leaflet-control-geocoder-throbber")},onAdd:function(t){var o,s="leaflet-control-geocoder",n=e.DomUtil.create("div",s+" leaflet-bar"),i=e.DomUtil.create("button",s+"-icon",n),r=this._form=e.DomUtil.create("div",s+"-form",n);return this._map=t,this._container=n,i.innerHTML=" ",i.type="button",(o=this._input=e.DomUtil.create("input","",r)).type="text",o.placeholder=this.options.placeholder,e.DomEvent.disableClickPropagation(o),this._errorElement=e.DomUtil.create("div",s+"-form-no-error",n),this._errorElement.innerHTML=this.options.errorMessage,this._alts=e.DomUtil.create("ul",s+"-alternatives leaflet-control-geocoder-alternatives-minimized",n),e.DomEvent.disableClickPropagation(this._alts),e.DomEvent.addListener(o,"keydown",this._keydown,this),this.options.geocoder.suggest&&e.DomEvent.addListener(o,"input",this._change,this),e.DomEvent.addListener(o,"blur",function(){this.options.collapsed&&!this._preventBlurCollapse&&this._collapse(),this._preventBlurCollapse=!1},this),this.options.collapsed?"click"===this.options.expand?e.DomEvent.addListener(n,"click",function(e){0===e.button&&2!==e.detail&&this._toggle()},this):e.Browser.touch&&"touch"===this.options.expand?e.DomEvent.addListener(n,"touchstart mousedown",function(e){this._toggle(),e.preventDefault(),e.stopPropagation()},this):(e.DomEvent.addListener(n,"mouseover",this._expand,this),e.DomEvent.addListener(n,"mouseout",this._collapse,this),this._map.on("movestart",this._collapse,this)):(this._expand(),e.Browser.touch?e.DomEvent.addListener(n,"touchstart",function(){this._geocode()},this):e.DomEvent.addListener(n,"click",function(){this._geocode()},this)),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),e.DomEvent.disableClickPropagation(n),n},_geocodeResult:function(t,o){if(!o&&this.options.showUniqueResult&&1===t.length)this._geocodeResultSelected(t[0]);else if(0<t.length){this._alts.innerHTML="",this._results=t,e.DomUtil.removeClass(this._alts,"leaflet-control-geocoder-alternatives-minimized"),e.DomUtil.addClass(this._container,"leaflet-control-geocoder-options-open");for(var s=0;s<t.length;s++)this._alts.appendChild(this._createAlt(t[s],s))}else e.DomUtil.addClass(this._container,"leaflet-control-geocoder-options-error"),e.DomUtil.addClass(this._errorElement,"leaflet-control-geocoder-error")},markGeocode:function(t){return t=t.geocode||t,this._map.fitBounds(t.bbox),this._geocodeMarker&&this._map.removeLayer(this._geocodeMarker),this._geocodeMarker=new e.Marker(t.center).bindPopup(t.html||t.name).addTo(this._map).openPopup(),this},_geocode:function(e){var t=this._input.value;if(e||!(t.length<this.options.queryMinLength)){var o=++this._requestCount,s=e?"suggest":"geocode",n={input:t};this._lastGeocode=t,e||this._clearResults(),this.fire("start"+s,n),this.options.geocoder[s](t,function(t){o===this._requestCount&&(n.results=t,this.fire("finish"+s,n),this._geocodeResult(t,e))},this)}},_geocodeResultSelected:function(e){this.fire("markgeocode",{geocode:e})},_toggle:function(){e.DomUtil.hasClass(this._container,"leaflet-control-geocoder-expanded")?this._collapse():this._expand()},_expand:function(){e.DomUtil.addClass(this._container,"leaflet-control-geocoder-expanded"),this._input.select(),this.fire("expand")},_collapse:function(){e.DomUtil.removeClass(this._container,"leaflet-control-geocoder-expanded"),e.DomUtil.addClass(this._alts,"leaflet-control-geocoder-alternatives-minimized"),e.DomUtil.removeClass(this._errorElement,"leaflet-control-geocoder-error"),e.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-open"),e.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-error"),this._input.blur(),this.fire("collapse")},_clearResults:function(){e.DomUtil.addClass(this._alts,"leaflet-control-geocoder-alternatives-minimized"),this._selection=null,e.DomUtil.removeClass(this._errorElement,"leaflet-control-geocoder-error"),e.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-open"),e.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-error")},_createAlt:function(t,o){var s=e.DomUtil.create("li",""),n=e.DomUtil.create("a","",s),i=this.options.showResultIcons&&t.icon?e.DomUtil.create("img","",n):null,r=t.html?void 0:document.createTextNode(t.name);return i&&(i.src=t.icon),s.setAttribute("data-result-index",o),t.html?n.innerHTML=n.innerHTML+t.html:n.appendChild(r),e.DomEvent.addListener(s,"mousedown touchstart",function(o){this._preventBlurCollapse=!0,e.DomEvent.stop(o),this._geocodeResultSelected(t),e.DomEvent.on(s,"click",function(){this.options.collapsed?this._collapse():this._clearResults()},this)},this),s},_keydown:function(t){function o(t){s._selection&&(e.DomUtil.removeClass(s._selection,"leaflet-control-geocoder-selected"),s._selection=s._selection[0<t?"nextSibling":"previousSibling"]),s._selection||(s._selection=s._alts[0<t?"firstChild":"lastChild"]),s._selection&&e.DomUtil.addClass(s._selection,"leaflet-control-geocoder-selected")}var s=this;switch(t.keyCode){case 27:this.options.collapsed?this._collapse():this._clearResults();break;case 38:o(-1);break;case 40:o(1);break;case 13:if(this._selection){var n=parseInt(this._selection.getAttribute("data-result-index"),10);this._geocodeResultSelected(this._results[n]),this._clearResults()}else this._geocode();break;default:return}e.DomEvent.preventDefault(t)},_change:function(){var t=this._input.value;t!==this._lastGeocode&&(clearTimeout(this._suggestTimeout),t.length>=this.options.suggestMinLength?this._suggestTimeout=setTimeout(e.bind(function(){this._geocode(!0)},this),this.options.suggestTimeout):this._clearResults())}});return e.Util.extend(T,P),e.Util.extend(e.Control,{Geocoder:T,geocoder:function(e){return new T(e)}}),T}(L);
|
|
1
|
+
"use strict";window.L=window.L||{},window.L.Control=window.L.Control||{},window.L.Control.Geocoder=function(e){function t(e){return d[e]}function o(t,o,s,n,r){var l="_l_geocoder_"+a++;o[r||"callback"]=l,window[l]=e.Util.bind(s,n);var c=document.createElement("script");c.type="text/javascript",c.src=t+i(o),c.id=l,document.getElementsByTagName("head")[0].appendChild(c)}function s(e,t,o){var s=new XMLHttpRequest;s.onreadystatechange=function(){if(4===s.readyState){var e;if(200!==s.status&&304!==s.status)e="";else if("string"==typeof s.response)try{e=JSON.parse(s.response)}catch(t){e=s.response}else e=s.response;o(e)}},s.open("GET",e+i(t),!0),s.responseType="json",s.setRequestHeader("Accept","application/json"),s.send(null)}function n(e,o){return e.replace(/\{ *([\w_]+) *\}/g,function(e,s){var n=o[s];return void 0===n?n="":"function"==typeof n&&(n=n(o)),function(e){return null==e?"":e?(e=""+e,c.test(e)?e.replace(l,t):e):e+""}(n)})}function i(t,o,s){var n=[];for(var i in t){var r=encodeURIComponent(s?i.toUpperCase():i),a=t[i];if(e.Util.isArray(a))for(var l=0;l<a.length;l++)n.push(r+"="+encodeURIComponent(a[l]));else n.push(r+"="+encodeURIComponent(a))}return(o&&-1!==o.indexOf("?")?"&":"?")+n.join("&")}function r(e,t){return new x(e,t)}e=e&&e.hasOwnProperty("default")?e["default"]:e;var a=0,l=/[&<>"'`]/g,c=/[&<>"'`]/,d={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},u=e.Class.extend({options:{service_url:"https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer"},initialize:function(t,o){e.setOptions(this,o),this._accessToken=t},geocode:function(t,o,n){var i={SingleLine:t,outFields:"Addr_Type",forStorage:!1,maxLocations:10,f:"json"};this._key&&this._key.length&&(i.token=this._key),s(this.options.service_url+"/findAddressCandidates",e.extend(i,this.options.geocodingQueryParams),function(t){var s,i,r,a=[];if(t.candidates&&t.candidates.length)for(var l=0;l<=t.candidates.length-1;l++)s=t.candidates[l],i=e.latLng(s.location.y,s.location.x),r=e.latLngBounds(e.latLng(s.extent.ymax,s.extent.xmax),e.latLng(s.extent.ymin,s.extent.xmin)),a[l]={name:s.address,bbox:r,center:i};o.call(n,a)})},suggest:function(e,t,o){return this.geocode(e,t,o)},reverse:function(t,o,n,i){var r={location:encodeURIComponent(t.lng)+","+encodeURIComponent(t.lat),distance:100,f:"json"};s(this.options.service_url+"/reverseGeocode",r,function(t){var o,s=[];t&&!t.error&&(o=e.latLng(t.location.y,t.location.x),s.push({name:t.address.Match_addr,center:o,bounds:e.latLngBounds(o,o)})),n.call(i,s)})}}),p=e.Class.extend({initialize:function(e){this.key=e},geocode:function(t,s,n){o("https://dev.virtualearth.net/REST/v1/Locations",{query:t,key:this.key},function(t){var o=[];if(0<t.resourceSets.length)for(var i=t.resourceSets[0].resources.length-1;0<=i;i--){var r=t.resourceSets[0].resources[i],a=r.bbox;o[i]={name:r.name,bbox:e.latLngBounds([a[0],a[1]],[a[2],a[3]]),center:e.latLng(r.point.coordinates)}}s.call(n,o)},this,"jsonp")},reverse:function(t,s,n,i){o("//dev.virtualearth.net/REST/v1/Locations/"+t.lat+","+t.lng,{key:this.key},function(t){for(var o=[],s=t.resourceSets[0].resources.length-1;0<=s;s--){var r=t.resourceSets[0].resources[s],a=r.bbox;o[s]={name:r.name,bbox:e.latLngBounds([a[0],a[1]],[a[2],a[3]]),center:e.latLng(r.point.coordinates)}}n.call(i,o)},this,"jsonp")}}),h=e.Class.extend({options:{serviceUrl:"https://maps.googleapis.com/maps/api/geocode/json",geocodingQueryParams:{},reverseQueryParams:{}},initialize:function(t,o){this._key=t,e.setOptions(this,o),this.options.serviceUrl=this.options.service_url||this.options.serviceUrl},geocode:function(t,o,n){var i={address:t};this._key&&this._key.length&&(i.key=this._key),i=e.Util.extend(i,this.options.geocodingQueryParams),s(this.options.serviceUrl,i,function(t){var s,i,r,a=[];if(t.results&&t.results.length)for(var l=0;l<=t.results.length-1;l++)s=t.results[l],i=e.latLng(s.geometry.location),r=e.latLngBounds(e.latLng(s.geometry.viewport.northeast),e.latLng(s.geometry.viewport.southwest)),a[l]={name:s.formatted_address,bbox:r,center:i,properties:s.address_components};o.call(n,a)})},reverse:function(t,o,n,i){var r={latlng:encodeURIComponent(t.lat)+","+encodeURIComponent(t.lng)};r=e.Util.extend(r,this.options.reverseQueryParams),this._key&&this._key.length&&(r.key=this._key),s(this.options.serviceUrl,r,function(t){var o,s,r,a=[];if(t.results&&t.results.length)for(var l=0;l<=t.results.length-1;l++)o=t.results[l],s=e.latLng(o.geometry.location),r=e.latLngBounds(e.latLng(o.geometry.viewport.northeast),e.latLng(o.geometry.viewport.southwest)),a[l]={name:o.formatted_address,bbox:r,center:s,properties:o.address_components};n.call(i,a)})}}),g=e.Class.extend({options:{geocodeUrl:"https://geocoder.api.here.com/6.2/geocode.json",reverseGeocodeUrl:"https://reverse.geocoder.api.here.com/6.2/reversegeocode.json",app_id:"<insert your app_id here>",app_code:"<insert your app_code here>",geocodingQueryParams:{},reverseQueryParams:{},reverseGeocodeProxRadius:null},initialize:function(t){e.setOptions(this,t)},geocode:function(t,o,s){var n={searchtext:t,gen:9,app_id:this.options.app_id,app_code:this.options.app_code,jsonattributes:1};n=e.Util.extend(n,this.options.geocodingQueryParams),this.getJSON(this.options.geocodeUrl,n,o,s)},reverse:function(t,o,s,n){var i=this.options.reverseGeocodeProxRadius?this.options.reverseGeocodeProxRadius:null,r=i?","+encodeURIComponent(i):"",a={prox:encodeURIComponent(t.lat)+","+encodeURIComponent(t.lng)+r,mode:"retrieveAddresses",app_id:this.options.app_id,app_code:this.options.app_code,gen:9,jsonattributes:1};a=e.Util.extend(a,this.options.reverseQueryParams),this.getJSON(this.options.reverseGeocodeUrl,a,s,n)},getJSON:function(t,o,n,i){s(t,o,function(t){var o,s,r,a=[];if(t.response.view&&t.response.view.length)for(var l=0;l<=t.response.view[0].result.length-1;l++)o=t.response.view[0].result[l].location,s=e.latLng(o.displayPosition.latitude,o.displayPosition.longitude),r=e.latLngBounds(e.latLng(o.mapView.topLeft.latitude,o.mapView.topLeft.longitude),e.latLng(o.mapView.bottomRight.latitude,o.mapView.bottomRight.longitude)),a[l]={name:o.address.label,bbox:r,center:s};n.call(i,a)})}}),m=e.Class.extend({options:{next:void 0,sizeInMeters:1e4},initialize:function(t){e.Util.setOptions(this,t)},geocode:function(t,o,s){var n,i;if((n=t.match(/^([NS])\s*(\d{1,3}(?:\.\d*)?)\W*([EW])\s*(\d{1,3}(?:\.\d*)?)$/))?i=e.latLng((/N/i.test(n[1])?1:-1)*parseFloat(n[2]),(/E/i.test(n[3])?1:-1)*parseFloat(n[4])):(n=t.match(/^(\d{1,3}(?:\.\d*)?)\s*([NS])\W*(\d{1,3}(?:\.\d*)?)\s*([EW])$/))?i=e.latLng((/N/i.test(n[2])?1:-1)*parseFloat(n[1]),(/E/i.test(n[4])?1:-1)*parseFloat(n[3])):(n=t.match(/^([NS])\s*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\W*([EW])\s*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?$/))?i=e.latLng((/N/i.test(n[1])?1:-1)*(parseFloat(n[2])+parseFloat(n[3]/60)),(/E/i.test(n[4])?1:-1)*(parseFloat(n[5])+parseFloat(n[6]/60))):(n=t.match(/^(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\s*([NS])\W*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\s*([EW])$/))?i=e.latLng((/N/i.test(n[3])?1:-1)*(parseFloat(n[1])+parseFloat(n[2]/60)),(/E/i.test(n[6])?1:-1)*(parseFloat(n[4])+parseFloat(n[5]/60))):(n=t.match(/^([NS])\s*(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]?\W*([EW])\s*(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]?$/))?i=e.latLng((/N/i.test(n[1])?1:-1)*(parseFloat(n[2])+parseFloat(n[3]/60+parseFloat(n[4]/3600))),(/E/i.test(n[5])?1:-1)*(parseFloat(n[6])+parseFloat(n[7]/60)+parseFloat(n[8]/3600))):(n=t.match(/^(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]\s*([NS])\W*(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]?\s*([EW])$/))?i=e.latLng((/N/i.test(n[4])?1:-1)*(parseFloat(n[1])+parseFloat(n[2]/60+parseFloat(n[3]/3600))),(/E/i.test(n[8])?1:-1)*(parseFloat(n[5])+parseFloat(n[6]/60)+parseFloat(n[7]/3600))):(n=t.match(/^\s*([+-]?\d+(?:\.\d*)?)\s*[\s,]\s*([+-]?\d+(?:\.\d*)?)\s*$/))&&(i=e.latLng(parseFloat(n[1]),parseFloat(n[2]))),i){var r=[{name:t,center:i,bbox:i.toBounds(this.options.sizeInMeters)}];o.call(s,r)}else this.options.next&&this.options.next.geocode(t,o,s)}}),f=e.Class.extend({options:{serviceUrl:"https://api.mapbox.com/geocoding/v5/mapbox.places/",geocodingQueryParams:{},reverseQueryParams:{}},initialize:function(t,o){e.setOptions(this,o),this.options.geocodingQueryParams.access_token=t,this.options.reverseQueryParams.access_token=t},geocode:function(t,o,n){var i=this.options.geocodingQueryParams;void 0!==i.proximity&&void 0!==i.proximity.lat&&void 0!==i.proximity.lng&&(i.proximity=i.proximity.lng+","+i.proximity.lat),s(this.options.serviceUrl+encodeURIComponent(t)+".json",i,function(t){var s,i,r,a=[];if(t.features&&t.features.length)for(var l=0;l<=t.features.length-1;l++){s=t.features[l],i=e.latLng(s.center.reverse()),r=s.bbox?e.latLngBounds(e.latLng(s.bbox.slice(0,2).reverse()),e.latLng(s.bbox.slice(2,4).reverse())):e.latLngBounds(i,i);for(var c={text:s.text,address:s.address},d=0;d<(s.context||[]).length;d++)c[s.context[d].id.split(".")[0]]=s.context[d].text;a[l]={name:s.place_name,bbox:r,center:i,properties:c}}o.call(n,a)})},suggest:function(e,t,o){return this.geocode(e,t,o)},reverse:function(t,o,n,i){s(this.options.serviceUrl+encodeURIComponent(t.lng)+","+encodeURIComponent(t.lat)+".json",this.options.reverseQueryParams,function(t){var o,s,r,a=[];if(t.features&&t.features.length)for(var l=0;l<=t.features.length-1;l++)o=t.features[l],s=e.latLng(o.center.reverse()),r=o.bbox?e.latLngBounds(e.latLng(o.bbox.slice(0,2).reverse()),e.latLng(o.bbox.slice(2,4).reverse())):e.latLngBounds(s,s),a[l]={name:o.place_name,bbox:r,center:s};n.call(i,a)})}}),v=e.Class.extend({options:{serviceUrl:"https://www.mapquestapi.com/geocoding/v1"},initialize:function(t,o){this._key=decodeURIComponent(t),e.Util.setOptions(this,o)},_formatName:function(){var e,t=[];for(e=0;e<arguments.length;e++)arguments[e]&&t.push(arguments[e]);return t.join(", ")},geocode:function(t,o,n){s(this.options.serviceUrl+"/address",{key:this._key,location:t,limit:5,outFormat:"json"},e.bind(function(t){var s,i,r=[];if(t.results&&t.results[0].locations)for(var a=t.results[0].locations.length-1;0<=a;a--)s=t.results[0].locations[a],i=e.latLng(s.latLng),r[a]={name:this._formatName(s.street,s.adminArea4,s.adminArea3,s.adminArea1),bbox:e.latLngBounds(i,i),center:i};o.call(n,r)},this))},reverse:function(t,o,n,i){s(this.options.serviceUrl+"/reverse",{key:this._key,location:t.lat+","+t.lng,outputFormat:"json"},e.bind(function(t){var o,s,r=[];if(t.results&&t.results[0].locations)for(var a=t.results[0].locations.length-1;0<=a;a--)o=t.results[0].locations[a],s=e.latLng(o.latLng),r[a]={name:this._formatName(o.street,o.adminArea4,o.adminArea3,o.adminArea1),bbox:e.latLngBounds(s,s),center:s};n.call(i,r)},this))}}),_=e.Class.extend({options:{userId:"<insert your userId here>",apiKey:"<insert your apiKey here>",serviceUrl:"https://neutrinoapi.com/"},initialize:function(t){e.Util.setOptions(this,t)},geocode:function(t,o,n){s(this.options.serviceUrl+"geocode-address",{apiKey:this.options.apiKey,userId:this.options.userId,address:t.split(/\s+/).join(".")},function(t){var s,i,r=[];t.locations&&(t.geometry=t.locations[0],s=e.latLng(t.geometry.latitude,t.geometry.longitude),i=e.latLngBounds(s,s),r[0]={name:t.geometry.address,bbox:i,center:s}),o.call(n,r)})},suggest:function(e,t,o){return this.geocode(e,t,o)},reverse:function(t,o,n,i){s(this.options.serviceUrl+"geocode-reverse",{apiKey:this.options.apiKey,userId:this.options.userId,latitude:t.lat,longitude:t.lng},function(o){var s,r,a=[];200==o.status.status&&o.found&&(s=e.latLng(t.lat,t.lng),r=e.latLngBounds(s,s),a[0]={name:o.address,bbox:r,center:s}),n.call(i,a)})}}),b=e.Class.extend({options:{serviceUrl:"https://nominatim.openstreetmap.org/",geocodingQueryParams:{},reverseQueryParams:{},htmlTemplate:function(e){var t=e.address,o=[];return(t.road||t.building)&&o.push("{building} {road} {house_number}"),(t.city||t.town||t.village||t.hamlet)&&o.push('<span class="'+(0<o.length?"leaflet-control-geocoder-address-detail":"")+'">{postcode} {city} {town} {village} {hamlet}</span>'),(t.state||t.country)&&o.push('<span class="'+(0<o.length?"leaflet-control-geocoder-address-context":"")+'">{state} {country}</span>'),n(o.join("<br/>"),t)}},initialize:function(t){e.Util.setOptions(this,t)},geocode:function(t,o,n){s(this.options.serviceUrl+"search",e.extend({q:t,limit:5,format:"json",addressdetails:1},this.options.geocodingQueryParams),e.bind(function(t){for(var s=[],i=t.length-1;0<=i;i--){for(var r=t[i].boundingbox,a=0;a<4;a++)r[a]=parseFloat(r[a]);s[i]={icon:t[i].icon,name:t[i].display_name,html:this.options.htmlTemplate?this.options.htmlTemplate(t[i]):void 0,bbox:e.latLngBounds([r[0],r[2]],[r[1],r[3]]),center:e.latLng(t[i].lat,t[i].lon),properties:t[i]}}o.call(n,s)},this))},reverse:function(t,o,n,i){s(this.options.serviceUrl+"reverse",e.extend({lat:t.lat,lon:t.lng,zoom:Math.round(Math.log(o/256)/Math.log(2)),addressdetails:1,format:"json"},this.options.reverseQueryParams),e.bind(function(t){var o,s=[];t&&t.lat&&t.lon&&(o=e.latLng(t.lat,t.lon),s.push({name:t.display_name,html:this.options.htmlTemplate?this.options.htmlTemplate(t):void 0,center:o,bounds:e.latLngBounds(o,o),properties:t})),n.call(i,s)},this))}}),L=e.Class.extend({options:{OpenLocationCode:void 0,codeLength:void 0},initialize:function(t){e.setOptions(this,t)},geocode:function(t,o,s){try{var n=this.options.OpenLocationCode.decode(t),i={name:t,center:e.latLng(n.latitudeCenter,n.longitudeCenter),bbox:e.latLngBounds(e.latLng(n.latitudeLo,n.longitudeLo),e.latLng(n.latitudeHi,n.longitudeHi))};o.call(s,[i])}catch(t){console.warn(t),o.call(s,[])}},reverse:function(t,o,s,n){try{var i={name:this.options.OpenLocationCode.encode(t.lat,t.lng,this.options.codeLength),center:e.latLng(t.lat,t.lng),bbox:e.latLngBounds(e.latLng(t.lat,t.lng),e.latLng(t.lat,t.lng))};s.call(n,[i])}catch(t){console.warn(t),s.call(n,[])}}}),y=e.Class.extend({options:{serviceUrl:"https://api.opencagedata.com/geocode/v1/json"},initialize:function(e){this._accessToken=e},geocode:function(t,o,n){s(this.options.serviceUrl,{key:this._accessToken,q:t},function(t){var s,i,r,a=[];if(t.results&&t.results.length)for(var l=0;l<t.results.length;l++)r=t.results[l],s=e.latLng(r.geometry),i=r.annotations&&r.annotations.bounds?e.latLngBounds(e.latLng(r.annotations.bounds.northeast),e.latLng(r.annotations.bounds.southwest)):e.latLngBounds(s,s),a.push({name:r.formatted,bbox:i,center:s});o.call(n,a)})},suggest:function(e,t,o){return this.geocode(e,t,o)},reverse:function(t,o,n,i){s(this.options.serviceUrl,{key:this._accessToken,q:[t.lat,t.lng].join(",")},function(t){var o,s,r,a=[];if(t.results&&t.results.length)for(var l=0;l<t.results.length;l++)r=t.results[l],o=e.latLng(r.geometry),s=r.annotations&&r.annotations.bounds?e.latLngBounds(e.latLng(r.annotations.bounds.northeast),e.latLng(r.annotations.bounds.southwest)):e.latLngBounds(o,o),a.push({name:r.formatted,bbox:s,center:o});n.call(i,a)})}}),x=e.Class.extend({options:{serviceUrl:"https://api.geocode.earth/v1",geocodingQueryParams:{},reverseQueryParams:{}},initialize:function(t,o){e.Util.setOptions(this,o),this._apiKey=t,this._lastSuggest=0},geocode:function(t,o,n){var i=this;s(this.options.serviceUrl+"/search",e.extend({api_key:this._apiKey,text:t},this.options.geocodingQueryParams),function(e){o.call(n,i._parseResults(e,"bbox"))})},suggest:function(t,o,n){var i=this;s(this.options.serviceUrl+"/autocomplete",e.extend({api_key:this._apiKey,text:t},this.options.geocodingQueryParams),e.bind(function(e){e.geocoding.timestamp>this._lastSuggest&&(this._lastSuggest=e.geocoding.timestamp,o.call(n,i._parseResults(e,"bbox")))},this))},reverse:function(t,o,n,i){var r=this;s(this.options.serviceUrl+"/reverse",e.extend({api_key:this._apiKey,"point.lat":t.lat,"point.lon":t.lng},this.options.reverseQueryParams),function(e){n.call(i,r._parseResults(e,"bounds"))})},_parseResults:function(t,o){var s=[];return e.geoJson(t,{pointToLayer:function(t,o){return e.circleMarker(o)},onEachFeature:function(t,n){var i,r,a={};n.getBounds?r=(i=n.getBounds()).getCenter():i=n.feature.bbox?(r=n.getLatLng(),e.latLngBounds(e.GeoJSON.coordsToLatLng(n.feature.bbox.slice(0,2)),e.GeoJSON.coordsToLatLng(n.feature.bbox.slice(2,4)))):(r=n.getLatLng(),e.latLngBounds(r,r)),a.name=n.feature.properties.label,a.center=r,a[o]=i,a.properties=n.feature.properties,s.push(a)}}),s}}),U=x,C=r,w=x,k=r,D=w.extend({options:{serviceUrl:"https://api.openrouteservice.org/geocode"}}),E=e.Class.extend({options:{serviceUrl:"https://photon.komoot.de/api/",reverseUrl:"https://photon.komoot.de/reverse/",nameProperties:["name","street","suburb","hamlet","town","city","state","country"]},initialize:function(t){e.setOptions(this,t)},geocode:function(t,o,n){var i=e.extend({q:t},this.options.geocodingQueryParams);s(this.options.serviceUrl,i,e.bind(function(e){o.call(n,this._decodeFeatures(e))},this))},suggest:function(e,t,o){return this.geocode(e,t,o)},reverse:function(t,o,n,i){var r=e.extend({lat:t.lat,lon:t.lng},this.options.reverseQueryParams);s(this.options.reverseUrl,r,e.bind(function(e){n.call(i,this._decodeFeatures(e))},this))},_decodeFeatures:function(t){var o,s,n,i,r,a,l=[];if(t&&t.features)for(o=0;o<t.features.length;o++)n=(s=t.features[o]).geometry.coordinates,i=e.latLng(n[1],n[0]),a=(r=s.properties.extent)?e.latLngBounds([r[1],r[0]],[r[3],r[2]]):e.latLngBounds(i,i),l.push({name:this._decodeFeatureName(s),html:this.options.htmlTemplate?this.options.htmlTemplate(s):void 0,center:i,bbox:a,properties:s.properties});return l},_decodeFeatureName:function(e){return(this.options.nameProperties||[]).map(function(t){return e.properties[t]}).filter(function(e){return!!e}).join(", ")}}),R=e.Class.extend({options:{serviceUrl:"https://api.what3words.com/v2/"},initialize:function(e){this._accessToken=e},geocode:function(t,o,n){s(this.options.serviceUrl+"forward",{key:this._accessToken,addr:t.split(/\s+/).join(".")},function(t){var s,i,r=[];t.geometry&&(s=e.latLng(t.geometry.lat,t.geometry.lng),i=e.latLngBounds(s,s),r[0]={name:t.words,bbox:i,center:s}),o.call(n,r)})},suggest:function(e,t,o){return this.geocode(e,t,o)},reverse:function(t,o,n,i){s(this.options.serviceUrl+"reverse",{key:this._accessToken,coords:[t.lat,t.lng].join(",")},function(t){var o,s,r=[];200==t.status.status&&(o=e.latLng(t.geometry.lat,t.geometry.lng),s=e.latLngBounds(o,o),r[0]={name:t.words,bbox:s,center:o}),n.call(i,r)})}}),P=Object.freeze({ArcGis:u,arcgis:function(e,t){return new u(e,t)},Bing:p,bing:function(e){return new p(e)},Google:h,google:function(e,t){return new h(e,t)},HERE:g,here:function(e){return new g(e)},LatLng:m,latLng:function(e){return new m(e)},Mapbox:f,mapbox:function(e,t){return new f(e,t)},MapQuest:v,mapQuest:function(e,t){return new v(e,t)},Neutrino:_,neutrino:function(e){return new _(e)},Nominatim:b,nominatim:function(e){return new b(e)},OpenLocationCode:L,openLocationCode:function(e){return new L(e)},OpenCage:y,opencage:function(e){return new y(e)},Pelias:x,pelias:r,GeocodeEarth:U,geocodeEarth:C,Mapzen:w,mapzen:k,Openrouteservice:D,openrouteservice:function(e,t){return new D(e,t)},Photon:E,photon:function(e){return new E(e)},What3Words:R,what3words:function(e){return new R(e)}}),T=e.Control.extend({options:{showUniqueResult:!0,showResultIcons:!1,collapsed:!0,expand:"touch",position:"topright",placeholder:"Search...",errorMessage:"Nothing found.",queryMinLength:1,suggestMinLength:3,suggestTimeout:250,defaultMarkGeocode:!0},includes:e.Evented.prototype||e.Mixin.Events,initialize:function(t){e.Util.setOptions(this,t),this.options.geocoder||(this.options.geocoder=new b),this._requestCount=0},addThrobberClass:function(){e.DomUtil.addClass(this._container,"leaflet-control-geocoder-throbber")},removeThrobberClass:function(){e.DomUtil.removeClass(this._container,"leaflet-control-geocoder-throbber")},onAdd:function(t){var o,s="leaflet-control-geocoder",n=e.DomUtil.create("div",s+" leaflet-bar"),i=e.DomUtil.create("button",s+"-icon",n),r=this._form=e.DomUtil.create("div",s+"-form",n);return this._map=t,this._container=n,i.innerHTML=" ",i.type="button",(o=this._input=e.DomUtil.create("input","",r)).type="text",o.placeholder=this.options.placeholder,e.DomEvent.disableClickPropagation(o),this._errorElement=e.DomUtil.create("div",s+"-form-no-error",n),this._errorElement.innerHTML=this.options.errorMessage,this._alts=e.DomUtil.create("ul",s+"-alternatives leaflet-control-geocoder-alternatives-minimized",n),e.DomEvent.disableClickPropagation(this._alts),e.DomEvent.addListener(o,"keydown",this._keydown,this),this.options.geocoder.suggest&&e.DomEvent.addListener(o,"input",this._change,this),e.DomEvent.addListener(o,"blur",function(){this.options.collapsed&&!this._preventBlurCollapse&&this._collapse(),this._preventBlurCollapse=!1},this),this.options.collapsed?"click"===this.options.expand?e.DomEvent.addListener(n,"click",function(e){0===e.button&&2!==e.detail&&this._toggle()},this):e.Browser.touch&&"touch"===this.options.expand?e.DomEvent.addListener(n,"touchstart mousedown",function(e){this._toggle(),e.preventDefault(),e.stopPropagation()},this):(e.DomEvent.addListener(n,"mouseover",this._expand,this),e.DomEvent.addListener(n,"mouseout",this._collapse,this),this._map.on("movestart",this._collapse,this)):(this._expand(),e.Browser.touch?e.DomEvent.addListener(n,"touchstart",function(){this._geocode()},this):e.DomEvent.addListener(n,"click",function(){this._geocode()},this)),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),e.DomEvent.disableClickPropagation(n),n},_geocodeResult:function(t,o){if(!o&&this.options.showUniqueResult&&1===t.length)this._geocodeResultSelected(t[0]);else if(0<t.length){this._alts.innerHTML="",this._results=t,e.DomUtil.removeClass(this._alts,"leaflet-control-geocoder-alternatives-minimized"),e.DomUtil.addClass(this._container,"leaflet-control-geocoder-options-open");for(var s=0;s<t.length;s++)this._alts.appendChild(this._createAlt(t[s],s))}else e.DomUtil.addClass(this._container,"leaflet-control-geocoder-options-error"),e.DomUtil.addClass(this._errorElement,"leaflet-control-geocoder-error")},markGeocode:function(t){return t=t.geocode||t,this._map.fitBounds(t.bbox),this._geocodeMarker&&this._map.removeLayer(this._geocodeMarker),this._geocodeMarker=new e.Marker(t.center).bindPopup(t.html||t.name).addTo(this._map).openPopup(),this},_geocode:function(e){var t=this._input.value;if(e||!(t.length<this.options.queryMinLength)){var o=++this._requestCount,s=e?"suggest":"geocode",n={input:t};this._lastGeocode=t,e||this._clearResults(),this.fire("start"+s,n),this.options.geocoder[s](t,function(t){o===this._requestCount&&(n.results=t,this.fire("finish"+s,n),this._geocodeResult(t,e))},this)}},_geocodeResultSelected:function(e){this.fire("markgeocode",{geocode:e})},_toggle:function(){e.DomUtil.hasClass(this._container,"leaflet-control-geocoder-expanded")?this._collapse():this._expand()},_expand:function(){e.DomUtil.addClass(this._container,"leaflet-control-geocoder-expanded"),this._input.select(),this.fire("expand")},_collapse:function(){e.DomUtil.removeClass(this._container,"leaflet-control-geocoder-expanded"),e.DomUtil.addClass(this._alts,"leaflet-control-geocoder-alternatives-minimized"),e.DomUtil.removeClass(this._errorElement,"leaflet-control-geocoder-error"),e.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-open"),e.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-error"),this._input.blur(),this.fire("collapse")},_clearResults:function(){e.DomUtil.addClass(this._alts,"leaflet-control-geocoder-alternatives-minimized"),this._selection=null,e.DomUtil.removeClass(this._errorElement,"leaflet-control-geocoder-error"),e.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-open"),e.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-error")},_createAlt:function(t,o){var s=e.DomUtil.create("li",""),n=e.DomUtil.create("a","",s),i=this.options.showResultIcons&&t.icon?e.DomUtil.create("img","",n):null,r=t.html?void 0:document.createTextNode(t.name);return i&&(i.src=t.icon),s.setAttribute("data-result-index",o),t.html?n.innerHTML=n.innerHTML+t.html:n.appendChild(r),e.DomEvent.addListener(s,"mousedown touchstart",function(o){this._preventBlurCollapse=!0,e.DomEvent.stop(o),this._geocodeResultSelected(t),e.DomEvent.on(s,"click",function(){this.options.collapsed?this._collapse():this._clearResults()},this)},this),s},_keydown:function(t){function o(t){s._selection&&(e.DomUtil.removeClass(s._selection,"leaflet-control-geocoder-selected"),s._selection=s._selection[0<t?"nextSibling":"previousSibling"]),s._selection||(s._selection=s._alts[0<t?"firstChild":"lastChild"]),s._selection&&e.DomUtil.addClass(s._selection,"leaflet-control-geocoder-selected")}var s=this;switch(t.keyCode){case 27:this.options.collapsed?this._collapse():this._clearResults();break;case 38:o(-1);break;case 40:o(1);break;case 13:if(this._selection){var n=parseInt(this._selection.getAttribute("data-result-index"),10);this._geocodeResultSelected(this._results[n]),this._clearResults()}else this._geocode();break;default:return}e.DomEvent.preventDefault(t)},_change:function(){var t=this._input.value;t!==this._lastGeocode&&(clearTimeout(this._suggestTimeout),t.length>=this.options.suggestMinLength?this._suggestTimeout=setTimeout(e.bind(function(){this._geocode(!0)},this),this.options.suggestTimeout):this._clearResults())}});return e.Util.extend(T,P),e.Util.extend(e.Control,{Geocoder:T,geocoder:function(e){return new T(e)}}),T}(L);
|