File: /home/dh_hwg2wc/fnaluxury.com/wp-content/themes/houzez/js/google-map-properties.min.js
jQuery(function(e){"use strict";if("undefined"!=typeof houzez_map_properties){if(e("#houzez-properties-map").length>0){var a,t,i,n,r=null,s=[],o=[],l="",p=1,c=12,m="",d="",u=0,g=0,h=0,f="no",v="",z="roadmap",y=houzez_vars.admin_url+"admin-ajax.php",$=houzez_vars.user_id,_=houzez_vars.not_found,w=houzez_vars.houzez_rtl,x=houzez_vars.processing_text,I=houzez_vars.compare_url,b=houzez_vars.compare_add_icon,k=houzez_vars.add_compare_text,M=houzez_vars.compare_remove_icon,T=houzez_vars.remove_compare_text,L=houzez_vars.compare_limit;houzez_vars.compare_page_not_found;var E=houzez_vars.for_rent_price_slider,j=parseInt(houzez_vars.search_min_price_range),D=parseInt(houzez_vars.search_max_price_range),P=parseInt(houzez_vars.search_min_price_range_for_rent),B=parseInt(houzez_vars.search_max_price_range_for_rent);parseInt(houzez_vars.get_min_price),parseInt(houzez_vars.get_max_price);var A=houzez_vars.currency_position,R=houzez_vars.currency_symbol,S=houzez_vars.thousands_separator,Z=parseInt(houzez_vars.is_halfmap),C=parseFloat(houzez_vars.default_lat),H=parseFloat(houzez_vars.default_long),U=parseInt(houzez_vars.houzez_default_radius),N=/ipad|iphone|ipod|android|blackberry|webos|iemobile|windows phone/i.test(navigator.userAgent.toLowerCase());w="yes"==w,"undefined"!=typeof houzez_map_options&&(l=houzez_map_options.clusterIcon,p=houzez_map_options.map_cluster_enable,c=houzez_map_options.clusterer_zoom,m=houzez_map_options.closeIcon,d=houzez_map_options.infoWindowPlac,u=houzez_map_options.marker_spiderfier,f=houzez_map_options.markerPricePins,z=houzez_map_options.map_type,""!=(v=houzez_map_options.googlemap_style)&&(v=JSON.parse(v)));var O={zoom:12,maxZoom:16,disableDefaultUI:!0,scrollwheel:!1,styles:v},W={"&":"&",""":'"',"'":"'","’":"’","&":"&","<":"<",">":">","‘":"‘","…":"…","”":"”","–":"–","—":"—"};switch(z){case"hybrid":O.mapTypeId=google.maps.MapTypeId.HYBRID;break;case"terrain":O.mapTypeId=google.maps.MapTypeId.TERRAIN;break;case"satellite":O.mapTypeId=google.maps.MapTypeId.SATELLITE;break;default:O.mapTypeId=google.maps.MapTypeId.ROADMAP}t=new google.maps.Map(document.getElementById("houzez-properties-map"),O),i=new google.maps.LatLngBounds;var q=e=>{if("number"!=typeof e)return e;for(var a=(e+="").split("."),t=a[0],i=a.length>1?"."+a[1]:"",n=/(\d+)(\d{3})/;n.test(t);)t=t.replace(n,"$1"+S+"$2");return t+i},F=function(e){for(++g>s.length&&(g=1);!1===s[g-1].visible;)++g>s.length&&(g=1);s[g]&&!s[g].getMap()&&0!=p&&(r.setMaxZoom(1),r.repaint()),google.maps.event.trigger(s[g-1],"click"),null!=s[g-1].getPosition()&&e.panTo(s[g-1].getPosition())},Y=function(e){for(--g<1&&(g=s.length);!1===s[g-1].visible;)--g>s.length&&(g=1);s[g]&&!s[g].getMap()&&0!=p&&(r.setMaxZoom(1),r.repaint()),google.maps.event.trigger(s[g-1],"click"),null!=s[g-1].getPosition()&&e.panTo(s[g-1].getPosition())};e(".houzezMapType").on("click",function(a){var i;a.preventDefault(),"roadmap"===(i=e(this).data("maptype"))?t.setMapTypeId(google.maps.MapTypeId.ROADMAP):"satellite"===i?t.setMapTypeId(google.maps.MapTypeId.SATELLITE):"hybrid"===i?t.setMapTypeId(google.maps.MapTypeId.HYBRID):"terrain"===i&&t.setMapTypeId(google.maps.MapTypeId.TERRAIN)}),document.getElementById("listing-mapzoomin")&&(X=t,google.maps.event.addDomListener(document.getElementById("listing-mapzoomin"),"click",function(){var e=parseInt(X.getZoom(),10);console.log(e),++e>20&&(e=20),X.setZoom(e)})),document.getElementById("listing-mapzoomout")&&(ee=t,google.maps.event.addDomListener(document.getElementById("listing-mapzoomout"),"click",function(){var e=parseInt(ee.getZoom(),10);console.log(e),--e<0&&(e=0),ee.setZoom(e)})),e("#houzez-gmap-next").on("click",function(){F(t)}),e("#houzez-gmap-prev").on("click",function(){Y(t)}),google.maps.event.addListener(t,"tilesloaded",function(){jQuery(".houzez-map-loading").hide()});var G=function(){0!=p&&null!=r&&r.clearMarkers()},J=function(){for(var e=0;e<s.length;e++)s[e].setMap(null);s=[]},K=function(){t.fitBounds(s.reduce(function(e,a){return e.extend(a.getPosition())},new google.maps.LatLngBounds))},Q=function(){var e=houzezGetCookie("houzez_compare_listings");add_to_compare(I,b,M,k,T,L,e,4),remove_from_compare(e,b,M,k,T)},V=function(e,a){if(0!=u)var t=new OverlappingMarkerSpiderfier(a,{markersWontMove:!0,markersWontHide:!0,keepSpiderfied:!0,circleSpiralSwitchover:1/0,nearbyDistance:50});n=function(){for(;o.length>0;)o.pop().close()};for(var m=function(e,a,t){google.maps.event.addListener(a,"click",function(){n(),t.open(e,a),o.push(t);var i=t.getContent().getElementsByClassName("listing-thumbnail");i.length&&i[0].dataset.src&&(i[0].src=i[0].dataset.src)})},g=0;g<e.length;g++)if(e[g].lat&&e[g].lng){if("yes"==f)var h='<div data-id="'+e[g].property_id+'" class="gm-marker gm-marker-color-'+e[g].term_id+'"><div class="gm-marker-price">'+e[g].pricePin+"</div></div>",v=new RichMarker({map:a,position:new google.maps.LatLng(e[g].lat,e[g].lng),draggable:!1,flat:!0,anchor:RichMarkerPosition.MIDDLE,content:h});else{var z=e[g].marker,y=new google.maps.Size(44,56);window.devicePixelRatio>1.5&&e[g].retinaMarker&&(z=e[g].retinaMarker,y=new google.maps.Size(44,56));var $={url:z,size:y,scaledSize:new google.maps.Size(44,56)},v=new google.maps.Marker({position:new google.maps.LatLng(e[g].lat,e[g].lng),map:a,icon:$,title:e[g].title.replace(/\&[\w\d\#]{2,5}\;/g,function(e){return W[e]}),animation:google.maps.Animation.DROP,visible:!0})}i.extend(v.getPosition());var _=document.createElement("div");_.className="map-info-window";var w="";w+='<div class="item-wrap">',w+='<div class="item-header">',e[g].thumbnail?w+='<a class="hover-effect" target="'+e[g].link_target+'" href="'+e[g].url+'"><img class="img-fluid listing-thumbnail" src="'+d+'" data-src="'+e[g].thumbnail+'" alt="'+e[g].title+'"/></a>':w+='<a class="hover-effect" target="'+e[g].link_target+'" href="'+e[g].url+'"><img class="img-fluid listing-thumbnail" src="'+d+'" alt="'+e[g].title+'"/></a>',w+="</div>",w+='<div class="item-body flex-grow-1">',w+='<h2 class="item-title">',w+='<a target="'+e[g].link_target+'" href="'+e[g].url+'">'+e[g].title+"</a>",w+="</h2>",w+='<ul class="list-unstyled item-info">',e[g].price&&(w+='<li class="item-price">'+e[g].price+"</li>"),e[g].property_type&&(w+='<li class="item-type">'+e[g].property_type+"</li>"),w+="</ul>",w+="</div>",w+="</div>",_.innerHTML=w,m(a,v,new google.maps.InfoWindow({content:_})),0!=u&&t.addMarker(v),s.push(v)}if(a.fitBounds(i),0!=p){var x={ignoreHidden:!0,maxZoom:parseInt(c),styles:[{url:l,height:48,width:48,textColor:"#ffffff"}]};r=new MarkerClusterer(a,s,x)}};if(houzez_map_properties.length>0)V(houzez_map_properties,t);else{var X,ee,O={center:new google.maps.LatLng(C,H),zoom:10,maxZoom:16,styles:v,disableDefaultUI:!0,scrollwheel:!1};t=new google.maps.Map(document.getElementById("houzez-properties-map"),O),jQuery(".houzez-map-loading").hide()}var ea=function(){return e("#half-map-listing-area .item-listing-wrap").each(function(a){e(this).on("mouseenter",function(){t&&(s[a].getMap()||0==p||(r.setMaxZoom(1),r.repaint()),google.maps.event.trigger(s[a],"click"))})}),e("#half-map-listing-area .item-listing-wrap").on("mouseleave",function(){n(),0!=p&&(r.setMaxZoom(13),r.repaint())}),!1};N||ea();var et=function(a){var i=e("#houzez_ajax_container"),n=e("#half-map-listing-area .page-title span"),r=e(".houzez-search-form-js"),s=e("#ajax_sort_properties").val(),o=e(".listing-view").data("layout");return e(this).parents(".houzez-search-form-js").addClass("sdfsdfsdffs"),e.ajax({type:"GET",dataType:"json",url:y,data:r.serialize()+"&action=houzez_half_map_listings&paged="+a+"&sortby="+s+"&item_layout="+o,beforeSend:function(){e(".houzez-map-loading").show(),i.empty().append('<div id="houzez-map-loading" class="houzez-map-loading"><div class="mapPlaceholder"><div class="loader-ripple spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div></div></div>')},success:function(a){return""!=a.query&&e('input[name="search_args"]').val(a.query),""!=a.search_uri&&e('input[name="search_URI"]').val(a.search_uri),e(".map-notfound").remove(),e(".search-no-results-found").remove(),e(".houzez-map-loading").hide(),!0===a.getProperties?(G(),J(),V(a.properties,t),K(),i.empty().html(a.propHtml),n.empty().html(a.total_results),es(),houzez_init_add_favorite(y,$),houzez_init_remove_favorite(y,$),houzez_listing_lightbox(y,x,w,$),houzez_grid_image_gallery(),houzez_grid_call_to_action(),Q(),N||ea(),e('[data-toggle="tooltip"]').tooltip()):(G(),J(),e("#houzez-properties-map").append('<div class="map-notfound">'+_+"</div>"),i.empty().html('<div class="search-no-results-found">'+_+"</div>"),n.empty().html(a.total_results)),!1},error:function(e,a,t){console.log(e.status),console.log(e.responseText),console.log(t)}}),!1},ei=e=>{window.history.pushState({houzezTheme:!0},"",e)},en=()=>{var a=e("form.houzez-search-filters-js"),t=a.attr("action");if(void 0==t)return!0;var i=a.find(":input").filter(function(a,t){if(""!=e(t).val()&&"search_geolocation"!=e(t).attr("name")&&"search_URI"!=e(t).attr("name")&&"search_args"!=e(t).attr("name")&&"houzez_save_search_ajax"!=e(t).attr("name"))return!0}).serialize();void 0==t?t="":(t.indexOf("?"),t=t+"?"+i),ei(t)},er=function(a){G(),e(".hz-halfmap-paged").val(a),en(),et(a)},es=function(){return e(".houzez_ajax_pagination a").on("click",function(a){a.preventDefault(),h=e(this).data("houzepagi"),er(h)}),!1};es(),e("#ajax_sort_properties").on("change",function(){er(h=0)});var eo=function(a,t){if(e(".price-range").slider({range:!0,min:a,max:t,values:[a,t],slide:function(a,t){if("after"==A)var i=q(t.values[0])+R,n=q(t.values[1])+R;else var i=R+q(t.values[0]),n=R+q(t.values[1]);e(".min-price-range-hidden").val(t.values[0]),e(".max-price-range-hidden").val(t.values[1]),e(".min-price-range").text(i),e(".max-price-range").text(n)},stop:function(e,a){er(h=0)}}),"after"==A)var i=q(e(".price-range").slider("values",0))+R,n=q(e(".price-range").slider("values",1))+R;else var i=R+q(e(".price-range").slider("values",0)),n=R+q(e(".price-range").slider("values",1));e(".min-price-range").text(i),e(".max-price-range").text(n),e(".min-price-range-hidden").val(e(".price-range").slider("values",0)),e(".max-price-range-hidden").val(e(".price-range").slider("values",1))};e(".price-range").length>0&&1==Z&&(e("select.status-js").val()==E?eo(P,B):eo(j,D),e("select.status-js").on("change",function(){e(this).val()==E?eo(P,B):eo(j,D)})),e("#radius-range-slider").length>0&&(a=U,e("#radius-range-slider").slider({value:a,min:0,max:100,step:1,value:e("#radius-range-value").data("default"),slide:function(a,t){e("#radius-range-text").html(t.value),e("#radius-range-value").val(t.value)},stop:function(a,t){e("#houzez-properties-map").length>0&&er(h=0)}}),e("#radius-range-text").html(e("#radius-range-slider").slider("value")),e("#radius-range-value").val(e("#radius-range-slider").slider("value"))),e("select.houzez_search_ajax, input.houzez_search_ajax").on("change",function(){er(h=0)}),e(".half-map-wrap").length>0&&e(".btn-apply, .half-map-search-js-btn, #auto_complete_ajax").on("click",function(e){e.preventDefault(),er(h=0)})}if(e("#houzez-btn-map-view").on("click",function(a){a.preventDefault(),e("#half-map-listing-area, .listing-wrap").hide(),e("#map-view-wrap").show(),google.maps.event.trigger(t,"resize"),K()}),e("#houzez-btn-listing-view").on("click",function(a){a.preventDefault(),e("#map-view-wrap").hide(),e("#half-map-listing-area, .listing-wrap").show()}),e(".hz-map-field-js").length>0){var el=houzez_vars.geo_country_limit,ep=houzez_vars.geocomplete_country,ec=function(e){this.$container=e};ec.prototype={init:function(){this.initDomElements(),this.autocomplete()},initDomElements:function(){this.addressField=this.$container.data("address-field")},autocomplete:function(){var e=this,a=this.addressField;if(null!==a){var t=document.getElementById(a),i=new google.maps.places.Autocomplete(t,{types:["geocode","establishment"]});0!=el&&""!=ep&&("UAE"==ep&&(ep="AE"),i.setComponentRestrictions({country:[ep]})),google.maps.event.addListener(i,"place_changed",function(){var a=i.getPlace(),t=new google.maps.LatLng(a.geometry.location.lat(),a.geometry.location.lng());e.updateCoordinate(t),Z&&er(0)})}},updateCoordinate:function(a){e('input[name="lat"]').val(a.lat()),e('input[name="lng"]').val(a.lng())}};var em=function(){var a,t=e(this);(a=new ec(t)).init()};e(".hz-map-field-js").each(em)}}});