text: define(["jquery","routing"],function(a,b){function c(){var a=!0;return["commerceMap","commerceMarkerCluster","commerceHeatmap"].forEach(function(b){if(!window.hasOwnProperty(b)||"undefined"==typeof window[b])return a=!1,!1}),a}function d(){j=window.commerceMap,k=window.commerceMarkerCluster,l=window.commerceHeatmap,m=a('form[name="map"]'),m.on("submit",function(a){return a.preventDefault(),a.stopPropagation(),f(),!1}),e(),f()}function e(){var a=document.getElementById("map_search");try{var b=new google.maps.places.Autocomplete(a,{types:["(regions)"]})}catch(c){return void console.log("Failed to load autocomplete")}b.bindTo("bounds",j),b.addListener("place_changed",function(){var a=b.getPlace();return a.geometry?void j.setCenter(a.geometry.location):void console.log("Autocomplete's returned place contains no geometry")})}function f(){if(!o){o=!0;var c=m.serialize();m.find("input, select, button").prop("disabled",!0);var d=a.ajax({url:b.generate("ekyna_commerce_admin_map_data"),method:"GET",data:c,dataType:"json"});d.done(function(a){a.hasOwnProperty("locations")&&(k.clearMarkers(),"order"===m.find('[name="map[mode]"]').val()?i(a.locations):g(a.locations),o=!1,m.find("input, select, button").prop("disabled",!1))})}}function g(a){l.setData([]),l.setMap(null),j.setOptions({styles:q}),k.clearMarkers(),a.forEach(function(a){var b=new google.maps.Marker(a);b.addListener("click",function(){h(b)}),k.addMarker(b)})}function h(c){if(n&&(n.close(),n=null),c.infoWindowContent)return n=new google.maps.InfoWindow({content:c.infoWindowContent}),void n.open(j,c);var d=a.ajax({url:b.generate("ekyna_commerce_admin_map_info"),method:"GET",data:{customerId:c.customerId},dataType:"html"});d.done(function(a){c.infoWindowContent=a,n=new google.maps.InfoWindow({content:a}),n.open(j,c)})}function i(a){k.clearMarkers(),j.setOptions({styles:r}),l.setData(a.map(function(a){return{location:new google.maps.LatLng(a.lat,a.lng),weight:a.weight}})),l.setMap(j)}var j,k,l,m,n,o=!1,p=setInterval(function(){c()&&(clearInterval(p),d())},250),q=[{featureType:"all",elementType:"labels.text.fill",stylers:[{saturation:36},{color:"#333333"},{lightness:40}]},{featureType:"all",elementType:"labels.text.stroke",stylers:[{visibility:"on"},{color:"#ffffff"},{lightness:16}]},{featureType:"all",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"administrative",elementType:"geometry.fill",stylers:[{color:"#fefefe"},{lightness:20}]},{featureType:"administrative",elementType:"geometry.stroke",stylers:[{color:"#fefefe"},{lightness:17},{weight:1.2}]},{featureType:"administrative.locality",elementType:"labels",stylers:[{visibility:"on"}]},{featureType:"administrative.locality",elementType:"labels.icon",stylers:[{visibility:"on"},{color:"#b6b6b6"},{weight:"0.20"}]},{featureType:"landscape",elementType:"geometry",stylers:[{color:"#ffffff"},{lightness:20}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"poi.park",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"road.highway",elementType:"geometry.fill",stylers:[{color:"#dedede"},{lightness:17}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{color:"#dedede"},{lightness:29},{weight:.2}]},{featureType:"road.arterial",elementType:"geometry",stylers:[{lightness:18},{color:"#dedede"}]},{featureType:"road.local",elementType:"geometry",stylers:[{color:"#e3e3e3"},{lightness:16}]},{featureType:"water",elementType:"geometry",stylers:[{color:"#a0d6d1"},{lightness:17}]},{featureType:"water",elementType:"labels",stylers:[{visibility:"off"}]}],r=[{featureType:"all",elementType:"labels.text.fill",stylers:[{saturation:36},{color:"#000000"},{lightness:40}]},{featureType:"all",elementType:"labels.text.stroke",stylers:[{visibility:"on"},{color:"#000000"},{lightness:16}]},{featureType:"all",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"administrative",elementType:"geometry.fill",stylers:[{color:"#000000"},{lightness:20}]},{featureType:"administrative",elementType:"geometry.stroke",stylers:[{color:"#000000"},{lightness:17},{weight:1.2}]},{featureType:"administrative.locality",elementType:"labels",stylers:[{visibility:"on"},{lightness:"0"}]},{featureType:"administrative.locality",elementType:"labels.text.fill",stylers:[{lightness:"-10"}]},{featureType:"administrative.locality",elementType:"labels.text.stroke",stylers:[{lightness:"-10"}]},{featureType:"administrative.locality",elementType:"labels.icon",stylers:[{color:"#737373"}]},{featureType:"landscape",elementType:"geometry",stylers:[{color:"#000000"},{lightness:20}]},{featureType:"landscape.natural",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"poi",elementType:"geometry",stylers:[{color:"#000000"},{lightness:21}]},{featureType:"road.highway",elementType:"geometry.fill",stylers:[{lightness:17},{color:"#3c3c3c"}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{lightness:29},{weight:.2},{visibility:"off"}]},{featureType:"road.arterial",elementType:"geometry",stylers:[{lightness:18},{color:"#393939"}]},{featureType:"road.local",elementType:"geometry",stylers:[{color:"#000000"},{lightness:16}]},{featureType:"transit",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"transit",elementType:"geometry",stylers:[{color:"#000000"},{lightness:19}]},{featureType:"water",elementType:"geometry",stylers:[{color:"#000000"},{lightness:17}]},{featureType:"water",elementType:"labels",stylers:[{lightness:"0"},{visibility:"off"}]},{featureType:"water",elementType:"labels.text",stylers:[{lightness:"0"}]}]});