Your IP : 216.73.216.84


Current Path : /home/helpink/www/components/com_jbusinessdirectory/assets/js/
Upload File :
Current File : /home/helpink/www/components/com_jbusinessdirectory/assets/js/jbd-appSAVE.js

/*! jbd-app.min.js file */

class JBDConstants{}JBDConstants.ITEM_TYPE_BUSINESS=1,JBDConstants.ITEM_TYPE_OFFER=2,JBDConstants.ITEM_TYPE_EVENT=3,JBDConstants.ITEM_TYPE_REQUEST_QUOTE=4,JBDConstants.MAP_TYPE_GOOGLE=1,JBDConstants.MAP_TYPE_BING=2,JBDConstants.MAP_TYPE_OSM=3,JBDConstants.IS_ADMIN=0,JBDConstants.IS_FRONT=1,JBDConstants.AJAX_RESPONSE_SUCCESS=1,JBDConstants.AJAX_RESPONSE_ERROR=0,JBDConstants.QUOTE_MESSAGES_POLLING_INTERVAL=5e3;class JBDUtils{setProperties(properties){let tmp="";properties.langaugeCode&&(tmp=properties.langaugeCode+"/"),properties.url=properties.site_url,properties.isProfile==JBDConstants.IS_ADMIN&&(properties.url=properties.admin_url),this.properties=properties,this.properties.month_names=this.properties.month_names.split(",")}getProperty(property){if(void 0===this.properties);else if(void 0!==this.properties[property])return this.properties[property];return null}setProperty(property,value){return this.properties[property]=value,!0}getAjaxUrl(task,controller,frontController=""){let url="";if(void 0===controller||0===controller.length)return url;if(void 0===task||0===task.length)return url;let cntrl=controller;jbdUtils.getProperty("isProfile")===JBDConstants.IS_FRONT&&frontController.length>0&&(cntrl=frontController);let baseUrl=jbdUtils.getProperty("url");return"undefined"!==baseUrl&&baseUrl.includes("?")?baseUrl+="&":baseUrl+="?",url+=baseUrl+"task="+cntrl+"."+task}getDateWithFormat(date){let format=this.getProperty("dateFormat"),delimiter="-";format.indexOf("/")>-1?delimiter="/":format.indexOf("\\")>-1&&(delimiter="\\");let tmp=format.split(delimiter),newDate="";for(let i=0;i<3;i++)"d"===tmp[i]?newDate+=("0"+date.getDate()).slice(-2):"m"===tmp[i]?newDate+=("0"+(date.getMonth()+1)).slice(-2):"y"!==tmp[i]&&"Y"!==tmp[i]||(newDate+=date.getFullYear()),i<2&&(newDate+=delimiter);return newDate}sleep(milliseconds){let start=(new Date).getTime();for(let i=0;i<1e7&&!((new Date).getTime()-start>milliseconds);i++);}registerStatAction(itemId,itemType,statType){let urlWebsiteCount=jbdUtils.getAjaxUrl("increaseCountAjax","statistics");jQuery.ajax({type:"GET",data:{item_id:itemId,item_type:itemType,stat_type:statType},url:urlWebsiteCount,success:function(){}})}increaseShareClicks(itemId,itemType){let urlShareCount=jbdUtils.getAjaxUrl("increaseShareCountAjax","companies");jQuery.ajax({type:"GET",data:{itemId:itemId,itemType:itemType},url:urlShareCount,success:function(){}})}addCoordinatesToUrl(position){let latitude=position.coords.latitude,longitude=position.coords.longitude,newURLString=window.location.href;newURLString+=-1==newURLString.indexOf("?")?"?":"&",newURLString+="geo-latitude="+latitude,newURLString+=-1==newURLString.indexOf("?")?"?":"&",newURLString+="geo-longitude="+longitude,window.location.href=newURLString}getCookie(name){for(var cookieArr=document.cookie.split(";"),i=0;i<cookieArr.length;i++){var cookiePair=cookieArr[i].split("=");if(name==cookiePair[0].trim())return decodeURIComponent(cookiePair[1])}}setCookie(c_name,value,exdays){var expires="";if(exdays){var date=new Date;date.setTime(date.getTime()+24*exdays*60*60*1e3),expires="; expires="+date.toUTCString()}document.cookie=c_name+"="+(value||"")+expires+"; path=/"}renderRadioButtons(){jQuery(".radio.btn-group label").addClass("btn"),jQuery(".btn-group label:not(.active)").click(function(){let label=jQuery(this),input=jQuery("#"+label.attr("for"));input.prop("checked")||(label.closest(".btn-group").find("label").removeClass("active btn-success btn-danger btn-primary"),""==input.val()?label.addClass("active btn-primary"):0==input.val()?label.addClass("active btn-danger"):label.addClass("active btn-success"),input.prop("checked",!0))}),jQuery(".btn-group input[checked=checked]").each(function(){""==jQuery(this).val()?jQuery("label[for="+jQuery(this).attr("id")+"]").addClass("active btn-primary"):0==jQuery(this).val()?jQuery("label[for="+jQuery(this).attr("id")+"]").addClass("active btn-danger"):jQuery("label[for="+jQuery(this).attr("id")+"]").addClass("active btn-success")})}initializeAdminAutocomplete(preventSubmit,componentForm){let element=document.getElementById("route");JBDMapHelper.initAutocomplete(element,function(place){jbdUtils.fillInAddress(place,componentForm)},preventSubmit,!0,null,componentForm)}addAdminMapClickAction(){"undefined"!=typeof jbdAdminMapInstance&&jbdAdminMapInstance.addMapListener("click",function(location){jbdAdminMapInstance.clearMarkers(),jbdAdminMapInstance.addMarker(location,function(){document.getElementById("latitude").value=location.latitude,document.getElementById("longitude").value=location.longitude})})}fillInAddress(place,component_form){let city=null,county=null;jQuery("#address-container").show(),jQuery("#sec-address-container").show(),void 0===component_form&&(component_form=jbdUtils.getComponentForm());for(let component in component_form){document.getElementById(component);"undefined"!=typeof maybeObject&&(document.getElementById(component).value="",document.getElementById(component).disabled=!1)}for(let j in place){let att=j;if(component_form[att]){let val=place[j];if(jQuery("#"+att).val(val),"administrative_area_level_1"==att&&(county=val),"locality"==att&&(city=val),"route"==att&&place.street_number&&!jQuery("#street_number").length){let addr=place.street_number+" "+val;jQuery("#"+att).val(addr)}"country"==att&&(jQuery("#country option").filter(function(){return jQuery(this).text()===val}).attr("selected",!0),jbdUtils.getProperty("limit_cities_regions"))}}jbdUtils.updateChosenSelect("#country")}getComponentForm(){return{street_number:"short_name",route:"long_name",locality:"long_name",administrative_area_level_1:"long_name",country:"long_name",postal_code:"short_name",administrative_area_level_2:"long_name",latitude:"long",longitude:"long",area_id:"short_name"}}validateAppSettingsForm(validateNonVisible,validateRichText,formName){formName=formName||"item-form";let validationResult=!1;return jQuery("#"+formName).validationEngine("attach",{validateNonVisibleFields:validateNonVisible}),(validationResult=jQuery("#"+formName).validationEngine("validate"))||jbdUtils.showSettingsValidationError(formName),validationResult}validateCmpForm(validateNonVisible,validateRichText,task=null,customRuleHook){void 0!==customRuleHook&&customRuleHook(),validateRichText&&jbdUtils.validateRichTextEditors(),jbdUtils.validateMultiSelects(),jbdUtils.validateSingleSelects();let isError=jQuery("#item-form").validationEngine("validate",{validateNonVisibleFields:validateNonVisible});return isError&&("apply"==task&&(jQuery(".button-save").addClass("loader"),jQuery(".button-save, .button-close , .button-cancel").attr("disabled",!0)),"save"==task&&(jQuery(".button-close").addClass("loader"),jQuery(".button-save, .button-close , .button-cancel").attr("disabled",!0))),!isError}showValidationError(formName){formName=formName||"item-form",jQuery("#validation-error").show(500),setTimeout(function(){jQuery("#validation-error").hide(700)},7e3),1==jbdUtils.getProperty("edit_form_mode")&&setTimeout(function(){for(let i=1;i<=6;i++)if(jQuery("#edit-tab"+i+" div.formError").length){jbdTabs.openTab(i);break}setTimeout(function(){jQuery("#"+formName).validationEngine("updatePromptsPosition")},500)},1500)}showSettingsValidationError(formName){formName=formName||"item-form",jQuery("#validation-error").show(500),setTimeout(function(){jQuery("#validation-error").hide(700)},5e3);let numItems=jQuery("#tab_general_id").children("dt.tabs").length;0==numItems&&(numItems=jQuery("#tab_general_id").children().children("li").length),0==numItems&&(numItems=jQuery("#tab_general_id").children("joomla-tab-element").length),setTimeout(function(){for(let i=1;i<=numItems;i++)if(jQuery(".panel_"+i+"_content div.formError").length){jbdUtils.openSettingsTab(i);break}setTimeout(function(){jQuery("#"+formName).validationEngine("updatePromptsPosition")},700)},1500)}checkUserByUsername(selectorId){let username=jQuery("#"+selectorId).val(),url=jbdUtils.getAjaxUrl("checkUserByUsernameAjax","businessuser");username&&jQuery.ajax({url:url,dataType:"json",data:{username:username},success:function(data){jQuery("#"+selectorId).siblings(".usernameWarning").html(data.message)}})}checkUserByEmail(selectorId){let email=jQuery("#"+selectorId).val(),url=jbdUtils.getAjaxUrl("checkUserByEmailAjax","businessuser");email&&jQuery.ajax({url:url,dataType:"json",data:{email:email},success:function(data){jQuery("#"+selectorId).siblings(".emailWarning").html(data.message)}})}calendarFormat(dateFormat){switch(dateFormat){case"Y-m-d":return"yyyy-mm-dd";case"m/d/Y":return"mm/dd/yyyy";case"d-m-Y":default:return"dd-mm-yyyy"}}openSettingsTab(tab){jQuery("#adminForm").validationEngine("detach"),jQuery("#adminForm").validationEngine("validate")&&(document.getElementById("tab-panel_"+tab)?document.getElementById("tab-panel_"+tab).click():jQuery('button[aria-controls="panel_'+tab+'"]').length?jQuery('button[aria-controls="panel_'+tab+'"]').click():jQuery(".panel_"+tab).click())}validateTabs(validateNonVisible,validateRichText,task=null){let validationResult=!1;if(jbdUtils.getProperty("isMultilingual")){let tabgroup=jQuery(".tab-"+jbdUtils.getProperty("defaultLang"));0==tabgroup.length&&(tabgroup=jQuery("button[aria-controls='tab-"+jbdUtils.getProperty("defaultLang")+"']")),tabgroup.each(function(){})}return validateRichText&&this.validateRichTextEditors(),jbdUtils.validateMultiSelects(),jQuery("#item-form").validationEngine("attach",{validateNonVisibleFields:validateNonVisible}),(validationResult=jQuery("#item-form").validationEngine("validate"))?("apply"==task&&(jQuery(".button-save").addClass("loader"),jQuery(".button-save , .button-close , .button-cancel").attr("disabled",!0)),"save"==task&&(jQuery(".button-close").addClass("loader"),jQuery(".button-save , .button-close, .button-cancel").attr("disabled",!0))):this.showValidationError(),validationResult}validateRichTextEditors(){let lang="";if(jbdUtils.getProperty("isMultilingual")){let tabgroup=jQuery(".tab-"+jbdUtils.getProperty("defaultLang"));0==tabgroup.length&&(tabgroup=jQuery("button[aria-controls='tab-"+jbdUtils.getProperty("defaultLang")+"']")),lang+="_"+jbdUtils.getProperty("langTab"),tabgroup.each(function(){})}let richTextEditorClass=".js-editor-tinymce";0==jQuery(richTextEditorClass).length&&jQuery(".wf-editor-container").length>0&&(richTextEditorClass=".wf-editor-container"),jQuery(richTextEditorClass).each(function(){let textarea=jQuery(this).find("textarea");tinyMCE.triggerSave(),textarea.attr("id")=="description"+lang&&(jQuery.trim(textarea.val()).length>0?jQuery(this).hasClass("validate[required]")&&jQuery(this).removeClass("validate[required]"):jQuery(this).hasClass("validate[required]")||jQuery(this).addClass("validate[required]"))})}showItem(link){window.open(link,"_blank").focus()}readMore(){jQuery("#general-info").removeClass("collapsed"),jQuery(".read-more").hide()}applyReadMore(){jQuery(".read-more").each(function(){let content=jQuery(this).html();if(content.length>70){let html=content.substr(0,70)+'<span class="moreellipses">...&nbsp;</span><span class="morecontent"><span>'+content.substr(70,content.length-70)+'</span>&nbsp;&nbsp;<a href="javascript:void(0)" class="morelink" >Show more</a></span>';jQuery(this).html(html)}}),jQuery(".morelink").click(function(){return jQuery(this).hasClass("less")?(jQuery(this).removeClass("less"),jQuery(this).html("Show more")):(jQuery(this).addClass("less"),jQuery(this).html("Show less")),jQuery(this).parent().prev().toggle(),jQuery(this).prev().toggle(),!1})}calculateLength(){let obj=jQuery("#description");if(obj.val()){let max=parseInt(obj.attr("maxlength"));obj.val().length>max&&obj.val(obj.val().substr(0,obj.attr("maxlength"))),jQuery("#descriptionCounter").val(max-obj.val().length)}}calculateLengthShort(){let obj=jQuery("#short_description");if(obj.val()){let max=parseInt(obj.attr("maxlength"));obj.val().length>max&&obj.val(obj.val().substr(0,obj.attr("maxlength"))),jQuery(".js-short-description").val(max-obj.val().length)}}calculateLengthSlogan(){let obj=jQuery("#slogan");if(obj.val()){let max=parseInt(obj.attr("maxlength"));obj.val().length>max&&obj.val(obj.val().substr(0,obj.attr("maxlength"))),jQuery(".js-slogan").val(max-obj.val().length)}}validateMultiSelects(){let chosenSelector=".chzn-container-multi";jQuery(chosenSelector).length||(chosenSelector=".chosen-container-multi"),jQuery(chosenSelector).each(function(){let id=jQuery(this).attr("id");if(void 0!==id){let selectId=id.substr(0,id.lastIndexOf("_"));if(jQuery("#"+selectId).hasClass("validate[required]")||jQuery("#"+id).hasClass("validate[required]")){let values=jQuery("#"+selectId).chosen().val();void 0===values||null==values||0==values.length?(jQuery("#"+id).hasClass("validate[required]")||jQuery("#"+id).addClass("validate[required]"),jQuery("#"+selectId).removeClass("validate[required]")):(jQuery("#"+id).removeClass("validate[required]"),jQuery("#"+selectId).addClass("validate[required]"))}}})}validateSingleSelects(){let chosenSelector=".chzn-container-single";jQuery(chosenSelector).length||(chosenSelector=".chosen-container-single"),jQuery(chosenSelector).each(function(){let id=jQuery(this).attr("id");if(void 0!==id){let selectId=id.substr(0,id.lastIndexOf("_"));if(jQuery("#"+selectId).hasClass("validate[required]")||jQuery("#"+id).hasClass("validate[required]")){let values=jQuery("#"+selectId).chosen().val();void 0===values||null==values||0==values.length?(jQuery("#"+id).hasClass("validate[required]")||jQuery("#"+id).addClass("validate[required]"),jQuery("#"+selectId).removeClass("validate[required]")):(jQuery("#"+id).removeClass("validate[required]"),jQuery("#"+selectId).addClass("validate[required]"))}}})}saveForm(formId="item-form"){let isError=!0;jQuery("#"+formId).validationEngine("detach"),isError=jQuery("#"+formId).validationEngine("validate"),jQuery("#"+formId).validationEngine("attach"),isError&&(jQuery("#"+formId+" button").each(function(){jQuery(this).attr("disabled","disabled")}),jQuery("#"+formId+" .jbd-commit").addClass("loader"),document.getElementById(formId).submit())}showLoginNotice(){jQuery("#login-notice").jbdModal()}showMap(display){jQuery("#map-link").hasClass("active")?(jQuery("#companies-map-container").hide(),jQuery("#map-link").removeClass("active")):(jQuery("#companies-map-container").show(),jQuery("#map-link").addClass("active"),mapInstance.initialize(),mapInstance.mapInitialized=!0)}hideMap(){jQuery("#company-map-holder").hide()}initializeSearchAutocomplete(token,preventSubmit,limitedCountries){let element=document.getElementsByClassName("zipcode-"+token)[0];jQuery(document).ready(function(){JBDMapHelper.initAutocomplete(element,function(place){jQuery("#geo-latitude").val(place.latitude),jQuery("#geo-longitude").val(place.longitude),jQuery("#regionSearch").val(place.administrative_area_level_1),jQuery("#citySearch").val(place.locality),jQuery("#location-detected").val("1"),"function"==typeof changeFormActionURL&&changeFormActionURL()},preventSubmit,!1,limitedCountries)})}saveSelectedCategory(categorySet,categId){let catId;catId=jQuery("#search-filter input[type='checkbox']:checked").attr("id"),categorySet&&(catId=categId),jQuery("#adminForm #categoryId").val(catId),jQuery("#adminForm input[name=limitstart]").val(0)}chooseCategory(categoryId){"chk"==categoryId.toString().substring(0,3)&&(categoryId=categoryId.substring(3)),categoryId=categoryId.toString().replace(";",""),jQuery("#adminForm #categoryId").val(categoryId),jQuery("#adminForm input[name=limitstart]").val(0),jbdUtils.initializeGetItemsAjax()}removeSearchRule(type){"province"==type&&jQuery("#adminForm #province-search").val(""),"type"==type&&jQuery("#adminForm #type-search").val(""),"zipcode"==type&&(jQuery("#adminForm #zipcode").val(""),jQuery("#adminForm #radius").val(""),jQuery("#adminForm #geo-latitude").val(""),jQuery("#adminForm #geo-longitude").val("")),"location"==type&&(jQuery("#adminForm #geo-latitude").val(""),jQuery("#adminForm #geo-longitude").val("")),"age"==type&&jQuery("#adminForm #age").val(""),"start-time"==type&&jQuery("#adminForm #start_time").val(""),"end-time"==type&&jQuery("#adminForm #end_time").val(""),"country"==type&&jQuery("#adminForm #country-search").val(""),"region"==type&&jQuery("#adminForm #region-search").val(""),"city"==type&&jQuery("#adminForm #city-search").val(""),"keyword"==type&&(jQuery("#adminForm #searchkeyword").val(""),jQuery("#adminForm #resetSearch").val("1")),"startDate"==type&&jQuery("#adminForm #startDate").val(""),"endDate"==type&&jQuery("#adminForm #endDate").val(""),"minprice"==type&&jQuery("#adminForm #minprice-search").val(""),"maxprice"==type&&jQuery("#adminForm #maxprice-search").val(""),"quoteRequestCompany"==type&&jQuery("#adminForm #selectedParams").val(""),jQuery("#adminForm #resetSearch").val("1"),jQuery("#adminForm").submit()}removeAttrCond(attributeId,value){jQuery("input[name=attribute_"+attributeId+"]").remove(),jQuery("#attribute_"+attributeId).val(""),this.removeFilterRule("attribute_"+attributeId,value),jQuery("#adminForm").submit()}addFilterRule(type,id,text){let filter=jQuery("#adminForm #selectedParams").val(),param="";if(filter.length>0){let start=filter.indexOf(type),end=filter.indexOf(";",start);-1!=start&&(param=filter.slice(start,end),filter=filter.slice(0,start)+filter.slice(end+1),jQuery("#selectedParams").val(filter))}let val=type+"="+id+";";jQuery("#adminForm #selectedParams").val().length>0?jQuery("#adminForm #selectedParams").val(jQuery("#adminForm #selectedParams").val()+val):jQuery("#adminForm #selectedParams").val(val),jQuery("#filter_active").val("1"),jQuery("#adminForm input[name=limitstart]").val(0),jbdUtils.initializeGetItemsAjax()}addFilterItem(type,id,text){let ul=jQuery("#selected-criteria"),li=document.createElement("li");li.innerHTML='<a class="filter-type-elem" onClick="jbdUtils.removeFilterRule(\''+type+"',"+id+')">'+text+'+ <i class="la la-times"></i></a>',ul.append(li)}removeFilterRule(type,id,categorySet,categId){let val=type+"="+id+";",filter=jQuery("#selectedParams").val();if(filter.length>0){let start=filter.indexOf(type),end=filter.indexOf(";",start);if(-1!=start){let param=filter.slice(start,end).toString();if(""!==(filter=filter.slice(0,start)+filter.slice(end+1))){let values=(param=param.replace(type+"=","")).split(",");for(var i=0;i<values.length;i++)parseInt(values[i])==id&&values.splice(i,1);filter+=param=type+"="+values.join()+";"}jQuery("#selectedParams").val(filter)}}jQuery("#selectedParams").val(filter.replace(val,"")),jQuery("#filter_active").val("1"),"city"==type&&jQuery("#adminForm #city-search").val(""),"region"==type&&jQuery("#adminForm #region-search").val(""),"country"==type&&jQuery("#adminForm #country-search").val(""),"type"==type&&jQuery("#adminForm #type-search").val(""),jbdUtils.initializeGetItemsAjax()}resetFilters(resetCategories,isCompany=!1){jQuery("#selectedParams").val(""),resetCategories?jQuery("#categories-filter").val(""):isCompany?jbdListings.saveSelectedCategory():this.saveSelectedCategory(),jQuery("#adminForm #categoryId").val(""),jQuery("#adminForm #searchkeyword").val(""),jQuery("#adminForm #zipcode").val(""),jQuery("#adminForm #city-search").val(""),jQuery("#adminForm #region-search").val(""),jQuery("#adminForm #province-search").val(""),jQuery("#adminForm #age").val(""),jQuery("#adminForm #start_time").val(""),jQuery("#adminForm #end_time").val(""),jQuery("#adminForm #minprice-search").val(""),jQuery("#adminForm #maxprice-search").val(""),jQuery("#adminForm #country-search").val(""),jQuery("#adminForm #type-search").val(""),jQuery("#adminForm #province-search").val(""),jQuery("#adminForm #radius").val(""),jQuery("#adminForm #startDate").val(""),jQuery("#adminForm #endDate").val(""),jQuery("#adminForm #filter-by-fav").val(""),jQuery("input[id*='attribute_']").val(""),jQuery("input[name*='attribute_']").remove(),jQuery("#adminForm #geo-latitude").val(""),jQuery("#adminForm #geo-longitude").val(""),jQuery("#adminForm #resetSearch").val("1"),jbdUtils.initializeGetItemsAjax()}checkMoreFilterRule(val){jQuery("input[name="+val+"]:checked").length>0?jbdUtils.addMoreFilter(val):jbdUtils.removeMoreFilter(val)}addMoreFilter(val){val+=";",jQuery("#moreParams").val().length>0?jQuery("#moreParams").val(jQuery("#moreParams").val()+val):jQuery("#moreParams").val(val),jQuery("#adminForm input[name=limitstart]").val(0)}removeMoreFilter(val){val+=";";let str=jQuery("#adminForm #moreParams").val();jQuery("#adminForm #moreParams").val(str.replace(val,""))}resetMoreFilter(){jQuery("#adminForm #moreParams").val(""),jQuery("#adminForm").submit()}addFilterRuleCategory(catId){catId+=";",jQuery("#categories-filter").val(catId),jQuery("#filter_active").val("1"),jQuery("#adminForm input[name=limitstart]").val(0),jbdUtils.chooseCategory(catId)}removeFilterRuleCategory(catId){let categoryId=catId+";",str=jQuery("#categories-filter").val();jQuery("#categories-filter").val(str.replace(categoryId,"")),jQuery("#categorySearch").val(""),jQuery("input[name='categorySearch']").each(function(){jQuery(this).val("")}),jQuery("#filter_active").val("1");let checked=jQuery("#filterCategoryItems input[type='checkbox']:checked");if(checked.length>0)checked.each(function(){let id=jQuery(this).attr("id");if(id!=catId)return jbdUtils.chooseCategory(id),!1});else if(0==checked.length){let categoryIds=jQuery("#categories-filter").val(),start=(categoryId=categoryIds.slice(0,categoryIds.length-1)).lastIndexOf(";")+1;-1==start&&(start=0),categoryId=categoryId.slice(start,categoryId.length),jbdUtils.chooseCategory(categoryId)}}changeFormActionURL(doSubmit=!0){let country=jbdUtils.getCookie("default-country"),enforceURL=jQuery("#enforce-url").val(),urlFormActionRetriever=jbdUtils.getAjaxUrl("getSearchFormActionAjax","search");1!=enforceURL?jQuery.ajax({type:"GET",url:urlFormActionRetriever,data:{category:jQuery("#admin-form #categorySearch").val(),country:country,city:jQuery("#admin-form #city-search").val(),region:jQuery("#admin-form #region-search").val()},dataType:"json",success:function(data){data&&(jQuery("#adminForm").attr("action",data.data.url),doSubmit&&jQuery("#adminForm").submit())}}):jQuery("#adminForm").submit()}initializeGetItemsAjax(){let form=jQuery("#adminForm"),actionUrl=jbdUtils.getProperty("initialize_get_items_url");if(0==jbdUtils.getProperty("search_results_loading"))return void jQuery("#adminForm").submit();jQuery("#jbd-results-list-container").html(""),jQuery("#jbd-results-grid-container").html(""),jQuery("#list-view-container").addClass("loading"),jQuery("#jbd-grid-view").addClass("loading"),document.getElementById("search-filters-react")&&ReactDOM.unmountComponentAtNode(document.querySelector("#search-filters-react")),jQuery("#adminForm #start").val(0);let filterItemType=jbdUtils.getProperty("filter_item_type");jQuery.ajax({url:actionUrl,type:"GET",data:form.serialize(),cache:!1,success:function(result){jQuery("#total-results").val(result.data.total_results),jQuery(".pag-total-result").text(result.data.total_results),jbdUtils.loadMoreItems();let e=React.createElement;ReactDOM.render(e(SearchFilter,{searchFilterType:jbdUtils.getProperty("ajax_search_filter_type"),showSearchFilterParams:!0,itemType:filterItemType}),document.querySelector("#search-filters-react"))}})}loadMoreItems(){let enable_ratings=jbdUtils.getProperty("enable_ratings"),url=jbdUtils.getProperty("get_items_url"),show_search_map=jbdUtils.getProperty("show_search_map"),start=jQuery("#start").val();void 0==start&&(start=0);let list_layout=jQuery("#list_layout").val(),grid_layout=jQuery("#grid_layout").val(),count=jQuery(".pag-to-result").html(),total_results=jQuery("#total-results").val(),resetLocations=!1,orderBy=jQuery("#orderBy").val();start=parseInt(start),list_layout=parseInt(list_layout),grid_layout=parseInt(grid_layout),count=parseInt(count),0==start&&(resetLocations=!0),jQuery(".load-more-js").addClass("loader dark"),jQuery.ajax({type:"GET",url:url,data:{start:start,list_layout:list_layout,grid_layout:grid_layout,reload:1,total_results:total_results,orderBy:orderBy},dataType:"json",cache:!1,success:function(data){jQuery("#list-view-container").removeClass("loading"),jQuery("#jbd-grid-view").removeClass("loading");let $listHtml=jQuery(data.data.listitems).filter("#jbd-results-list-container").html(),$gridHtml=jQuery(data.data.griditems).find("#jbd-results-grid-container").html();$listHtml||($listHtml=jQuery(data.data.listitems).find("#jbd-results-list-container").html()),jQuery("#jbd-results-list-container").append($listHtml),jQuery("#jbd-results-grid-container").append($gridHtml),1==show_search_map&&data.data.locations&&mapInstance&&mapInstance.setLocations(data.data.locations,resetLocations),jQuery("#start").val(data.data.items_count),jQuery(".pag-to-result").html(data.data.items_count),data.data.show_more?jQuery("#load-more-btn").show():jQuery("#load-more-btn").hide(),1==enable_ratings&&(jbdListings.renderListAverageRating(),jbdListings.renderGridReviewRating()),jQuery(".list-style-7").length&&renderListGallery(),jQuery(".load-more-js").removeClass("loader dark")}})}showMoreParams(div,lessButton){div="#"+div;let less="#"+lessButton;jQuery(div).removeAttr("style"),jQuery(less).css("display","none")}showLessParams(div,moreButton){div="#"+div;let more="#"+moreButton;jQuery(div).css("display","none"),jQuery(more).removeAttr("style")}initSlider(params){let sliderId="#slider",sliderContentId="#slider-content";void 0!==params.sliderId&&(sliderId+="-"+params.sliderId,sliderContentId+="-"+params.sliderId),void 0!==params.override_id&&(sliderId=params.sliderId);let autoplay=!1;void 0!==params.autoplay&&(autoplay=params.autoplay);let autoplaySpeed=0;void 0!==params.autoplaySpeed&&(autoplaySpeed=params.autoplaySpeed);let nrVisibleItems=0;void 0!==params.nrVisibleItems&&(nrVisibleItems=parseInt(params.nrVisibleItems));let nrVisibleItems1024=3;nrVisibleItems1024>nrVisibleItems&&(nrVisibleItems1024=nrVisibleItems);let nrVisibleItems600=2;nrVisibleItems600>nrVisibleItems&&(nrVisibleItems600=nrVisibleItems);let nrItemsToScrool=0;void 0!==params.nrItemsToScrool&&(nrItemsToScrool=parseInt(params.nrItemsToScrool));let rtl=!1;void 0!==params.rtl&&(rtl=params.rtl);let infinite=!0;void 0!==params.infinite&&(infinite=params.infinite);let centerMode=!1;void 0!==params.centerMode&&(centerMode=params.centerMode);let variableWidth=!1;void 0!==params.variableWidth&&(variableWidth=params.variableWidth),jQuery(sliderId+"-loader").hide(),jQuery(sliderId).slick({dots:!1,prevArrow:'<a class="controller-prev" href="javascript:;"><span><i class="la la-angle-left"></i></span></a>',nextArrow:'<a class="controller-next" href="javascript:;"><span><i class="la la-angle-right"></i></span></a>',customPaging:function(slider,i){return'<a class="controller-dot" href="javascript:;"><span><i class="la la-circle"></i></span></a>'},autoplay:autoplay,autoplaySpeed:autoplaySpeed,speed:300,slidesToShow:nrVisibleItems,slidesToScroll:nrItemsToScrool,infinite:infinite,centerMode:centerMode,variableWidth:variableWidth,rtl:rtl,responsive:[{breakpoint:1024,settings:{slidesToShow:nrVisibleItems1024,slidesToScroll:nrVisibleItems1024,infinite:infinite,dots:!1}},{breakpoint:600,settings:{slidesToShow:nrVisibleItems600,slidesToScroll:nrVisibleItems600}},{breakpoint:480,settings:{slidesToShow:1,slidesToScroll:1}}]})}showAddBookmark(requiresLogin,itemId,itemType){requiresLogin?jbdUtils.showLoginNotice():this.showBookmarkDialog(itemId,itemType)}showBookmarkDialog(itemId,itemType){let url=jbdUtils.getAjaxUrl("getBookmarkAjax","bookmark","bookmark");jQuery.ajax({type:"GET",data:{user_id:jQuery("#update-bookmark #user_id").val(),item_id:itemId,item_type:itemType},url:url,cache:!1,success:function(response){response.data.bookmark&&response.data.bookmark.id>0?(jQuery("#update-bookmark #item_id").val(itemId),jQuery("#update-bookmark #item_type").val(itemType),jQuery("#update-bookmark #note").val(response.data.bookmark.note),jQuery("#update-bookmark").jbdModal()):(jQuery("#add-bookmark #item_id").val(itemId),jQuery("#add-bookmark #item_type").val(itemType),jQuery("#add-bookmark #note").val(""),jQuery("#add-bookmark").jbdModal())}})}addBookmark(){let url=jbdUtils.getAjaxUrl("addBookmarkAjax","bookmark","bookmark");jQuery.ajax({type:"GET",data:{item_id:jQuery("#add-bookmark #item_id").val(),item_type:jQuery("#add-bookmark #item_type").val(),note:jQuery("#add-bookmark #note").val()},url:url,cache:!1,success:function(response){let itemId=jQuery("#add-bookmark #item_id").val();jQuery("#bookmark-"+itemId+" i").toggleClass("la la-heart"),jQuery("#bookmark-"+itemId+" i").toggleClass("la la-heart-o"),jbdUtils.showMessage(response.data.response_message)}})}showUpdateBookmarkDialog(requiresLogin,itemId,itemType){requiresLogin?jbdUtils.showLoginNotice():this.showBookmarkDialog(itemId,itemType)}updateBookmark(){let url=jbdUtils.getAjaxUrl("updateBookmarkAjax","bookmark","bookmark");jQuery.ajax({type:"GET",data:{user_id:jQuery("#update-bookmark #user_id").val(),item_id:jQuery("#update-bookmark #item_id").val(),item_type:jQuery("#update-bookmark #item_type").val(),note:jQuery("#update-bookmark #note").val()},url:url,cache:!1,success:function(response){jbdUtils.showMessage(response.data.response_message)}})}removeBookmark(type){let url=jbdUtils.getAjaxUrl("removeBookmarkAjax","bookmark","bookmark");jQuery.ajax({type:"GET",data:{user_id:jQuery("#update-bookmark #user_id").val(),item_id:jQuery("#update-bookmark #item_id").val(),item_type:jQuery("#update-bookmark #item_type").val()},url:url,cache:!1,success:function(response){let itemId=jQuery("#update-bookmark #item_id").val();jQuery("#bookmark-"+itemId+" i").toggleClass("la la-heart"),jQuery("#bookmark-"+itemId+" i").toggleClass("la la-heart-o"),jbdUtils.showMessage(response.data.response_message)}})}showMessage(message){let html='<div class="jbd-container" style="display:none"><div class="jmodal-sm"><div class="jmodal-header"><p class="jmodal-header-title">'+Joomla.JText._("LNG_MESSAGE")+'</p><a href="#close-modal" rel="modal:close" class="close-btn"><i class="la la-close "></i></a></div><div class="jmodal-body"><p>'+message+'<p></div><div class="jmodal-footer"><div class="btn-group" role="group" aria-label=""><button type="button" class="jmodal-btn jmodal-btn-outline" onclick="jQuery.jbdModal.close()">'+Joomla.JText._("LNG_CLOSE")+"</button></div></div></div></div>";jQuery(html).appendTo("body").jbdModal()}basename(path){return path.split("/").reverse()[0]}addDirAnnouncement(){jQuery("#id").val(0),jQuery("#adminForm #task").val("managecompanyannouncement.add"),jQuery("#adminForm").submit()}deleteDirAnnouncement(id){jQuery("#id").val(id),confirm(Joomla.JText._("COM_JBUSINESS_DIRECTORY_ANNOUNCEMENT_CONFIRM_DELETE"))&&(jQuery("#id").val(id),jQuery("#adminForm #task").val("managecompanyannouncements.deleteAnnouncement"),jQuery("#adminForm").submit())}addDirPriceList(){jQuery("#id").val(0),jQuery("#adminForm #task").val("managecompanypricelist.add"),jQuery("#adminForm").submit()}deleteDirPriceList(id){jQuery("#id").val(id),confirm(Joomla.JText._("COM_JBUSINESS_DIRECTORY_PRICE_LIST_CONFIRM_DELETE"))&&(jQuery("#id").val(id),jQuery("#adminForm #task").val("managecompanypricelists.deletePriceList"),jQuery("#adminForm").submit())}addPaymentProcessor(){jQuery("#id").val(0),jQuery("#adminForm #task").val("managepaymentprocessor.add"),jQuery("#adminForm").submit()}deletePaymentProcessor(processorId){confirm(Joomla.JText._("COM_JBUSINESS_DIRECTORY_PAYMENT_PROCESSOR_CONFIRM_DELETE"))&&(jQuery("#id").val(processorId),jQuery("#adminForm #task").val("managepaymentprocessors.delete"),jQuery("#adminForm").submit())}listItemTaskAjax(cid,itemId,task){let iState=jQuery("#"+itemId).prop("checked"),cidArray=[];cidArray[0]=jQuery("#"+cid).val();let url=jbdUtils.getProperty("url")+"&task="+task;jQuery.ajax({type:"GET",url:url,data:{cid:cidArray,id:cidArray[0],itemId:itemId,ajax:!0,status:iState},dataType:"json",success:function(data){if(data.error)jQuery("#"+itemId).prop("checked",!iState);else{if(!Array.isArray(data.cid)){let cida=[data.cid];data.cid=cida}if("categories.unpublish"==task)for(let i=0;i<data.cid.length;i++){jQuery("#jtoggle-state-"+data.cid[i]).prop("checked",!1);let res=document.getElementById("jtoggle-state-"+data.cid[i]).getAttribute("onclick").replace("unpublish","publish");document.getElementById("jtoggle-state-"+data.cid[i]).setAttribute("onclick",res)}else if("categories.publish"==task)for(let i=0;i<data.cid.length;i++){jQuery("#jtoggle-state-"+data.cid[i]).prop("checked",!0);let res=document.getElementById("jtoggle-state-"+data.cid[i]).getAttribute("onclick").replace("publish","unpublish");document.getElementById("jtoggle-state-"+data.cid[i]).setAttribute("onclick",res)}for(let i=0;i<data.cid.length;i++)document.getElementById("jtoggle-state-"+data.cid[i])&&document.getElementById("jtoggle-approval-"+data.cid[i])?jQuery("#jtoggle-state-"+data.cid[i]).prop("checked")&&jQuery("#jtoggle-approval-"+data.cid[i]).prop("checked")?(jQuery("#item-status-"+data.cid[i]).removeClass("bg-danger"),jQuery("#item-status-"+data.cid[i]).addClass("bg-success")):(jQuery("#item-status-"+data.cid[i]).addClass("bg-danger"),jQuery("#item-status-"+data.cid[i]).removeClass("bg-success")):document.getElementById("jtoggle-state-"+data.cid[i])?jQuery("#jtoggle-state-"+data.cid[i]).prop("checked")?(jQuery("#item-status-"+data.cid[i]).removeClass("bg-danger"),jQuery("#item-status-"+data.cid[i]).addClass("bg-success")):(jQuery("#item-status-"+data.cid[i]).addClass("bg-danger"),jQuery("#item-status-"+data.cid[i]).removeClass("bg-success")):document.getElementById("jtoggle-approval-"+data.cid[i])&&(jQuery("#jtoggle-approval-"+data.cid[i]).prop("checked")?(jQuery("#item-status-"+data.cid[i]).removeClass("bg-danger"),jQuery("#item-status-"+data.cid[i]).addClass("bg-success")):(jQuery("#item-status-"+data.cid[i]).addClass("bg-danger"),jQuery("#item-status-"+data.cid[i]).removeClass("bg-success")))}}})}isBlank(str){return!str||/^\s*$/.test(str)}checkAll(elementId){jQuery("#"+elementId+" option").prop("selected",!0),jbdUtils.updateChosenSelect("#"+elementId+" option")}uncheckAll(elementId){jQuery("#"+elementId+" option").prop("selected",!1),jbdUtils.updateChosenSelect("#"+elementId+" option")}uncheckAllCategories(mainCategoryId="main_subcategory",subCategoriesId="categories"){let mainCatElement="#"+mainCategoryId;jQuery(mainCatElement).empty(),jbdUtils.updateChosenSelect(mainCatElement+" option");let subCatElement="#"+subCategoriesId;jQuery(subCatElement+" option").attr("selected",!1),jbdUtils.updateChosenSelect(subCatElement)}truncate(text,id,limit){let truncatedText;return id.length>10&&(id=id.slice(15,id.length)),text.length<=limit?text:text.length>limit?(truncatedText=text.slice(0,limit)+"<span>...</span>",truncatedText+='<a href="javascript:void(0)" onClick=\'jbdUtils.showFullText("'+id+'")\' class="more" id="more'+id+'">'+Joomla.JText._("LNG_READ_MORE")+"</a>",truncatedText+='<span style="display:none;" id="more-text">'+text.slice(limit,text.length)+"</span>"):void 0}printItem(url,params=null){let width="1050",height="700",timeout=2e3;null!=params&&(void 0!==params.width&&(width=params.width),void 0!==params.height&&(height=params.height),void 0!==params.timeout&&(timeout=params.timeout));let winref=window.open(url,"windowName","width="+width+",height="+height);winref.window.focus(),setTimeout(function(){winref.window.print()},timeout)}showFullText(id){jQuery("#more"+id).next().show(),jQuery("#more"+id).prev().remove(),jQuery("#more"+id).remove()}changeOrder(orderField){jQuery("#orderBy").val(orderField),jQuery("#adminForm").submit()}setFilterDates(type,val){jQuery("#"+type).val(val),jQuery("#adminForm").submit()}changeRadius(radius){jQuery("#radius").val(radius),jQuery("#adminForm").submit()}compareVersions(installed,required){let a=installed.split("."),b=required.split(".");for(let i=0;i<a.length;++i)a[i]=Number(a[i]);for(let i=0;i<b.length;++i)b[i]=Number(b[i]);return 2==a.length&&(a[2]=0),a[0]>b[0]||!(a[0]<b[0])&&(a[1]>b[1]||!(a[1]<b[1])&&(a[2]>b[2]||!(a[2]<b[2])))}deleteOfferSellingOption(index){jQuery(".selling-option-fields").length>1?jQuery("#"+index).remove():jQuery("#customOptionsContent #"+index).find(":input").each(function(){jQuery(this).val("")})}deleteProcessorOption(id){if(jQuery(".processor-fields").length>1)jQuery("#processor_field_"+id).remove();else{var nameInput=jQuery("#processor_field_"+id+" #column_name").find("input");nameInput.val(""),nameInput.attr("type","text"),nameInput.attr("placeholder",Joomla.JText._("LNG_COLUMN_NAME")),jQuery("#processor_field_"+id+" .hasTooltip").empty();var valueInput=jQuery("#processor_field_"+id+" #column_value").find("input");valueInput.val(""),valueInput.attr("placeholder",Joomla.JText._("LNG_COLUMN_VALUE")),jQuery("#processor_field_"+id+" #delete_processor_field_"+id).empty()}}addOfferSellingOption(){jQuery("#customOptionsContent div.selling-option-fields:last");var lastElementId=jQuery("#customOptionsContent div.selling-option-fields:last").attr("id"),newIdex=lastElementId.split("-")[1]+1,deleteButton="";deleteButton+='<div id="delete_offer_selling_option">\n                <a href="javascript:void(0)" class="btn btn-xs btn-danger btn-panel" onclick="jbdUtils.deleteOfferSellingOption(\'options-'+newIdex+'\')">\n                    <i class="la la-trash"></i>\n                </a>\n            </div>',jQuery("#"+lastElementId).clone().prop("id","options-"+newIdex).insertAfter("#"+lastElementId),jQuery("#options-"+newIdex).find(":input").each(function(){"hidden"!=this.type&&jQuery(this).val("")}),jQuery("#options-"+newIdex+" .deleteButton").html(deleteButton)}addProcessorOption(id){var newId=(id=parseInt(id))+1,deleteButton="";deleteButton+='<a href="javascript:void(0)" class="btn btn-xs btn-danger btn-panel" onclick="jbdUtils.deleteProcessorOption('+newId+')">',deleteButton+='<i class="la la-trash"></i>',deleteButton+="</a>";var fields=jQuery(".processor-fields"),lastId=jQuery(fields[fields.length-1]).attr("id").slice(-1);jQuery("#processor_field_"+lastId).clone().prop("id","processor_field_"+newId).insertAfter("#processor_field_"+lastId),jQuery("#processor_field_"+newId).addClass("new-field");var newNameField=jQuery("#processor_field_"+newId+" #column_name").find("input");newNameField.attr("id","column_name_"+newId),newNameField.attr("type","text"),newNameField.val(""),newNameField.attr("placeholder",Joomla.JText._("LNG_COLUMN_NAME")),jQuery("#processor_field_"+newId+" .hasTooltip").remove(),jQuery("#processor_field_"+newId+" #column_name_"+lastId).find("button").attr("id","column_name_"+newId+"_img");var newValueField=jQuery("#processor_field_"+newId+" #column_value").find("input");newValueField.attr("id","column_value_"+newId),newValueField.attr("placeholder",Joomla.JText._("LNG_COLUMN_VALUE")),newValueField.val(""),jQuery("#processor_field_"+newId+" #column_value_"+lastId).find("button").attr("id","column_value_"+newId+"_img"),jQuery("#processor_field_"+newId+" #delete_processor_field_"+lastId).prop("id","delete_processor_field_"+newId),jQuery("#add_processor_field").find("a").attr("onclick","jbdUtils.addProcessorOption('"+newId+"')"),jQuery("#delete_processor_field_"+newId).html(deleteButton),jQuery("#add_processor_field"+parseInt(id)).remove()}resizeIframe(iframe){iframe.height=iframe.contentWindow.document.body.scrollHeight+"px"}addProcessorFieldsHTML(){let container=jQuery("#payment_processor_fields"),url=jbdUtils.getAjaxUrl("getPaymentProcessorFields","paymentprocessor","managepaymentprocessor"),processorType=jQuery("#type").find("option:selected").val();if(void 0===processorType||0==processorType.length)return!1;container.empty(),jQuery.ajax({type:"GET",data:{processor_type:processorType},url:url,cache:!1,success:function(data){1==data.status&&container.append(data.data)}})}updateChosenSelect(item){jQuery(item).trigger("liszt:updated"),jQuery(item).trigger("chosen:updated")}renderReviewAverageRating(averageRating){jQuery(".rating-average-review").rating({min:0,max:5,step:.5,stars:5,size:"sm",showCaption:!1,rtl:!1,displayOnly:!0}),jQuery(".rating-average-review").rating("update",averageRating)}updateVideoAttributes(categoryId,videoId){let attributesUrl=jbdUtils.getAjaxUrl("getAttributesAjax","video","managevideo");jQuery.ajax({type:"GET",url:attributesUrl,data:{categoryId:categoryId,videoId:videoId},dataType:"json",cache:!1,success:function(data){jQuery("#customFieldsContent").html(data),jQuery(".chosen-select").chosen({width:"95%",disable_search_threshold:5,search_contains:!0,placeholder_text_single:Joomla.JText._("LNG_SELECT_OPTION"),placeholder_text_multiple:Joomla.JText._("LNG_SELECT_OPTION")})}})}toggleFilter(){jQuery("#search-filter").toggleClass("open"),jQuery("#search-filter").slideToggle(500),jQuery("#search-filter").height()<10?(jQuery(".filter-switch").html(Joomla.JText._("LNG_HIDE_FILTER")),jQuery("#search-filter").parents(".col-lg-3").removeClass("mobile-sticky")):(jQuery(".filter-switch").html(Joomla.JText._("LNG_SHOW_FILTER")),jQuery("#search-filter").parents(".col-lg-3").addClass("mobile-sticky"))}toggleHorizontalFilter(){jQuery("#search-filter-horizontal").toggleClass("open"),jQuery("#search-filter-horizontal").slideToggle(500),jQuery("#search-filter-horizontal").height()<10?jQuery(".filter-switch").html(Joomla.JText._("LNG_HIDE_FILTER")):jQuery(".filter-switch").html(Joomla.JText._("LNG_SHOW_FILTER"))}registerSessionJoinAction(sessionId,userId,requiresLogin,canJoin){requiresLogin?jbdUtils.showLoginNotice():canJoin?this.joinSessionUser(sessionId,userId):jQuery("#register-notice").jbdModal()}joinSessionUser(sessionId,userId){let urlSessionRegister=jbdUtils.getAjaxUrl("joinSessionUserAjax","conferencesessions");jQuery.ajax({type:"GET",data:{session_id:sessionId,user_id:userId},url:urlSessionRegister,success:function(){}})}registerSessionUser(sessionId,userId){let urlSessionRegister=jbdUtils.getAjaxUrl("registerSessionUserAjax","conferencesessions");jQuery.ajax({type:"GET",data:{session_id:sessionId,user_id:userId},url:urlSessionRegister,success:function(){jbdUtils.showMessage("You have been successfully registered to this session."),window.setTimeout(function(){location.reload()},1500)}})}unregisterSessionUser(sessionId,userId,isAdmin=null){void 0!==isAdmin&&null!==isAdmin||(isAdmin=!1);let urlSessionUnregister=jbdUtils.getAjaxUrl("unregisterSessionUserAjax","conferencesessions");jQuery.ajax({type:"GET",data:{session_id:sessionId,user_id:userId},url:urlSessionUnregister,success:function(){isAdmin?jQuery(".registered-user-"+sessionId+userId).toggleClass("d-none"):(jbdUtils.showMessage("You have been successfully unregistered from this session."),window.setTimeout(function(){location.reload()},1500))}})}updateUserSession(sessionId,overlapId,userId){let urlSessionUpdate=jbdUtils.getAjaxUrl("updateUserSessionAjax","conferencesessions");jQuery.ajax({type:"GET",data:{session_id:sessionId,overlapId:overlapId,user_id:userId},url:urlSessionUpdate,success:function(){jbdUtils.showMessage("You have been successfully registered to the new session."),window.setTimeout(function(){location.reload()},1500)}})}showSessionRegisterDialog(requiresLogin,sessionId){requiresLogin?jbdUtils.showLoginNotice():jQuery("#register-session-"+sessionId).jbdModal()}showSessionUnregisterDialog(sessionId){jQuery("#unregister-session-"+sessionId).jbdModal()}showRegisteredUsersDialog(sessionId){jQuery("#registered-users-dialog-"+sessionId).jbdModal()}showSessionUpdateDialog(sessionId){jQuery("#session-update-dialog-"+sessionId).jbdModal()}renderContactFormSteps(){jQuery("#company-contact .jbd-btn-next").on("click",function(){jQuery("#company-contact .form-step-2 , #company-contact .btn-step-2").css("display","block"),jQuery("#company-contact .form-step-1 , #company-contact .btn-step-1").css("display","none")}),jQuery("#company-contact .jbd-btn-back , #company-contact .close-btn").on("click",function(){jQuery("#company-contact .form-step-2 , #company-contact .btn-step-2").css("display","none"),jQuery("#company-contact .form-step-1 , #company-contact .btn-step-1").css("display","block")}),jQuery("#company-contact #description").on("input",function(){jQuery("#company-contact #description").val().length>0?jQuery("#company-contact .jbd-btn-next").attr("disabled",!1):jQuery("#company-contact .jbd-btn-next").attr("disabled",!0)})}renderClaimFormSteps(){jQuery("#company-claim .jbd-btn-next").on("click",function(){jQuery("#company-claim .form-step-2 , #company-claim .btn-step-2").css("display","block"),jQuery("#company-claim .form-step-1 , #company-claim .btn-step-1").css("display","none")}),jQuery("#company-claim .jbd-btn-back , #company-claim .close-btn").on("click",function(){jQuery("#company-claim .form-step-2 , #company-claim .btn-step-2").css("display","none"),jQuery("#company-claim .form-step-1 , #company-claim .btn-step-1").css("display","block")})}removeUserRegistration(sessionId,userId){confirm("Are you sure you want to remove this registered user?")&&jbdUtils.unregisterSessionUser(sessionId,userId,!0)}updateCitiesByRegion(callback){var regionIds=jQuery("#administrative_area_level_1").val(),dataSelected=[];if(jQuery("#locality").find("option:selected").each(function(){dataSelected.push(jQuery(this).val())}),null==regionIds)return jQuery("#locality").empty(),void jbdUtils.updateChosenSelect("#locality");let url=jbdUtils.getAjaxUrl("getCitiesByRegionsAjax","managecities");jQuery.ajax({type:"GET",url:url,data:{regionParam:regionIds},dataType:"json",success:function(data){var selectedVar;jQuery("#locality").empty(),jQuery("#locality").append('<option value="">'+Joomla.JText._("LNG_SELECT_CITY")+"</option>"),jQuery.each(data,function(i,val){selectedVar="","-1"!=jQuery.inArray(val.name,dataSelected)&&dataSelected.length>0&&(selectedVar="selected"),jQuery("#locality").append("<option "+selectedVar+' value="'+val.name+'">'+val.name+"</option>")}),void 0!==callback&&callback()}})}updateRegionsByCountry(callback){var countryId=jQuery("#country").val(),dataSelected=[];if(jQuery("#administrative_area_level_1").find("option:selected").each(function(){dataSelected.push(jQuery(this).val())}),null==countryId)return jQuery("#administrative_area_level_1").empty(),void jbdUtils.updateChosenSelect("#administrative_area_level_1");jQuery.ajax({type:"GET",url:jbdUtils.getAjaxUrl("getRegionsByCountryAjax","manageregions"),data:{countryId:countryId},dataType:"json",success:function(data){var selectedVar;jQuery("#administrative_area_level_1").empty(),jQuery("#administrative_area_level_1").append('<option value="">'+Joomla.JText._("LNG_SELECT_REGION")+"</option>"),jQuery.each(data,function(i,val){selectedVar="","-1"!=jQuery.inArray(val.name,dataSelected)&&dataSelected.length>0&&(selectedVar="selected"),jQuery("#administrative_area_level_1").append("<option "+selectedVar+' value="'+val.name+'">'+val.name+"</option>")}),jQuery("#administrative_area_level_1").val().length>0?jbdUtils.updateCitiesByRegion():jbdUtils.updateCitiesByRegion(function(){jQuery("#locality").empty(),jQuery("#locality").append('<option value="">'+Joomla.JText._("LNG_SELECT_CITY")+"</option>")}),void 0!==callback&&callback()}})}getEditorStats(editor){var body=tinyMCE.get(editor).getBody(),text=tinyMCE.trim(body.innerText||body.textContent);return{chars:text.length,words:text.split(/[\w\u2019\'-]+/).length}}convertMetric(value,index){return value=parseFloat(value),value=(value*=index).toFixed(2)}toggleOnlyLocal(){1==jQuery("#only-local").val()?jQuery("#only-local").val(0):jQuery("#only-local").val(1),jQuery(".toggle-dir-btn input").attr("disabled","disabled"),setTimeout(function(){jQuery("#adminForm").submit()},700)}moveMap(){}initializeQuilEditor(editorId){var icons=Quill.import("ui/icons");icons.undo='<svg viewbox="0 0 18 18">\n            <polygon class="ql-fill ql-stroke" points="6 10 4 12 2 10 6 10"></polygon>\n            <path class="ql-stroke" d="M8.09,13.91A4.6,4.6,0,0,0,9,14,5,5,0,1,0,4,9"></path>\n          </svg>',icons.redo='<svg viewbox="0 0 18 18">\n            <polygon class="ql-fill ql-stroke" points="12 10 14 12 16 10 12 10"></polygon>\n            <path class="ql-stroke" d="M9.91,13.91A4.6,4.6,0,0,1,9,14a5,5,0,1,1,5-5"></path>\n          </svg>';var quill=new Quill(editorId,{modules:{history:{delay:1e3,maxStack:100,userOnly:!1},toolbar:{container:[["bold","italic","underline"],[{list:"ordered"},{list:"bullet"}],["link"],["undo","redo"]],handlers:{undo:function(value){quill.history.undo()},redo:function(value){quill.history.redo()}}}},theme:"snow"})}decodeHtml(html){return jQuery("<div>").html(html).text()}}jQuery.fn.center=function(){return this.css("left",(jQuery(window).width()-this.width())/2+jQuery(window).scrollLeft()+"px"),this};let JBDItemList=function(){this.element=null,this.status=!0,this.delete=!0,this.statusSelector=null,this.enabled=1,this.disabled=0,this.statusCallback=function(){},this.deleteCallback=function(){},this.deleteMsg="Are you sure you want to delete this?",this.construct=function(element,params){this.element=element,void 0!==params&&(void 0!==params.status&&(this.status=params.status),void 0!==params.delete&&(this.delete=params.delete),void 0!==params.statusSelector&&(this.statusSelector=params.statusSelector),void 0!==params.statusCallback&&(this.statusCallback=params.statusCallback),void 0!==params.deleteCallback&&(this.deleteCallback=params.deleteCallback),void 0!==params.enabled&&(this.enabled=params.enabled),void 0!==params.disabled&&(this.disabled=params.disabled),void 0!==params.deleteMsg&&(this.deleteMsg=params.deleteMsg)),this.init()},this.init=function(){var self=this;this.element.find(".jbd-item-list").find(".jbd-item").each(function(){var actionDiv=jQuery(this).find(".jbd-item-actions"),id=self.getId(this);if(self.status){var statusValue=self.getStatusValue(id),statusBtn=self.getStatusButton(statusValue);actionDiv.find(".jbd-item-status").length||(actionDiv.append(statusBtn),actionDiv.find(".jbd-item-status").click(function(){self.changeStatus(this,id)}))}if(self.delete){var deleteBtn=self.getDeleteButton();actionDiv.find(".jbd-item-delete").length||(actionDiv.append(deleteBtn),actionDiv.find(".jbd-item-delete").click(function(){self.deleteItem(id)}))}})},this.changeStatus=function(element,id){var oldClass="la-check-circle",newClass="la-ban",oldVal=this.getStatusValue(id);oldVal==this.disabled&&(oldClass="la-ban",newClass="la-check-circle"),jQuery(element).find(".la").removeClass(oldClass).addClass(newClass),this.statusCallback(id,oldVal)},this.getStatusButton=function(val){var html="";return html+='<a href="javascript:void(0)" class="jbd-item-status">',val==this.enabled?html+='  <i class="la la-check-circle"></i>':html+='  <i class="la la-ban"></i>',html+="</a>"},this.deleteItem=function(id){if(!confirm(this.deleteMsg))return!1;jQuery("#jbd-item-"+id).remove(),this.deleteCallback(id)},this.getDeleteButton=function(){var html="";return html+='<a href="javascript:void(0)" class="jbd-item-delete">',html+='  <i class="la la-trash"></i>',html+="</a>"},this.getId=function(element){return jQuery(element).closest(".jbd-item").attr("id").substr(9)},this.getStatusValue=function(id){return(this.statusSelector.indexOf("#")>-1?jQuery(this.statusSelector+id):jQuery("#"+this.statusSelector+id)).val()}};jQuery.fn.jbdList=function(options){(new JBDItemList).construct(this,options)},String.prototype.replaceAll=function(search,replacement){return this.split(search).join(replacement)};let jbdUtils=new JBDUtils;class JBDMapAbstract{constructor(locations,params,mapType){this.locations=locations,this.params=params,this.mapType=void 0!==mapType?mapType:parseInt(jbdUtils.getProperty("mapType")),this.params.is_admin=void 0!==this.params.is_admin&&this.params.is_admin;let map_zoom=jbdUtils.getProperty("mapDefaultZoom");if(void 0!==this.params&&null!=this.params){let mapDivId="company-map";void 0!==this.params.map_div&&(mapDivId=this.params.map_div);let mapId="";void 0!==this.params.tmapId&&(mapId=this.params.tmapId),this.mapDiv=mapDivId+""+mapId,void 0!==this.params.map_zoom&&(map_zoom=this.params.map_zoom);let map_width="100%",map_height="450px";void 0!==this.params.map_width&&(map_width=this.params.map_width),void 0!==this.params.map_height&&(map_height=this.params.map_height),this.mapWidth=map_width,this.mapHeight=map_height}this.zoom=parseInt(map_zoom),this.mapInitialized=!1}setMapWidth(width){this.mapWidth=width}setMapHeight(height){this.mapHeight=height}hasMap(){return void 0===this.params.no_map}getMap(){return this.map}getMapId(){return void 0!==this.params.tmapId?this.params.tmapId:null}getInstance(){return this}setLocations(locations,resetLocations){resetLocations&&(this.locations=null),this.locations?this.locations=this.locations.concat(locations):this.locations=locations,this.mapInitialized=!1,this.initialize()}}class JBDMapHelper{static loadMapScript(locations,params,mapType){let mapObject=null;if("undefined"!=typeof jbd_map_gdpr&&!jbd_map_gdpr)return JBDMapHelper.openMapGDPRModal(locations,params,mapType),!1;switch(void 0===mapType&&(mapType=jbdUtils.getProperty("mapType")),mapType=parseInt(mapType)){case JBDConstants.MAP_TYPE_GOOGLE:void 0!==JBDGoogleMap&&(mapObject=new JBDGoogleMap(locations,params,mapType));break;case JBDConstants.MAP_TYPE_BING:void 0!==JBDBingMap&&(mapObject=new JBDBingMap(locations,params,mapType));break;case JBDConstants.MAP_TYPE_OSM:void 0!==JBDOpenMap&&(mapObject=new JBDOpenMap(locations,params,mapType));break;default:void 0!==JBDGoogleMap&&(mapObject=new JBDGoogleMap(locations,params,mapType))}return void 0===JBDMapHelper.map_instances&&(JBDMapHelper.map_instances=[]),mapObject.initialize(),JBDMapHelper.map_instances[mapObject.getMapId()]=mapObject,mapObject}static getMapClass(mapType){let mapClass;switch(void 0===mapType&&(mapType=jbdUtils.getProperty("mapType")),mapType=parseInt(mapType)){case JBDConstants.MAP_TYPE_GOOGLE:mapClass=JBDGoogleMap;break;case JBDConstants.MAP_TYPE_BING:mapClass=JBDBingMap;break;case JBDConstants.MAP_TYPE_OSM:mapClass=JBDOpenMap;break;default:mapClass=JBDGoogleMap}return mapClass}static openMapGDPRModal(locations,params,mapType){let script=document.createElement("script"),lang=jbdUtils.getProperty("defaultLang"),key="&key="+jbdUtils.getProperty("google_map_key");script.src="https://maps.googleapis.com/maps/api/js?language="+lang+key+"&libraries=geometry&libraries=places";let modal=jQuery("#map-gdpr-modal");modal.jbdModal(),modal.on("hidden.bs.modal",function(){return!1}),jQuery("#gdpr-deny-btn").on("click",event=>(jQuery.jbdModal.close(),!1)),jQuery("#gdpr-accept-btn").on("click",event=>{document.head.appendChild(script),JBDMapHelper.acceptMapGDPR(locations,params,mapType)})}static acceptMapGDPR(locations,params,mapType){let urlAcceptMapGdpr=jbdUtils.getAjaxUrl("acceptMapGDPRAjax","companies");jQuery.ajax({type:"GET",url:urlAcceptMapGdpr,dataType:"json",success:()=>{jbd_map_gdpr=!0,jQuery.jbdModal.close(),location.reload()}})}static initAutocomplete(element,action,preventSubmit,focus_view,limitedCountries,componentForm){let mapClass=JBDMapHelper.getMapClass();void 0===componentForm&&(componentForm=jbdUtils.getComponentForm()),mapClass.initAutocomplete(element,action,preventSubmit,focus_view,limitedCountries,componentForm)}static reverseGeocoding(location,action){if(jbdUtils.getProperty("mapType")==JBDConstants.MAP_TYPE_BING)return!1;JBDMapHelper.getMapClass().reverseGeocoding(location,action)}static getMapInstance(mapId){return void 0!==JBDMapHelper.map_instances&&void 0!==JBDMapHelper.map_instances[mapId]&&(mapInstance=JBDMapHelper.map_instances[mapId]),mapInstance}}class JBDBingMap extends JBDMapAbstract{constructor(locations,params,mapType){super(locations,params,mapType),this.bounds={maxLat:-999,minLng:999,minLat:999,maxLng:-999},void 0!==this.params&&null!=this.params&&void 0!==this.params.key&&(this.key=this.params.key)}checkifMapLoaded(){var flag=!1;"function"==typeof Microsoft.Maps.Location&&"object"==typeof Microsoft.Maps.Location.prototype&&(flag=!0),0==flag?window.setTimeout(this.checkifMapLoaded.bind(this),500):this.initializeMap()}initialize(){this.checkifMapLoaded()}initializeMap(){if(null!=this.params&&void 0===this.params.no_map){var mapdiv=document.getElementById(this.mapDiv);mapdiv.style.width=this.mapWidth,mapdiv.style.height=this.mapHeight,this.map=new Microsoft.Maps.Map("#"+this.mapDiv,{credentials:this.key,center:new Microsoft.Maps.Location(this.params.map_latitude,this.params.map_longitude),mapTypeId:Microsoft.Maps.MapTypeId.ROAD,zoom:this.zoom}),null!=this.eventParams&&this.addMapListener(this.eventParams.event,this.eventParams.action),this.locations&&this.locations.length>0&&this.setMarkers(this.locations);var self=this;if(1!=jbdUtils.getProperty("enable_map_clustering")||this.params.is_admin||Microsoft.Maps.loadModule("Microsoft.Maps.Clustering",function(){var clusterLayer=new Microsoft.Maps.ClusterLayer(self.markers);self.map.layers.insert(clusterLayer)}),1==jbdUtils.getProperty("map_enable_auto_locate")&&this.bounds.maxLat>-999){var box=new Microsoft.Maps.LocationRect.fromEdges(this.bounds.maxLat,this.bounds.minLng,this.bounds.minLat,this.bounds.maxLng);0!=box.height&&this.map.setView({bounds:box,zoom:this.map.getZoom()})}}}setMarkers(locations){for(var self=this,lastMarker=null,i=0;i<locations.length;i++){var item=locations[i];if(0==item.length||"undefined"===item)continue;var marker=new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(item.latitude,item.longitude),54);this.bounds.maxLat=this.bounds.maxLat<parseFloat(item.latitude)?parseFloat(item.latitude):this.bounds.maxLat,this.bounds.minLat=this.bounds.minLat>parseFloat(item.latitude)?parseFloat(item.latitude):this.bounds.minLat,this.bounds.maxLng=this.bounds.maxLng<parseFloat(item.longitude)?parseFloat(item.longitude):this.bounds.maxLng,this.bounds.minLng=this.bounds.minLng>parseFloat(item.longitude)?parseFloat(item.longitude):this.bounds.minLng;let markerImage="";1==jbdUtils.getProperty("enable_map_clustering")&&this.params.is_admin||("0"!=item.marker?markerImage=item.marker:jbdUtils.getProperty("mapMarker")&&jbdUtils.getProperty("mapMarker").length&&(markerImage=jbdUtils.getProperty("imageBaseUrl")+jbdUtils.getProperty("mapMarker"))),""!==markerImage&&marker.setOptions({icon:markerImage});var center=this.map.getCenter();this.infobox=new Microsoft.Maps.Infobox(center,{maxWidth:263,maxHeight:645,visible:!1}),marker.metadata={description:"description"},marker.metadata.description=item.content;var zIndex=0;void 0!==item.zIndex&&(zIndex=item.zIndex),marker.metadata.zIndex=zIndex;var markerFunction=function(e){e.target.metadata.description.length>0&&self.infobox.setOptions({location:e.target.getLocation(),description:e.target.metadata.description,visible:!0}),self.moveToLocation(e.target.getLocation())};1==this.params.isLayout&&(markerFunction=function(e){var target="#company"+e.target.metadata.zIndex;jQuery([document.documentElement,document.body]).animate({scrollTop:jQuery(target).offset().top-150},1e3),setTimeout(function(){jQuery(target).fadeOut(1e3).fadeIn(500)},1e3)}),Microsoft.Maps.Events.addHandler(marker,"mousedown",markerFunction),this.infobox.setMap(this.map),void 0!==this.markers?this.markers.push(marker):this.markers=Array(marker),1==jbdUtils.getProperty("enable_map_clustering")&&this.params.is_admin||this.map.entities.push(marker),void 0!==item.in_range&&(lastMarker=marker)}if(1==this.params.has_location&&""!=this.params.latitude&&0!=this.params.latitude){var myLatLng={latitude:this.params.latitude,longitude:this.params.longitude};this.addMarker(myLatLng),lastMarker=this.markers.pop();let locationMarker=jbdUtils.getProperty("location_map_marker")?jbdUtils.getProperty("imageBaseUrl")+jbdUtils.getProperty("location_map_marker"):"https://maps.google.com/mapfiles/kml/shapes/library_maps.png";lastMarker.setOptions({icon:locationMarker})}this.params.radius>0&&((void 0===this.params.longitude&&void 0===this.params.latitude||""==this.params.longitude)&&(this.params.longitude=this.params.map_longitude,this.params.latitude=this.params.map_latitude),Microsoft.Maps.loadModule("Microsoft.Maps.SpatialMath",function(){if(void 0!==self.params.map_longitude&&void 0!==self.params.map_latitude&&(1==self.params.has_location||null!=lastMarker)){var center=lastMarker.getLocation(),circle=new Microsoft.Maps.Polygon(center,center,center);circle.metadata={center:center},self.setCircle(center,circle,self.params.radius)}}))}setCircle(center,circle,radius){var locs=Microsoft.Maps.SpatialMath.getRegularPolygon(circle.metadata.center,radius,36,Microsoft.Maps.SpatialMath.DistanceUnits.Miles);circle.setLocations(locs),this.map.entities.push(circle)}moveToLocation(location){this.map.setView({center:new Microsoft.Maps.Location(location.latitude,location.longitude)})}addMarker(location,callback){var marker=new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(location.latitude,location.longitude));this.map.entities.push(marker),this.markers.push(marker),void 0!==callback&&callback()}clearMarkers(){for(var i=this.map.entities.getLength()-1;i>=0;i--){this.map.entities.get(i)instanceof Microsoft.Maps.Pushpin&&this.map.entities.removeAt(i)}this.markers=[]}addMapListener(event,action){Microsoft.Maps.Events.addHandler(this.map,event,function(e){if("map"===e.targetType){var point=new Microsoft.Maps.Point(e.getX(),e.getY()),location=e.target.tryPixelToLocation(point);action(location)}}),this.eventParams=null}static triggerAutocomplete(element,action,preventSubmit,focus_view,limitedCountries){var flag=!1;"function"==typeof Microsoft.Maps.Location&&"object"==typeof Microsoft.Maps.Location.prototype&&"function"==typeof Microsoft.Maps.loadModule&&"object"==typeof Microsoft.Maps.loadModule.prototype&&(flag=!0),0==flag?window.setTimeout(this.triggerAutocomplete.bind(this,element,action,preventSubmit,focus_view,limitedCountries),500):JBDBingMap.loadInitAutocomplete(element,action,preventSubmit,focus_view,limitedCountries)}static initAutocomplete(element,action,preventSubmit,focus_view,limitedCountries){JBDBingMap.triggerAutocomplete(element,action,preventSubmit,focus_view,limitedCountries)}static loadInitAutocomplete(element,action,preventSubmit,focus_view,limitedCountries){void 0===focus_view&&(focus_view=!1),Microsoft.Maps.loadModule("Microsoft.Maps.AutoSuggest",function(){var elementId=jQuery(element).attr("id"),parentId=jQuery(element).parent().attr("id"),manager=new Microsoft.Maps.AutosuggestManager({maxResults:5});if("undefined"==typeof mapInstance&&"undefined"==typeof jbdAdminMapInstance){jQuery("#"+parentId).append('<div style="display:none" id="bing-fake-autocomplete"></div>');new Microsoft.Maps.Map(document.getElementById("bing-fake-autocomplete"))}manager.attachAutosuggest("#"+elementId,"#"+parentId,function(result){focus_view&&"undefined"!=typeof jbdAdminMapInstance&&jbdAdminMapInstance.autocompleteFocus(result),action(JBDBingMap.formatSuggestionResponse(result)),jQuery("#as_container").css("visibility","hidden")})})}autocompleteFocus(result){this.clearMarkers(),this.addMarker(result.location),this.map.setView({bounds:result.bestView})}focusLocation(params){let loc={};loc.latitude=params.latitude,loc.longitude=params.longitude,this.map.setView({center:new Microsoft.Maps.Location(params.latitude,params.longitude)}),void 0!==params.clearMarkers&&params.clearMarkers||this.clearMarkers(),(void 0===params.addMarker||params.addMarker)&&this.addMarker(loc)}static formatSuggestionResponse(place){var suggestionResult=[];let config=JSON.parse(jbdUtils.getProperty("autocomplete_config"));for(let att in config.bing)if(config.bing.hasOwnProperty(att))for(let i=0;i<config.bing[att].length;i++){let alternative=config.bing[att][i];if(void 0!==place.address[alternative]){suggestionResult[att]=place.address[alternative];break}}return suggestionResult.latitude=place.location.latitude,suggestionResult.longitude=place.location.longitude,suggestionResult}}class JBDGoogleMap extends JBDMapAbstract{constructor(locations,params,mapType){super(locations,params,mapType)}initialize(){if(!this.mapInitialized&&null!=this.params&&void 0===this.params.no_map){var center=0;void 0!==this.params.map_longitude&&void 0!==this.params.map_latitude&&(center=new google.maps.LatLng(this.params.map_latitude,this.params.map_longitude));var mapOptions={zoom:this.zoom,scrollwheel:!1,mapTypeId:google.maps.MapTypeId.ROADMAP,center:center};1==this.params.disableDefaultUI&&(mapOptions.disableDefaultUI=!0),mapOptions.styles=[{featureType:"all",elementType:"labels.text",stylers:[{color:"#878787"}]},{featureType:"all",elementType:"labels.text.stroke",stylers:[{visibility:"off"}]},{featureType:"landscape",elementType:"all",stylers:[{color:"#f9f5ed"}]},{featureType:"road.highway",elementType:"all",stylers:[{color:"#f5f5f5"}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{color:"#c9c9c9"}]},{featureType:"water",elementType:"all",stylers:[{color:"#aee0f4"}]},{featureType:"administrative",elementType:"geometry",stylers:[{visibility:"off"}]},{featureType:"poi",stylers:[{visibility:"off"}]},{featureType:"road",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"transit",stylers:[{visibility:"off"}]}];var mapdiv=document.getElementById(this.mapDiv);if(mapdiv.style.width=this.mapWidth,mapdiv.style.height=this.mapHeight,this.map=new google.maps.Map(mapdiv,mapOptions),this.locations&&this.locations.length>0&&this.setMarkers(this.locations),1==this.params.panorama&&this.locations.length>0){var company=this.locations[0],myLatLng=new google.maps.LatLng(company.latitude,company.longitude);this.panorama=this.map.getStreetView(),this.panorama.setPosition(myLatLng),this.panorama.setPov({heading:265,pitch:0})}}}setMarkers(locations){var bounds=new google.maps.LatLngBounds,markers=[],self=this,lastMarker=null,pinImage=null;let width=32,height=37,markerSize=jbdUtils.getProperty("marker_size");null!=markerSize&&0!=markerSize.length&&(width=markerSize.width,height=markerSize.height);for(var i=0;i<locations.length;i++){var item=locations[i];if(0!=item.length&&"undefined"!==item){void 0!==item.marker&&"0"!=item.marker?pinImage={url:item.marker,scaledSize:new google.maps.Size(width,height),origin:new google.maps.Point(0,0),anchor:new google.maps.Point(16,32)}:jbdUtils.getProperty("mapMarker")&&jbdUtils.getProperty("mapMarker").length&&(pinImage={url:jbdUtils.getProperty("imageBaseUrl")+jbdUtils.getProperty("mapMarker"),scaledSize:new google.maps.Size(width,height),origin:new google.maps.Point(0,0),anchor:new google.maps.Point(16,32)});var myLatLng=new google.maps.LatLng(item.latitude,item.longitude);markers.length;var zIndex=0;void 0!==item.zIndex&&(zIndex=item.zIndex);var marker=new google.maps.Marker({position:myLatLng,map:this.map,icon:pinImage,animation:google.maps.Animation.DROP,title:item.title,zIndex:zIndex});if(void 0!==item.in_range&&(lastMarker=marker),markers.push(marker),void 0!==this.markers?this.markers.push(marker):this.markers=Array(marker),1==this.params.isLayout)google.maps.event.addListener(marker,"click",function(){var target="#company"+this.getZIndex();jQuery([document.documentElement,document.body]).animate({scrollTop:jQuery(target).offset().top-150},1e3),setTimeout(function(){jQuery(target).fadeOut(1e3).fadeIn(500)},1e3)});else{var contentBody=item.content,infowindow=new google.maps.InfoWindow({content:contentBody,maxWidth:210});google.maps.event.addListener(marker,"click",function(contentBody){return function(){infowindow.setContent(contentBody),infowindow.open(this.map,this)}}(contentBody))}if(item.activity_radius)(circle=new google.maps.Circle({map:this.map,radius:1600*item.activity_radius,strokeColor:"#006CD9",strokeOpacity:.7,strokeWeight:2,fillColor:"#006CD9",fillOpacity:.15})).bindTo("center",marker,"position");bounds.extend(myLatLng)}}if("undefined"!==this.params.markerButton&&jQuery(".show-marker").click(function(){var id=jQuery(this).closest(".grid-item-holder").attr("id").match(/\d/g);for(id=id.join(""),i=0;i<markers.length;i++)markers[i].getZIndex()==id&&(self.map.setZoom(12),self.map.setCenter(markers[i].getPosition()))}),1==jbdUtils.getProperty("enable_map_clustering")&&!this.params.is_admin){let mcOptions={imagePath:this.params.imagePath+"mapcluster/m"};new MarkerClusterer(this.map,markers,mcOptions)}if(1==this.params.has_location&&""!=this.params.latitude&&0!=this.params.latitude){pinImage={url:jbdUtils.getProperty("location_map_marker")?jbdUtils.getProperty("imageBaseUrl")+jbdUtils.getProperty("location_map_marker"):"https://maps.google.com/mapfiles/kml/shapes/library_maps.png",scaledSize:new google.maps.Size(width,height),origin:new google.maps.Point(0,0),anchor:new google.maps.Point(16,32)},myLatLng=new google.maps.LatLng(this.params.latitude,this.params.longitude),lastMarker=marker=new google.maps.Marker({position:myLatLng,map:this.map,icon:pinImage})}if(this.params.radius>0&&((void 0===this.params.longitude&&void 0===this.params.latitude||""==this.params.longitude)&&(this.params.longitude=this.params.map_longitude,this.params.latitude=this.params.map_latitude),void 0!==this.params.longitude&&void 0!==this.params.latitude&&""!==this.params.longitude)){this.map.setCenter(new google.maps.LatLng(this.params.latitude,this.params.longitude));var circle=new google.maps.Circle({map:this.map,radius:1600*this.params.radius,strokeColor:"#006CD9",strokeOpacity:.7,strokeWeight:2,fillColor:"#006CD9",fillOpacity:.15});1!=this.params.has_location&&null==lastMarker||circle.bindTo("center",lastMarker,"position")}bounds.extend(myLatLng),1!=jbdUtils.getProperty("map_enable_auto_locate")||void 0!==this.params.map_enable_auto_locate&&1!=this.params.map_enable_auto_locate||this.map.fitBounds(bounds);var listener=google.maps.event.addListener(this.map,"idle",function(){self.map.getZoom()>16&&self.map.setZoom(16),google.maps.event.removeListener(listener)})}toggleBounce(marker){null!==marker.getAnimation()?marker.setAnimation(null):marker.setAnimation(google.maps.Animation.BOUNCE)}toggleStreetView(){0==this.panorama.getVisible()?this.panorama.setVisible(!0):this.panorama.setVisible(!1)}moveToLocation(location){var center=new google.maps.LatLng(location.latitude,location.longitude);this.map.panTo(center)}addMarker(location,callback){var loc=new google.maps.LatLng(location.latitude,location.longitude),marker=new google.maps.Marker({position:loc,map:this.map});this.markers.push(marker),void 0!==callback&&callback()}clearMarkers(){for(var i=0;i<this.markers.length;i++)this.markers[i].setMap(null);this.markers=[]}addMapListener(event,action){google.maps.event.addListener(this.map,event,function(e){var location={};location.latitude=e.latLng.lat(),location.longitude=e.latLng.lng(),action(location)})}static initAutocomplete(element,action,preventSubmit,focus_view,limitedCountries,componentForm){var place,autocomplete;autocomplete=void 0!==limitedCountries&&null!==limitedCountries?new google.maps.places.Autocomplete(element,{types:["geocode"],componentRestrictions:{country:limitedCountries}}):new google.maps.places.Autocomplete(element,{types:["geocode"]}),google.maps.event.addListener(autocomplete,"place_changed",function(){place=autocomplete.getPlace(),action(JBDGoogleMap.formatSuggestionResponse(place,componentForm)),focus_view&&"undefined"!=typeof jbdAdminMapInstance&&jbdAdminMapInstance.autocompleteFocus(place)}),preventSubmit&&google.maps.event.addDomListener(element,"keydown",function(e){13==e.keyCode&&jQuery(".pac-container:visible").length&&e.preventDefault()})}autocompleteFocus(place){this.map.setCenter(place.geometry.location),place.geometry.viewport&&this.map.fitBounds(place.geometry.viewport);let loc={};loc.latitude=place.geometry.location.lat(),loc.longitude=place.geometry.location.lng(),this.clearMarkers(),this.addMarker(loc)}focusLocation(params){var loc=new google.maps.LatLng(params.latitude,params.longitude),marker=new google.maps.Marker({position:loc,map:this.map});this.map.setCenter(marker.getPosition()),void 0!==params.clearMarkers&&params.clearMarkers||this.clearMarkers(),(void 0===params.addMarker||params.addMarker)&&this.addMarker(loc)}static reverseGeocoding(location,action){var country,geocoder=new google.maps.Geocoder,latlng=new google.maps.LatLng(location.latitude,location.longitude);geocoder.geocode({latLng:latlng},function(results,status){if(status===google.maps.GeocoderStatus.OK&&results[1]){for(var i=0;i<results[0].address_components.length;i++)for(var b=0;b<results[0].address_components[i].types.length;b++)if("country"===results[0].address_components[i].types[b]){country=results[0].address_components[i];break}action(country.short_name)}})}static formatSuggestionResponse(place,component_form){var suggestionResult=[];let config=JSON.parse(jbdUtils.getProperty("autocomplete_config")),addressComponents=[];for(let i=0;i<place.address_components.length;i++)addressComponents[place.address_components[i].types[0]]=place.address_components[i];for(let component in addressComponents)if(addressComponents.hasOwnProperty(component))for(let att in config.google)for(let i=0;i<config.google[att].length;i++){let alternative=config.google[att][i];if(void 0!==addressComponents[alternative]){suggestionResult[att]=addressComponents[alternative].long_name;break}}return suggestionResult.latitude=place.geometry.location.lat(),suggestionResult.longitude=place.geometry.location.lng(),suggestionResult}}class JBDOpenMap extends JBDMapAbstract{constructor(locations,params,mapType){super(locations,params,mapType),this.infoboxTemplate="<div style='overflow:hidden;'>{content}</div>",this.bounds={maxLat:-999,minLng:999,minLat:999,maxLng:-999}}initialize(){if(!this.mapInitialized&&null!=this.params&&void 0===this.params.no_map){var parent=jQuery("#"+this.mapDiv).parent();jQuery("#"+this.mapDiv).remove(),parent.append('<div id="'+this.mapDiv+'" style="width:'+this.mapWidth+";height:"+this.mapHeight+';z-index:1"></div>'),this.map=L.map(this.mapDiv,{dragging:!L.Browser.mobile,fullscreenControl:!0}).setView([this.params.map_latitude,this.params.map_longitude],this.zoom),L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'}).addTo(this.map),this.locations&&this.locations.length>0&&this.setMarkers(this.locations)}}setMarkers(locations){var markerClusters;1!=jbdUtils.getProperty("enable_map_clustering")||this.params.is_admin||(markerClusters=L.markerClusterGroup());var lastMarker=null;let iconSize=[32,32],markerSize=jbdUtils.getProperty("marker_size");if(0!=markerSize.length&&(iconSize=[markerSize.width,markerSize.height]),locations.length>0){for(var i=0;i<locations.length;i++){var item=locations[i];if(0!=item.length&&"undefined"!==item){var markerImage;this.bounds.maxLat=this.bounds.maxLat<parseFloat(item.latitude)?parseFloat(item.latitude):this.bounds.maxLat,this.bounds.minLat=this.bounds.minLat>parseFloat(item.latitude)?parseFloat(item.latitude):this.bounds.minLat,this.bounds.maxLng=this.bounds.maxLng<parseFloat(item.longitude)?parseFloat(item.longitude):this.bounds.maxLng,this.bounds.minLng=this.bounds.minLng>parseFloat(item.longitude)?parseFloat(item.longitude):this.bounds.minLng,(1!=jbdUtils.getProperty("enable_map_clustering")||1==locations.length||jbdUtils.getProperty("mapMarker"))&&("0"!=item.marker?markerImage=item.marker:jbdUtils.getProperty("mapMarker")&&jbdUtils.getProperty("mapMarker").length&&(markerImage=jbdUtils.getProperty("imageBaseUrl")+jbdUtils.getProperty("mapMarker")));var zIndex=0;void 0!==item.zIndex&&(zIndex=item.zIndex);var popup=this.infoboxTemplate.replace("{content}",item.content),marker=L.marker([item.latitude,item.longitude]);if(marker.zIndex=zIndex,1!=this.params.isLayout)marker.bindPopup(popup);else{var markersLayer=L.featureGroup().addTo(this.map);markersLayer.on("click",function(event){var target="#company"+event.layer.zIndex;jQuery([document.documentElement,document.body]).animate({scrollTop:jQuery(target).offset().top-150},1e3),setTimeout(function(){jQuery(target).fadeOut(1e3).fadeIn(500)},1e3)}),marker.addTo(markersLayer)}if("undefined"!==this.params.markerButton){var self=this;jQuery(".show-marker").click(function(){var id=jQuery(this).closest(".grid-item-holder").attr("id").match(/\d/g);id=id.join("");for(var i=0;i<self.markers.length;i++)self.markers[i].zIndex==id&&self.map.setView([self.markers[i].getLatLng().lat,self.markers[i].getLatLng().lng],16)})}if(1==jbdUtils.getProperty("enable_map_clustering")&&1!=locations.length||marker.addTo(this.map),""!==markerImage&&void 0!==markerImage){var icon=L.icon({iconUrl:markerImage,iconSize:iconSize});marker.setIcon(icon)}markerImage="",1!=jbdUtils.getProperty("enable_map_clustering")||this.params.is_admin||markerClusters.addLayer(marker),void 0!==this.markers?this.markers.push(marker):this.markers=Array(marker),void 0!==item.in_range&&(lastMarker=marker),item.activity_radius&&L.circle([item.latitude,item.longitude],1600*item.activity_radius).addTo(this.map)}}1!=jbdUtils.getProperty("enable_map_clustering")||this.params.is_admin||this.map.addLayer(markerClusters)}if(1==this.params.has_location&&""!=this.params.latitude&&0!=this.params.latitude){var myLatLng={latitude:this.params.latitude,longitude:this.params.longitude};this.addMarker(myLatLng),lastMarker=this.markers.pop();let locationMarker=jbdUtils.getProperty("location_map_marker")?jbdUtils.getProperty("imageBaseUrl")+jbdUtils.getProperty("location_map_marker"):"https://maps.google.com/mapfiles/kml/shapes/library_maps.png";var tmpIcon=L.icon({iconUrl:locationMarker,iconSize:iconSize});lastMarker.setIcon(tmpIcon)}if(this.params.radius>0&&((void 0===this.params.longitude&&void 0===this.params.latitude||""==this.params.longitude)&&(this.params.longitude=this.params.map_longitude,this.params.latitude=this.params.map_latitude),1==this.params.has_location||null!=lastMarker)){var center=lastMarker.getLatLng();L.circle([center.lat,center.lng],1600*this.params.radius).addTo(this.map)}this.map.invalidateSize(!1),1==jbdUtils.getProperty("map_enable_auto_locate")&&this.map.fitBounds([[this.bounds.maxLat,this.bounds.maxLng],[this.bounds.minLat,this.bounds.minLng]])}moveToLocation(location){this.map.setView([location.latitude,location.longitude])}addMarker(location,callback){var marker=L.marker([location.latitude,location.longitude]);(1!=jbdUtils.getProperty("enable_map_clustering")||this.locations.length<=1)&&marker.addTo(this.map),void 0!==this.markers?this.markers.push(marker):this.markers=Array(marker),void 0!==callback&&callback()}clearMarkers(){for(var i=0;i<this.markers.length;i++)this.map.removeLayer(this.markers[i])}addMapListener(event,action){this.map.on(event,function(e){var location={};location.latitude=e.latlng.lat,location.longitude=e.latlng.lng,action(location)})}static initAutocomplete(element,action,preventSubmit,focus_view,limitedCountries){null==limitedCountries&&(limitedCountries=[]),jQuery(element).keyup(function(e){var key=event.keyCode||event.charCode;if(38!=key&&40!=key){var query=jQuery(element).val(),countyLimit="";limitedCountries.length>0&&(countyLimit="&countrycodes="+limitedCountries.join());var res,url="https://nominatim.openstreetmap.org/search?format=json&addressdetails=1&q="+query+countyLimit;jQuery(element).autocomplete({source:function(request,response){jQuery.ajax({type:"GET",url:url,dataType:"json",success:function(data){response(jQuery.map(data,function(item){return{label:item.display_name,value:item.place_id}})),res=data}})},select:function(event,ui){for(var i in event.preventDefault(),jQuery(element).val(ui.item.label),res)res.hasOwnProperty(i)&&res[i].place_id==ui.item.value&&(focus_view&&"undefined"!=typeof jbdAdminMapInstance&&jbdAdminMapInstance.autocompleteFocus(res[i].lat,res[i].lon),action(JBDOpenMap.formatSuggestionResponse(res[i])))}})}})}autocompleteFocus(lat,long){this.clearMarkers();let loc={};loc.latitude=lat,loc.longitude=long,this.addMarker(loc),this.moveToLocation(loc)}focusLocation(params){let loc={};loc.latitude=params.latitude,loc.longitude=params.longitude,this.moveToLocation(loc),void 0!==params.clearMarkers&&params.clearMarkers||this.clearMarkers(),(void 0===params.addMarker||params.addMarker)&&this.addMarker(loc)}static reverseGeocoding(location,action){let response,lon=location.longitude,url="https://nominatim.openstreetmap.org/reverse.php?format=json&lat="+location.latitude+"&lon="+lon;jQuery.ajax({type:"GET",url:url,dataType:"json",success:data=>{response=JBDOpenMap.formatSuggestionResponse(data),action(response.country_code)}})}static formatSuggestionResponse(place){let suggestionResult=[],config=JSON.parse(jbdUtils.getProperty("autocomplete_config"));for(let att in config.openstreet)if(config.openstreet.hasOwnProperty(att))for(let i=0;i<config.openstreet[att].length;i++){let alternative=config.openstreet[att][i];if(void 0!==place.address[alternative]){suggestionResult[att]=place.address[alternative];break}}return suggestionResult.latitude=place.lat,suggestionResult.longitude=place.lon,suggestionResult}}class JBDListings{constructor(){this.issetCategory=!1,this.todayDate=new Date,this.maxDate=new Date,this.maxDate.setMonth(this.todayDate.getMonth()+6),this.availableHoursCallType="site"}setLocationUrl(eurl,eurlf,durl,durlf){this.editUrl=eurl,this.editUrlFront=eurlf,this.deleteUrl=durl,this.deleteUrlFront=durlf}extendPeriod(packageId){jbdUtils.getProperty("isProfile")!=JBDConstants.IS_ADMIN?jQuery("#item-form #task").val("managecompanies.extendPeriod"):(jQuery("#extend_package_id").val(packageId),jQuery("#item-form #task").val("company.extendPeriod")),jQuery("#extend_package_id").val(packageId),jQuery("#item-form").submit()}checkAllActivityCities(){this.uncheckAllActivityCities(),jQuery(".cities_ids-select option").each(function(){""!=jQuery(this).val()&&activityCitiesList.add(jQuery(this))}),jQuery("#activity_cities option").each(function(){jQuery(this).attr("selected","selected")})}uncheckAllActivityCities(){jQuery("#activity_cities option").each(function(){jQuery(this).removeAttr("selected")}),activityCitiesList.remove()}editLocation(locationId,identifier){let baseUrl=this.editUrl;jbdUtils.getProperty("isProfile")==JBDConstants.IS_FRONT&&(baseUrl=this.editUrlFront),baseUrl=baseUrl+"&locationId="+locationId+"&identifier="+identifier,jQuery("#location-frame").attr("src",baseUrl);jQuery("#location-dialog").jbdModal({modalClass:"jbd-modal jbd-location"})}deleteLocation(locationId){if(!confirm(Joomla.JText._("LNG_DELETE_LOCATION_CONF")))return;let baseUrl=this.deleteUrl;jbdUtils.getProperty("isProfile")==JBDConstants.IS_FRONT&&(baseUrl=this.deleteUrlFront);let postData="&locationId="+locationId;jQuery.post(baseUrl,postData,this.processDeleteLocationResult)}processDeleteLocationResult(response){jQuery(response).find("answer").each(function(){if("1"==jQuery(this).attr("error"))jQuery("#location-box-"+jQuery(this).attr("locationId")).remove();else{let html='<div class="jbd-container" style="display:none"><div class="jmodal-sm"><div class="jmodal-header"><p class="jmodal-header-title">'+Joomla.JText._("LNG_LOCATION_DELETE_FAILED")+'</p><a href="#close-modal" rel="modal:close" class="close-btn"><i class="la la-close "></i></a>  </div></div></div>';jQuery(html).appendTo("body").jbdModal(),setTimeout(function(){jQuery.jbdModal.close()},2e3)}})}addNewContact(index){let newIndex=parseInt(index)+1;jQuery("#contact-form-box1").clone().prop("id","contact-form-box"+newIndex).appendTo("#contact_details"),jQuery("#contact-form-box"+newIndex).find("h3").text(Joomla.JText._("LNG_CONTACT")+" "+newIndex),jQuery("#contact-form-box"+newIndex+" input").each(function(){jQuery(this).val("")}),jQuery("#contact-form-box"+newIndex+" .remove-contact").attr("href","javascript:jbdListings.removeContact('"+newIndex+"')").show(),jQuery("#add_contact").attr("onclick","jbdListings.addNewContact('"+newIndex+"')")}removeContact(index){index<2||(index=parseInt(index),jQuery("#contact-form-box"+index).remove())}addNewTestimonial(index){let newIndex=parseInt(index)+1;jQuery("#testimonial-form-box1").clone().prop("id","testimonial-form-box"+newIndex).appendTo("#testimonial_details"),jQuery("#testimonial-form-box"+newIndex).find("h3").text(Joomla.JText._("LNG_TESTIMONIAL")+" "+newIndex),jQuery("#testimonial-form-box"+newIndex+" input").each(function(){jQuery(this).val("")}),jQuery("#testimonial-form-box"+newIndex+" textarea").each(function(){jQuery(this).html("")}),jQuery("#testimonial-form-box"+newIndex+" textarea").val(""),jQuery("#testimonial-form-box"+newIndex+" .remove-testimonial").attr("href","javascript:removeTestimonial('"+newIndex+"')").show(),jQuery("#add_testimonial").attr("onclick","jbdListings.addNewTestimonial('"+newIndex+"')")}removeTestimonial(index){index<2||(index=parseInt(index),jQuery("#testimonial-form-box"+index).remove())}addNewService(index,ServiceFolder,ServiceFolderPath){let newIndex=parseInt(index)+1;jQuery("#service-form-box1").clone().prop("id","service-form-box"+newIndex).appendTo("#service_details"),jQuery("#service-form-box"+newIndex).find("h5").text(Joomla.JText._("LNG_ITEM")+" "+newIndex),jQuery("#service-form-box"+newIndex+" input").each(function(){jQuery(this).val("")}),jQuery("#service-form-box"+newIndex+" textarea").each(function(){jQuery(this).html("")}),jQuery("#service-form-box"+newIndex+" textarea").val(""),jQuery("#service-form-box"+newIndex+" .input-imageLocation").prop("id","service-imageLocation"+newIndex),jQuery("#service-form-box"+newIndex+" .input-imageLocationSize").prop("id","service-imageUploader"+newIndex),jQuery("#service-form-box"+newIndex+" .services").prop("id","service-picture-preview"+newIndex),jQuery("#member-picture-preview"+newIndex).html('<i class="la la-image"></i>'),jQuery("#service-form-box"+newIndex+" #imageSelection2").find("a").prop("href",'javascript:uploadInstance.removeImage("service-",  '+newIndex+")"),jQuery("#service-form-box"+newIndex+" #imageSelection2").find("label").prop("for","service-imageUploader"+newIndex),jQuery("#service-form-box"+newIndex+" #imageSelection1").find("#service-imageUploader1").prop("id","service-imageUploader"+newIndex),jQuery("#service-form-box"+newIndex).find("#service-imageLocation1").prop("id","service-imageLocation"+newIndex),jQuery("#service-form-box"+newIndex+" .remove-service").attr("href","javascript:jbdListings.removeService('"+newIndex+"')").show(),jQuery("#add_service").attr("onclick","jbdListings.addNewService('"+newIndex+"','"+ServiceFolder+"','"+ServiceFolderPath+"')"),JBDUploadHelper.getUploadInstance().imageUploader(ServiceFolder,ServiceFolderPath,"service-",newIndex)}removeService(index){index<2||(index=parseInt(index),jQuery("#service-form-box"+index).remove())}disableWorkPeriod(day,mandatory,multiple){let status;void 0===multiple&&(multiple=!0);let button,checked=jQuery("#work_status_check_"+day).is(":checked"),dayRow=jQuery("#js_workhours_"+day);multiple&&(dayRow=jQuery("#break_period_"+day)),checked?(status=1,jQuery("#work_start_hour_"+day).prop("readonly",!1),mandatory&&(jQuery("#work_start_hour_"+day).addClass("validate[required]"),jQuery("#work_end_hour_"+day).addClass("validate[required]")),jQuery("#work_end_hour_"+day).prop("readonly",!1),(button=dayRow.find(".js_action_buttons").find("a")).text(Joomla.JText._("LNG_ADD_BREAK")),button.attr("onclick","jbdListings.addBreak("+day+", "+multiple+")"),button.attr("disabled",!1),button.addClass("btn-success"),button.removeClass("btn-outline-danger")):(status=0,jQuery("#work_start_hour_"+day).prop("readonly",!0),mandatory&&(jQuery("#work_start_hour_"+day).removeClass("validate[required]"),jQuery("#work_end_hour_"+day).removeClass("validate[required]")),jQuery("#work_end_hour_"+day).prop("readonly",!0),(button=dayRow.find(".js_action_buttons").find("a")).attr("disabled",!0),button.text(Joomla.JText._("LNG_CLOSED")),button.attr("onclick",""),button.removeClass("btn-success"),button.addClass("btn-outline-danger"),jQuery("#break_hours_day_"+day).empty(),jQuery("#break_periods_count_"+day).val(0)),jQuery("#work_status_"+day).val(status)}addBreak(day,multiple){let newId=parseInt(jQuery("#break_periods_count_"+day).val())+1,button=jQuery("#js_workhours_"+day).find(".js_action_buttons").find("a");if(void 0!==button.attr("disabled"))return!1;let html="";html+='<div class="row align-items-center" id="break_hour_period_'+day+"_"+newId+'">',html+='<div class="col-1 p-1"></div>',html+='<div class="col-4"><input type="text" name="break_start_hour[]" class="form-control p-1 text-center timepicker" value="01:00 PM" /></div>',html+='<div class="col-4"><input type="text" name="break_end_hour[]" class="form-control p-1 text-center timepicker" value="02:00 PM" /></div>',multiple?html+='<div class="col-2"><a href="javascript:void(0)" class="btn btn-sm btn-danger btn-panel" onclick="jbdListings.deleteBreak('+day+", "+newId+')">':(html+='<div class="col-2"><a href="javascript:void(0)" class="btn btn-sm btn-danger btn-panel" onclick="jbdListings.deleteCompanyBreak('+day+", "+newId+')">',button.attr("disabled",!0)),html+='<i class="la la-trash"></i>',html+="</a></div>",html+='<input type="hidden" name="break_ids[]" id="break_ids" value="" />',html+="</div>",jQuery("#break_hours_day_"+day).append(html),jQuery("#break_periods_count_"+day).val(newId),multiple||(jQuery("#break_period_"+day).find(".break-button").attr("disabled",!0),jQuery("#break_period_"+day).find(".break-button").attr("onclick","")),jQuery(".timepicker").timepicker({timeFormat:jbdUtils.getProperty("timeFormat"),minTime:"6:00am"})}deleteCompanyBreak(day,id){jQuery("#break_hour_period_"+day+"_"+id).remove(),jQuery("#js_workhours_"+day).find(".js_action_buttons").find("a").attr("disabled",!1),jQuery("#break_period_"+day).find(".break-button").removeAttr("disabled");let count=jQuery("#break_periods_count_"+day).val();count>0&&count--,jQuery("#break_periods_count_"+day).val(count),jQuery("#break_period_"+day).find(".break-button").attr("onclick","jbdListings.addBreak("+day+", false)")}deleteBreak(day,id){jQuery("#break_hour_period_"+day+"_"+id).empty();let newCount=parseInt(jQuery("#break_periods_count_"+day).val())-1;jQuery("#break_periods_count_"+day).val(newCount)}disableTrailPeriod(date){jQuery("#trail_status_"+date).val();let button=jQuery(".js_trailhours_"+date).find(".js_action_buttons").find("a");jQuery("#trail_status_checkbox_"+date).is(":checked")?(jQuery("#trail_status_"+date).val(1),jQuery(".js_trail_row_"+date).find(".js_trail_hours").attr("disabled",!1),button.text(Joomla.JText._("LNG_ADD_BREAK")),button.attr("onclick",'jbdListings.addTrailBreak("'+date+'")'),button.attr("disabled",!1),button.addClass("btn-success"),button.removeClass("btn-outline-danger")):(jQuery("#trail_status_"+date).val(0),jQuery(".js_trail_row_"+date).find(".js_trail_hours").attr("disabled",!0),button.attr("disabled",!0),button.text(Joomla.JText._("LNG_CLOSED")),button.attr("onclick",""),button.removeClass("btn-success"),button.addClass("btn-outline-danger"))}addTrailBreak(date){let button=jQuery(".js_trailhours_"+date).find(".js_action_buttons").find("a");if(void 0!==button.attr("disabled"))return!1;button.attr("disabled",!0),jQuery("#trail_breaks_status_"+date).val(1),jQuery("#trail_break_hours_"+date).show(),jQuery(".timepicker").timepicker({timeFormat:jbdUtils.getProperty("timeFormat"),minTime:"6:00am"})}deleteTrailBreak(date){let button=jQuery(".js_trailhours_"+date).find(".js_action_buttons").find("a");jQuery("#trail_breaks_status_"+date).val(0),jQuery("#trail_break_hours_"+date).hide(),button.attr("disabled",!1)}updateAttributes(categoryId,companyId){let attributesUrl=jbdUtils.getAjaxUrl("getAttributesAjax","company","managecompany"),packageId=0;1==jbdUtils.getProperty("enable_packages")&&((packageId=jQuery("#filter_package_select").val())||(packageId=jQuery("#filter_package").val())),jQuery.ajax({type:"GET",url:attributesUrl,data:{categoryId:categoryId,companyId:companyId,packageId:packageId},dataType:"json",cache:!1,success:function(data){null!==data&&"undefined"!==data?jQuery("#custom-attributes-section").show():jQuery("#custom-attributes-section").hide(),jQuery("#customFieldsContent").html(data),jQuery(".chosen-select").chosen({width:"95%",disable_search_threshold:5,search_contains:!0,placeholder_text_single:Joomla.JText._("LNG_SELECT_OPTION"),placeholder_text_multiple:Joomla.JText._("LNG_SELECT_OPTION")})}})}displaySubcategories(id,level,maxLevel){let categoryId=jQuery("#"+id).val();categoryId||(categoryId=0);for(let i=level+1;i<=maxLevel;i++)jQuery("#company_categories-level-"+i).html("");jQuery("#company_categories-level-"+(level+1)).html("<div style='width:20px;margin: 0 auto;'><img align='center' src='"+jbdUtils.getProperty("imageRepo")+"/assets/images/loading.gif'  /></div>");let postParameters="";postParameters+="&categoryId="+categoryId;let postData="";postData=jbdUtils.getProperty("isProfile")==JBDConstants.IS_ADMIN?"&option=com_jbusinessdirectory&task=company.getSubcategories"+postParameters:"&option=com_jbusinessdirectory&task=managecompany.getSubcategories"+postParameters,jQuery.post(jbdUtils.baseUrl,postData,this.processDisplaySubcategoriesResponse)}processDisplaySubcategoriesResponse(response){let self=this;jQuery(response).find("answer").each(function(){if("1"==jQuery(this).attr("error"))jQuery("#frm_error_msg_facility").className="text_error",jQuery("#frm_error_msg_facility").html(jQuery(this).attr("errorMessage")),jQuery("#frm_error_msg_facility").show();else if("0"==jQuery(this).attr("error")){jQuery("#subcategories").html(jQuery(this).attr("content_categories")),self.removeSelectedCategories(),jQuery("#company_categories-level-"+jQuery(this).attr("category-level")).html("");let level=1+parseInt(jQuery(this).attr("category-level"));jQuery("#company_categories-level-"+level).html(""),"1"!=jQuery(this).attr("isLastLevel")&&jQuery("#company_categories-level-"+jQuery(this).attr("category-level")).html(jQuery(this).attr("content_select_categories"))}})}removeSelectedCategories(){jQuery("#mainSubcategory > option").each(function(){jQuery("#subcategories option[value="+jQuery(this).val()+"]").remove()})}hideDisapprovalBox(){jQuery("#disapprovalBox").hide()}showDisapprovalBox(){jQuery("#disapprovalBox").show()}addVacation(id){let newId=(id=parseInt(id))+1,deleteButton="";deleteButton+="<br/>",deleteButton+='<a href="javascript:void(0)" class="btn btn-sm btn-danger btn-panel mb-1" onclick="jbdListings.deleteVacation('+newId+')">',deleteButton+='<i class="la la-trash"></i>',deleteButton+="</a>",jQuery("#vacation_0").clone().prop("id","vacation_"+newId).insertAfter("#vacation_"+id),jQuery("#vacation_"+newId+" #start_calendar_0").find("input").attr("id","start_date_"+newId),jQuery("#vacation_"+newId+" #start_calendar_0").find("input").val(""),jQuery("#vacation_"+newId+" #start_calendar_0").find("button").attr("id","start_date_"+newId+"_img"),jQuery("#vacation_"+newId+" #end_calendar_0").find("input").attr("id","end_date_"+newId),jQuery("#vacation_"+newId+" #end_calendar_0").find("input").val(""),jQuery("#vacation_"+newId+" #end_calendar_0").find("button").attr("id","end_date_"+newId+"_img"),jQuery("#vacation_"+newId+" #delete_vacation_0").prop("id","delete_vacation_"+newId),jQuery("#add_vacation").find("a").attr("onclick","jbdListings.addVacation('"+newId+"')"),jQuery("#delete_vacation_"+newId).html(deleteButton),this.initCalendar(newId),jQuery("#add_vacation_"+parseInt(id)).remove()}deleteVacation(id){jQuery("#vacation_"+id).empty()}updateServices(){let companyId=jQuery("#company_id").find(":selected").val(),urlGetServices=jbdUtils.getAjaxUrl("getServicesAjax","companyserviceprovider","managecompanyserviceprovider");jQuery.ajax({type:"GET",url:urlGetServices,data:{companyId:companyId},dataType:"json",cache:!1,success:function(data){jQuery("#services").html(data),jbdUtils.updateChosenSelect("#services")}})}initCalendar(id){Calendar._DN=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Calendar._SDN=["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Calendar._FD=0,Calendar._MN=["January","February","March","April","May","June","July","August","September","October","November","December"],Calendar._SMN=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Calendar._TT={INFO:"About the Calendar",ABOUT:"DHTML Date/Time Selector\n(c) dynarch.com 2002-2005 / Author: Mihai Bazon\nFor latest version visit: http://www.dynarch.com/projects/calendar/\nDistributed under GNU LGPL.  See http://gnu.org/licenses/lgpl.html for details.\n\nDate selection:\n- Use the « and » buttons to select year\n- Use the < and > buttons to select month\n- Hold mouse button on any of the buttons above for faster selection.",ABOUT_TIME:"\n\nTime selection:\n- Click on any of the time parts to increase it\n- or Shift-click to decrease it\n- or click and drag for faster selection.",PREV_YEAR:"Select to move to the previous year. Select and hold for a list of years.",PREV_MONTH:"Select to move to the previous month. Select and hold for a list of the months.",GO_TODAY:"Go to today",NEXT_MONTH:"Select to move to the next month. Select and hold for a list of the months.",SEL_DATE:"Select a date.",DRAG_TO_MOVE:"Drag to move.",PART_TODAY:" Today ",DAY_FIRST:"Display %s first",WEEKEND:"0,6",CLOSE:"Close",TODAY:"Today",TIME_PART:"(Shift-)Select or Drag to change the value.",DEF_DATE_FORMAT:"%Y-%m-%d",TT_DATE_FORMAT:"%a, %b %e",WK:"wk",TIME:"Time:"},Calendar.setup({inputField:"start_date_"+id,ifFormat:"%d-%m-%Y",button:"start_date_"+id+"_img",align:"Tl",singleClick:!0,firstDay:0,defaultDate:new Date}),Calendar.setup({inputField:"end_date_"+id,ifFormat:"%d-%m-%Y",button:"end_date_"+id+"_img",align:"Tl",singleClick:!0,firstDay:0,defaultDate:new Date})}updateProviders(){let serviceId=jQuery("#service_id").find(":selected").val(),urlGetProviders=jbdUtils.getAjaxUrl("getProvidersAjax","companyservicereservation");jQuery("#time-text").empty(),jQuery("#date-text").empty(),jQuery.ajax({type:"GET",url:urlGetProviders,data:{serviceId:serviceId},dataType:"json",cache:!1,success:function(data){jQuery("#provider_id").html(data)}})}selectHourAdmin(time){jQuery("#time").val(time),jQuery("#time-text").html(time)}showAppointmentDialog(){jQuery("#event-appointment").jbdModal(),jQuery(".timepicker").timepicker({timeFormat:jbdUtils.getProperty("timeFormat"),minTime:"6:00am"})}makeAppointment(eventId,eventStartDate,eventEndDate){this.showAppointmentDialog(),jQuery("#eventId-appoint").val(eventId),this.listAvailableDates(eventStartDate,eventEndDate)}listAvailableDates(eventStartDate,eventEndDate){let dStart,dEnd;dStart=0===eventStartDate.length||null==eventStartDate||"0000-00-00"===eventStartDate?new Date:new Date(eventStartDate),0===eventEndDate.length||null==eventEndDate||"0000-00-00"===eventEndDate?(dEnd=new Date).setDate(dStart.getDate()+20):dEnd=new Date(eventEndDate);let dNow=new Date;dNow>dStart&&dNow<dEnd&&(dStart=dNow);let select=document.getElementById("date-appoint"),i=0;for(;dStart<=dEnd&&i<=20;){let opt=document.createElement("option");opt.value=dStart.toDateString(),opt.innerHTML=dStart.toDateString(),select.appendChild(opt),dStart.setDate(dStart.getDate()+1),i++}}selectService(id){serviceId=id,providerId=0,wizard.steps("next")}selectProvider(id,type){providerId=id,providerType=type,providerName=jQuery("#provider-"+id).text(),serviceName=jQuery(".selected-service").text(),jQuery("#morning").empty(),jQuery("#afternoon").empty(),jQuery("#evening").empty(),wizard.steps("next")}selectHour(hour){selectedHour=hour,wizard.steps("finish")}renderProviders(){let urlGetProviders=jbdUtils.getAjaxUrl("getServiceProvidersAjax","companyservicereservation","managecompanyservicereservation");jQuery.ajax({type:"GET",url:urlGetProviders,data:{serviceId:serviceId},dataType:"json",cache:!1,success:function(data){jQuery("#providers-content").html(data)}})}createProviderCalendarAdmin(){let providerId=jQuery("#provider_id").find(":selected").val(),providerType=jQuery("#provider_type").val(),urlGetDays=jbdUtils.getAjaxUrl("getVacationDaysAjax","companyservicereservation","managecompanyservicereservation");2==providerType&&(urlGetDays=jbdUtils.getAjaxUrl("getWorkingDaysAjax","companyservicereservation","managecompanyservicereservation"));let $bookingDate=jQuery("#item-form #date").val();this.availableHoursCallType="admin",this.createProviderCalendar(providerId,providerType,$bookingDate)}createProviderCalendarFront(){jQuery(".selected-provider-service").text(serviceName),jQuery(".selected-provider").text(providerName),this.availableHoursCallType="site",this.createProviderCalendar(providerId,providerType,null)}createProviderCalendar(providerId,providerType,seldate){let urlGetDays=jbdUtils.getAjaxUrl("getVacationDaysAjax","companyservicereservation","managecompanyservicereservation");2==providerType&&(urlGetDays=jbdUtils.getAjaxUrl("getWorkingDaysAjax","companyservicereservation","managecompanyservicereservation"));let self=this,hourCall=self.getAvailableHoursFront;"admin"==self.availableHoursCallType&&(hourCall=self.getAvailableHoursAdmin),jQuery.ajax({type:"GET",url:urlGetDays,data:{providerId:providerId},dataType:"json",cache:!1,success:function(data){var startDate=self.todayDate;if(data&&data.length>0&&2==providerType){let parts=data.at(-1).split("-");startDate=new Date(parts[2],parts[1]-1,parts[0]),datepicker.minDate=startDate}if(jQuery("#datepicker").datepicker("destroy"),jQuery("#datepicker").datepicker({beforeShowDay:function(date){let string=jQuery.datepicker.formatDate("dd-mm-yy",date);return 2==providerType?[-1!=data.indexOf(string)]:[-1==data.indexOf(string)]},onSelect:hourCall,minDate:startDate}),seldate){var parts=seldate.split("-"),sDate=new Date(parts[0],parts[1]-1,parts[2]);jQuery("#datepicker").datepicker("setDate",sDate)}let todayString=jQuery.datepicker.formatDate("dd-mm-yy",startDate);(-1==data.indexOf(todayString)&&1==providerType||-1!=data.indexOf(todayString)&&2==providerType)&&("admin"==self.availableHoursCallType?self.getAvailableHoursAdmin(seldate):self.getAvailableHoursFront(startDate))}})}getAvailableHoursAdmin(date){let serviceId=jQuery("#service_id").find(":selected").val(),providerId=jQuery("#provider_id").find(":selected").val(),providerType=jQuery("#provider_type").find(":selected").val();jQuery("#date").val(date),jQuery("#date-text").html(date),jbdListings.getAvailableHours(date,serviceId,providerId,providerType)}getAvailableHoursFront(date){jbdListings.getAvailableHours(date,serviceId,providerId,providerType)}getAvailableHours(date,serviceId,providerId,providerType){let urlGetHours=jbdUtils.getAjaxUrl("getAvailableHoursAjax","companyservicereservation","managecompanyservicereservation"),hoursD=new Date(date),hoursDate=jQuery.datepicker.formatDate("dd-mm-yy",hoursD),self=this;jQuery.ajax({type:"GET",url:urlGetHours,data:{serviceId:serviceId,providerId:providerId,providerType:providerType,type:this.availableHoursCallType,date:hoursDate},dataType:"json",cache:!1,success:function(data){jQuery("#morning").empty(),jQuery("#afternoon").empty(),jQuery("#evening").empty(),jQuery("#morning").append(data.morning),jQuery("#afternoon").append(data.afternoon),jQuery("#evening").append(data.evening),"site"==self.availableHoursCallType?selectedDate=hoursDate:jQuery("#date").val(hoursDate)}})}initTabs(tabId){jQuery("#tabs").tabs(),jQuery("#dir-tab-2").click(function(){loadDetailsViewMap()}),jQuery(".dir-tabs-options").click(function(){jQuery(".dir-tabs-options").each(function(){jQuery(this).removeClass("ui-state-active")}),jQuery(this).addClass("ui-state-active")}),jQuery("#dir-tab-"+tabId).click()}showCompanyMap(){jQuery("#company-map-holder").show(),loadDetailsViewMap()}showDetails(identifier){let ids=["company-details","company-announcements","company-gallery","company-videos","company-sounds","company-offers","company-offers-price-list","company-products","company-related","company-services","company-associated","company-events","events-associated","company-testimonials","company-price-list","company-projects","company-memberships","listing-articles","company-team","company-reviews","company-contact-details"],pos=ids.indexOf(identifier);jQuery(".company-menu a").each(function(){jQuery(this).removeClass("active")}),this.returnToProjects();let linkIdentifier=identifier.substring(identifier.indexOf("-")+1,identifier.length);jQuery("#"+linkIdentifier+"-link").addClass("active");for(let i=0;i<pos;i++)jQuery("#"+ids[i]).slideUp();for(let i=pos;i<ids.length;i++)jQuery("#"+ids[i]).slideDown()}showTabContent(identifier){let ids=["company-details","company-gmap","company-testimonials","company-services","company-price-list","company-projects","company-offers-price-list","company-announcements","company-products","company-team","company-reviews"];jQuery(".company-menu a").each(function(){jQuery(this).removeClass("active")});let linkIdentifier=identifier.substring(identifier.indexOf("-")+1,identifier.length);jQuery("#"+linkIdentifier+"-link").addClass("active"),jQuery("#"+identifier).show();for(let i=0;i<ids.length;i++)ids[i]!==identifier&&jQuery("#"+ids[i]).hide();"company-projects"===identifier&&this.returnToProjects(),"company-gmap"===identifier&&loadDetailsViewMap(),"company-products"===identifier&&this.goBack(),"company-offers"===identifier&&jQuery(".offers-container").removeAttr("style")}renderUserAverageRating(averageRating,companyId,showNotice){let self=this;jQuery(".user-rating-avg").rating({min:0,max:5,step:.5,stars:5,starCaptions:{.5:Joomla.JText._("LNG_BAD"),1:Joomla.JText._("LNG_BAD"),1.5:Joomla.JText._("LNG_POOR"),2:Joomla.JText._("LNG_POOR"),2.5:Joomla.JText._("LNG_REGULAR"),3:Joomla.JText._("LNG_REGULAR"),3.5:Joomla.JText._("LNG_GOOD"),4:Joomla.JText._("LNG_GOOD"),4.5:Joomla.JText._("LNG_GORGEOUS"),5:Joomla.JText._("LNG_GORGEOUS")},size:"sm",showCaption:!1,starCaptionClasses:{.5:"badge badge-danger",1:"badge badge-danger",1.5:"badge badge-warning",2:"badge badge-warning",2.5:"badge badge-info",3:"badge badge-info",3.5:"badge badge-primary",4:"badge badge-primary",4.5:"badge badge-success",5:"badge badge-success"},clearCaption:Joomla.JText._("LNG_NOT_RATED_YET"),clearCaptionClass:"badge badge-default",hoverEnabled:!1,hoverChangeCaption:!1,hoverChangeStars:!1,rtl:!1,displayOnly:!0}),jQuery(".user-rating-avg").on("rating:change",function(event,value,caption){1==showNotice?(jQuery(this).rating("update",jQuery(this).attr("title")),jbdUtils.showLoginNotice()):self.updateCompanyRate(companyId,value)}),jQuery(".user-rating-avg").on("rating:clear",function(event){jQuery(this).parent().parent().parent().children("input").val(0)}),jQuery(".user-rating-avg").on("rating:reset",function(event){jQuery(this).parent().parent().parent().children("input").val(0)})}showReviewForm(requiresLogin){requiresLogin?jbdUtils.showLoginNotice():(jQuery("#add-review").slideDown(500),jQuery("html, body").animate({scrollTop:jQuery("#add-review").offset().top+jQuery("#add-review").height()/2},1e3))}renderRatingCriteria(calculate_review_criterias,companyId){let self=this;jQuery(".rating-criteria").rating({min:0,max:5,step:.5,stars:5,starCaptions:{.5:Joomla.JText._("LNG_BAD"),1:Joomla.JText._("LNG_BAD"),1.5:Joomla.JText._("LNG_POOR"),2:Joomla.JText._("LNG_POOR"),2.5:Joomla.JText._("LNG_REGULAR"),3:Joomla.JText._("LNG_REGULAR"),3.5:Joomla.JText._("LNG_GOOD"),4:Joomla.JText._("LNG_GOOD"),4.5:Joomla.JText._("LNG_GORGEOUS"),5:Joomla.JText._("LNG_GORGEOUS")},size:"sm",showCaption:!0,starCaptionClasses:{.5:"badge badge-danger",1:"badge badge-danger",1.5:"badge badge-warning",2:"badge badge-warning",2.5:"badge badge-info",3:"badge badge-info",3.5:"badge badge-primary",4:"badge badge-primary",4.5:"badge badge-success",5:"badge badge-success"},clearCaption:Joomla.JText._("LNG_NOT_RATED_YET"),clearCaptionClass:"badge badge-default",hoverEnabled:!0,hoverChangeCaption:!0,hoverChangeStars:!0,rtl:!1}),jQuery(".rating-criteria").on("rating:change",function(event,value,caption){if(jQuery(this).parent().parent().parent().children("input").val(value),1==calculate_review_criterias){let total=0,count=0;jQuery(".review-criterias").each(function(){count++,total+=parseFloat(jQuery(this).val())}),isNaN(total)||(value=1*total/count)}self.updateCompanyRate(companyId,value)}),jQuery(".rating-criteria").on("rating:clear",function(event){jQuery(this).parent().parent().parent().children("input").val(0)}),jQuery(".rating-criteria").on("rating:reset",function(event){jQuery(this).parent().parent().parent().children("input").val(0)})}renderRatingQuestions(){jQuery(".rating-question").rating({min:0,max:5,step:.5,stars:5,size:"sm",showCaption:!1,hoverEnabled:!0,hoverChangeCaption:!1,hoverChangeStars:!0,rtl:!1,displayOnly:!1}),jQuery(".rating-question").on("rating:change",function(event,value,caption){jQuery(this).parent().parent().parent().children("input").val(value)}),jQuery(".rating-question").on("rating:clear",function(event){jQuery(this).parent().parent().parent().children("input").val(0)}),jQuery(".rating-question").on("rating:reset",function(event){jQuery(this).parent().parent().parent().children("input").val(0)})}showReviewQuestions(reviewId){let self=this;jQuery("#show-questions"+reviewId).text(Joomla.JText._("LNG_HIDE_REVIEW_QUESTIONS")),jQuery("#show-questions"+reviewId).attr("onclick",'hideReviewQuestions("'+reviewId+'")'),jQuery("#review-questions"+reviewId).slideDown(500),jQuery("#review-questions"+reviewId).children(".review-question-answer").each(function(){jQuery(this).hasClass("star-rating")?self.showStarRating(jQuery(this).attr("id")):jQuery(this).html(jbdUtils.truncate(jQuery(this).text(),jQuery(this).attr("id"),100))})}hideReviewQuestions(reviewId){jQuery("#show-questions"+reviewId).text(Joomla.JText._("LNG_SHOW_REVIEW_QUESTIONS")),jQuery("#show-questions"+reviewId).attr("onclick",'jbdListings.showReviewQuestions("'+reviewId+'")'),jQuery("#review-questions"+reviewId).slideUp(500)}showStarRating(answerId){let id=answerId.slice(15,answerId.length);jQuery("#"+answerId).empty(),jQuery("#"+answerId).rating({min:0,max:5,step:.5,stars:5,size:"sm",showCaption:!1,rtl:!1,displayOnly:!0}),jQuery("#"+answerId).rating("update",jQuery("#star-rating-score"+id).val())}editAnswer(answerId,answerType){let data,score,answerDiv=jQuery("#question-answer"+answerId),answer=answerDiv.text(),self=this;if(0==answerType)jbdUtils.showFullText(answerId),answer=answerDiv.text(),data='<textarea style="width:100%;" name="answer-'+answerId+'" id="answer-'+answerId+'" onblur="jbdListings.saveAnswer(\''+answerId+"', '"+answerType+"')\" >"+answer+"</textarea>";else if(1==answerType){let yes=answer==Joomla.JText._("LNG_YES")?'checked="checked"':"",no=answer==Joomla.JText._("LNG_NO")?'checked="checked"':"";data='<input type="radio" id="answer-'+answerId+'" value="1" onclick="jbdListings.saveAnswer(\''+answerId+"', '"+answerType+'\')" name="answer-'+answerId+'"'+yes+">"+Joomla.JText._("LNG_YES")+"</input>",data+=' <input type="radio" id="answer-'+answerId+'" value="0" onclick="jbdListings.saveAnswer(\''+answerId+"', '"+answerType+'\')" name="answer-'+answerId+'"'+no+">"+Joomla.JText._("LNG_NO")+"</input>"}else 2==answerType&&(data='<div class="rating-answer"></div>',score=parseFloat(answer));jQuery("#question-answer"+answerId).attr("class",""),answerDiv.html(data),2==answerType&&(jQuery(".rating-answer").rating({min:0,max:5,step:.5,stars:5,size:"sm",showCaption:!1,hoverEnabled:!0,hoverChangeCaption:!1,hoverChangeStars:!0,rtl:!1,displayOnly:!1}),jQuery(".rating-answer").on("rating:change",function(event,value,caption){jQuery(this).parent().parent().parent().children("input").val(value),document.getElementById("star-rating-score"+answerId).value=value,self.saveAnswer(answerId,answerType)}),jQuery(".rating-answer").on("rating:clear",function(event){jQuery(this).parent().parent().parent().children("input").val(0)}),jQuery(".rating-answer").on("rating:reset",function(event){jQuery(this).parent().parent().parent().children("input").val(0)}))}saveAnswer(answerId,answerType){let data,self=this;0==answerType?data=jQuery("#answer-"+answerId).val():1==answerType?data=jQuery("input[name='answer-"+answerId+"']:checked").val():2==answerType&&(data=jQuery("#star-rating-score"+answerId).val());let urlSaveAnswerAjax=jbdUtils.getAjaxUrl("saveAnswerAjax","companies");jQuery.ajax({type:"GET",url:urlSaveAnswerAjax,data:{answer:data,answerId:answerId},dataType:"json",cache:!1,success:function(){jQuery("#question-answer"+answerId).empty(),1==answerType&&(0==data?data=Joomla.JText._("LNG_NO"):1==data&&(data=Joomla.JText._("LNG_YES"))),2!=answerType?jQuery("#question-answer"+answerId).text(data):self.showStarRating("question-answer"+answerId)}}),2!=answerType?jQuery("#question-answer"+answerId).attr("class","answer question-answer"):jQuery("#question-answer"+answerId).attr("class","answer star-rating")}magnifyImages(htmlClass){const galleries=document.getElementsByClassName(htmlClass);galleries.length&&Array.from(galleries).forEach(gallery=>{lightGallery(gallery,{selector:"li a",plugins:[lgZoom,lgThumbnail,lgRotate,lgShare],speed:500,addClass:"gallery-review-lightbox",download:!0,counter:!0,enableDrag:!0,enableTouch:!0,getCaptionFromTitleOrAlt:!0,thumbnail:!0,animateThumb:!0,showThumbByDefault:!0,thumbWidth:100,thumbHeight:80,galleryId:"review-gallery",loop:!0,hideScrollbar:!0,closable:!0,escKey:!0,keyPress:!0,appendSubHtmlTo:".lg-sub-html"})})}renderAverageRating(averageRating){jQuery(".user-rating-avg").rating({min:0,max:5,step:.5,stars:5,size:"sm",showCaption:!1,rtl:!1,displayOnly:!0}),jQuery(".user-rating-avg").rating("update",averageRating)}renderReviewRating(){jQuery(".rating-review").rating({min:0,max:5,step:.5,stars:5,size:"sm",showCaption:!1,rtl:!1,displayOnly:!0}),jQuery(".rating-review").each(function(){jQuery(this).rating("update",this.title)})}showTab(tabId){jQuery("#tabId").val(tabId),jQuery("#tabsForm").submit()}claimCompany(requiresLogin){requiresLogin?jbdUtils.showLoginNotice():(jQuery(".error_msg").each(function(){jQuery(this).hide()}),this.showClaimDialog())}showClaimDialog(){jQuery("#company-claim").jbdModal()}showDirTab(tab){jQuery(".dir-tab").each(function(){jQuery(this).hide()}),jQuery(tab).show(),jQuery(".track-business-details").each(function(){jQuery(this).parent().removeClass("active")});let number=tab.substr(tab.indexOf("-")+1,tab.length);jQuery("#dir-tab-"+number).parent().addClass("active"),this.returnToProjects()}updateCompanyOwner(companyId,userId){jQuery('<div class="jbd-container" style="display:none"><div class="jmodal-sm"><div class="jmodal-header"><p class="jmodal-header-title">Please wait...</p><a href="#close-modal" rel="modal:close" class="close-btn"><i class="la la-close "></i></a>  </div></div></div>').appendTo("body").jbdModal(),jQuery("#company-claim button").each(function(){jQuery(this).attr("disabled","disabled")});document.reportAbuse;let postParameters="";postParameters+="&companyId="+companyId;let postData="&controller=companies&task=companies.updateCompanyOwner"+(postParameters+="&userId="+userId);jQuery.post(jbdUtils.baseUrl,postData,this.processUpdateCompanyOwner)}processUpdateCompanyOwner(response){jQuery(response).find("answer").each(function(){let message="";1==jQuery(this).attr("result")?(message=Joomla.JText._("LNG_CLAIM_SUCCESSFULLY"),jQuery("#claim-container").hide()):message=Joomla.JText._("LNG_ERROR_CLAIMING_COMPANY"),jQuery('<span class="loading-message">'+message+"</span>").appendTo("body").jbdModal(),setTimeout(function(){jQuery.jbdModal.close()},2e3)})}showReportAbuse(){jQuery("#reportAbuseEmail").jbdModal()}renderGridReviewRating(){jQuery(".rating-review").rating({min:0,max:5,step:.5,stars:5,size:"sm",showCaption:!1,rtl:!1,displayOnly:!0}),jQuery(".rating-review").each(function(){jQuery(this).rating("update",this.title)})}showQuoteCompanyForm(companyId){jQuery("#company-quote #companyId").val(companyId),jQuery("#company-quote").jbdModal()}showQuoteCompany(companyId,showData){0==showData?jbdUtils.showLoginNotice():(jQuery(".error_msg").each(function(){jQuery(this).hide()}),this.showQuoteCompanyForm(companyId))}showContactCompanyList(companyId,showData,companyName,companyLogo,companyCover,rating){let logo=companyLogo?jbdUtils.getProperty("imageBaseUrl")+companyLogo:jbdUtils.getProperty("imageBaseUrl")+jbdUtils.getProperty("no_image"),cover=companyCover?jbdUtils.getProperty("imageBaseUrl")+companyCover:jbdUtils.getProperty("imageBaseUrl")+jbdUtils.getProperty("no_image");0==showData?jbdUtils.showLoginNotice():(jQuery(".error_msg").each(function(){jQuery(this).hide()}),jQuery("#company-contact #companyId").val(companyId),jQuery("#company-contact .item-header-title").html(companyName),jQuery("#company-contact .item-header-photo img").attr("src",logo),jQuery("#company-contact .jmodal-header-background").css("background-image","url("+cover+")"),1==jbdUtils.getProperty("enable_ratings")&&(jQuery("#company-contact .rating-average-review").rating({min:0,max:5,step:.5,stars:5,size:"sm",showCaption:!1,rtl:!1,displayOnly:!0}),jQuery("#company-contact .rating-average-review").rating("update",rating)),this.showContactCompany())}requestQuoteCompany(){let baseurl=jbdUtils.getAjaxUrl("requestQuoteCompanyAjax","companies");if(!jQuery("#quoteCompanyFrm").validationEngine("validate"))return;jQuery("#company-quote button").each(function(){jQuery(this).attr("disabled","disabled")}),jQuery(".quote-submit-button").addClass("loader");let postData="";postData+="&firstName="+jQuery("#company-quote #firstName-quote").val(),postData+="&lastName="+jQuery("#company-quote #lastName-quote").val(),postData+="&email="+jQuery("#company-quote #email-quote").val(),postData+="&phone="+jQuery("#company-quote #phone-quote").val(),postData+="&description="+jQuery("#company-quote #description-quote").val(),postData+="&companyId="+jQuery("#company-quote #companyId").val(),postData+="&category="+jQuery("#company-quote #category").val(),postData+="&g-recaptcha-response="+jQuery("#company-quote .g-recaptcha-response").val(),jQuery("#quoteCompanyFrm .jbd-commit").addClass("loader"),jQuery.post(baseurl,postData,this.processQuoteCompanyResult)}initializeListingsSearch(){}contactCompanyList(){if(!jQuery("#contactCompanyFrm").validationEngine("validate"))return;jQuery("#contactCompanyFrm button").each(function(){jQuery(this).attr("disabled","disabled")}),jQuery(".contact-submit-button").addClass("loader");let postData="";postData+="&firstName="+jQuery("#company-contact #firstName").val(),postData+="&lastName="+jQuery("#company-contact #lastName").val(),postData+="&email="+jQuery("#company-contact #email").val(),postData+="&phone="+jQuery("#company-contact #phone").val(),postData+="&description="+jQuery("#company-contact #description").val(),postData+="&companyId="+jQuery("#company-contact #companyId").val(),postData+="&g-recaptcha-response="+jQuery("#captcha-div-contact .g-recaptcha-response").val(),jQuery.post(contactListUrl,postData,this.processContactCompanyResult)}contactBusinessListing(){if(!jQuery("#contactListingFrm").validationEngine("validate"))return;let postData="";postData+="&firstName="+jQuery("#listing-contact #firstName").val(),postData+="&email="+jQuery("#listing-contact #email").val(),postData+="&phone="+jQuery("#listing-contact #phone").val(),postData+="&description="+jQuery("#listing-contact #description").val(),postData+="&companyId="+jQuery("#listing-contact #companyId").val(),postData+="&g-recaptcha-response="+jQuery("#captcha-div-contact .g-recaptcha-response").val(),jQuery.post(contactListUrl,postData,this.processContactCompanyResult)}showContactCompany(){jQuery("#company-contact").jbdModal()}contactCompany(showData){0==showData?jbdUtils.showLoginNotice():(jQuery(".error_msg").each(function(){jQuery(this).hide()}),this.showContactCompany())}joinCompany($companyId,multipleListings){let baseUrl=jbdUtils.getAjaxUrl("joinCompany","companies"),selectedValues=jQuery("#userAssociatedCompanies").val(),companyIds="";multipleListings&&Array.isArray(selectedValues)&&(companyIds=selectedValues.join()),jQuery(".associated-buttons button").each(function(){jQuery(this).attr("disabled","disabled")}),jQuery(".jbd-commit-associated").addClass("loader"),jQuery.ajax({type:"GET",url:baseUrl,cache:!1,data:{companyIds:companyIds,multipleListings:multipleListings,mainCompanyId:$companyId},dataType:"json",success:function(data){if("1"==data.error){let html='<div class="jbd-container" style="display:none"><div class="jmodal-sm"><div class="jmodal-header"><p class="jmodal-header-title">'+Joomla.JText._("COM_JBUSINESS_ERROR")+'</p><a href="#close-modal" rel="modal:close" class="close-btn"><i class="la la-close "></i></a>  </div> <div class="jmodal-body"><p>'+data.message+"</p></div> </div></div>";jQuery(html).appendTo("body").jbdModal(),setTimeout(function(){jQuery.jbdModal.close(),location.reload(!0)},1200)}else{let html='<div class="jbd-container" style="display:none"><div class="jmodal-sm"><div class="jmodal-header"><p class="jmodal-header-title">'+Joomla.JText._("COM_JBUSINESS_DIRECTORY_COMPANY_REGISTERED")+'</p><a href="#close-modal" rel="modal:close" class="close-btn"><i class="la la-close "></i></a>  </div></div></div>';jQuery(html).appendTo("body").jbdModal(),setTimeout(function(){jQuery.jbdModal.close(),location.reload(!0)},1200)}}})}showCompanyListDialog($companyId,multipleListings,nrJoined){multipleListings||nrJoined>0?jQuery("#company-list").jbdModal():jbdListings.joinCompany($companyId,multipleListings)}joinListing(nrJoined,$companyId,userId,multipleListings){0==userId?jbdUtils.showLoginNotice():this.showCompanyListDialog($companyId,multipleListings,nrJoined)}processContactCompanyResult(response){jQuery("#quoteCompanyFrm .jbd-commit").removeClass("loader"),jQuery("#quoteCompanyFrm button").each(function(){jQuery(this).removeAttr("disabled")}),jQuery(response).find("answer").each(function(){if("1"==jQuery(this).attr("error")){let html='<div class="jbd-container" style="display:none"><div class="jmodal-sm"><div class="jmodal-header"><p class="jmodal-header-title">'+Joomla.JText._("COM_JBUSINESS_ERROR")+'</p><a href="#close-modal" rel="modal:close" class="close-btn"><i class="la la-close "></i></a>  </div> <div class="jmodal-body"><p>'+jQuery(this).attr("errorMessage")+"</p></div> </div></div>";jQuery(html).appendTo("body").jbdModal(),setTimeout(function(){jQuery.jbdModal.close()},2e3)}else{let html='<div class="jbd-container" style="display:none"><div class="jmodal-sm"><div class="jmodal-header"><p class="jmodal-header-title">'+Joomla.JText._("COM_JBUSINESS_DIRECTORY_COMPANY_CONTACTED")+'</p><a href="#close-modal" rel="modal:close" class="close-btn"><i class="la la-close "></i></a>  </div></div></div>';jQuery(html).appendTo("body").jbdModal(),setTimeout(function(){jQuery.jbdModal.close()},2e3),void 0!==jQuery(this).attr("redirect_url")&&""!=jQuery(this).attr("redirect_url")&&(window.location.href=jQuery(this).attr("redirect_url"))}}),jQuery("#contactListingFrm").each(function(){this.reset()})}renderListAverageRating(){jQuery(".rating-average").rating({min:0,max:5,step:.5,stars:5,size:"sm",showCaption:!1,rtl:!1,displayOnly:!0}),jQuery(".rating-average").each(function(){jQuery(this).rating("update",this.title)})}setCategoryStatus(status,categoryId){this.issetCategory=status,this.cat_id=categoryId}saveSelectedCategory(){let catId;catId=jQuery("#filterCategoryItems input[type='checkbox']:checked").attr("id"),this.issetCategory&&(catId=this.cat_id),jQuery("#adminForm #categoryId").val(catId),jQuery("#adminForm input[name=limitstart]").val(0)}showList(){jQuery("#jbd-results-list-container").show(),jQuery("#jbd-grid-view").hide(),jQuery("#grid-view-link").removeClass("active"),jQuery("#list-view-link").addClass("active")}showGrid(){jQuery("#jbd-results-list-container").hide(),jQuery("#jbd-grid-view").show(),jQuery(window).resize(),jQuery("#grid-view-link").addClass("active"),jQuery("#list-view-link").removeClass("active")}removeFilterRule(type,id){let param="",filter=jQuery("#selectedParams").val();if(filter.length>0){let start=filter.indexOf(type),end=filter.indexOf(";",start);if(-1!=start){param=filter.slice(start,end),filter=filter.slice(0,start)+filter.slice(end+1);let values=(param=param.replace(type+"=","")).split(",");for(var i=0;i<values.length;i++)values[i]==id&&values.splice(i,1);values.length>0&&(filter+=param=type+"="+values.join()+";"),jQuery("#selectedParams").val(filter)}}jQuery("#filter_active").val("1"),"city"==type&&jQuery("#adminForm #city-search").val(""),"region"==type&&jQuery("#adminForm #region-search").val(""),"country"==type&&jQuery("#adminForm #country-search").val(""),"type"==type&&jQuery("#adminForm #type-search").val(""),"city"==type&&jQuery("#adminForm #city-search").val(""),"region"==type&&jQuery("#adminForm #region-search").val(""),"country"==type&&jQuery("#adminForm #country-search").val(""),"type"==type&&jQuery("#adminForm #type-search").val(""),"province"==type&&jQuery("#adminForm #province-search").val(""),jbdUtils.initializeGetItemsAjax()}setRadius(radius){jQuery("#adminForm > #radius").val(radius),jQuery("#adminForm input[name=limitstart]").val(0),jbdUtils.initializeGetItemsAjax()}filterByFavorites(requiresLogin){requiresLogin?jbdUtils.showLoginNotice():(jQuery("#adminForm #filter-by-fav").val("1"),jQuery("#adminForm").submit())}collapseSearchFilter(){let headers=["H1","H2","H3","H4","H5","H6"];jQuery(".accordionCollapse").click(function(e){let target=e.target,name=target.nodeName.toUpperCase();if(jQuery.inArray(name,headers)>-1){let subItem=jQuery(target).next(),depth=jQuery(subItem).parents().length,allAtDepth=jQuery(".accordion li, .accordion div").filter(function(){if(jQuery(this).parents().length>=depth&&this!==subItem.get(0))return!0});jQuery(allAtDepth).slideUp("fast"),subItem.slideToggle("fast",function(){jQuery(".accordionCollapse :visible:last").css("border-radius","0 0 10px 10px")}),jQuery(target).css({"border-bottom-right-radius":"0","border-bottom-left-radius":"0"})}})}deleteDirListing(id){confirm(Joomla.JText._("COM_JBUSINESS_DIRECTORY_COMPANIES_CONFIRM_DELETE"))&&(jQuery("#cid").val(id),jQuery("#adminForm #task").val("managecompanies.delete"),jQuery("#adminForm").submit())}deleteMessage(id){confirm(Joomla.JText._("COM_JBUSINESS_DIRECTORY_COMPANY_MESSAGE_CONFIRM_DELETE"))&&(jQuery("#id").val(id),jQuery("#adminForm #task").val("managemessages.delete"),jQuery("#adminForm").submit())}addService(){jQuery("#id").val(0),jQuery("#adminForm #task").val("managecompanyservice.add"),jQuery("#adminForm").submit()}deleteService(serviceId){confirm(Joomla.JText._("COM_JBUSINESS_DIRECTORY_COMPANY_SERVICE_CONFIRM_DELETE"))&&(jQuery("#id").val(serviceId),jQuery("#adminForm #task").val("managecompanyservices.delete"),jQuery("#adminForm").submit())}duplicateService(serviceId){jQuery("#id").val(serviceId),jQuery("#adminForm #task").val("managecompanyservice.duplicate"),jQuery("#adminForm").submit()}selectServiceProviders(){jQuery("#adminForm").submit()}addServiceProvider(){jQuery("#adminForm #id").val(0),jQuery("#adminForm #task").val("managecompanyserviceprovider.add"),jQuery("#adminForm").submit()}deleteServiceProvider(serviceId){confirm(Joomla.JText._("COM_JBUSINESS_DIRECTORY_COMPANY_SERVICE_PROVIDER_CONFIRM_DELETE"))&&(jQuery("#adminForm #id").val(serviceId),jQuery("#adminForm #task").val("managecompanyserviceproviders.delete"),jQuery("#adminForm").submit())}selectReservation(){jQuery("#adminForm").submit()}deleteReservation(bookingId){confirm(Joomla.JText._("COM_JBUSINESS_DIRECTORY_SERVICE_RESERVATION_CONFIRM_DELETE"))&&(jQuery("#adminForm #id").val(bookingId),jQuery("#adminForm #task").val("managecompanyservicereservations.delete"),jQuery("#adminForm").submit())}editProject(projectId){jQuery("#adminForm #id").val(projectId),jQuery("#adminForm #task").val("managecompanyproject.edit"),jQuery("#adminForm").submit()}addProject(){jQuery("#adminForm #id").val(0),jQuery("#adminForm #task").val("managecompanyproject.add"),jQuery("#adminForm").submit()}deleteProject(projectId){confirm(Joomla.JText._("COM_JBUSINESS_DIRECTORY_PROJECT_CONFIRM_DELETE"))&&(jQuery("#adminForm #id").val(projectId),jQuery("#adminForm #task").val("managecompanyprojects.delete"),jQuery("#adminForm").submit())}showProjectDetail(project){let self=this,baseUrl=jbdUtils.getAjaxUrl("getProjectDetailsAjax","companies");jQuery.ajax({type:"GET",url:baseUrl,data:{projectId:project},dataType:"json",cache:!1,success:function(data){jQuery("#project-name").html(data.name),jQuery("#project-name-link").html(data.breadCrumbsName),jQuery("#project-description").html(data.description),jQuery("#project-tagline").html(data.tagline),jQuery("#project-gallery").html(data.projectGalleryImages),0===data.nrPhotos?jQuery("#project-image-container").css("display","none"):jQuery("#project-image-container").css("display","");const projectsStyle=jbdUtils.getProperty("projects_style");if(3!=projectsStyle&&(jQuery("#company-projects-container").hide(500),jQuery("#project-details").show(500),jQuery("#project-gallery-loader").hide()),1==projectsStyle){const galleryContainer="#project-gallery .swiper-container",galleryWrapper="#project-gallery .swiper-wrapper";setTimeout(()=>{self.initSwiperSlider(galleryContainer,{slidesPerView:1}),self.initLightGallery(galleryWrapper)},200)}else if(2==projectsStyle)jQuery("#project-gallery-loader").show(),setTimeout(()=>{self.initSwiperSlider("#project-gallery .swiper-container",{slidesPerView:3,spaceBetween:10,navigation:!0,pagination:{clickable:!0}}),self.initLightGallery("#project-gallery .swiper-wrapper"),jQuery("#project-gallery-loader").hide()},100);else if(3==projectsStyle){jQuery("#popup-gallery-full #project-gallery").html(data.projectGalleryImages),self.showGalleryPopup()}}})}initSwiperSlider(selector,options={}){const swiperContainer=jQuery(selector);if(swiperContainer.length&&"undefined"!=typeof Swiper){const finalOptions={...{loop:!1,pagination:{el:".swiper-pagination",clickable:!0},navigation:{nextEl:".swiper-button-next.custom-arrow",prevEl:".swiper-button-prev.custom-arrow"},observer:!0,observeParents:!0},...options};finalOptions.navigation&&finalOptions.navigation.nextEl&&!swiperContainer.find(finalOptions.navigation.nextEl).length&&swiperContainer.append('<div class="'+finalOptions.navigation.nextEl.substring(1).replace(/\./g," ")+'"></div>'),finalOptions.navigation&&finalOptions.navigation.prevEl&&!swiperContainer.find(finalOptions.navigation.prevEl).length&&swiperContainer.append('<div class="'+finalOptions.navigation.prevEl.substring(1).replace(/\./g," ")+'"></div>'),finalOptions.pagination&&finalOptions.pagination.el&&!swiperContainer.find(finalOptions.pagination.el).length&&swiperContainer.append('<div class="'+finalOptions.pagination.el.substring(1)+'"></div>'),swiperContainer[0].swiper&&swiperContainer[0].swiper.destroy(!0,!0),new Swiper(swiperContainer[0],finalOptions)}else swiperContainer.length}initLightGallery(selector,options={}){const galleryContainer=jQuery(selector);if(galleryContainer.length&&"undefined"!=typeof lightGallery){const existingInstance=window.lgData&&window.lgData[galleryContainer.attr("lg-uid")];if(existingInstance)try{existingInstance.destroy()}catch(e){}const defaultOptions={selector:"a",plugins:"undefined"!=typeof lgZoom&&"undefined"!=typeof lgThumbnail?[lgZoom,lgThumbnail]:[],speed:500,download:!0,counter:!0,thumbnail:!0};"undefined"!=typeof lgShare&&defaultOptions.plugins.push(lgShare),"undefined"!=typeof lgRotate&&defaultOptions.plugins.push(lgRotate);const finalOptions={...defaultOptions,...options};lightGallery(galleryContainer[0],finalOptions)}else galleryContainer.length}showGalleryPopup(){const popup=jQuery("#popup-gallery-full");if(!popup.length)return;popup.show(),jQuery("body").addClass("fixed");this.initSwiperSlider("#popup-gallery-full #project-gallery .swiper-container",{slidesPerView:1}),this.initLightGallery("#popup-gallery-full #project-gallery .swiper-wrapper")}returnToProjects(){jQuery("#project-details").hide(500),jQuery("#company-projects-container").show(500),jQuery("#project-gallery-loader").show(),jQuery("#project-gallery").removeClass("swiper-initialized")}updateCompanyRate(companyId,rateScore){let postParameters="",ratingId=this.getRatingId(companyId);void 0===ratingId&&(ratingId=0),postParameters+="&companyId="+companyId,postParameters+="&rating="+rateScore;let postData="&task=companies.updateRating"+(postParameters+="&ratingId="+ratingId);jQuery.post(jbdUtils.baseUrl,postData,this.processRateResult)}processRateResult(response){let self=this;jQuery(response).find("answer").each(function(){jQuery("#rateNumber"+jQuery(this).attr("id")).html(jQuery(this).attr("nrRatings")),jQuery("#rateNumber"+jQuery(this).attr("id")).parent().show(),jQuery(".user-rating-avg").rating("update",jQuery(this).attr("averageRating")),self.saveCookieRating(jQuery(this).attr("id"),jQuery(this).attr("ratingId"))})}getRatingId(companyId){let ratings=jbdUtils.getCookie("companyRatingIds");if(void 0===ratings)return;let ratingsIds=ratings.split("#");for(let i=0;i<ratingsIds.length;i++){let temp=ratingsIds[i].split(",");if(temp[0]==companyId)return temp[1]}}saveCookieRating(companyId,reviewId){let ratings=jbdUtils.getCookie("companyRatingIds");void 0==ratings&&(ratings=companyId+","+reviewId+"#");let ratingsIds=ratings.split("#"),found=!1;for(let i=0;i<ratingsIds.length;i++){ratingsIds[i].split(",")[0]==companyId&&(found=!0)}found||(ratings=ratings+companyId+","+reviewId+"#"),jbdUtils.setCookie("companyRatingIds",ratings,60)}saveCookieLastViewed(companyId){let viewedListings=jbdUtils.getCookie("jbdViewedListings");if(viewedListings){let listingIds=viewedListings.split(","),found=!1;for(let i=0;i<listingIds.length;i++)if(listingIds[i]==companyId){found=!0;break}found||(viewedListings=viewedListings+","+companyId)}else viewedListings=companyId;jbdUtils.setCookie("jbdViewedListings",viewedListings,60)}showProductCategories(parentId){jQuery(".categories-level-1").hide(500),jQuery(".categories-level-"+parentId).show(500);let parent=jQuery("#parent-category-"+parentId+" .post-title").text();parent=parent+" - "+Joomla.JText._("LNG_SUBCATEGORIES"),jQuery("#sub-categories").html('<a href="javascript:void(0);" onclick="this.showProductCategories('+parentId+')">'+parent+"</a>&raquo;"),jQuery("#category-products").empty(),jQuery("#product-details").empty(),jQuery("#product-details-content").empty(),jQuery("#product-list-content").empty()}goBack(){jQuery(".grid4").hide(500),jQuery(".categories-level-1").show(500),jQuery("#sub-categories").empty(),jQuery("#category-products").empty(),jQuery("#product-details").empty(),jQuery("#product-details-content").empty(),jQuery("#product-list-content").empty()}showProducts(catId,companyId){jQuery(".categories-level-1").hide(500),jQuery(".grid4").hide(500),jQuery("#product-list-content").html('<p id="remove-image-loading" class="text-center"><span class="icon-refresh icon-refresh-animate"></span> Loading...</p>').load(jbdUtils.getProperty("url")+"&view=companyproducts #grid-content",{categoryId:catId,companyId:companyId},function(){let categoryName=jQuery("#product-category h1").text();jQuery("#category-products").html('<a href="javascript:void(0);" onclick="jbdListings.goBackToProducts('+catId+", "+companyId+')">'+categoryName+"</a>&raquo;")}),jQuery("#company-products-title").text(Joomla.JText._("LNG_PRODUCTS")),jQuery("#product-list-content").attr("style","display: block;"),jQuery("#category-products").empty(),jQuery("#product-details").empty(),jQuery("#product-details-content").empty()}showQuoteCompanyProduct(companyId){var path_part1=jQuery("#all-categories-path").text(),path_part2=jQuery("#sub-categories").text(),path_part3=jQuery("#category-products").text(),path_part4=jQuery("#product-details").text(),path=path_part1;""!=path_part2&&(path+=" -> "+path_part2,""!=path_part3&&(path+=" -> "+path_part3,""!=path_part4&&(path+=" -> "+path_part4))),jQuery("#company-quote-product #path").val(path),jQuery("#company-quote-product #companyId").val(companyId),jQuery("#company-quote-product").jbdModal()}requestQuoteCompanyProduct(baseurl){if(jQuery("#quoteCompanyProductFrm").validationEngine("validate")){var postData="";postData+="&firstName="+jQuery("#company-quote-product #firstName-quote").val(),postData+="&lastName="+jQuery("#company-quote-product #lastName-quote").val(),postData+="&email="+jQuery("#company-quote-product #email-quote").val(),postData+="&description="+jQuery("#company-quote-product #description-quote").val(),postData+="&companyId="+jQuery("#company-quote-product #companyId").val();var productId=jQuery("#company-quote-product #productId").val();postData+=""!=productId?"&productId="+productId:"&productId=0";var productAlias=jQuery("#company-quote-product #productAlias").val();postData+=""!=productAlias?"&productAlias="+productAlias:"&productAlias=0";var productSubject=jQuery("#company-quote-product #productSubject").val();postData+=""!=productSubject?"&productSubject="+productSubject:"&productSubject=0",postData+="&path="+jQuery("#company-quote-product #path").val(),postData+="&recaptcha_response_field="+jQuery("#company-quote-product #recaptcha_response_field").val(),postData+="&g-recaptcha-response="+jQuery("#company-quote-product #g-recaptcha-response-1").val(),jQuery.post(baseurl,postData,this.processContactCompanyResult)}}processQuoteCompanyResult(response){jQuery(response).find("answer").each(function(){jQuery(".quote-submit-button").removeClass("loader");let html='<div class="jbd-container" style="display:none"><div class="jmodal-sm"><div class="jmodal-header"><p class="jmodal-header-title">'+Joomla.JText._("LNG_MESSAGE")+'</p><a href="#close-modal" rel="modal:close" class="close-btn"><i class="la la-close "></i></a>  </div> <div class="jmodal-body"><p>'+jQuery(this).attr("errorMessage")+"</p></div> </div></div>";jQuery(html).appendTo("body").jbdModal(),setTimeout(function(){jQuery.jbdModal.close()},4e3)})}goBackToCategories(catId){jQuery("#product-list-content").empty(),jQuery("#subcategory-"+catId).closest(".grid4").show(500),jQuery("#company-products-title").text(Joomla.JText._("LNG_PRODUCT_CATEGORIES"))}showProductDetails(productId,catId,companyId,productAlias,productSubject){jQuery("#product-list-content").hide(500),jQuery("#product-details-content").html('<p id="remove-image-loading" class="text-center"><span class="icon-refresh icon-refresh-animate"></span> Loading...</p>').load(jbdUtils.getProperty("url")+"&view=companyproducts #product-details",{productId:productId,categoryId:catId},function(){let productName=jQuery("#product-name h2").text();jQuery("#product-details").html('<a style="color:black;">'+productName+"</a>"),jQuery("#company-quote-product #productId").val(productId),jQuery("#company-quote-product #productAlias").val(productAlias),jQuery("#company-quote-product #productSubject").val(productSubject),jQuery("#product-quote-request").html(),jQuery("#product-quote-request").html('<a href="javascript:void(0);" class="btn btn-primary" style="float: right" onclick="jbdListings.showQuoteCompanyProduct('+companyId+')">'+Joomla.JText._("LNG_QUOTE")+"</a>")}),jQuery("#company-products-title").text(Joomla.JText._("LNG_PRODUCT_DETAILS")),jQuery("#product-details-content").show(500)}goBackToProducts(catId,companyId){jQuery("#product-details-content").hide(500),jQuery("#product-details-content").empty(),this.showProducts(catId,companyId),jQuery("#product-list-content").show(500),jQuery("#product-list-content").attr("style","display: block;")}addNewMember(index,memberFolder,memberFolderPath){var newMemId=parseInt(index)+1;jQuery("#member-form-box1").clone().prop("id","member-form-box"+newMemId).appendTo("#member_details"),jQuery("#member-form-box"+newMemId).find("h3").text(Joomla.JText._("LNG_MEMBER")+" "+newMemId),jQuery("#member-form-box"+newMemId+" input").each(function(){jQuery(this).val("")}),jQuery("#member-form-box"+newMemId+" textarea").each(function(){jQuery(this).html("")}),jQuery("#member-form-box"+newMemId+" textarea").val(""),jQuery("#member-form-box"+newMemId+" .input-imageLocation").prop("id","member-imageLocation"+newMemId),jQuery("#member-form-box"+newMemId+" .input-imageLocationSize").prop("id","member-imageUploader"+newMemId);var options=jQuery("#member-form-box1 #member_type_1").clone();jQuery("#member-form-box"+newMemId+" #member_type1_chosen").remove(),jQuery("#member-form-box"+newMemId+" #member_type_select").append(options),jQuery("#member-form-box"+newMemId+" #member_type1").removeAttr("onchange"),jQuery(".chosen-select").chosen({disable_search_threshold:5,search_contains:!1}),jQuery("#member-form-box"+newMemId+" .services").prop("id","member-picture-preview"+newMemId),jQuery("#member-picture-preview"+newMemId).html(""),jQuery("#member-form-box"+newMemId+" #memberImageSection").find("a").prop("href",'javascript:uploadInstance.removeImage("member-",'+newMemId+")"),jQuery("#member-form-box"+newMemId+" .remove-member").attr("href","javascript:jbdListings.removeMember('"+newMemId+"')").show(),jQuery("#add_member").attr("onclick","jbdListings.addNewMember('"+newMemId+"','"+memberFolder+"','"+memberFolderPath+"' )"),uploadInstance.imageUploader(memberFolder,memberFolderPath,"member-",newMemId)}removeMember(index){index<2||(index=parseInt(index),jQuery("#member-form-box"+index).remove())}sendEditorInvitation(){let invitationUrl=jbdUtils.getAjaxUrl("sendEditorInvitationAjax","managecompany"),email=jQuery("#editor-email").val(),companyId=jQuery("#company_id").val();jQuery("#invitation-btn").addClass("loader"),jQuery.ajax({type:"GET",url:invitationUrl,data:{companyId:companyId,email:email},dataType:"json",cache:!1,success:function(response){jbdUtils.showMessage(response.data.message),jQuery("#invitation-btn").removeClass("loader")}})}openFormReply(messageId){jQuery("#message-"+messageId).addClass("show-reply-form"),jQuery("#message-"+messageId).removeClass("show-replies")}cancelReply(messageId){jQuery("#message-"+messageId).removeClass("show-reply-form"),jQuery("#message-"+messageId).removeClass("show-replies")}sendReply(messageId){let sendReplyUrl=jbdUtils.getAjaxUrl("sendMessageReply","managemessages"),replyContent=jQuery("#message-reply-"+messageId).val();0!=replyContent.length&&(jQuery("#message-send-"+messageId).addClass("loader"),jQuery.ajax({type:"GET",url:sendReplyUrl,data:{message_id:messageId,content:replyContent},dataType:"json",cache:!1,success:function(response){jbdUtils.showMessage(response.message),jQuery("#message-send-"+messageId).removeClass("loader"),jQuery("#message-reply-"+messageId).val(""),jbdListings.addReplyMessage(messageId,response.data),jbdListings.showReplies(messageId)}}))}addReplyMessage(messageId,data){var content='<div class="message-reply"><div class="reply-name">{name}</div><div class="jtable-body-row-data-allias">{date}</div><div class="reply-content">{content}</div></div>';content=(content=(content=content.replace("{name}",data.user)).replace("{content}",data.content)).replace("{date}",data.date),jQuery("#message-"+messageId+" .message-replies").append(content)}showReplies(messageId){jQuery("#message-"+messageId).removeClass("show-reply-form"),jQuery("#message-"+messageId).addClass("show-replies"),jQuery("#message-"+messageId+" .message-replies").scrollTop(jQuery("#message-"+messageId+" .message-replies")[0].scrollHeight)}closeMessage(messageId){jQuery("#message-"+messageId).removeClass("show-reply-form"),jQuery("#message-"+messageId).removeClass("show-replies")}changeMessageStatus(messageId){let sendReplyUrl=jbdUtils.getAjaxUrl("changeMessageStatus","managemessages");jQuery.ajax({type:"GET",url:sendReplyUrl,data:{id:messageId},dataType:"json",cache:!1,success:function(response){jQuery("#message-"+messageId).toggleClass("unread-message")}})}readMessage(messageId){let sendReplyUrl=jbdUtils.getAjaxUrl("readMessageAjax","managemessages");jQuery.ajax({type:"GET",url:sendReplyUrl,data:{id:messageId},dataType:"json",cache:!1,success:function(response){jQuery("#message-"+messageId).removeClass("unread-message"),jQuery("#message-"+messageId+" .new-message").hide()}})}}let jbdListings=new JBDListings;class JBDOffers{saveDates(){let start_time=jQuery("#publish_start_time").val(),end_time=jQuery("#publish_end_time").val();""==start_time&&jQuery("#start_time").attr("value",""),""==end_time&&jQuery("#end_time").attr("value","")}updateAttributes(categoryId,offerId){let attributesUrl=jbdUtils.getAjaxUrl("getAttributesAjax","offer","managecompanyoffer");jQuery.ajax({type:"GET",url:attributesUrl,data:{categoryId:categoryId,offerId:offerId},dataType:"json",cache:!1,success:function(data){jQuery("#customFieldsContent").html(data),jQuery(".chosen-select").chosen({width:"95%",disable_search_threshold:5,search_contains:!0,placeholder_text_single:Joomla.JText._("LNG_SELECT_OPTION"),placeholder_text_multiple:Joomla.JText._("LNG_SELECT_OPTION")})}})}updateSellingOptionsAjax(categoryId,offerId){let attributesUrl=jbdUtils.getAjaxUrl("getSellingOptionsAjax","offer","managecompanyoffer");jQuery.ajax({type:"GET",url:attributesUrl,data:{categoryId:categoryId,offerId:offerId},dataType:"json",cache:!1,success:function(data){null==data?(jQuery("#defaultQuantity").show(),jQuery("#noAttributesExplain").show(),jQuery("#customOptionsContent").hide()):(jQuery("#customOptionsContent").show(),jQuery("#noAttributesExplain").hide(),jQuery("#defaultQuantity").hide()),jQuery("#customOptionsContent").html(data)}})}updateQuantity(currentValue,offerId,$mainCatId){let url=jbdUtils.getAjaxUrl("updateQuantityAjax","offer","offer"),attrVal={},newValue=jQuery(".jbtn-order-info").find(":input").first().val(),oldVal=jQuery("#firstValue").val();jQuery(".jbtn-order-info").find(":input").each(function(){"select-one"==this.type&&"quantity"!=this.name?attrVal[this.id]=jQuery(this).val():"select-one"==this.type&&"quantity"==this.name&&jQuery("#quantity option").each(function(){"0"!=jQuery(this).val()&&jQuery(this).hide()})}),jQuery.ajax({type:"GET",url:url,data:{selectedValues:attrVal,offerId:offerId,mainCatId:$mainCatId,oldVal:oldVal,newValue:newValue},dataType:"json",cache:!1,success:function(data){jQuery(".jbtn-order-info").html(""),jQuery(".jbtn-order-info").html(data)}}),jbdOffers.checkAddToCartStatus()}showPriceBase(div,link){jQuery("#"+link).css("display","none"),jQuery("#"+div).removeAttr("style")}lessPriceBase(div,link){jQuery("#"+div).css("display","none"),jQuery("#"+link).removeAttr("style")}loadAddress(limit){let companyId=jQuery("select#companyId option:selected").val();if(""==companyId)return void alert(Joomla.JText._("LNG_MISSING_OFFER_COMPANY"));let offerUrl=jbdUtils.getAjaxUrl("getListingAddressAjax","offer","managecompanyoffer");jQuery.ajax({type:"GET",url:offerUrl,data:{companyId:companyId},dataType:"json",cache:!1,success:function(data){null==data?alert(Joomla.JText._("LNG_MISSING_DELETED_COMPANY")):(jQuery("#route").val(data.address),jQuery("#street_number").val(data.street_number),jQuery("#area_id").val(data.area),jQuery("#administrative_area_level_2").val(data.province),jQuery("#postal_code").val(data.postalCode),jQuery("#latitude").val(data.latitude),jQuery("#longitude").val(data.longitude),jQuery("#country").val(data.countryId),limit?updateRegions(function(){jQuery("#administrative_area_level_1").val(data.county),updateCities(function(){jQuery("#locality").val(data.city)})}):(jQuery("#administrative_area_level_1").val(data.county),jQuery("#locality").val(data.city)),"undefined"!=typeof jbdAdminMapInstance&&jbdAdminMapInstance.focusLocation({latitude:data.latitude,longitude:data.longitude}))}})}checkAddToCartStatus(){let enableStatus=!0;jQuery(".jbtn-order-info").find(":input").each(function(){"select-one"==this.type&&(""!=jQuery(this).val()&&"0"!=jQuery(this).val()||(enableStatus=!1))}),1==enableStatus?(jQuery("#addToCartButton").removeAttr("style"),jQuery(".jbtn-order-btn").removeAttr("style")):(jQuery("#addToCartButton").attr("style","pointer-events:none"),jQuery(".jbtn-order-btn").attr("style","background-color:lightgray"));let count=0;jQuery(".jbtn-order-info").find(":input").each(function(){"select-one"==this.type&&0==count&&(jQuery("#firstValue").val(jQuery(this).val()),count=1)});var totalprice=jQuery("#offer-stock-price").attr("unitprice")*jQuery("#quantity").val();jQuery("#total-price").html(totalprice)}resetCartAndAdd(offerId){let resetCartUrl=jbdUtils.getAjaxUrl("emptyCartAjax","cart");jQuery.ajax({type:"GET",url:resetCartUrl,dataType:"json",cache:!1,success:function(data){jbdOffers.addToCart(offerId)}})}addToCart(offerId,qnt=0){let values={},quantity=jQuery("#quantity").val();qnt&&(quantity=qnt,values.quantity=qnt),jQuery(".jbtn-order-info").find(":input").each(function(){"select-one"==this.type&&(values[this.id]=jQuery(this).val())});let urlAddToCart=jbdUtils.getAjaxUrl("addToCartAjax","cart");if(0==quantity)return void alert(Joomla.JText._("LNG_PLEASE_SELECT_QUANTITY"));let html='<div class="jbd-container" style="display:none"><div class="jmodal-sm"><div class="jmodal-header"><p class="jmodal-header-title">'+Joomla.JText._("LNG_ADDING_PRODUCT_TO_SHOPPING_CART")+'</p><a href="#close-modal" rel="modal:close" class="close-btn"><i class="la la-close "></i></a>  </div></div></div>';jQuery(html).appendTo("body").jbdModal(),jQuery.ajax({type:"GET",url:urlAddToCart,data:{offerId:offerId,selectedData:values},dataType:"json",cache:!1,success:function(data){jQuery.jbdModal.close();let count=0;jbdOffers.checkAddToCartStatus(),!0===data?(jQuery("#cart-dialog").jbdModal(),jQuery(".jbtn-order-info").find(":input").each(function(){"select-one"==this.type&&0==count&&("quantity"==this.name?jQuery(this).val("0"):(jQuery(this).val(""),jQuery(this).trigger("change")),count=1)})):jQuery("#cart-error").jbdModal()}})}renderOfferRatingCriteria(imagePath){jQuery(".rating-criteria").rating({min:0,max:5,step:.5,stars:5,starCaptions:{.5:Joomla.JText._("LNG_BAD"),1:Joomla.JText._("LNG_BAD"),1.5:Joomla.JText._("LNG_POOR"),2:Joomla.JText._("LNG_POOR"),2.5:Joomla.JText._("LNG_REGULAR"),3:Joomla.JText._("LNG_REGULAR"),3.5:Joomla.JText._("LNG_GOOD"),4:Joomla.JText._("LNG_GOOD"),4.5:Joomla.JText._("LNG_GORGEOUS"),5:Joomla.JText._("LNG_GORGEOUS")},size:"sm",showCaption:!0,starCaptionClasses:{.5:"badge badge-danger",1:"badge badge-danger",1.5:"badge badge-warning",2:"badge badge-warning",2.5:"badge badge-info",3:"badge badge-info",3.5:"badge badge-primary",4:"badge badge-primary",4.5:"badge badge-success",5:"badge badge-success"},clearCaption:Joomla.JText._("LNG_NOT_RATED_YET"),clearCaptionClass:"badge badge-default",hoverEnabled:!0,hoverChangeCaption:!0,hoverChangeStars:!0,rtl:!1}),jQuery(".rating-criteria").on("rating:change",function(event,value,caption){jQuery(this).parent().parent().parent().children("input").val(value)}),jQuery(".rating-criteria").on("rating:clear",function(event){jQuery(this).parent().parent().parent().children("input").val(0)}),jQuery(".rating-criteria").on("rating:reset",function(event){jQuery(this).parent().parent().parent().children("input").val(0)})}renderOfferReviews(){jQuery(".rating-review").rating({min:0,max:5,step:.5,stars:5,size:"sm",showCaption:!1,rtl:!1,displayOnly:!0}),jQuery(".rating-review").each(function(){jQuery(this).rating("update",this.title)})}showList(){jQuery("#list-view-container").show(),jQuery("#jbd-grid-view").hide(),jQuery("#grid-view-link").removeClass("active"),jQuery("#list-view-link").addClass("active")}showGrid(){jQuery("#list-view-container").hide(),jQuery("#jbd-grid-view").show(),jQuery("#grid-view-link").addClass("active"),jQuery("#list-view-link").removeClass("active")}editOffer(offerId){jQuery("#id").val(offerId),jQuery("#adminForm #task").val("managecompanyoffer.edit"),jQuery("#adminForm").submit()}addOffer(){jQuery("#id").val(0),jQuery("#adminForm #task").val("managecompanyoffer.add"),jQuery("#adminForm").submit()}deleteOffer(offerId){confirm(Joomla.JText._("COM_JBUSINESS_DIRECTORY_OFFERS_CONFIRM_DELETE"))&&(jQuery("#id").val(offerId),jQuery("#adminForm #task").val("managecompanyoffers.delete"),jQuery("#adminForm").submit())}deleteOrder(orderId){confirm(Joomla.JText._("COM_JBUSINESS_DIRECTORY_OFFER_ORDER_CONFIRM_DELETE"))&&(jQuery("#id").val(orderId),jQuery("#adminForm #task").val("managecompanyofferorders.delete"),jQuery("#adminForm").submit())}deleteCoupon(couponId){confirm(Joomla.JText._("COM_JBUSINESS_DIRECTORY_COUPONS_CONFIRM_DELETE",!0))&&(jQuery("#id").val(couponId),jQuery("#adminForm #task").val("managecompanyoffercoupons.delete"),jQuery("#adminForm").submit())}deleteOfferMessage(id){confirm(Joomla.JText._("COM_JBUSINESS_DIRECTORY_OFFER_MESSAGE_CONFIRM_DELETE"))&&(jQuery("#id").val(id),jQuery("#adminForm #task").val("manageoffermessages.delete"),jQuery("#adminForm").submit())}displayOfferSelling(show){0==show&&jQuery("#offerSellingOptions").hide(),1==show&&jQuery("#offerSellingOptions").show()}displayStockPrice(showHide=0){0==showHide&&jQuery(".stock-price").hide(),1==showHide&&jQuery(".stock-price").show()}removeFromCart(offerId){let url=jbdUtils.getAjaxUrl("removeOfferFromCartAjax","cart");jQuery.ajax({type:"GET",url:url,data:{offerId:offerId},dataType:"json",cache:!1,success:function(data){data.status==JBDConstants.AJAX_RESPONSE_SUCCESS?location.reload():alert(data.message)}})}showReportOfferAbuse(){jQuery("#reportOfferAbuseEmail").jbdModal()}}let jbdOffers=new JBDOffers;class JBDEvents{showSaveDialog(task){jQuery("#adminForm #task").val(task),jQuery("#edit-event-dialog").jbdModal()}repeatNone(){jQuery("#repeat-options").hide()}repeatDaily(){jQuery("#repeat-options").show(),jQuery("#week-days-group").hide(),jQuery("#monthly-repeat").hide()}repeatWeekly(){jQuery("").hide(),jQuery("#repeat-options").show(),jQuery("#week-days-group").show(),jQuery("#monthly-repeat").hide()}repeatMonthly(){jQuery("#repeat-options").show(),jQuery("#week-days-group").hide(),jQuery("#monthly-repeat").show()}repeatYearly(){jQuery("#repeat-options").show(),jQuery("#week-days-group").hide(),jQuery("#monthly-repeat").hide()}endsOnOccurances(){jQuery("#rend_date").prop("disabled",!0),jQuery("#occurrences").prop("disabled",!1)}endsOnDate(){jQuery("#rend_date").prop("disabled",!1),jQuery("#occurrences").prop("disabled",!0)}editCurrentEvent(){jQuery("#edit_mode").val(1),Joomla.submitform(jQuery("#task").val(),document.getElementById("item-form")),jQuery.jbdModal.close()}editAllFollowignEvents(){jQuery("#edit_mode").val(2),Joomla.submitform(jQuery("#task").val(),document.getElementById("item-form")),jQuery.jbdModal.close()}editAllSeriesEvents(){jQuery("#edit_mode").val(3),Joomla.submitform(jQuery("#task").val(),document.getElementById("item-form")),jQuery.jbdModal.close()}saveDates(){let start_time=jQuery("#start_time").val(),end_time=jQuery("#end_time").val(),doors_open_time=jQuery("#doors_open_time").val(),booking_open_time=jQuery("#booking_open_time").val(),booking_close_time=jQuery("#booking_close_time").val();""==start_time&&jQuery("#start_time").attr("value",""),""==end_time&&jQuery("#end_time").attr("value",""),""==doors_open_time&&jQuery("#doors_open_time").attr("value",""),""==booking_open_time&&jQuery("#booking_open_time").attr("value",""),""==booking_close_time&&jQuery("#booking_close_time").attr("value","")}updateAttributes(categoryId,eventId){let attributesUrl=jbdUtils.getAjaxUrl("getAttributesAjax","event","managecompanyevent");jQuery.ajax({type:"GET",url:attributesUrl,data:{categoryId:categoryId,eventId:eventId},dataType:"json",cache:!1,success:function(data){jQuery("#customFieldsContent").html(data),jQuery(".chosen-select").chosen({width:"95%",disable_search_threshold:5,search_contains:!0,placeholder_text_single:Joomla.JText._("LNG_SELECT_OPTION"),placeholder_text_multiple:Joomla.JText._("LNG_SELECT_OPTION")})}})}loadAddress(limit){let companyId=jQuery("select#company_id option:selected").val();if(""==companyId)return void alert(Joomla.JText._("LNG_MISSING_EVENT_COMPANY"));let eventUrl=jbdUtils.getAjaxUrl("getListingAddressAjax","event","managecompanyevent");jQuery.ajax({type:"GET",url:eventUrl,data:{companyId:companyId},dataType:"json",cache:!1,success:function(data){null==data?alert(Joomla.JText._("LNG_MISSING_DELETED_COMPANY")):(jQuery("#route").val(data.address),jQuery("#street_number").val(data.street_number),jQuery("#area_id").val(data.area),jQuery("#administrative_area_level_2").val(data.province),jQuery("#postal_code").val(data.postalCode),jQuery("#latitude").val(data.latitude),jQuery("#longitude").val(data.longitude),jQuery("#country").val(data.countryId),limit?updateRegions(function(){jQuery("#administrative_area_level_1").val(data.county),updateCities(function(){jQuery("#locality").val(data.city)})}):(jQuery("#administrative_area_level_1").val(data.county),jQuery("#locality").val(data.city)),"undefined"!=typeof jbdAdminMapInstance&&jbdAdminMapInstance.focusLocation({latitude:data.latitude,longitude:data.longitude}))}})}showCompanyListDialog(){jQuery("#company-list").jbdModal()}joinEvent(userId){0==userId?jbdUtils.showLoginNotice():jbdEvents.showCompanyListDialog()}associateCompanies(event_id){let companyIds,urlAssociateCompanies=jbdUtils.getAjaxUrl("associateCompaniesAjax","event"),eventId=event_id,selectedValues=jQuery("#userAssociatedCompanies").val();companyIds=Array.isArray(selectedValues)?selectedValues.join():-1,jQuery("#company-list button").each(function(){jQuery(this).attr("disabled","disabled")}),jQuery("#company-list .jmodal-btn").addClass("loader");let successMessage=jQuery("#associated-companies-message").html();jQuery.ajax({type:"GET",url:urlAssociateCompanies,data:{companyIds:companyIds,eventId:eventId},dataType:"json",cache:!1,success:function(){Array.isArray(selectedValues)?(jQuery(successMessage).appendTo("body").jbdModal(),jQuery("#company-list .jmodal-btn").removeClass("loader")):jQuery.jbdModal.close(),location.reload()}})}showEventList(view){jQuery("#list-view-container").show(),jQuery("#jbd-grid-view").hide(),jQuery(".result-counter").show(),jQuery(".pagination").show(),jQuery(".search-toggles .sortby").show(),jQuery(".search-toggles .orderBy").show(),jQuery("#grid-view-link").removeClass("active"),jQuery("#list-view-link").addClass("active"),jQuery("#search-filters-react").show()}showGrid(hidePagination=!1){if(jQuery("#list-view-container").hide(),jQuery("#jbd-grid-view").show(),hidePagination&&(jQuery(".result-counter").hide(),jQuery(".pagination").hide()),jQuery(".search-toggles .sortby").hide(),jQuery(".search-toggles .orderBy").hide(),"undefined"!=typeof calendarOptions&&document.getElementById("events-calendar")){var calendarEl=document.getElementById("events-calendar");void 0===calendarOptions.initialView&&(calendarOptions.initialView="dayGridMonth"),new FullCalendar.Calendar(calendarEl,calendarOptions).render(),jQuery("#search-filters-react").hide()}jQuery("#grid-view-link").addClass("active"),jQuery("#list-view-link").removeClass("active")}setSearchDates(startDate,endDate){jQuery("#adminForm #startDate").val(startDate),jQuery("#adminForm #endDate").val(endDate),jQuery("#adminForm input[name=limitstart]").val(0),jbdUtils.initializeGetItemsAjax()}editEvent(eventId){jQuery("#adminForm #id").val(eventId),jQuery("#adminForm #task").val("managecompanyevent.edit"),jQuery("#adminForm").submit()}addDirEvent(){jQuery("#adminForm #id").val(0),jQuery("#adminForm #task").val("managecompanyevent.add"),jQuery("#adminForm").submit()}deleteDirEvent(eventId){jQuery("#adminForm #id").val(eventId),confirm(Joomla.JText._("COM_JBUSINESS_DIRECTORY_EVENTS_CONFIRM_DELETE"))&&(jQuery("#adminForm #id").val(eventId),jQuery("#adminForm #task").val("managecompanyevents.delete"),jQuery("#adminForm").submit())}showDeleteDialog(){jQuery("#delete-event-dialog").jbdModal()}deleteEvent(){jQuery("#delete_mode").val(1),Joomla.submitform("managecompanyevents.delete"),jQuery.jbdModal.close()}deleteAllFollowignEvents(){jQuery("#delete_mode").val(2),Joomla.submitform("managecompanyevents.delete"),jQuery.jbdModal.close()}deleteAllSeriesEvents(){jQuery("#delete_mode").val(3),Joomla.submitform("managecompanyevents.delete"),jQuery.jbdModal.close()}selectAppointment(){jQuery("#adminForm").submit()}deleteAppointment(appointmentId){confirm(Joomla.JText._("COM_JBUSINESS_DIRECTORY_EVENT_APPOINTMENT_CONFIRM_DELETE"))&&(jQuery("#adminForm #id").val(appointmentId),jQuery("#adminForm #task").val("managecompanyeventappointments.delete"),jQuery("#adminForm").submit())}confirmAppointment(appointmentId){jQuery("#adminForm #id").val(appointmentId),jQuery("#adminForm #task").val("managecompanyeventappointments.confirm"),jQuery("#adminForm").submit()}denyAppointment(appointmentId){jQuery("#adminForm #id").val(appointmentId),jQuery("#adminForm #task").val("managecompanyeventappointments.deny"),jQuery("#adminForm").submit()}deleteEventReservation(bookingId){confirm(Joomla.JText._("COM_JBUSINESS_DIRECTORY_EVENT_RESERVATION_CONFIRM_DELETE"))&&(jQuery("#adminForm #id").val(bookingId),jQuery("#adminForm #task").val("managecompanyeventreservations.delete"),jQuery("#adminForm").submit())}selectTicket(){jQuery("#adminForm").submit()}addEventTicket(){jQuery("#adminForm #id").val(0),jQuery("#adminForm #task").val("managecompanyeventticket.add"),jQuery("#adminForm").submit()}deleteTicket(ticketId){confirm(Joomla.JText._("COM_JBUSINESS_DIRECTORY_EVENT_TICKET_CONFIRM_DELETE"))&&(jQuery("#adminForm #id").val(ticketId),jQuery("#adminForm #task").val("managecompanyeventtickets.delete"),jQuery("#adminForm").submit())}duplicateTicket(ticketId){jQuery("#adminForm #id").val(ticketId),jQuery("#adminForm #task").val("managecompanyeventticket.duplicate"),jQuery("#adminForm").submit()}deleteEventMessage(id){confirm(Joomla.JText._("COM_JBUSINESS_DIRECTORY_EVENT_MESSAGE_CONFIRM_DELETE"))&&(jQuery("#adminForm #id").val(id),jQuery("#adminForm #task").val("manageeventmessages.delete"),jQuery("#adminForm").submit())}}let jbdEvents=new JBDEvents;class JBDTrips{constructor(){this.todayDate=new Date}showSaveDialog(task){jQuery("#adminForm #task").val(task),jQuery("#edit-trip-dialog").jbdModal()}repeatNone(){jQuery("#repeat-options").hide(),jQuery("#datepicker-calendar").hide()}repeatDaily(){jQuery("#repeat-options").show(),jQuery("#week-days-group").hide(),jQuery("#monthly-repeat").hide(),jQuery("#datepicker-calendar").hide()}repeatWeekly(){jQuery("").hide(),jQuery("#repeat-options").show(),jQuery("#week-days-group").show(),jQuery("#monthly-repeat").hide(),jQuery("#datepicker-calendar").hide()}repeatMonthly(){jQuery("#repeat-options").show(),jQuery("#week-days-group").hide(),jQuery("#monthly-repeat").show(),jQuery("#datepicker-calendar").hide()}repeatYearly(){jQuery("#repeat-options").show(),jQuery("#week-days-group").hide(),jQuery("#monthly-repeat").hide(),jQuery("#datepicker-calendar").hide()}repeatByDate(){jQuery("#repeat-options").hide(),jQuery("#week-days-group").hide(),jQuery("#monthly-repeat").hide(),jQuery("#datepicker-calendar").show()}endsOnOccurances(){jQuery("#rend_date").prop("disabled",!0),jQuery("#occurrences").prop("disabled",!1)}endsOnDate(){jQuery("#rend_date").prop("disabled",!1),jQuery("#occurrences").prop("disabled",!0)}handleUncompleteBookings(tripId){let urlBookings=jbdUtils.getAjaxUrl("handleUncompleteBookingsAjax","trip"),self=this;jQuery.ajax({type:"GET",url:urlBookings,data:{tripId:tripId},dataType:"json",cache:!1,success:function(){self.createTripCalendar(tripId)}})}createTripCalendar(tripId){let urlGetDays=jbdUtils.getAjaxUrl("getTripAvailableDatesAjax","trip");jQuery.ajax({type:"GET",url:urlGetDays,data:{tripId:tripId},dataType:"json",cache:!1,success:function(data){var firstDate=jQuery.datepicker.formatDate("mm/dd/yy",new Date(data[0]));jQuery("#datepicker").datepicker("destroy"),jQuery("#datepicker").datepicker({beforeShowDay:function(date){let string=jQuery.datepicker.formatDate("mm-dd-yy",date);return[-1!=data.indexOf(string)]},onSelect:function(date){jQuery("#tripDate").val(date)},defaultDate:firstDate}),jQuery("#tripDate").val(firstDate),data.length>0&&jQuery("#trip-action-container").html('<a href="javascript:document.tripBookingForm.submit()" class="btn btn-success">Book Now</a>')}})}}let jbdTrips=new JBDTrips;class JBDVideos{loadMore(){let moreVideosUrl=jbdUtils.getAjaxUrl("getMoreVideosAjax","video"),videoId=jQuery("#video-id").val(),categoryId=jQuery("#main-catetegory").val(),start=jQuery("#start").val();start=parseInt(start),jQuery.ajax({type:"GET",url:moreVideosUrl,data:{videoId:videoId,categoryId:categoryId,start:start},dataType:"json",cache:!1,success:function(data){jQuery("#related-videos").append(data.data.videos),jQuery("#start").val(start+data.data.videosCount),data.data.show_more||jQuery("#load-more-btn").hide()}})}}let jbdVideos=new JBDVideos;class JBDReviews{saveReview(formId){var form_id="#"+formId;jQuery(form_id).validationEngine({validateNonVisibleFields:!0,updatePromptsPosition:!0,ignore:""}),jQuery(form_id).validationEngine("validate")&&document.getElementById(formId).submit()}cancelSubmitReview(){jQuery("#add-review").slideUp(500)}addNewReview(requiresLogin,companyView){companyView=void 0===companyView||companyView,requiresLogin?jbdUtils.showLoginNotice():(1==companyView&&jbdListings.showDetails("company-reviews"),window.location.hash="#reviews",jQuery("#add-review").slideDown(500),jQuery("html, body").animate({scrollTop:jQuery("#add-review").offset().top+jQuery("#add-review").height()/2},1e3))}addNewReviewOnTabs(requiresLogin){requiresLogin?jbdUtils.showLoginNotice():(jbdListings.showDirTab("#tabs-3"),jQuery("#add-review").slideDown(500),jbdListings.showTabContent("company-reviews"),window.location.hash="#add-review")}reportReviewAbuse(requiresLogin,reviewId){requiresLogin?jbdUtils.showLoginNotice():(document.getElementById("reportAbuse").elements.reviewId.value=reviewId,jQuery("#report-abuse").jbdModal())}respondToReview(requiresLogin,reviewId){requiresLogin?jbdUtils.showLoginNotice():(document.reviewResponseFrm.elements.reviewId.value=reviewId,jQuery("#new-review-response").jbdModal())}saveReviewAbuse(){this.validateReportAbuseForm()&&document.reportAbuse.submit()}saveReviewResponse(){this.validateReviewResponseForm()&&document.reviewResponseFrm.submit()}closeDialog(){jQuery.jbdModal.close()}increaseReviewLikeCount(reviewId){var postParameters="",postData="&task=companies.increaseReviewLikeCountAjax&view=companies"+(postParameters+="&reviewId="+reviewId);jQuery.post(jbdUtils.getProperty("baseUrl"),postData,this.processIncreaseLikeResult)}increaseOfferReviewLikeCount(reviewId){var postParameters="",postData="&task=offer.increaseReviewLikeCountAjax&view=offers"+(postParameters+="&reviewId="+reviewId);jQuery.post(jbdUtils.getProperty("baseUrl"),postData,this.processIncreaseLikeResult)}processIncreaseLikeResult(response){jQuery(response).find("answer").each(function(){1==jQuery(this).attr("result")&&(jQuery("#like"+jQuery(this).attr("reviewId")).text(parseInt(jQuery("#like"+jQuery(this).attr("reviewId")).text())+1),jbdReviews.saveCookieLikeId(jQuery(this).attr("reviewId")),jQuery("#like"+jQuery(this).attr("reviewId")).parent().parent().children().attr("onclick",""),jQuery("#like"+jQuery(this).attr("reviewId")).parent().parent().addClass("reduceOpacity"))})}saveCookieLikeId(reviewId){var ids=jbdUtils.getCookie("likeIds");void 0===ids&&(ids=""),ids+=","+reviewId,jbdUtils.setCookie("likeIds",ids,60)}increaseReviewLoveCount(reviewId){var postParameters="",postData="&task=companies.increaseReviewLoveCountAjax&view=companies"+(postParameters+="&reviewId="+reviewId);jQuery.post(jbdUtils.getProperty("baseUrl"),postData,this.processIncreaseLoveResult)}processIncreaseLoveResult(response){jQuery(response).find("answer").each(function(){1==jQuery(this).attr("result")&&(jQuery("#love"+jQuery(this).attr("reviewId")).text(parseInt(jQuery("#love"+jQuery(this).attr("reviewId")).text())+1),jbdReviews.saveCookieLoveId(jQuery(this).attr("reviewId")),jQuery("#love"+jQuery(this).attr("reviewId")).parent().parent().children().attr("onclick",""),jQuery("#love"+jQuery(this).attr("reviewId")).parent().parent().addClass("reduceOpacity"))})}saveCookieLoveId(reviewId){var ids=jbdUtils.getCookie("loveIds");void 0===ids&&(ids=""),ids+=","+reviewId,jbdUtils.setCookie("loveIds",ids,60)}increaseReviewDislikeCount(reviewId){var postParameters="",postData="&task=companies.increaseReviewDislikeCountAjax&view=companies"+(postParameters+="&reviewId="+reviewId);jQuery.post(jbdUtils.getProperty("baseUrl"),postData,this.processIncreaseDislikeResult)}increaseOfferReviewDislikeCount(reviewId){var postParameters="",postData="&task=offer.increaseReviewDislikeCountAjax&view=offers"+(postParameters+="&reviewId="+reviewId);jQuery.post(jbdUtils.getProperty("baseUrl"),postData,this.processIncreaseDislikeResult)}processIncreaseDislikeResult(response){jQuery(response).find("answer").each(function(){1==jQuery(this).attr("result")&&(jQuery("#dislike"+jQuery(this).attr("reviewId")).text(parseInt(jQuery("#dislike"+jQuery(this).attr("reviewId")).text())+1),jbdReviews.saveCookieDislikeId(jQuery(this).attr("reviewId")),jQuery("#dislike"+jQuery(this).attr("reviewId")).parent().parent().children().attr("onclick",""),jQuery("#dislike"+jQuery(this).attr("reviewId")).parent().parent().addClass("reduceOpacity"))})}saveCookieDislikeId(reviewId){var ids=jbdUtils.getCookie("dislikeIds");void 0===ids&&(ids=""),ids+=","+reviewId,jbdUtils.setCookie("dislikeIds",ids,60)}checkLikeStatus(){var ids=jbdUtils.getCookie("likeIds");void 0===ids&&(ids=""),ids=ids.split(",");for(var i=0;i<ids.length;i++)jQuery("#like"+ids[i]).parent().parent().children("a:first-child").attr("onclick",""),jQuery("#like"+ids[i]).parent().parent().addClass("reduceOpacity")}checkLoveStatus(){var ids=jbdUtils.getCookie("loveIds");void 0===ids&&(ids=""),ids=ids.split(",");for(var i=0;i<ids.length;i++)jQuery("#love"+ids[i]).parent().parent().children("a:first-child").attr("onclick",""),jQuery("#love"+ids[i]).parent().parent().addClass("reduceOpacity")}checkDislikeStatus(){var ids=jbdUtils.getCookie("dislikeIds");void 0===ids&&(ids=""),ids=ids.split(",");for(var i=0;i<ids.length;i++)jQuery("#dislike"+ids[i]).parent().parent().children("a:first-child").attr("onclick",""),jQuery("#dislike"+ids[i]).parent().parent().addClass("reduceOpacity")}validateReportAbuseForm(){var form=document.reportAbuse,isError=!1;return jQuery(".error_msg").each(function(){jQuery(this).hide()}),validateField(form.elements.email,"email",!1,null)||(jQuery("#reportAbuse #frmEmail_error_msg").show(),isError||jQuery("#reportAbuse #email").focus(),isError=!0),validateField(form.elements.description,"string",!1,null)||(jQuery("#reportAbuse #frmDescription_error_msg").show(),isError||jQuery("#reportAbuse #frmDescription_error_msg").focus(),isError=!0),!isError}validateReviewResponseForm(){var form=document.reviewResponseFrm,isError=!1;return jQuery(".error_msg").each(function(){jQuery(this).hide()}),validateField(form.elements.firstName,"string",!1,null)||(jQuery("#reviewResponseFrm #frmFirstName_error_msg").show(),isError||jQuery("#firstName").focus(),isError=!0),validateField(form.elements.lastName,"string",!1,null)||(jQuery(" #reviewResponseFrm #frmLastName_error_msg").show(),isError||jQuery("#lastName").focus(),isError=!0),validateField(form.elements.email,"email",!1,null)||(jQuery("#reviewResponseFrm #frmEmail_error_msg").show(),isError||jQuery("#email").focus(),isError=!0),validateField(form.elements.response,"string",!1,null)||(jQuery("#reviewResponseFrm #frmDescription_error_msg").show(),isError||jQuery("#reviewResponseFrm #frmDescription_error_msg").focus(),isError=!0),!isError}deleteReview(controller,id){confirm(Joomla.JText._("LNG_ARE_YOU_SURE_YOU_WANT_TO_DELETE"))&&(jQuery("#id").val(id),jQuery("#task").val(controller+".delete"),jQuery("#adminForm").submit())}loadMoreReviews(){let moreReviewsUrl=jbdUtils.getAjaxUrl("getMoreReviewsAjax","companies"),start=jQuery("#start").val(),companyId=jQuery("#company").val();start=parseInt(start),jQuery.ajax({type:"GET",url:moreReviewsUrl,data:{start:start,companyId:companyId},dataType:"json",cache:!1,success:function(data){jQuery("#reviews").append(data.data.reviews),jQuery("#start").val(start+data.data.reviewsCount),jbdListings.magnifyImages("gallery"),data.data.show_more||jQuery("#load-more-btn").hide(),jbdReviews.checkLikeStatus(),jbdReviews.checkDislikeStatus(),jbdReviews.checkLoveStatus(),jbdListings.renderReviewRating(),jQuery(".review-questions").each(function(){jbdListings.showReviewQuestions(jQuery(this).attr("id"))})}})}}let jbdReviews=new JBDReviews;window.addEventListener("load",function(){jbdReviews.checkLikeStatus(),jbdReviews.checkDislikeStatus(),jbdReviews.checkLoveStatus()});class JBDTabs{constructor(){this.currentTab=1,this.currentTabIndex=0,this.maxTabs=6,this.tabMapInitialized=0}setMaxTabs(maxTabs){this.maxTabs=maxTabs}setPresentTabs(presentTabs){this.presentTabs=presentTabs,this.setMaxTabs(presentTabs.length)}openTab(tab){if(jbdUtils.getProperty("isMultilingual")){let tabgroup=jQuery(".tab-"+jbdUtils.getProperty("defaultLang"));0==tabgroup.length&&(tabgroup=jQuery("button[aria-controls='tab-"+jbdUtils.getProperty("defaultLang")+"']")),tabgroup.each(function(){jQuery(this).click()})}jQuery("#item-form").validationEngine("detach"),jbdUtils.getProperty("validateRichTextEditors")&&jbdUtils.validateRichTextEditors(),jbdUtils.validateMultiSelects(),jQuery("#item-form").validationEngine("validate")&&(jQuery("#tab"+tab).hasClass("active")?(jQuery("#tab"+tab).removeClass("active"),jQuery("#edit-tab"+tab).hide()):this.showEditTab(tab))}showEditTab(tab){if(jQuery(".edit-tab").each(function(){jQuery(this).hide()}),jQuery(".process-step").each(function(){jQuery(this).hide(),jQuery(this).removeClass("active")}),jQuery(".process-tab").each(function(){jQuery(this).removeClass("active"),jQuery(this).removeClass("completed"),jQuery(this).removeClass("not-completed")}),jQuery("#next-btn").length||jQuery("#save-btn").length){for(var i=1;i<this.currentTabIndex+1;i++)jQuery("#tab"+i).addClass("completed");for(i=this.currentTabIndex+2;i<=this.maxTabs;i++)jQuery("#tab"+i).addClass("not-completed")}if(0==this.currentTabIndex?jQuery("#prev-btn").hide():jQuery("#prev-btn").show(),this.currentTabIndex+1==this.maxTabs?(jQuery("#next-btn").hide(),jQuery("#save-btn").show(),jQuery("#privacy_policy").show()):(jQuery("#next-btn").show(),jQuery("#save-btn").hide(),jQuery("#privacy_policy").hide()),jQuery("#edit-tab"+tab).show(),jQuery("#step"+tab).show(),1!=tab){let scrollTopOffset=jQuery("#tab"+tab).offset().top-150;jQuery("html,body").animate({scrollTop:scrollTopOffset},"slow")}jQuery("#step"+tab).addClass("active"),jQuery("#tab"+tab).addClass("active"),jQuery("#active-step-number").html(tab),3==tab&&0==this.tabMapInitialized&&(initializeMap(),this.tabMapInitialized=1)}nextTab(){if(jbdUtils.getProperty("isMultilingual")){let tabgroup=jQuery(".tab-"+jbdUtils.getProperty("defaultLang"));0==tabgroup.length&&(tabgroup=jQuery("button[aria-controls='tab-"+jbdUtils.getProperty("defaultLang")+"']")),tabgroup.each(function(){jQuery(this).click()})}jbdUtils.getProperty("validateRichTextEditors")&&jbdUtils.validateRichTextEditors(),jQuery("#item-form").validationEngine("validate")&&(this.currentTabIndex<this.presentTabs.length-1&&(this.currentTabIndex++,this.currentTab=this.presentTabs[this.currentTabIndex]),this.showEditTab(this.currentTab))}previousTab(){this.currentTabIndex>0&&(this.currentTabIndex--,this.currentTab=this.presentTabs[this.currentTabIndex]),this.showEditTab(this.currentTab)}}let jbdTabs=new JBDTabs;class JBDUpload{constructor(params){this.setIsBack=!1,this.folderIDs=[],this.allowedImageFileExtension=/^.+\.(png|bmp|gif|png|jpeg|webp|PNG|JPG|GIF|JPEG|WEBP)$/i,this.allowedImageFileExtMessage="Only the following file extensions allowed: jpg, bmp ,gif ,png,  jpeg, webp!",void 0!==params?(void 0!==params.maxAttachments?this.maxAttachments=params.maxAttachments:this.maxAttachments=jbdUtils.getProperty("maxAttachments"),void 0!==params.maxPictures&&(this.maxPictures=params.maxPictures),void 0!==params.maxVideos&&(this.maxVideos=params.maxVideos),void 0!==params.maxSounds&&(this.maxSounds=params.maxSounds),void 0!==params.removePath&&(this.removePath=params.removePath),void 0!==params.setIsBack&&(this.setIsBack=params.setIsBack),void 0!==params.picturesFolder?this.picturesFolder=params.picturesFolder:this.picturesFolder=jbdUtils.getProperty("imageBaseUrl")):(this.picturesFolder=jbdUtils.getProperty("imageBaseUrl"),this.maxAttachments=jbdUtils.getProperty("maxAttachments"))}setIsBackEnd(){picturesUploaded=jQuery('input[name*="picture_path[]"]').length,this.setIsBack=!0,this.checkNumberOfPictures()}setMaxPictures(maxAllowedNumber){picturesUploaded=jQuery('input[name*="picture_path[]"]').length,this.maxPictures=maxAllowedNumber,this.checkNumberOfPictures()}checkNumberOfPictures(){let nrPictures=jQuery("#pictures-list #sortable li").length;this.maxPictures<=nrPictures?jQuery("#file-upload").hide():jQuery("#file-upload").show()}getItemName(){let name=jQuery("#alias").val();return null!=name&&""!=name&&void 0!=name||null!=(name=jQuery("#name").val())&&""!=name&&void 0!=name||null!=(name=jQuery('[id^="name_"]').val())&&void 0!=name||(name=""),name=name.replace(/ /g,"_")}imageUploader(folderID,folderIDPath,type,picId){let typeIndex=void 0===type?"default":type;this.folderIDs[typeIndex]={folderID:folderID,folderIDPath:folderIDPath};let self=this;void 0!==type&&null!==type||(type=""),void 0!==picId&&null!==picId||(picId=""),jQuery("#"+type+"imageUploader"+picId).change(function(){jQuery("#remove-image-loading").remove(),jQuery("#"+type+"picture-preview"+picId).append('<p id="remove-image-loading" class="text-center"><span class="icon-refresh icon-refresh-animate"></span> Loading...</p>'),jQuery("#item-form").validationEngine("detach");var path=jQuery(this).val();if(!path)return!1;if(-1==path.search(self.allowedImageFileExtension))return jQuery("#remove-image-loading").remove(),alert(self.allowedImageFileExtMessage),!1;let imageName="image_name="+self.getItemName();jQuery(this).upload(folderIDPath,imageName,function(responce){if(""==responce)jQuery("#remove-image-loading").remove(),alert(Joomla.JText._("LNG_ERROR_ADDING_FILE")),jQuery(this).val("");else{var xml=responce;if(jbdUtils.getProperty("enable_resolution_check"))if(void 0!==jQuery(xml).find("warning").attr("value")){jQuery("#remove-image-loading").remove();var wHeight=jQuery(xml).find("warning").attr("height"),wWidth=jQuery(xml).find("warning").attr("width");return alert(Joomla.JText._("LNG_IMAGE_SIZE_WARNING")+" (Width:"+wWidth+", Height:"+wHeight+")"),!1}jQuery(xml).find("picture").each(function(){0==jQuery(this).attr("error")?(self.setUpImage(folderID+jQuery(this).attr("path"),jQuery(this).attr("name"),type,picId),jQuery("#remove-image-loading").remove(),jbdUtils.getProperty("enable_crop")&&!jbdUtils.getProperty("disable_cropping_types").includes(jQuery(this).attr("picture-type"))&&self.showCropper(self.picturesFolder+folderID+jQuery(this).attr("path"),type,picId)):1==jQuery(this).attr("error")?alert(Joomla.JText._("LNG_FILE_ALLREADY_ADDED")):2==jQuery(this).attr("error")?alert(Joomla.JText._("LNG_ERROR_ADDING_FILE")):3==jQuery(this).attr("error")?alert(Joomla.JText._("LNG_ERROR_GD_LIBRARY")):4==jQuery(this).attr("error")&&alert(Joomla.JText._("LNG_ERROR_RESIZING_FILE"))})}}),jQuery("#item-form").validationEngine("attach")})}setUpImage(path,name,type,picId){jQuery("#"+type+"imageLocation"+picId).val(path);let img_new=document.createElement("img");img_new.setAttribute("src",this.picturesFolder+path),img_new.setAttribute("id","itemImg"),img_new.setAttribute("class","item-image"),jQuery("#"+type+"picture-preview"+picId).empty(),jQuery("#"+type+"picture-preview"+picId).append(img_new),"/no_image.jpg"==path&&window.location.reload(!0)}markerUploader(folderID,folderIDPath){let self=this;jQuery("#markerfile").change(function(){if(jQuery("#remove-image-loading").remove(),jQuery("#marker-preview").append('<p id="remove-image-loading" class="text-center"><span class="icon-refresh icon-refresh-animate"></span></p>'),jQuery("#item-form").validationEngine("detach"),-1==jQuery(this).val().search(self.allowedImageFileExtension))return jQuery("#remove-image-loading").remove(),alert(self.allowedImageFileExtMessage),!1;jQuery(this).upload(folderIDPath,function(responce){""==responce?(jQuery("#remove-image-loading").remove(),alert(Joomla.JText._("LNG_ERROR_ADDING_FILE")),jQuery(this).val("")):jQuery(responce).find("picture").each(function(){0==jQuery(this).attr("error")?(self.setUpMarker(folderID+jQuery(this).attr("path"),jQuery(this).attr("name")),jQuery("#remove-image-loading").remove()):1==jQuery(this).attr("error")?alert(Joomla.JText._("LNG_FILE_ALLREADY_ADDED")):2==jQuery(this).attr("error")?alert(Joomla.JText._("LNG_ERROR_ADDING_FILE")):3==jQuery(this).attr("error")?alert(Joomla.JText._("LNG_ERROR_GD_LIBRARY")):4==jQuery(this).attr("error")&&alert(Joomla.JText._("LNG_ERROR_RESIZING_FILE"))})}),jQuery("#item-form").validationEngine("attach")})}setUpMarker(path,name){jQuery("#markerLocation").val(path);var img_new=document.createElement("img");img_new.setAttribute("src",this.picturesFolder+path),img_new.setAttribute("id","markerImg"),img_new.setAttribute("class","marker-image"),jQuery("#marker-preview").empty(),jQuery("#marker-preview").append(img_new)}multiImageUploader(folder,folderPath){let self=this;jQuery("#multiImageUploader").change(function(){if(jQuery("#remove-image-loading").remove(),jQuery("#table_pictures").append('<p id="remove-image-loading" class="text-center"><span class="icon-refresh icon-refresh-animate"></span>Loading...</p>'),jQuery("#item-form").validationEngine("detach"),-1==jQuery(this).val().search(self.allowedImageFileExtension))return jQuery("#remove-image-loading").remove(),alert(self.allowedImageFileExtMessage),!1;jQuery(this).upload(folderPath,function(responce){if(""==responce)jQuery("#remove-image-loading").remove(),alert(Joomla.JText._("LNG_ERROR_ADDING_FILE")),jQuery(this).val("");else{var xml=responce;if(jbdUtils.getProperty("enable_resolution_check"))if(void 0!==jQuery(xml).find("warning").attr("value")){jQuery("#remove-image-loading").remove();var wHeight=jQuery(xml).find("warning").attr("height"),wWidth=jQuery(xml).find("warning").attr("width");return alert(Joomla.JText._("LNG_IMAGE_SIZE_WARNING")+" (Width:"+wWidth+", Height:"+wHeight+")"),!1}jQuery(xml).find("picture").each(function(){0==jQuery(this).attr("error")?(self.addPicture(folder+jQuery(this).attr("path"),jQuery(this).attr("name")),jQuery("#remove-image-loading").remove()):1==jQuery(this).attr("error")?alert(Joomla.JText._("LNG_FILE_ALLREADY_ADDED")):2==jQuery(this).attr("error")?alert(Joomla.JText._("LNG_ERROR_ADDING_FILE")):3==jQuery(this).attr("error")?alert(Joomla.JText._("LNG_ERROR_GD_LIBRARY")):4==jQuery(this).attr("error")&&alert(Joomla.JText._("LNG_ERROR_RESIZING_FILE"))}),jQuery(this).val("")}},"html"),jQuery("#item-form").validationEngine("attach")})}removePicture(pos){let lis=document.querySelectorAll("#sortable li");null==lis&&alert("Undefined List, contact administrator !"),pos>=lis.length&&(pos=lis.length-1),this.checkNumberOfPictures()}removeAllPicture(id){void 0!==id&&null!==id||(id="sortable");let lis=document.querySelectorAll("#"+id+" li");null==lis&&alert("Undefined List, contact administrator !");let maxImages=lis.length;for(let i=0;i<maxImages;i++){let pos=i;pos>=lis.length&&(pos=lis.length-1),lis[pos].parentNode.removeChild(lis[pos])}this.checkNumberOfPictures()}btn_removefile(){let self=this;jQuery("#btn_removefile").click(function(){jQuery("#item-form").validationEngine("detach");let pos=jQuery("#crt_pos").val(),path=jQuery("#crt_path").val();jQuery(this).upload(this.removePath+path+"&_pos="+pos,function(responce){""==responce?(alert(Joomla.JText._("LNG_ERROR_REMOVING_FILE")),jQuery(this).val("")):(jQuery(responce).find("picture").each(function(){0==jQuery(this).attr("error")?self.removePicture(jQuery(this).attr("pos")):2==jQuery(this).attr("error")?self.removePicture(pos):3==jQuery(this).attr("error")&&alert(Joomla.JText._("LNG_FILE_DOESNT_EXIST"))}),jQuery("#crt_pos").val(""),jQuery("#crt_path").val(""))},"html"),jQuery("#item-form").validationEngine("detach")})}multiFileUploader(folderID,folderIDPath){let self=this;jQuery("#multiFileUploader").change(function(){jQuery("#remove-file-loading").remove(),jQuery("#attachment-list").find(".jbd-item-list").append('<p id="remove-file-loading" class="text-center"><span class="icon-refresh icon-refresh-animate"></span> Loading...</p>'),jQuery("#item-form").validationEngine("detach");jQuery(this).val();jQuery(this).upload(folderIDPath,function(responce){if(""==responce)jQuery("#remove-file-loading").remove(),alert(Joomla.JText._("LNG_ERROR_ADDING_FILE")),jQuery(this).val("");else{var xml=responce;jQuery("#remove-file-loading").remove(),jQuery(xml).find("attachment").each(function(){jQuery(this).attr("name").length>jbdUtils.getProperty("maxFilenameLength")?alert(Joomla.JText._("LNG_FILENAME_TOO_LONG")):0==jQuery(this).attr("error")?jQuery("#attachment-list #sortable-attachment li").length<self.maxAttachments?(self.addAttachment(folderID+jQuery(this).attr("path"),jQuery(this).attr("name")),jQuery("#multiFileUploader").val("")):alert(Joomla.JText._("LNG_MAX_ATTACHMENTS_ALLOWED")+self.maxAttachments):jQuery(this).attr("info")?alert(jQuery(this).attr("info")):alert(Joomla.JText._("LNG_ERROR_ADDING_FILE"))})}},"html"),jQuery("#item-form").validationEngine("attach")})}addAttachment(path,name){var attachTemplate=jQuery("#attachment-item-template").html(),newId=Math.random().toString(36).substring(7);attachTemplate=(attachTemplate=(attachTemplate=(attachTemplate=(attachTemplate=attachTemplate.replaceAll("{attachment_id}",newId)).replaceAll("{attachment_name}",name)).replaceAll("{attachment_path}",jbdUtils.basename(path))).replaceAll("{attachment_full_path}",path)).replaceAll("{attachment_status}",1),jQuery("#attachment-list").find(".jbd-item-list").append(attachTemplate),jQuery("#attachment-list").jbdList({statusCallback:this.changeAttachmentStatus,deleteCallback:this.deleteAttachment,statusSelector:"attachment_status_",deleteMsg:Joomla.JText._("LNG_CONFIRM_DELETE_ATTACHMENT")})}addPicture(path,name){var pictureTemplate=jQuery("#picture-item-template").html(),newId=Math.random().toString(36).substring(7);pictureTemplate=(pictureTemplate=(pictureTemplate=(pictureTemplate=(pictureTemplate=(pictureTemplate=pictureTemplate.replaceAll("{picture_id}",newId)).replaceAll("{picture_title}","")).replaceAll("{picture_info}","")).replaceAll("{picture_path}",jbdUtils.basename(path))).replaceAll("{picture_full_path}",path)).replaceAll("{picture_enable}",1);var link='<img src="'+(link=this.picturesFolder+path)+'">';pictureTemplate=pictureTemplate.replaceAll("{picture_link}",link),jQuery("#pictures-list").find(".jbd-item-list").append(pictureTemplate),jQuery("#pictures-list").jbdList({statusCallback:this.changePictureStatus,deleteCallback:this.deletePicture,statusSelector:"picture_enable_",deleteMsg:Joomla.JText._("LNG_CONFIRM_DELETE_PICTURE")}),this.checkNumberOfPictures()}changeAttachmentStatus(id,oldVal){var newVal=0==oldVal?1:0;jQuery("#attachment_status_"+id).val(newVal)}changePictureStatus(id,oldVal){var newVal=0==oldVal?1:0;jQuery("#picture_enable_"+id).val(newVal)}changeExtraPictureStatus(id,oldVal){var newVal=0==oldVal?1:0;jQuery("#image_enable_"+id).val(newVal)}deleteAttachment(id){jQuery("#crt_path_a").val(jQuery("#attachment_path_"+id)),jQuery("#btn_removefile_at").click()}deletePicture(id){jQuery("#crt_path").val(jQuery("#picture_path_"+id)),jQuery("#btn_removefile").click()}deleteExtraPicture(id){jQuery("#crt_path").val(jQuery("#image_path_"+id)),jQuery("#btn_removefile").click()}btn_removefile_at(removePath_at){void 0===removePath_at&&(removePath_at=this.removePath),jQuery("#btn_removefile_at").click(function(){jQuery("#item-form").validationEngine("detach"),pos=jQuery("#crt_pos_a").val(),path=jQuery("#crt_path_a").val(),jQuery(this).upload(removePath_at+path+"&_pos="+pos,function(responce){""==responce?(alert(Joomla.JText._("LNG_ERROR_REMOVING_FILE")),jQuery(this).val("")):(jQuery(responce).find("picture").each(function(){0==jQuery(this).attr("error")||(2==jQuery(this).attr("error")?alert(Joomla.JText._("LNG_ERROR_REMOVING_FILE")):3==jQuery(this).attr("error")&&alert(Joomla.JText._("LNG_FILE_DOESNT_EXIST")))}),jQuery("#crt_pos_a").val(""),jQuery("#crt_path_a").val(""))},"html"),jQuery("#item-form").validationEngine("detach")})}removeImage(type,picId){void 0!==type&&null!==type||(type=""),void 0!==picId&&null!==picId||(picId=""),jQuery("#"+type+"imageLocation"+picId).val(""),jQuery("#"+type+"picture-preview"+picId).html("<i class='la la-image'></i>"),jQuery("#"+type+"imageUploader"+picId).val("")}removeRow(id){jQuery("#"+id).remove(),self.checkNumberOfVideos(),self.checkNumberOfSounds()}showCropper(dataUri,type,picId){let self=this;void 0!==this.cropper&&this.cropper.destroy();var width,height;void 0!==picId&&null!==picId||(picId=""),jQuery("#cropper-modal").jbdModal(),jQuery("#cropper-image").attr("src",""),jQuery("#cropper-image").attr("src",dataUri),jQuery("#save-cropped").unbind("click"),jQuery("#save-cropped").on("click",function(event){self.saveCropped(type,picId)}),0==type.length?(this.removeImage(),width=jbdUtils.getProperty("logo_width"),height=jbdUtils.getProperty("logo_height")):"cover-"===type?(width=jbdUtils.getProperty("cover_width"),height=jbdUtils.getProperty("cover_height"),this.removeImage("cover-")):"service-"===type?(width=jbdUtils.getProperty("gallery_width"),height=jbdUtils.getProperty("gallery_height"),this.removeImage("service-",picId)):"speaker-"===type?(width=jbdUtils.getProperty("speaker_img_width"),height=jbdUtils.getProperty("speaker_img_height"),this.removeImage("speaker-")):(width=jbdUtils.getProperty("gallery_width"),height=jbdUtils.getProperty("gallery_height")),width=parseInt(width),height=parseInt(height);var image=document.getElementById("cropper-image");this.cropper=new Cropper(image,{aspectRatio:width/height,cropBoxResizable:!1,dragMode:"move",scalable:!0,minCropBoxWidth:width,minCropBoxHeight:height,crop:function(e){}})}saveCropped(type,picId){let self=this;this.cropper.getCroppedCanvas({fillColor:"#fff"}).toBlob(function(blob){var formData=new FormData;blob.name="cropped."+blob.type.substr(blob.type.indexOf("/")+1,blob.type.length),formData.append("croppedimage",blob);let folderID="",submitPath="";0==type.length?(folderID=self.folderIDs.default.folderID,submitPath=self.folderIDs.default.folderIDPath):(folderID=self.folderIDs[type].folderID,submitPath=self.folderIDs[type].folderIDPath),submitPath+="&crop=1",submitPath+="&image_name="+self.getItemName(),jQuery.ajax(submitPath,{type:"POST",data:formData,processData:!1,contentType:!1,success:function(xml){jQuery(xml).find("picture").each(function(){0==jQuery(this).attr("error")?(self.setUpImage(folderID+jQuery(this).attr("path"),jQuery(this).attr("name"),type,picId),jQuery("#remove-image-loading").remove()):1==jQuery(this).attr("error")?alert(Joomla.JText._("LNG_FILE_ALLREADY_ADDED")):2==jQuery(this).attr("error")?alert(Joomla.JText._("LNG_ERROR_ADDING_FILE")):3==jQuery(this).attr("error")?alert(Joomla.JText._("LNG_ERROR_GD_LIBRARY")):4==jQuery(this).attr("error")&&alert(Joomla.JText._("LNG_ERROR_RESIZING_FILE"))}),jQuery.jbdModal.close(),self.cropper.destroy()},error:function(){}})},"image/jpeg",.8)}imageUploaderDropzone(dropZoneDiv,url,clickableButtons,MultiLanguageMessage,ImagePath,paralelUploadNumber,pictureAdder){let self=this;Dropzone.autoDiscover=!1,jQuery(dropZoneDiv).dropzone({url:url,addRemoveLinks:!0,acceptedFiles:"image/gif,.jpg,.jpeg,.png,.svg,.webp",maxFilesize:32,enqueueForUpload:!0,dictRemoveFile:"Remove Preview",autoProcessQueue:!0,parallelUploads:paralelUploadNumber,dictDefaultMessage:MultiLanguageMessage,clickable:clickableButtons,init:function(){var myDropzone=this;jQuery(dropZoneDiv+"-submitAll").click(function(e){e.preventDefault(),e.stopPropagation(),myDropzone.processQueue(),jQuery("button").each(function(){jQuery(this).remove("#add")})})},success:function(file,response){var xml=response;file.name.replace(/[^0-9a-zA-Z.]/g,"_"),file.previewElement.classList.add("dz-success");var name=jQuery(xml).find("picture").attr("name");switch(pictureAdder){case"addPicture":file.height>=jbdUtils.getProperty("gallery_height")&&file.width>=jbdUtils.getProperty("gallery_width")||!jbdUtils.getProperty("enable_resolution_check")?self.addPicture(ImagePath+name,name):alert("["+name+"] "+Joomla.JText._("LNG_IMAGE_SIZE_WARNING")+" (Width:"+jbdUtils.getProperty("gallery_width")+", Height:"+jbdUtils.getProperty("gallery_height")+")");break;case"addExtraPicture":file.height>=jbdUtils.getProperty("gallery_height")&&file.width>=jbdUtils.getProperty("gallery_width")||!jbdUtils.getProperty("enable_resolution_check")?self.addExtraPicture(ImagePath+name,name):alert("["+name+"] "+Joomla.JText._("LNG_IMAGE_SIZE_WARNING")+" (Width:"+jbdUtils.getProperty("gallery_width")+", Height:"+jbdUtils.getProperty("gallery_height")+")");break;case"setUpLogo":setUpLogo(name);break;case"setUpLogoExtraOptions":setUpLogoExtraOptions(ImagePath+name,name);break;default:alert("Error! no image creation function defined for this view")}},error:function(file,response){file.previewElement.classList.add("dz-error")}})}addExtraPicture(path,name){var pictureTemplate=jQuery("#extra-picture-item-template").html(),newId=Math.random().toString(36).substring(7);pictureTemplate=(pictureTemplate=(pictureTemplate=(pictureTemplate=(pictureTemplate=(pictureTemplate=pictureTemplate.replaceAll("{image_id}",newId)).replaceAll("{image_title}","")).replaceAll("{image_info}","")).replaceAll("{image_path}",jbdUtils.basename(path))).replaceAll("{image_full_path}",path)).replaceAll("{image_enable}",1);var link='<img src="'+(link=this.picturesFolder+path)+'">';pictureTemplate=pictureTemplate.replaceAll("{image_link}",link),jQuery("#extra-pictures-list").find(".jbd-item-list").append(pictureTemplate),jQuery("#extra-pictures-list").jbdList({statusCallback:this.changePictureStatus,deleteCallback:this.deletePicture,statusSelector:"image_enable_",deleteMsg:Joomla.JText._("LNG_CONFIRM_DELETE_PICTURE")}),this.checkNumberOfPictures()}photosNameFormater(imageName){return imageName.length>14?imageName.substring(imageName.length-14):imageName}addVideo(type){null!==type&&void 0!==type||(type="");var count=jQuery("#video-container").children().length+1;var outerDiv=document.createElement("div");outerDiv.setAttribute("class","video-item"),outerDiv.setAttribute("id","detailBox"+count);var newLabel=document.createElement("label");newLabel.setAttribute("for",0),newLabel.innerHTML=Joomla.JText._("LNG_VIDEO");var cointainerDiv=document.createElement("div");cointainerDiv.setAttribute("class","input-group");var newInput=document.createElement("input");newInput.setAttribute("name","videos[]"),newInput.setAttribute("type","text"),newInput.setAttribute("maxlength","245"),newInput.setAttribute("id",0),newInput.setAttribute("class","form-control"),newInput.setAttribute("placeholder","Video URL");var appendDiv=document.createElement("div");appendDiv.setAttribute("class","input-group-append");var newButton=document.createElement("button");newButton.setAttribute("class","btn btn-secondary"),newButton.setAttribute("onclick",'uploadInstance.removeRow("detailBox'+count+'");checkNumberOfVideos();');var newIcon=document.createElement("i");if(newIcon.setAttribute("class","la la-lg la-remove"),newButton.appendChild(newIcon),appendDiv.appendChild(newButton),"withTitle"==type){var titleInput=document.createElement("input");titleInput.setAttribute("name","title[]"),titleInput.setAttribute("type","text"),titleInput.setAttribute("id",0),titleInput.setAttribute("maxlength","245"),titleInput.setAttribute("class","form-control mr-2"),titleInput.setAttribute("placeholder","Video Title"),cointainerDiv.appendChild(titleInput)}cointainerDiv.appendChild(newInput),cointainerDiv.appendChild(appendDiv),outerDiv.appendChild(newLabel),outerDiv.appendChild(cointainerDiv),jQuery("#video-container").append(outerDiv),this.checkNumberOfVideos()}checkNumberOfVideos(){jQuery('input[name*="videos[]"]').length<this.maxVideos?jQuery("#add-video").show():jQuery("#add-video").hide()}addSound(){var count=jQuery("#sound-container").children().length+1;var outerDiv=document.createElement("div");outerDiv.setAttribute("id","soundDetailBox"+count),outerDiv.setAttribute("class","sound-details-box");var newLabel=document.createElement("label");newLabel.setAttribute("for",0),newLabel.innerHTML=Joomla.JText._("LNG_SOUND");var inputGroupDiv=document.createElement("div");inputGroupDiv.setAttribute("class","input-group");var newInput=document.createElement("input");newInput.setAttribute("name","sounds[]"),newInput.setAttribute("id",0),newInput.setAttribute("class","form-control");var inputGroupAppendDiv=document.createElement("div");inputGroupAppendDiv.setAttribute("class","input-group-append");var newButton=document.createElement("button");newButton.setAttribute("class","input-group-text btn-secondary"),newButton.setAttribute("onclick",'uploadInstance.removeRow("soundDetailBox'+count+'");');var newIcon=document.createElement("i");newIcon.setAttribute("class","la la-lg la-remove"),newButton.appendChild(newIcon),inputGroupAppendDiv.appendChild(newButton),inputGroupDiv.appendChild(newInput),inputGroupDiv.appendChild(inputGroupAppendDiv),outerDiv.appendChild(newLabel),outerDiv.appendChild(inputGroupDiv),jQuery("#sound-container").append(outerDiv),this.checkNumberOfSounds()}checkNumberOfSounds(){jQuery('input[name*="sounds[]"]').length<this.maxSounds?jQuery("#add-sound").show():jQuery("#add-sound").hide()}removeRow(id){jQuery("#"+id).remove(),this.checkNumberOfVideos(),this.checkNumberOfSounds()}}class JBDUploadHelper{static getUploadInstance(params){return void 0!==params&&void 0!==params.maxPictures&&(JBDUploadHelper.maxPictures=params.maxPictures),new JBDUpload(params)}static getMaxAllowedNumber(){return JBDUploadHelper.maxPictures}}class JBDQuoteRequest{constructor(categoryId=null){this.response_success=1,this.response_error=0,this.validate_default=1,this.validate_location=2,this.validate_input=3,this.validate_user=4,this.validate_skip=0,this.category_id=categoryId}init(categoryId){this.category_id=categoryId,this.modal=jQuery("#quote-request-modal"),this.modal.jbdModal({clickClose:!1}),this.modal.find(".modal-container").html(""),this.modal.find("#thankyou-step").hide(),this.modal.find("#loading-quote-requests").find(".msg").text(Joomla.JText._("LNG_RETRIEVING_QUESTIONS")),this.modal.find("#loading-quote-requests").show(),this.retrieveQuestions()}retrieveQuestions(){let questionsUrl=jbdUtils.getAjaxUrl("getQuestions","requestquote"),self=this,categoryId=this.category_id;jQuery("#quotes-form").validationEngine("attach"),jQuery.ajax({type:"GET",url:questionsUrl,data:{categoryId:categoryId,cache:!1},dataType:"json",cache:!1,success:function(data){data.status==self.response_error?(alert(data.message),self.closeModal()):data.status==self.response_success&&(self.modal.find("#loading-quote-requests").hide(),self.modal.find(".modal-container").html(data.data),self.initAutocomplete())}})}openStep(step,validate){if(void 0===validate&&(validate=this.validate_default),1==jQuery("#login").val()){let stopStep=!1,message="",email=jQuery("#quote-request-modal #email").val(),password=jQuery("$quote-request-modal #password").val(),result=jbdUtils.getAjaxUrl("checkUserLoginCredentials","businessuser");if(jQuery.ajax({type:"GET",url:result,data:{email:email,password:password},dataType:"json",cache:!1,async:!1,success:function(data){0==data.status?(stopStep=!0,message=data.message):2==data.status&&(stopStep=!0,message=data.message)}}),1==stopStep)return void alert(message)}if(validate!=this.validate_skip&&!this.validateStep(validate))return void alert(Joomla.JText._("LNG_PLEASE_FILL_THE_DETAILS"));let oldStep=jQuery(".step-container.step-active");if(oldStep.hide(),oldStep.removeClass("step-active"),validate==this.validate_location){let loadingDiv=jQuery("#loading-quote-requests");loadingDiv.find(".msg").text(Joomla.JText._("LNG_SEARCHING_LISTINGS")),loadingDiv.show(),this.searchListings(function(){let newStep=jQuery("#step-"+step);newStep.addClass("step-active"),newStep.fadeIn()})}else{let newStep=jQuery("#step-"+step);newStep.addClass("step-active"),newStep.fadeIn()}}validateStep(validate){if(validate==this.validate_default){let isChecked=!1;return jQuery(".step-active .options-container .option-row").each(function(){if(!1!==jQuery(this).find(".question-container").find("input").prop("checked"))return isChecked=!0,!0}),isChecked}if(validate==this.validate_location)return 0!=jQuery(".step-active").find(".zipcode-quote").val().length;if(validate==this.validate_user)return jQuery("#quotes-form").validationEngine("validate");if(validate==this.validate_input){let isFilled=!1;return jQuery(".step-active .options-container .option-row").each(function(){if(""!==jQuery(this).find("input").val().trim())return isFilled=!0,!0}),isFilled}}initAutocomplete(){let element=document.getElementsByClassName("zipcode-quote")[0];jQuery(document).ready(function(){JBDMapHelper.initAutocomplete(element,function(place){jQuery("#quote-latitude").val(place.latitude),jQuery("#quote-longitude").val(place.longitude)},!1,!1)})}submitRequest(){let data=jQuery("#quotes-form").serializeArray(),saveQuote=jbdUtils.getAjaxUrl("saveQuoteRequests","requestquote"),self=this,loadingMessage=this.modal.find("#loading-quote-requests").find(".msg"),loadingDiv=this.modal.find("#loading-quote-requests");this.modal.find(".modal-container").html(""),loadingMessage.text(Joomla.JText._("LNG_SENDING_REQUESTS")),loadingDiv.show(),jQuery.ajax({type:"POST",url:saveQuote,data:{data:data},dataType:"json",cache:!1,success:function(data){data.status==self.response_error?(self.closeModal(),alert(data.message)):data.status==self.response_success&&(1==data.data.contactListings&&self.contactListings(data.data.quoteId,data.data.companyIds),loadingDiv.hide(),self.modal.find("#thankyou-step").fadeIn())}})}searchListings(callback){let searchListing=jbdUtils.getAjaxUrl("searchListingsAjax","requestquote"),self=this,lat=jQuery("#quote-latitude").val(),long=jQuery("#quote-longitude").val(),locationString=jQuery("#quote-zipcode").val();jQuery.ajax({type:"GET",url:searchListing,data:{categoryId:self.category_id,latitude:lat,longitude:long,location:locationString},dataType:"json",cache:!1,success:function(data){if(data.status==self.response_error){self.closeModal();let html='<div class="jbd-container" style="display:none"><div class="jmodal-sm"><div class="jmodal-header"><p class="jmodal-header-title">'+data.data.title+'</p><a href="#close-modal" rel="modal:close" class="close-btn"><i class="la la-close "></i></a>  </div> <div class="jmodal-body"><p>'+data.message+"</p></div> </div></div>";jQuery(html).appendTo("body").jbdModal()}else if(data.status==self.response_success){let loadingDiv=self.modal.find("#loading-quote-requests");jQuery("#quote-latitude").val(data.data.latitude),jQuery("#quote-longitude").val(data.data.longitude),loadingDiv.hide(),callback()}}})}contactListings(quoteId,companyIds){let contactListings=jbdUtils.getAjaxUrl("contactListingsAjax","requestquote");jQuery.ajax({type:"GET",url:contactListings,data:{quoteId:quoteId,companyIds:companyIds},dataType:"json",cache:!1,success:function(data){}})}quoteApply(quoteId,companyId,price=null,message=null){this.contactListings(quoteId,companyId);let applyUrl=jbdUtils.getAjaxUrl("replyToQuoteAjax","managelistingrequestquotes");jQuery.ajax({type:"GET",url:applyUrl,data:{quote_id:quoteId,company_id:companyId,price:price,message:message},dataType:"json",cache:!1,success:function(data){null!=price&&jQuery.jbdModal.close(),jQuery("#apply-"+quoteId).html('<i class="la la-check-circle la-2x jbd-green mr-2"></i>')}})}closeModal(){this.modal.find("#thankyou-step").hide(),this.modal.find("#loading-quote-requests").hide(),jQuery.jbdModal.close()}toggleLogIn(){jQuery("#nameDiv").toggle(),jQuery("#name, #password, #email").val(""),1==jQuery("#login").val()?(jQuery("#loginDiv").html(Joomla.JText._("LNG_ALREADY_HAVE_ACCOUNT")+' <a href="javascript:jbdQuoteRequest.toggleLogIn()">'+Joomla.JText._("LNG_LOG_IN")+"</a>"),jQuery("#description").html(Joomla.JText._("LNG_ENTER_USER_DETAILS")),jQuery("#login").val(0)):(jQuery("#loginDiv").html(Joomla.JText._("LNG_NOT_MEMBER")+' <a href="javascript:jbdQuoteRequest.toggleLogIn()">'+Joomla.JText._("LNG_REGISTER_HERE")+"</a>"),jQuery("#description").html(Joomla.JText._("LNG_YOU_HAVE_TO_BE_LOGGED_IN")),jQuery("#login").val(1))}}let jbdQuoteRequest=new JBDQuoteRequest;class JBDQuoteMessages{constructor(){this.response_success=1,this.response_error=0,this.allowSend=!1,this.messages=[],this.lastMsgId=0,this.firstMsgId=0,this.pollingInterval=JBDConstants.QUOTE_MESSAGES_POLLING_INTERVAL}init(replyId,userId=null,options=null){this.replyId=replyId,this.userId=userId,null!=options&&void 0!==options.allowSend&&(this.allowSend=options.allowSend),this.chatContainer=jQuery("#chat-container-"+this.replyId),this.chatFooter=this.chatContainer.find(".chat-footer"),this.chatInput=this.chatContainer.find(".chat-textbox"),this.chatSendBtn=this.chatContainer.find(".btn-send"),this.chatBody=this.chatContainer.find(".chat-body"),this.chatLoading=this.chatBody.find(".loading-quote-messages");let self=this;this.allowSend?(this.chatInput.on("keydown",function(event){13==event.which&&self.sendMessage()}),this.chatSendBtn.on("click",function(event){self.sendMessage()})):this.chatFooter.attr("style","display:none !important"),this.chatBody.on("scroll",function(){0==jQuery(this).scrollTop()&&self.loadHistory()}),this.chatLoading.show(),this.chatBody.hide(),this.getMessages(),this.chatLoading.hide(),this.chatBody.show(),this.interval=setInterval(function(){self.pollMessages()},self.pollingInterval)}getMessages(){let self=this,getMessages=jbdUtils.getAjaxUrl("getMessagesAjax","requestquotemessages");jQuery.ajax({type:"POST",url:getMessages,data:{replyId:self.replyId},dataType:"json",cache:!1,success:function(data){data.status==self.response_success?(self.messages=data.data,self.chatInput.val(""),self.renderMessages(!0),self.chatLoading.hide(),self.chatBody.show()):alert(data.message)}})}renderMessages(scrollDown,messages){void 0===messages&&(messages=this.messages),void 0===scrollDown&&(scrollDown=!1);for(let i in messages){let msg=messages[i];if(void 0!==msg&&0===jQuery("#msg-"+msg.msgId).length&&messages.hasOwnProperty(i)){let html=this.getMessageHtml(msg);msg.msgId=parseInt(msg.msgId),0!=this.lastMsgId?msg.msgId>this.lastMsgId?this.chatBody.append(html):this.chatBody.find(".chat-top").after(html):this.chatBody.append(html),this.lastMsgId<msg.msgId&&(this.lastMsgId=msg.msgId),0===this.firstMsgId?this.firstMsgId=msg.msgId:this.firstMsgId>msg.msgId&&(this.firstMsgId=msg.msgId)}}scrollDown&&void 0!==this.chatBody[0]&&this.chatBody.scrollTop(this.chatBody[0].scrollHeight)}getMessageHtml(msg){let html="",msgClass="msg-rcvd";null==this.userId&&(this.userId=msg.senderId),msg.senderId==this.userId&&(msgClass="msg-snt");let date=new Date(msg.created);return html+='<div class="msg" id="msg-'+msg.msgId+'">',html+='<div class="'+msgClass+'">',html+='<div class="msg-txt">',html+=msg.text,html+="</div>",html+='<p class="msg-date">'+date.toLocaleString()+"</p>",html+="</div>",html+="</div>"}sendMessage(){let msg={},text=this.chatInput.val();if(0==text.length||jbdUtils.isBlank(text))return!1;let self=this,sendMessage=jbdUtils.getAjaxUrl("sendMessageAjax","requestquotemessages");jQuery.ajax({type:"POST",url:sendMessage,data:{replyId:self.replyId,senderId:self.userId,text:text},dataType:"json",cache:!1,success:function(data){data.status==self.response_success?(msg=data.data,self.messages.unshift(msg),self.chatInput.val(""),self.renderMessages(!0)):alert(data.message)}})}loadHistory(){let messages=[],getMessages=jbdUtils.getAjaxUrl("getMessagesAjax","requestquotemessages"),self=this;self.chatLoading.show(),jQuery.ajax({type:"POST",url:getMessages,data:{replyId:self.replyId,firstId:self.firstMsgId},dataType:"json",cache:!1,success:function(data){data.status==self.response_success?(messages=data.data,self.renderMessages(!1,messages),self.chatLoading.hide()):alert(data.message)}})}pollMessages(){let self=this,getMessages=jbdUtils.getAjaxUrl("getMessagesAjax","requestquotemessages");jQuery.ajax({type:"POST",url:getMessages,data:{replyId:self.replyId,lastId:self.lastMsgId},dataType:"json",cache:!1,success:function(data){data.status==self.response_success?data.data.length>0&&(self.messages=data.data,self.renderMessages(!0)):alert(data.message)}})}openModal(replyId,userId=null,options=null){let modal=jQuery("#quote-request-messages-modal");modal.jbdModal();let self=this,getChat=jbdUtils.getAjaxUrl("getChatHtmlAjax","requestquotemessages");jQuery.ajax({type:"POST",url:getChat,data:{replyId:replyId},dataType:"json",cache:!1,success:function(data){data.status==self.response_success?(modal.find(".jmodal-body").html(data.data),self.init(replyId,userId,options)):alert(data.message),jQuery("#new-messages-"+replyId).hide()}}),modal.on(jQuery.jbdModal.BEFORE_CLOSE,function(){self.clearInstance()})}clearInstance(){this.replyId=null,this.userId=null,this.allowSend=!1,this.messages=[],this.lastMsgId=0,this.firstMsgId=0,this.chatContainer=null,this.chatInput=null,this.chatSendBtn=null,this.chatLoading=null,this.chatBody=null,this.chatFooter=null,clearInterval(this.interval),this.interval=null,jQuery("#quote-request-messages-modal").find(".modal-body").html("")}}let jbdQuoteMessages=new JBDQuoteMessages;class JBDBatch{constructor(){this.controller="",this.incremental=0,this.resume=0,this.batchSize=100,this.offset=0,this.progress=0,this.reload=!1,this.totalItems=0}initialize(controller,task,incremental){this.controller=controller,this.incremental=incremental,this.offset=0,this.progress=0,this.runTask(task)}runTask(task){let baseUrl=jbdUtils.getAjaxUrl(task,this.controller);baseUrl=baseUrl+"&"+jQuery("#jbd-indexer-token").attr("name")+"=1";jQuery.ajax({type:"GET",url:baseUrl,data:{incremental:this.incremental,offset:this.offset},success:this.processResponse,error:this.processFailure,cache:!1})}processResponse(data,resp){try{if(null===data)throw resp;if(data.error)throw data;data.start&&(jbdBatch.totalItems=data.totalItems),jbdBatch.offset=data.batchOffset,jbdBatch.updateProgress(data.header,data.message),jbdBatch.offset<jbdBatch.totalItems?jbdBatch.runTask("processBatch"):jbdBatch.reload||(jbdBatch.reload=!0,setTimeout(function(){},3e3))}catch(error){return jQuery("#progress").remove(),data.error&&(jQuery("#jbd-progress-title").text(data.header).addClass("finder-error"),jQuery("#jbd-progress-message").html(data.message).addClass("finder-error")),!1}return!0}processFailure(xhr){let data="object"==typeof xhr&&xhr.responseText?xhr.responseText:null;data=data?jQuery.parseJSON(data):null,jQuery("#progress").remove(),data&&(data=null!=data.responseText?Json.evaluate(data.responseText,!0):data);var header=data?data.header:Joomla.JText._("LNG_AN_ERROR_HAS_OCCURED"),message=data?data.message:Joomla.JText._("LNG_MESSAGE_RETRIEVED")+" <br />"+data;jQuery("#jbd-progress-title").text(header).addClass("finder-error"),jQuery("#jbd-progress-message").html(message).addClass("finder-error")}updateProgress(header,message){let progress=jbdBatch.offset/jbdBatch.totalItems*100;jQuery("#jbd-progress-title").text(header),jQuery("#jbd-progress-message").html(message+" ( "+jbdBatch.offset+" / "+jbdBatch.totalItems+" )"),progress<100?jQuery("#progress-bar").css("width",progress+"%").attr("aria-valuenow",progress):(jQuery("#progress-bar").removeClass("bar-success").addClass("bar-warning").attr("aria-valuemin",100).attr("aria-valuemax",200),jQuery("#progress-bar").css("width",progress+"%").attr("aria-valuenow",progress)),""==message&&jQuery("#progress").remove()}}let jbdBatch=new JBDBatch;const jbdAI={targetField:null,type:null,field:null,language:null,showTextGenerationPopup:function(type,field,targetField,promptText,language){this.type=type,this.field=field,this.targetField=targetField,this.language=language,jQuery("#text-generation-dialog").remove();const modalHtml=`\n            <div id="text-generation-dialog" class="jbd-container message-modal">\n                <div class="jmodal-md">\n                    <div class="jmodal-header">\n                        <p class="jmodal-header-title">${Joomla.JText._("COM_JBUSINESSDIRECTORY_AI_GENERATE_TEXT")}</p>\n                        <a href="#close-modal" rel="modal:close" class="close-btn"><i class="la la-close "></i></a>\n                    </div>\n                    <div class="jmodal-body">\n                        <div class="form-group">\n                            <label for="ai-prompt">${Joomla.JText._("COM_JBUSINESSDIRECTORY_AI_PROMPT")}</label>\n                            <textarea id="ai-prompt" class="form-control" rows="3">${promptText}</textarea>\n                        </div>\n                        <div class="form-group">\n                            <button type="button" class="btn btn-primary" onclick="jbdAI.generateText();">\n                                <i class="la la-magic"></i> ${Joomla.JText._("COM_JBUSINESSDIRECTORY_AI_GENERATE")}\n                            </button>\n                        </div>\n                        <div id="ai-result" class="form-group">\n                            <label for="ai-preview">${Joomla.JText._("COM_JBUSINESSDIRECTORY_AI_GENERATED_TEXT")}</label>\n                            <div id="ai-preview" style="display:none;" class="border p-3 mb-3"></div>\n                            <textarea id="ai-generated-text" class="form-control" rows="5"></textarea>\n                        </div>\n                        <div class="button-row">\n                            <button type="button" class="btn btn-dark" onclick="jQuery.jbdModal.close();">\n                                ${Joomla.JText._("COM_JBUSINESSDIRECTORY_CANCEL")}\n                            </button>\n                            <button type="button" class="btn btn-success" onclick="jbdAI.useGeneratedText();">\n                                ${Joomla.JText._("COM_JBUSINESSDIRECTORY_USE_TEXT")}\n                            </button>\n                        </div>\n                    </div>\n                </div>\n            </div>\n        `;jQuery("body").append(modalHtml),jQuery("#text-generation-dialog").jbdModal()},generateText:function(){const prompt=jQuery("#ai-prompt").val(),loadingHtml='<div class="text-center"><i class="la la-spinner la-spin la-2x"></i><br>'+Joomla.JText._("COM_JBUSINESSDIRECTORY_AI_GENERATING")+"</div>";jQuery("#ai-preview").show(),jQuery("#ai-preview").html(loadingHtml);let url=jbdUtils.getAjaxUrl("ai","frontai");jQuery.ajax({url:url,type:"POST",cache:!1,data:{prompt:prompt,type:this.type,field:this.field,language:this.language,task:"ai.generateText"},success:function(response){try{jQuery("#ai-preview").hide(),jQuery("#ai-preview").html("");const result="string"==typeof response?JSON.parse(response):response;"success"===result.status?jQuery("#ai-generated-text").val(result.text):jQuery("#ai-preview").html('<div class="alert alert-danger">'+(result.message||Joomla.JText._("COM_JBUSINESSDIRECTORY_AI_ERROR"))+"</div>")}catch(e){jQuery("#ai-preview").html('<div class="alert alert-danger">'+Joomla.JText._("COM_JBUSINESSDIRECTORY_AI_ERROR")+"</div>")}},error:function(){jQuery("#ai-preview").html('<div class="alert alert-danger">'+Joomla.JText._("COM_JBUSINESSDIRECTORY_AI_ERROR")+"</div>")}})},useGeneratedText:function(){const generatedText=jQuery("#ai-generated-text").val(),formattedText=generatedText.replace(/\n/g,"<br>");if(jQuery(this.targetField).length>0&&jQuery(this.targetField).val(generatedText),"undefined"!=typeof tinyMCE){const textField=this.targetField.replace("#","").replace("-","_");tinyMCE.get(textField)&&tinyMCE.get(textField).setContent(formattedText,{format:"html"})}jQuery.jbdModal.close()}};function _typeof(obj){"@babel/helpers - typeof";return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj})(obj)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Constructor}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),superClass&&_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){return(_setPrototypeOf=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o})(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function(){var result,Super=_getPrototypeOf(Derived);if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else result=Super.apply(this,arguments);return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){return!call||"object"!==_typeof(call)&&"function"!=typeof call?_assertThisInitialized(self):call}function _assertThisInitialized(self){if(void 0===self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return self}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(o){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(o){return o.__proto__||Object.getPrototypeOf(o)})(o)}var SearchFilterHorizontalCatItems=function(_React$Component){_inherits(SearchFilterHorizontalCatItems,_React$Component);var _super=_createSuper(SearchFilterHorizontalCatItems);function SearchFilterHorizontalCatItems(props){return _classCallCheck(this,SearchFilterHorizontalCatItems),_super.call(this,props)}return _createClass(SearchFilterHorizontalCatItems,[{key:"render",value:function(){var nameField=this.props.nameField,valueField=this.props.valueField,selectedItems=void 0!==this.props.selectedItems?this.props.selectedItems:null,type=this.props.type,title=this.props.title,items=Object.values(this.props.items);null!=selectedItems&&selectedItems[0];var values=[];selectedItems&&(values=-1!=selectedItems.toString().indexOf(",")?selectedItems.toString().split(",").map(Number):[parseInt(selectedItems)]);var addFilterAction=jbdUtils.addFilterRule,removeFilterAction=jbdUtils.removeFilterRule;return React.createElement("li",{key:Math.random()},React.createElement("div",{className:"main-cat-container"},React.createElement("div",null,React.createElement("div",{className:"filter-main-cat cursor-pointer"},title)),React.createElement("i",{className:"icon"})),React.createElement("ul",{className:"submenu",key:"horizontal-"+type},items.map(function(item){if(null!=item[valueField]){var action=addFilterAction,itemValue=parseInt(item[valueField]);return values.includes(itemValue)&&(action=removeFilterAction),React.createElement("li",{key:Math.random(),className:""},React.createElement("div",null,React.createElement("input",{className:"cursor-pointer",name:"cat",type:"checkbox",checked:values.includes(itemValue),onChange:function(){return action(type,item[valueField],!0)}}),"  ",React.createElement("a",{className:"cursor-pointer",onClick:function(){return action(type,item[valueField],!0)}},item[nameField])))}})))}}]),SearchFilterHorizontalCatItems}(React.Component);function _typeof(obj){"@babel/helpers - typeof";return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj})(obj)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Constructor}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),superClass&&_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){return(_setPrototypeOf=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o})(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function(){var result,Super=_getPrototypeOf(Derived);if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else result=Super.apply(this,arguments);return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){return!call||"object"!==_typeof(call)&&"function"!=typeof call?_assertThisInitialized(self):call}function _assertThisInitialized(self){if(void 0===self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return self}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(o){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(o){return o.__proto__||Object.getPrototypeOf(o)})(o)}var SearchFilterHorizontalCat=function(_React$Component){_inherits(SearchFilterHorizontalCat,_React$Component);var _super=_createSuper(SearchFilterHorizontalCat);function SearchFilterHorizontalCat(props){return _classCallCheck(this,SearchFilterHorizontalCat),_super.call(this,props)}return _createClass(SearchFilterHorizontalCat,[{key:"componentDidMount",value:function(){jQuery(".chosen-react").on("change",function(e){var type=jQuery(this).attr("name"),val=jQuery(this).chosen().val();switch(type){case"categories":jbdUtils.chooseCategory(val);break;default:jbdUtils.addFilterRule(type,val)}}),jQuery(".filter-categories i.icon").click(function(e){$hasOpenClass=jQuery(this).parent().parent().hasClass("open"),jQuery(".filter-categories li").removeClass("open"),$hasOpenClass||jQuery(this).parent().parent().toggleClass("open"),e.stopPropagation()}),jQuery(".filter-main-cat").click(function(e){$hasOpenClass=jQuery(this).parent().parent().parent().hasClass("open"),jQuery(".filter-categories li").removeClass("open"),$hasOpenClass||jQuery(this).parent().parent().parent().toggleClass("open"),e.stopPropagation()}),jQuery("body").click(function(e){jQuery(".filter-categories li").removeClass("open")})}},{key:"getCategoryFilters",value:function(categories){for(var _this=this,counterCategories=0,categoryFilters=[],_loop=function(i){var filterCriteria=categories[i];if(filterCriteria[0].subCategories=Object.values(filterCriteria[0].subCategories),counterCategories<100){var action=jbdUtils.addFilterRuleCategory,checkedMain=!1;_this.props.selectedCategories.some(function(cat){return cat==filterCriteria[0][0].id})&&("selectedlink","selected",action=jbdUtils.removeFilterRuleCategory,React.createElement("span",{className:"cross"}),checkedMain=!0);var subCategoriesFilters=[];if(null!=filterCriteria[0].subCategories)for(var _loop2=function(j){var subCategory=filterCriteria[0].subCategories[j],liClassSub="",actionSub=jbdUtils.addFilterRuleCategory,removeTextSub="",checked=!1;_this.props.selectedCategories.some(function(cat){return cat==subCategory[0].id})&&(liClassSub="selectedlink","selected",actionSub=jbdUtils.removeFilterRuleCategory,removeTextSub=React.createElement("span",{className:"cross"}),checked=!0),subCategoriesFilters.push(React.createElement("li",{key:Math.random()+"-"+i,className:liClassSub},React.createElement("div",null,React.createElement("input",{className:"cursor-pointer",name:"cat",type:"checkbox",checked:checked,onChange:function(){return actionSub(subCategory[0].id)}}),"  ",React.createElement("a",{className:"cursor-pointer",onClick:function(){return actionSub(subCategory[0].id)}},subCategory[0].name," ",removeTextSub))))},j=0;j<filterCriteria[0].subCategories.length;j++)_loop2(j);categoryFilters.push(React.createElement("li",{key:Math.random()+"-"+i,className:"multi-column"},React.createElement("div",{className:"main-cat-container"},React.createElement("div",null,React.createElement("div",{className:"filter-main-cat cursor-pointer"},filterCriteria[0][0].name)),React.createElement("i",{className:"icon"})),React.createElement("ul",{className:"submenu"},React.createElement("li",{key:Math.random()+"-"+i},React.createElement("div",null,React.createElement("input",{className:"cursor-pointer",name:"cat",type:"checkbox",checked:checkedMain,onChange:function(){return action(filterCriteria[0][0].id)}}),"  ",React.createElement("a",{className:"cursor-pointer",onClick:function(){return action(filterCriteria[0][0].id)}},filterCriteria[0][0].name))),subCategoriesFilters))),counterCategories++}},i=0;i<categories.length;i++)_loop(i);return categoryFilters}},{key:"render",value:function(){var _this2=this;return null!=this.props.searchFilter.categories&&this.props.searchFilter.categories.length>0&&this.getCategoryFilters(this.props.searchFilter.categories),React.createElement("div",{id:"category-filter-horizontal",className:"category-filter-horizontal"},React.createElement("ul",{key:100*Math.random(),className:"filter-categories"},null!=this.props.searchFilter.categories&&this.props.searchFilter.categories.length>0?this.getCategoryFilters(this.props.searchFilter.categories):null,null!=this.props.searchFilter.memberships&&this.props.searchFilter.memberships.length>0?React.createElement(SearchFilterHorizontalCatItems,{items:this.props.searchFilter.memberships,selectedItems:this.props.selectedParams.membership,title:Joomla.JText._("LNG_SELECT_MEMBERSHIP"),type:"membership",valueField:"membership_id",nameField:"membership_name"}):null,null!=this.props.searchFilter&&null!=this.props.searchFilter.attributes&&this.props.searchFilter.attributes.length>0?this.props.searchFilter.attributes.map(function(items){var item=Object.values(items)[0],nameField="value";null!=item.optionName&&(nameField="optionName");var type="attribute_"+item.id;return React.createElement(SearchFilterHorizontalCatItems,{items:items,selectedItems:_this2.props.selectedParams[type],title:item.name,type:type,valueField:"value",nameField:nameField})}):null),null)}}]),SearchFilterHorizontalCat}(React.Component);function _typeof(obj){"@babel/helpers - typeof";return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj})(obj)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Constructor}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),superClass&&_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){return(_setPrototypeOf=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o})(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function(){var result,Super=_getPrototypeOf(Derived);if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else result=Super.apply(this,arguments);return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){return!call||"object"!==_typeof(call)&&"function"!=typeof call?_assertThisInitialized(self):call}function _assertThisInitialized(self){if(void 0===self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return self}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(o){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(o){return o.__proto__||Object.getPrototypeOf(o)})(o)}var SearchFilterHorizontalItems=function(_React$Component){_inherits(SearchFilterHorizontalItems,_React$Component);var _super=_createSuper(SearchFilterHorizontalItems);function SearchFilterHorizontalItems(props){return _classCallCheck(this,SearchFilterHorizontalItems),_super.call(this,props)}return _createClass(SearchFilterHorizontalItems,[{key:"render",value:function(){var _this=this,nameField=this.props.nameField,valueField=this.props.valueField,selectedItems=void 0!==this.props.selectedItems?this.props.selectedItems:null,type=this.props.type,title=this.props.title,items=Object.values(this.props.items),selectedItem=null;return null!=selectedItems&&(selectedItem=selectedItems[0]),React.createElement("div",{className:"search-options-item"},React.createElement("div",{className:"jbd-select-box"},React.createElement("i",{className:"la la-list"}),React.createElement("select",{name:type,className:"chosen-react",value:selectedItem,key:"horizontal-"+type,onChange:function(){return jbdUtils.addFilterRule(type,_this.value)}},React.createElement("option",{value:""},title),items.map(function(item){return React.createElement("option",{className:type+"-"+item[valueField],value:item[valueField]},item[nameField])}))))}}]),SearchFilterHorizontalItems}(React.Component);function _typeof(obj){"@babel/helpers - typeof";return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj})(obj)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Constructor}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),superClass&&_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){return(_setPrototypeOf=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o})(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function(){var result,Super=_getPrototypeOf(Derived);if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else result=Super.apply(this,arguments);return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){return!call||"object"!==_typeof(call)&&"function"!=typeof call?_assertThisInitialized(self):call}function _assertThisInitialized(self){if(void 0===self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return self}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(o){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(o){return o.__proto__||Object.getPrototypeOf(o)})(o)}SearchFilterHorizontalItems=function(_React$Component){_inherits(SearchFilterHorizontalItems,_React$Component);var _super=_createSuper(SearchFilterHorizontalItems);function SearchFilterHorizontalItems(props){var _this;return _classCallCheck(this,SearchFilterHorizontalItems),(_this=_super.call(this,props)).changeHandler=_this.changeHandler.bind(_assertThisInitialized(_this)),_this}return _createClass(SearchFilterHorizontalItems,[{key:"changeHandler",value:function(e){jbdUtils.addFilterRule(this.props.type,e.target.value,e.target.options[e.target.selectedIndex].text)}},{key:"render",value:function(){var _this2=this,nameField=this.props.nameField,valueField=this.props.valueField,type=(void 0!==this.props.selectedItems&&this.props.selectedItems,this.props.type),title=this.props.title,itemDisabled=!1;jQuery.isEmptyObject(this.props.items)&&(itemDisabled=!0);var items=Object.values(this.props.items);return React.createElement("div",{className:"search-options-item"},React.createElement("div",{className:"jbd-select-box"},React.createElement("i",{className:"la la-list"}),React.createElement("select",{name:type,className:"chosen-react",value:null,key:"horizontal-"+type,disabled:itemDisabled,onChange:function(e){return _this2.changeHandler(e)}},React.createElement("option",{value:""},title),items.map(function(item){return React.createElement("option",{className:type+"-"+item[valueField],value:item[valueField]},item[nameField])}))))}}]),SearchFilterHorizontalItems}(React.Component);function _typeof(obj){"@babel/helpers - typeof";return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj})(obj)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Constructor}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),superClass&&_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){return(_setPrototypeOf=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o})(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function(){var result,Super=_getPrototypeOf(Derived);if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else result=Super.apply(this,arguments);return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){return!call||"object"!==_typeof(call)&&"function"!=typeof call?_assertThisInitialized(self):call}function _assertThisInitialized(self){if(void 0===self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return self}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(o){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(o){return o.__proto__||Object.getPrototypeOf(o)})(o)}var SearchFilterHorizontal=function(_React$Component){_inherits(SearchFilterHorizontal,_React$Component);var _super=_createSuper(SearchFilterHorizontal);function SearchFilterHorizontal(props){return _classCallCheck(this,SearchFilterHorizontal),_super.call(this,props)}return _createClass(SearchFilterHorizontal,[{key:"componentDidMount",value:function(){jQuery(".chosen-react").on("change",function(e){var type=jQuery(this).attr("name"),val=jQuery(this).chosen().val();if(val)switch(type){case"categories":jbdUtils.addFilterRuleCategory(val);break;case"distance":jbdListings.setRadius(val);break;default:jbdUtils.addFilterRule(type,val)}}),jQuery(".chosen-react").chosen({width:"165px",disable_search_threshold:5,inherit_select_classes:!0,placeholder_text_single:Joomla.JText._("LNG_SELECT_OPTION"),placeholder_text_multiple:Joomla.JText._("LNG_SELECT_OPTION")})}},{key:"render",value:function(){var _this=this,showClearFilter=!1;void 0!==this.props.selectedParams.city&&this.props.selectedParams.city.length,this.props.onlyLocal;(null!=this.props.searchKeyword||null!=this.props.zipCode||null!=this.props.searchFilter.categories&&this.props.searchFilter.categories.length>0||null!=this.props.searchFilter.starRating&&this.props.searchFilter.starRating.length>0||null!=this.props.searchFilter.types&&this.props.searchFilter.types.length>0||null!=this.props.searchFilter.countries&&this.props.searchFilter.countries.length>0||null!=this.props.searchFilter.provinces&&this.props.searchFilter.provinces.length>0||null!=this.props.searchFilter.regions&&this.props.searchFilter.regions.length>0||null!=this.props.searchFilter.cities&&this.props.searchFilter.cities.length>0||null!=this.props.searchFilter.areas&&this.props.searchFilter.areas.length>0||null!=this.props.searchFilter.companies&&this.props.searchFilter.companies.length>0||null!=this.props.customAttributesValues&&this.props.customAttributesValues.length>0||null!=this.props.location&&null!=this.props.location.latitude)&&(showClearFilter=!1);var selectedCategory=null,selectedCategoryName=null;null!=this.props.category&&(selectedCategory=this.props.category.id,selectedCategoryName=this.props.category.name),selectedCategory=null;return React.createElement("div",null,React.createElement("div",{id:"filter-switch-horizontal",className:"filter-switch",onClick:function(){return jbdUtils.toggleHorizontalFilter()}},Joomla.JText._("LNG_SHOW_FILTER")),React.createElement("div",{id:"search-filter-horizontal",className:"search-filter-horizontal"},React.createElement("div",{class:"search-filter-label"},React.createElement("i",{class:"icon filters"})," ",Joomla.JText._("LNG_FILTERS")),React.createElement("div",{class:"search-filter-fields"},void 0==this.props.searchFilter.categories||0!=this.props.categorySearch&&null!=this.props.categorySearch?null:React.createElement("div",{className:"search-options-item"},React.createElement("div",{className:"jbd-select-box"},React.createElement("i",{className:"la la-list"}),React.createElement("select",{name:"categories",className:"chosen-react",value:selectedCategory,onChange:function(e){return jbdUtils.chooseCategory(e.target.value)}},null!=selectedCategory?React.createElement(React.Fragment,null,React.createElement("option",{value:""},Joomla.JText._("LNG_CATEGORY")),React.createElement("option",{value:selectedCategory},selectedCategoryName)):React.createElement("option",{value:""},Joomla.JText._("LNG_CATEGORY")),this.props.searchFilter.categories.map(function(filterCriteria){return filterCriteria[1]>0&&filterCriteria[0][0].id!=selectedCategory?React.createElement("option",{value:filterCriteria[0][0].id},filterCriteria[0][0].name):null})))),void 0!==this.props.searchFilter.starRating?React.createElement(SearchFilterHorizontalItems,{items:this.props.searchFilter.starRating,selectedItems:this.props.selectedParams.starRating,title:Joomla.JText._("LNG_SELECT_RATING"),type:"starRating",valueField:"reviewScore",nameField:"reviewScore"}):null,void 0!==this.props.searchFilter.types?React.createElement(SearchFilterHorizontalItems,{fetchData:this.props.fetchData,items:this.props.searchFilter.types,selectedItems:this.props.selectedParams.type,title:Joomla.JText._("LNG_SELECT_TYPE"),type:"type",valueField:"typeId",nameField:"typeName"}):null,void 0!==this.props.searchFilter.packages?React.createElement(SearchFilterHorizontalItems,{fetchData:this.props.fetchData,items:this.props.searchFilter.packages,selectedItems:this.props.selectedParams.package,title:Joomla.JText._("LNG_PACKAGE"),type:"package",valueField:"package_id",nameField:"package_name"}):null,void 0!==this.props.searchFilter.countries&&null==this.props.zipCode?React.createElement(SearchFilterHorizontalItems,{items:this.props.searchFilter.countries,selectedItems:this.props.selectedParams.country,title:Joomla.JText._("LNG_SELECT_COUNTRY"),type:"country",valueField:"countryId",nameField:"countryName"}):null,void 0!==this.props.searchFilter.provinces&&null==this.props.zipCode?React.createElement(SearchFilterHorizontalItems,{items:this.props.searchFilter.provinces,selectedItems:this.props.selectedParams.province,title:Joomla.JText._("LNG_PROVINCE"),type:"province",valueField:"provinceName",nameField:"provinceName"}):null,void 0!==this.props.searchFilter.regions&&null==this.props.zipCode?React.createElement(SearchFilterHorizontalItems,{items:this.props.searchFilter.regions,selectedItems:this.props.selectedParams.region,title:Joomla.JText._("LNG_SELECT_REGION"),type:"region",valueField:"region",nameField:"regionName"}):null,void 0!==this.props.searchFilter.cities&&null==this.props.zipCode?React.createElement(SearchFilterHorizontalItems,{items:this.props.searchFilter.cities,selectedItems:this.props.selectedParams.city,title:Joomla.JText._("LNG_SELECT_CITY"),type:"city",valueField:"city",nameField:"cityName"}):null,void 0!==this.props.searchFilter.areas?React.createElement(SearchFilterHorizontalItems,{items:this.props.searchFilter.areas,selectedItems:this.props.selectedParams.area,title:Joomla.JText._("LNG_SELECT_AREA"),type:"area",valueField:"areaName",nameField:"areaName"}):null,void 0!==this.props.searchFilter.memberships?React.createElement(SearchFilterHorizontalItems,{items:this.props.searchFilter.memberships,selectedItems:this.props.selectedParams.membership,title:Joomla.JText._("LNG_SELECT_MEMBERSHIP"),type:"membership",valueField:"membership_id",nameField:"membership_name"}):null,void 0!=this.props.searchFilter.attributes?this.props.searchFilter.attributes.map(function(items){var item=Object.values(items)[0],nameField="value";null!=item.optionName&&(nameField="optionName");var type="attribute_"+item.id;return React.createElement(SearchFilterHorizontalItems,{items:items,selectedItems:_this.props.selectedParams[type],title:item.name,type:type,valueField:"value",nameField:nameField})}):null,void 0!==this.props.searchFilter.companies?React.createElement(SearchFilterHorizontalItems,{items:this.props.searchFilter.companies,selectedItems:this.props.selectedParams.company,title:Joomla.JText._("LNG_SELECT_COMPANY"),type:"company",valueField:"companyId",nameField:"companyName"}):null,null!=this.props.searchFilter.showDates&&this.props.itemType==JBDConstants.ITEM_TYPE_REQUEST_QUOTE?React.createElement("div",{className:"search-options-item"},React.createElement("div",{className:"jbd-date-box"},React.createElement("input",{type:"date",value:this.props.startDate,onChange:function(e){return jbdUtils.setFilterDates("startDate",e.target.value)}}))):null,null!=this.props.searchFilter.showDates&&this.props.itemType==JBDConstants.ITEM_TYPE_REQUEST_QUOTE?React.createElement("div",{className:"search-options-item"},React.createElement("div",{className:"jbd-date-box"},React.createElement("input",{type:"date",value:this.props.endDate,onChange:function(e){return jbdUtils.setFilterDates("endDate",e.target.value)}}))):null,void 0!=this.props.location&&void 0!=this.props.location.latitude?React.createElement("div",{className:"search-options-item radius"},React.createElement("div",{className:"jbd-select-box"},React.createElement("i",{className:"la la-list"}),React.createElement("select",{name:"distance",className:"chosen-react",onChange:function(e){return jbdListings.setRadius(e.target.value)}},React.createElement("option",{value:"0"},Joomla.JText._("LNG_RADIUS")),React.createElement("option",{value:"10"},"10"),React.createElement("option",{value:"25"},"25"),React.createElement("option",{value:"50"},"50")))):null,showClearFilter?React.createElement("div",{className:"search-options-item"},React.createElement("a",{className:"clear-search cursor-pointer",onClick:function(){return jbdUtils.resetFilters(!0,!0)},style:{textDecoration:"none"}},Joomla.JText._("LNG_CLEAR"))):null,null,null)))}}]),SearchFilterHorizontal}(React.Component);function _typeof(obj){"@babel/helpers - typeof";return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj})(obj)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Constructor}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),superClass&&_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){return(_setPrototypeOf=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o})(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function(){var result,Super=_getPrototypeOf(Derived);if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else result=Super.apply(this,arguments);return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){return!call||"object"!==_typeof(call)&&"function"!=typeof call?_assertThisInitialized(self):call}function _assertThisInitialized(self){if(void 0===self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return self}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(o){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(o){return o.__proto__||Object.getPrototypeOf(o)})(o)}var SearchFilterParams=function(_React$Component){_inherits(SearchFilterParams,_React$Component);var _super=_createSuper(SearchFilterParams);function SearchFilterParams(props){return _classCallCheck(this,SearchFilterParams),_super.call(this,props)}return _createClass(SearchFilterParams,[{key:"componentDidMount",value:function(){}},{key:"render",value:function(){var _this=this,showClearFilter=!1;this.props.selectedParams.city,this.props.onlyLocal;null!=this.props.category&&(this.props.category.id,this.props.category.name);return(null!=this.props.searchKeyword&&this.props.searchKeyword.length>0||null!=this.props.selectedParams.category&&this.props.selectedParams.category.length>0&&(0==this.props.categorySearch||null==this.props.categorySearch)||null!=this.props.selectedParams.starRating&&this.props.selectedParams.starRating.length>0||null!=this.props.selectedParams.type&&this.props.selectedParams.type.length>0||null!=this.props.zipCode&&this.props.zipCode.length>0||!jQuery.isEmptyObject(this.props.location)||null!=this.props.selectedParams.package&&this.props.selectedParams.package.length>0||null!=this.props.selectedParams.country&&this.props.selectedParams.country.length>0&&null==this.props.zipCode||null!=this.props.selectedParams.province&&this.props.selectedParams.province.length>0&&null==this.props.zipCode||null!=this.props.selectedParams.region&&this.props.selectedParams.region.length>0&&null==this.props.zipCode||null!=this.props.selectedParams.city&&this.props.selectedParams.city.length>0&&null==this.props.zipCode||null!=this.props.selectedParams.area&&this.props.selectedParams.area.length>0&&null==this.props.zipCode||null!=this.props.selectedParams.membership&&this.props.selectedParams.membership.length>0||null!=this.props.selectedParams.startDate&&this.props.selectedParams.startDate.length>0||null!=this.props.selectedParams.endDate&&this.props.selectedParams.endDate.length>0||null!=this.props.selectedParams.startTime&&this.props.selectedParams.startTime.length>0||null!=this.props.selectedParams.endTime&&this.props.selectedParams.endTime.length>0||null!=this.props.selectedParams.minPrice&&this.props.selectedParams.minPrice.length>0||null!=this.props.selectedParams.maxPrice&&this.props.selectedParams.maxPrice.length>0||null!=this.props.selectedParams.age&&this.props.selectedParams.age.length>0||null!=this.props.selectedParams["custom-attributes"]&&this.props.selectedParams["custom-attributes"].length>0||null!=this.props.customAttributesValues&&this.props.customAttributesValues.length>0)&&(showClearFilter=!0),React.createElement("div",{id:"search-filter-source"},1==showClearFilter?React.createElement("div",{id:"search-path",className:"search-filter-params"},1==showClearFilter&&2==this.props.filterType?React.createElement("div",{class:"search-filter-header"},React.createElement("span",{class:"search-filter-title"},Joomla.JText._("LNG_APPLIED_FILTERS")),React.createElement("span",{className:"filter-type-elem reset"},React.createElement("a",{href:"javascript:jbdUtils.resetFilters(true, true)"},Joomla.JText._("LNG_CLEAR_ALL_FILTERS")," ",React.createElement("i",{className:"la la-close"})))):null,React.createElement("ul",{id:"selected-criteria",className:"selected-criteria"},null!=this.props.searchKeyword?React.createElement("li",null,React.createElement("a",{class:"filter-type-elem",onClick:function(){return jbdUtils.removeSearchRule("keyword")}},this.props.searchKeyword," ",React.createElement("i",{class:"la la-times"}))):null,null==this.props.category||0!=this.props.categorySearch&&null!=this.props.categorySearch?null:React.createElement("li",null,React.createElement("a",{class:"filter-type-elem",onClick:function(){return jbdUtils.removeFilterRuleCategory(_this.props.category.id)}},this.props.category.name," ",React.createElement("i",{class:"la la-times"}))),!jQuery.isEmptyObject(this.props.searchFilter.types)&&void 0!==this.props.selectedParams.type&&this.props.selectedParams.type.length>0?React.createElement("li",null,React.createElement("a",{class:"filter-type-elem",onClick:function(){return jbdUtils.removeFilterRule("type",_this.props.selectedParams.type[0])}},this.props.searchFilter.types[this.props.selectedParams.type[0]].typeName," ",React.createElement("i",{class:"la la-times"}))):null,!jQuery.isEmptyObject(this.props.searchFilter.packages)&&void 0!==this.props.selectedParams.package&&this.props.selectedParams.package.length>0?React.createElement("li",null,React.createElement("a",{class:"filter-type-elem",onClick:function(){return jbdUtils.removeFilterRule("package",_this.props.selectedParams.package[0])}},this.props.searchFilter.packages[this.props.selectedParams.package[0]].package_name," ",React.createElement("i",{class:"la la-times"}))):null,!jQuery.isEmptyObject(this.props.searchFilter.starRating)&&void 0!==this.props.selectedParams.starRating&&this.props.selectedParams.starRating.length>0?React.createElement("li",null,React.createElement("a",{class:"filter-type-elem",onClick:function(){return jbdUtils.removeFilterRule("starRating",_this.props.selectedParams.starRating[0])}},this.props.searchFilter.starRating[this.props.selectedParams.starRating[0]].reviewScore,React.createElement("i",{class:"la la-star"})," ",React.createElement("i",{class:"la la-times"}))):null,null!=this.props.searchFilter.countries&&this.props.searchFilter.countries.length>0&&void 0!==this.props.selectedParams.country&&this.props.selectedParams.country.length>0&&null==this.props.zipCode?React.createElement("li",null,React.createElement("a",{class:"filter-type-elem",onClick:function(){return jbdUtils.removeFilterRule("country",_this.props.selectedParams.country[0])}},this.props.searchFilter.countries[this.props.selectedParams.country[0]].countryName," ",React.createElement("i",{class:"la la-times"}))):null,!jQuery.isEmptyObject(this.props.searchFilter.provinces)&&void 0!==this.props.selectedParams.province&&this.props.selectedParams.province.length>0&&null==this.props.zipCode?React.createElement("li",null,React.createElement("a",{class:"filter-type-elem",onClick:function(){return jbdUtils.removeFilterRule("province",_this.props.selectedParams.province[0])}},this.props.searchFilter.provinces[this.props.selectedParams.province[0]].provinceName," ",React.createElement("i",{class:"la la-times"}))):null,!jQuery.isEmptyObject(this.props.searchFilter.regions)&&void 0!==this.props.selectedParams.region&&this.props.selectedParams.region.length>0&&null==this.props.zipCode?React.createElement("li",null,React.createElement("a",{class:"filter-type-elem region",onClick:function(){return jbdUtils.removeFilterRule("region",_this.props.selectedParams.region[0])}},this.props.searchFilter.regions[this.props.selectedParams.region[0]].regionName," ",React.createElement("i",{class:"la la-times"}))):null,!jQuery.isEmptyObject(this.props.searchFilter.cities)&&void 0!==this.props.selectedParams.city&&this.props.selectedParams.city.length>0&&null==this.props.zipCode?React.createElement("li",null,React.createElement("a",{class:"filter-type-elem city",onClick:function(){return jbdUtils.removeFilterRule("city",_this.props.selectedParams.city[0])}},this.props.searchFilter.cities[this.props.selectedParams.city[0]].cityName," ",React.createElement("i",{class:"la la-times"}))):null,!jQuery.isEmptyObject(this.props.searchFilter.areas)&&void 0!==this.props.selectedParams.area&&this.props.selectedParams.area.length>0?React.createElement("li",null,React.createElement("a",{class:"filter-type-elem",onClick:function(){return jbdUtils.removeFilterRule("area",_this.props.selectedParams.area[0])}},this.props.searchFilter.areas[this.props.selectedParams.area[0]].areaName," ",React.createElement("i",{class:"la la-times"}))):null,!jQuery.isEmptyObject(this.props.searchFilter.memberships)&&void 0!==this.props.selectedParams.membership&&this.props.selectedParams.membership.length>0?React.createElement("li",null,React.createElement("a",{class:"filter-type-elem",onClick:function(){return jbdUtils.removeFilterRule("membership",_this.props.selectedParams.membership[0])}},this.props.searchFilter.memberships[this.props.selectedParams.membership[0]].membership_name," ",React.createElement("i",{class:"la la-times"}))):null,!jQuery.isEmptyObject(this.props.searchFilter.attributes)&&null!=this.props.customAttributesValues&&this.props.customAttributesValues.length>0?React.createElement("ul",{class:"selected-criteria"},this.props.customAttributesValues.map(function(attribute,index){return null!=attribute?React.createElement("li",null,React.createElement("a",{className:"filter-type-elem",onClick:function(){return jbdUtils.removeAttrCond(attribute.attribute_id,attribute.id)}},attribute.name," ",React.createElement("i",{class:"la la-times"}))):null})):null,!jQuery.isEmptyObject(this.props.selectedParams["custom-attributes"])&&null!=this.props.selectedParams["custom-attributes"]&&this.props.selectedParams["custom-attributes"].length>0?React.createElement("ul",{class:"selected-criteria"},this.props.selectedParams["custom-attributes"].map(function(attribute,index){if(null==attribute)return null;Object.keys(attribute).map(function(key,index){return React.createElement("li",null,React.createElement("a",{className:"filter-type-elem",onClick:function(){return jbdUtils.removeAttrCond(key,key)}},attribute[key]," ",React.createElement("i",{class:"la la-times"})))})})):null,null!=this.props.zipCode&&this.props.zipCode.length>0?React.createElement("li",null,React.createElement("a",{class:"filter-type-elem 12",onClick:function(){return jbdUtils.removeSearchRule("zipcode")}},this.props.zipCode," ",React.createElement("i",{class:"la la-times"}))):null,!jQuery.isEmptyObject(this.props.location)&&jQuery.isEmptyObject(this.props.zipCode)?React.createElement("li",null,React.createElement("a",{class:"filter-type-elem",onClick:function(){return jbdUtils.removeSearchRule("location")}},Joomla.JText._("LNG_GEO_LOCATION")," ",React.createElement("i",{class:"la la-times"}))):null,void 0!==this.props.selectedParams.age&&this.props.selectedParams.age.length>0?React.createElement("li",null,React.createElement("a",{class:"filter-type-elem",onClick:function(){return jbdUtils.removeSearchRule("age")}},Joomla.JText._("LNG_AGE")," ",this.props.selectedParams.age," ",React.createElement("i",{class:"la la-times"}))):null,void 0!==this.props.selectedParams.startTime&&this.props.selectedParams.startTime.length>0?React.createElement("li",null,React.createElement("a",{class:"filter-type-elem",onClick:function(){return jbdUtils.removeSearchRule("start-time")}},Joomla.JText._("LNG_START_TIME")," ",this.props.selectedParams.startTime," ",React.createElement("i",{class:"la la-times"}))):null,void 0!==this.props.selectedParams.endTime&&this.props.selectedParams.endTime.length>0?React.createElement("li",null,React.createElement("a",{class:"filter-type-elem",onClick:function(){return jbdUtils.removeSearchRule("end-time")}},Joomla.JText._("LNG_END_TIME")," ",this.props.selectedParams.endTime," ",React.createElement("i",{class:"la la-times"}))):null,void 0!==this.props.selectedParams.startDate&&this.props.selectedParams.startDate.length>0?React.createElement("li",null,React.createElement("a",{class:"filter-type-elem",onClick:function(){return jbdUtils.removeSearchRule("startDate")}},Joomla.JText._("LNG_START")," ",this.props.selectedParams.startDate," ",React.createElement("i",{class:"la la-times"}))):null,void 0!==this.props.selectedParams.endDate&&this.props.selectedParams.endDate.length>0?React.createElement("li",null,React.createElement("a",{class:"filter-type-elem",onClick:function(){return jbdUtils.removeSearchRule("endDate")}},Joomla.JText._("LNG_END")," ",this.props.selectedParams.endDate," ",React.createElement("i",{class:"la la-times"}))):null,void 0!==this.props.selectedParams.minPrice&&this.props.selectedParams.minPrice.length>0?React.createElement("li",null,React.createElement("a",{class:"filter-type-elem",onClick:function(){return jbdUtils.removeSearchRule("minprice")}},Joomla.JText._("LNG_MIN_PRICE")," ",this.props.selectedParams.minPrice," ",React.createElement("i",{class:"la la-times"}))):null,void 0!==this.props.selectedParams.maxPrice&&this.props.selectedParams.maxPrice.length>0?React.createElement("li",null,React.createElement("a",{class:"filter-type-elem",onClick:function(){return jbdUtils.removeSearchRule("maxprice")}},Joomla.JText._("LNG_MAX_PRICE")," ",this.props.selectedParams.maxPrice," ",React.createElement("i",{class:"la la-times"}))):null,1==showClearFilter&&2!=this.props.filterType?React.createElement("span",{className:"filter-type-elem reset"},React.createElement("a",{href:"javascript:jbdUtils.resetFilters(true, true)"},Joomla.JText._("LNG_CLEAR_ALL_FILTERS"))):null)):null)}}]),SearchFilterParams}(React.Component);function _typeof(obj){"@babel/helpers - typeof";return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj})(obj)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Constructor}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),superClass&&_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){return(_setPrototypeOf=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o})(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function(){var result,Super=_getPrototypeOf(Derived);if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else result=Super.apply(this,arguments);return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){return!call||"object"!==_typeof(call)&&"function"!=typeof call?_assertThisInitialized(self):call}function _assertThisInitialized(self){if(void 0===self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return self}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(o){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(o){return o.__proto__||Object.getPrototypeOf(o)})(o)}var SearchFilterVerticalCategories=function(_React$Component){_inherits(SearchFilterVerticalCategories,_React$Component);var _super=_createSuper(SearchFilterVerticalCategories);function SearchFilterVerticalCategories(props){return _classCallCheck(this,SearchFilterVerticalCategories),_super.call(this,props)}return _createClass(SearchFilterVerticalCategories,[{key:"getRegularFilters",value:function(categories){for(var _this=this,counterCategories=0,categoryFilters=[],moreCategoryFilters=[],_loop=function(i){var filterCriteria=categories[i];if(!(counterCategories<_this.props.searchFilterItems))return categoryFilters.push(React.createElement("a",{id:"showMoreCategories",className:"filterExpand cursor-pointer",onClick:function(){return jbdUtils.showMoreParams("extra_categories_params","showMoreCategories")}},Joomla.JText._("LNG_MORE")," (+)")),"break";filterCriteria[1]>0&&categoryFilters.push(React.createElement("li",{key:Math.random()+"-"+i},null!=_this.props.category&&filterCriteria[0][0].id==_this.props.category.id?React.createElement("strong",null,filterCriteria[0][0].name):React.createElement("a",{className:"cursor-pointer",onClick:function(){return jbdUtils.chooseCategory(filterCriteria[0][0].id)}},filterCriteria[0][0].name))),counterCategories++},i=0;i<categories.length;i++){if("break"===_loop(i))break}for(var _loop2=function(_i){var filterCriteria=categories[_i];--counterCategories<0&&filterCriteria[1]>0&&moreCategoryFilters.push(React.createElement("li",{key:Math.random()+"-"+_i},null!=_this.props.category&&filterCriteria[0][0]==_this.props.category.id?React.createElement("strong",null,filterCriteria[0][0].name):React.createElement("a",{className:"cursor-pointer",onClick:function(){return jbdUtils.chooseCategory(filterCriteria[0][0].id)}},filterCriteria[0][0].name)))},_i=0;_i<categories.length;_i++)_loop2(_i);return React.createElement("ul",null,categoryFilters,React.createElement("div",{style:{display:"none"},id:"extra_categories_params"},moreCategoryFilters,React.createElement("a",{id:"showLessCategories",className:"filterExpand cursor-pointer",onClick:function(){return jbdUtils.showLessParams("extra_categories_params","showMoreCategories")}},Joomla.JText._("LNG_LESS")," (-)")))}},{key:"getFacetedFilters",value:function(categories){for(var _this2=this,counterCategories=0,categoryFilters=[],moreCategoryFilters=[],_loop3=function(i){var filterCriteria=categories[i];if(filterCriteria[0].subCategories=Object.values(filterCriteria[0].subCategories),!(counterCategories<_this2.props.searchFilterItems))return categoryFilters.push(React.createElement("a",{id:"showMoreCategories1",className:"filterExpand cursor-pointer",onClick:function(){return jbdUtils.showMoreParams("extra_categories_params1","showMoreCategories1")}},Joomla.JText._("LNG_MORE")," (+)")),"break";var liClass="",divClass="",action=jbdUtils.addFilterRuleCategory,removeText="";_this2.props.selectedCategories.some(function(cat){return cat==filterCriteria[0][0].id})&&(liClass="selectedlink",divClass="selected",action=jbdUtils.removeFilterRuleCategory,removeText=React.createElement("span",{className:"cross"}));var subCategoriesFilters=[];if(null!=filterCriteria[0].subCategories)for(var _loop5=function(j){var subCategory=filterCriteria[0].subCategories[j],liClassSub="",divClassSub="",actionSub=jbdUtils.addFilterRuleCategory,removeTextSub="";_this2.props.selectedCategories.some(function(cat){return cat==subCategory[0].id})&&(liClassSub="selectedlink",divClassSub="selected",actionSub=jbdUtils.removeFilterRuleCategory,removeTextSub=React.createElement("span",{className:"cross"})),subCategoriesFilters.push(React.createElement("li",{className:liClassSub},React.createElement("div",{className:divClassSub},React.createElement("a",{className:"cursor-pointer",onClick:function(){return actionSub(subCategory[0].id)}},subCategory[0].name," ",removeTextSub))))},j=0;j<filterCriteria[0].subCategories.length;j++)_loop5(j);categoryFilters.push(React.createElement("li",{key:Math.random()+"-"+i,className:liClass},React.createElement("div",{key:Math.random()+"-"+i,className:divClass},React.createElement("a",{className:"filter-main-cat cursor-pointer",onClick:function(){return action(filterCriteria[0][0].id)}},filterCriteria[0][0].name," ",removeText)),subCategoriesFilters)),counterCategories++},i=0;i<categories.length;i++){if("break"===_loop3(i))break}for(var _loop4=function(_i2){var filterCriteria=categories[_i2];counterCategories--,filterCriteria[0].subCategories=Object.values(filterCriteria[0].subCategories),counterCategories<0&&filterCriteria[1]>0&&function(){var liClass="",divClass="",action=jbdUtils.addFilterRuleCategory,removeText="";_this2.props.selectedCategories.some(function(cat){return cat==filterCriteria[0][0].id})&&(liClass="selectedlink",divClass="selected",action=jbdUtils.removeFilterRuleCategory,removeText=React.createElement("span",{className:"cross"}));var subCategoriesFilters=[];if(null!=filterCriteria[0].subCategories)for(var _loop6=function(j){var subCategory=filterCriteria[0].subCategories[j],liClassSub="",divClassSub="",removeTextSub=(jbdUtils.addFilterRuleCategory,"");_this2.props.selectedCategories.some(function(cat){return cat==subCategory[0].id})&&(liClassSub="selectedlink",divClassSub="selected",jbdUtils.removeFilterRuleCategory,removeTextSub=React.createElement("span",{className:"cross"})),subCategoriesFilters.push(React.createElement("li",{key:Math.random()+"-"+_i2,className:liClassSub},React.createElement("div",{className:divClassSub},React.createElement("a",{className:"cursor-pointer",onClick:function(){return action(subCategory[0].id)}},subCategory[0].name," ",removeTextSub))))},j=0;j<filterCriteria[0].subCategories.length;j++)_loop6(j);moreCategoryFilters.push(React.createElement("li",{key:Math.random()+"-"+_i2,className:liClass},React.createElement("div",{className:divClass},React.createElement("a",{className:"filter-main-cat cursor-pointer",onClick:function(){return action(filterCriteria[0][0].id)}},filterCriteria[0][0].name," ",removeText)),React.createElement("ul",null,subCategoriesFilters)))}()},_i2=0;_i2<categories.length;_i2++)_loop4(_i2);return React.createElement("ul",{className:"filter-categories"},categoryFilters,React.createElement("div",{style:{display:"none"},id:"extra_categories_params1"},moreCategoryFilters,React.createElement("a",{id:"showLessCategories1",className:"filterExpand cursor-pointer",onClick:function(){return jbdUtils.showLessParams("extra_categories_params1","showMoreCategories1")}},Joomla.JText._("LNG_LESS")," (-)")))}},{key:"render",value:function(){var categories=this.props.categories,categoryFilters="";return categoryFilters=0==this.props.searchType?this.getRegularFilters(categories):this.getFacetedFilters(categories),React.createElement("div",{className:"filter-criteria"},React.createElement("div",{className:"filter-header"},jbdUtils.decodeHtml(Joomla.JText._("LNG_CATEGORIES"))),categoryFilters,React.createElement("div",{className:"clear"}))}}]),SearchFilterVerticalCategories}(React.Component);function _typeof(obj){"@babel/helpers - typeof";return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj})(obj)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Constructor}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),superClass&&_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){return(_setPrototypeOf=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o})(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function(){var result,Super=_getPrototypeOf(Derived);if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else result=Super.apply(this,arguments);return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){return!call||"object"!==_typeof(call)&&"function"!=typeof call?_assertThisInitialized(self):call}function _assertThisInitialized(self){if(void 0===self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return self}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(o){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(o){return o.__proto__||Object.getPrototypeOf(o)})(o)}var SearchFilterVerticalItems=function(_React$Component){_inherits(SearchFilterVerticalItems,_React$Component);var _super=_createSuper(SearchFilterVerticalItems);function SearchFilterVerticalItems(props){return _classCallCheck(this,SearchFilterVerticalItems),_super.call(this,props)}return _createClass(SearchFilterVerticalItems,[{key:"getFilters",value:function(items){var nameField=this.props.nameField,valueField=this.props.valueField,selectedItems=this.props.selectedItems,customText=this.props.customText,type=this.props.type;items=Object.values(items);var setCategory=void 0!==this.props.category&&null!=this.props.category?1:0,categId=void 0!==this.props.categoryId&&null!=this.props.categoryId?this.props.categoryId:0,addFilterAction=void 0!==this.props.addFilterAction?this.props.addFilterAction:jbdUtils.addFilterRule,removeFilterAction=void 0!==this.props.removeFilterAction?this.props.removeFilterAction:jbdUtils.removeFilterRule;return React.createElement("span",null,items.map(function(item,index){if(null!=item[valueField]){var liClass="",divClass="",action=addFilterAction,removeText="";return null!=selectedItems&&selectedItems.some(function(selectedItem){return selectedItem==item[valueField]})&&(liClass="selectedlink",divClass="selected",action=removeFilterAction,removeText=React.createElement("span",{className:"cross"})),React.createElement("li",{key:10*Math.random()*index,className:liClass},React.createElement("div",{key:10*Math.random(),className:divClass},React.createElement("a",{className:"cursor-pointer",onClick:function(){return action(type,item[valueField],setCategory,categId)}},jbdUtils.decodeHtml(item[nameField])," ",jbdUtils.decodeHtml(customText)," ",removeText)))}}))}},{key:"getExpandedFilters",value:function(){var items=this.props.items,showMoreBtn=this.props.showMoreBtn,showMoreId=this.props.showMoreId;items=Object.values(items);for(var filters,result=[],moreFilters="",counterItems=0,visibleItems=[],hiddenItems=[],i=0;i<items.length;i++){var item=items[i];counterItems<this.props.searchFilterItems?visibleItems.push(item):hiddenItems.push(item),counterItems++}return filters=this.getFilters(visibleItems),result.push(filters),hiddenItems.length>0&&(moreFilters=this.getFilters(hiddenItems),result.push(React.createElement("a",{id:showMoreBtn,className:"filterExpand cursor-pointer",onClick:function(){return jbdUtils.showMoreParams(showMoreId,showMoreBtn)}},Joomla.JText._("LNG_MORE")," (+)")),result.push(React.createElement("div",{style:{display:"none"},id:showMoreId},moreFilters,React.createElement("a",{id:showMoreBtn,className:"filterExpand cursor-pointer",onClick:function(){return jbdUtils.showLessParams(showMoreId,showMoreBtn)}},Joomla.JText._("LNG_LESS")," (-)")))),result}},{key:"render",value:function(){var items=this.props.items,title=jbdUtils.decodeHtml(this.props.title),filters="";return filters=this.props.expandItems?this.getExpandedFilters(items):this.getFilters(items),React.createElement("div",{key:10*Math.random(),className:"filter-criteria"},React.createElement("div",{key:10*Math.random(),className:"filter-header"},title),React.createElement("ul",{key:10*Math.random()},filters),React.createElement("div",{key:10*Math.random(),className:"clear"}))}}]),SearchFilterVerticalItems}(React.Component);function _typeof(obj){"@babel/helpers - typeof";return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj})(obj)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Constructor}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),superClass&&_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){return(_setPrototypeOf=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o})(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function(){var result,Super=_getPrototypeOf(Derived);if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else result=Super.apply(this,arguments);return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){return!call||"object"!==_typeof(call)&&"function"!=typeof call?_assertThisInitialized(self):call}function _assertThisInitialized(self){if(void 0===self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return self}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(o){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(o){return o.__proto__||Object.getPrototypeOf(o)})(o)}var SearchFilterVertical=function(_React$Component){_inherits(SearchFilterVertical,_React$Component);var _super=_createSuper(SearchFilterVertical);function SearchFilterVertical(props){return _classCallCheck(this,SearchFilterVertical),_super.call(this,props)}return _createClass(SearchFilterVertical,[{key:"getDistanceFilters",value:function(){var _this=this,distanceUnit=1==jbdUtils.getProperty("metric")?Joomla.JText._("LNG_MILES"):Joomla.JText._("LNG_KM");return React.createElement("div",{className:"filter-criteria"},React.createElement("div",{key:Math.random(),className:"filter-header"},Joomla.JText._("LNG_DISTANCE")),React.createElement("ul",null,[50,25,10,0].map(function(radius,index){var radiusText=radius+" "+distanceUnit;return 0==radius&&(radiusText=Joomla.JText._("LNG_ALL")),React.createElement("li",{key:Math.random()+"-"+index},_this.props.radius!=radius?React.createElement("a",{className:"cursor-pointer",onClick:function(){return jbdListings.setRadius(radius)}},radiusText):React.createElement("strong",null,radiusText))})))}},{key:"getFilterMonths",value:function(){var filterMonths=this.props.filterMonths,startDate=this.props.startDate;return null==filterMonths?null:React.createElement("div",{className:"filter-criteria"},React.createElement("div",{key:Math.random(),className:"filter-header"},Joomla.JText._("LNG_MONTHS")),React.createElement("ul",null,filterMonths.map(function(month,index){var liClass="",divClass="",removeText="",action=jbdEvents.setSearchDates,paramStartDate=month.start_date,paramEndDate=month.end_date;return month.start_date==startDate&&(action=jbdEvents.setSearchDates,liClass="selectedlink",divClass="selected",removeText=React.createElement("span",{className:"cross"}),paramStartDate="",paramEndDate=""),React.createElement("li",{key:Math.random()+"-"+index,className:liClass},React.createElement("div",{key:Math.random()+"-"+index,className:divClass},React.createElement("a",{className:"cursor-pointer",onClick:function(){return action(paramStartDate,paramEndDate)}},month.name," ",removeText)))})))}},{key:"render",value:function(){var _this2=this,searchFilterClasses=["search-filter"];2==jbdUtils.getProperty("search_filter_view")&&searchFilterClasses.push("style-2");var distanceFilters="";null!=this.props.location&&null!=this.props.location.latitude&&(distanceFilters=this.getDistanceFilters());var cityValueField="city",regionValueField="region",monthFilters="",searchFilterItems=jbdUtils.getProperty("search_filter_items"),searchType=jbdUtils.getProperty("search_type");return this.props.itemType==JBDConstants.ITEM_TYPE_EVENT?(cityValueField="cityName",regionValueField="regionName",monthFilters=this.getFilterMonths(),searchFilterItems=jbdUtils.getProperty("event_search_filter_items"),searchType=jbdUtils.getProperty("event_search_type")):this.props.itemType==JBDConstants.ITEM_TYPE_OFFER&&(cityValueField="cityName",regionValueField="regionName",searchFilterItems=jbdUtils.getProperty("offer_search_filter_items"),searchType=jbdUtils.getProperty("offer_search_type")),React.createElement("div",null,React.createElement("div",{id:"filter-switch",className:"filter-switch",onClick:function(){return jbdUtils.toggleFilter()}},Joomla.JText._("LNG_SHOW_FILTER")),React.createElement("div",{id:"search-filter",className:searchFilterClasses.join(" ")},React.createElement("div",{className:"filter-fav clear",style:{display:"none"}},"/* TODO is this section needed? */"),React.createElement("div",{key:Math.random(),className:"search-category-box"},distanceFilters,jQuery.isEmptyObject(this.props.searchFilter.months)?null:monthFilters,React.createElement("div",{id:"filterCategoryItems",key:Math.random()},null!=this.props.searchFilter&&null!=this.props.searchFilter.categories&&this.props.searchFilter.categories.length>0?React.createElement(SearchFilterVerticalCategories,{categories:this.props.searchFilter.categories,category:this.props.category,selectedCategories:this.props.selectedCategories,searchFilterItems:searchFilterItems,searchType:searchType}):null,jQuery.isEmptyObject(this.props.searchFilter.starRating)?null:React.createElement(SearchFilterVerticalItems,{items:this.props.searchFilter.starRating,selectedItems:this.props.selectedParams.starRating,title:Joomla.JText._("LNG_STAR_RATING"),type:"starRating",valueField:"reviewScore",nameField:"reviewScore",customText:Joomla.JText._("LNG_STARS"),expandItems:!1,searchFilterItems:searchFilterItems}),jQuery.isEmptyObject(this.props.searchFilter.types)?null:React.createElement(SearchFilterVerticalItems,{items:this.props.searchFilter.types,selectedItems:this.props.selectedParams.type,title:Joomla.JText._("LNG_TYPES"),type:"type",valueField:"typeId",nameField:"typeName",expandItems:!0,showMoreId:"extra_types_params",showMoreBtn:"showMoreTypes",categoryId:this.props.categoryId,category:this.props.category,searchFilterItems:searchFilterItems}),jQuery.isEmptyObject(this.props.searchFilter.memberships)?null:React.createElement(SearchFilterVerticalItems,{items:this.props.searchFilter.memberships,selectedItems:this.props.selectedParams.membership,title:Joomla.JText._("LNG_SELECT_MEMBERSHIP"),type:"membership",valueField:"membership_id",nameField:"membership_name",expandItems:!0,showMoreId:"extra_memberships_params",showMoreBtn:"showMoreMemberships",searchFilterItems:searchFilterItems}),jQuery.isEmptyObject(this.props.searchFilter.packages)?null:React.createElement(SearchFilterVerticalItems,{items:this.props.searchFilter.packages,selectedItems:this.props.selectedParams.package,title:Joomla.JText._("LNG_PACKAGE"),type:"package",valueField:"package_id",nameField:"package_name",expandItems:!0,showMoreId:"extra_package_params",showMoreBtn:"showMorePackages",searchFilterItems:searchFilterItems}),jQuery.isEmptyObject(this.props.searchFilter.countries)?null:React.createElement(SearchFilterVerticalItems,{items:this.props.searchFilter.countries,selectedItems:this.props.selectedParams.country,title:Joomla.JText._("LNG_COUNTRIES"),type:"country",valueField:"countryId",nameField:"countryName",expandItems:!0,showMoreId:"extra_countries_params",showMoreBtn:"showMoreCountries",searchFilterItems:searchFilterItems}),jQuery.isEmptyObject(this.props.searchFilter.provinces)?null:React.createElement(SearchFilterVerticalItems,{items:this.props.searchFilter.provinces,selectedItems:this.props.selectedParams.province,title:Joomla.JText._("LNG_PROVINCE"),type:"province",valueField:"provinceName",nameField:"provinceName",expandItems:!0,showMoreId:"extra_provinces_params",showMoreBtn:"showMoreProvinces",searchFilterItems:searchFilterItems}),jQuery.isEmptyObject(this.props.searchFilter.regions)?null:React.createElement(SearchFilterVerticalItems,{items:this.props.searchFilter.regions,selectedItems:this.props.selectedParams.region,title:Joomla.JText._("LNG_REGIONS"),type:"region",valueField:regionValueField,nameField:"regionName",expandItems:!0,showMoreId:"extra_regions_params",showMoreBtn:"showMoreRegions",categoryId:this.props.categoryId,category:this.props.category,searchFilterItems:searchFilterItems}),jQuery.isEmptyObject(this.props.searchFilter.cities)?null:React.createElement(SearchFilterVerticalItems,{items:this.props.searchFilter.cities,selectedItems:this.props.selectedParams.city,title:Joomla.JText._("LNG_CITIES"),type:"city",valueField:cityValueField,nameField:"cityName",expandItems:!0,showMoreId:"extra_cities_params",showMoreBtn:"showMoreCities",categoryId:this.props.categoryId,category:this.props.category,searchFilterItems:searchFilterItems}),jQuery.isEmptyObject(this.props.searchFilter.areas)?null:React.createElement(SearchFilterVerticalItems,{items:this.props.searchFilter.areas,selectedItems:this.props.selectedParams.area,title:Joomla.JText._("LNG_AREA"),type:"area",valueField:"areaName",nameField:"areaName",expandItems:!0,showMoreId:"extra_areas_params",showMoreBtn:"showMoreAreas",categoryId:this.props.categoryId,category:this.props.category,searchFilterItems:searchFilterItems}),jQuery.isEmptyObject(this.props.searchFilter.attributes)?null:this.props.searchFilter.attributes.map(function(items){var item=Object.values(items)[0],nameField="value";null!=item.optionName&&(nameField="optionName");var type="attribute_"+item.id,extraAttribute="extra_attributes_params_"+item.id,showMore="showMoreAttributes_"+item.id;return React.createElement(SearchFilterVerticalItems,{items:items,selectedItems:_this2.props.selectedParams[type],title:item.name,type:type,valueField:"value",nameField:nameField,expandItems:!0,showMoreId:extraAttribute,showMoreBtn:showMore,categoryId:_this2.props.categoryId,category:_this2.props.category,searchFilterItems:searchFilterItems})})))))}}]),SearchFilterVertical}(React.Component);function _typeof(obj){"@babel/helpers - typeof";return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj})(obj)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Constructor}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),superClass&&_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){return(_setPrototypeOf=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o})(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function(){var result,Super=_getPrototypeOf(Derived);if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else result=Super.apply(this,arguments);return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){return!call||"object"!==_typeof(call)&&"function"!=typeof call?_assertThisInitialized(self):call}function _assertThisInitialized(self){if(void 0===self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return self}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(o){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(o){return o.__proto__||Object.getPrototypeOf(o)})(o)}var SearchFilter=function(_React$Component){_inherits(SearchFilter,_React$Component);var _super=_createSuper(SearchFilter);function SearchFilter(props){var _this;return _classCallCheck(this,SearchFilter),(_this=_super.call(this,props)).state={radius:null,location:null,searchFilter:[],category:null,categoryId:null,categorySearch:null,selectedCategories:[],selectedParams:[],filterMonths:null,startDate:null,endDate:null,searchKeyword:null,customAttributesValues:null,zipCode:null,err:null,searchFilterType:null,showSearchFilterParams:null,isLoading:!1,onlyLocal:null},_this.fetchData=_this.fetchData.bind(_assertThisInitialized(_this)),_this}return _createClass(SearchFilter,[{key:"fetchData",value:function(){var _this2=this;this.setState({isLoading:!0});var url=jbdUtils.getAjaxUrl("getSearchFilter","search");this.props.itemType==JBDConstants.ITEM_TYPE_EVENT?url=jbdUtils.getAjaxUrl("getSearchFilter","events"):this.props.itemType==JBDConstants.ITEM_TYPE_OFFER?url=jbdUtils.getAjaxUrl("getSearchFilter","offers"):this.props.itemType==JBDConstants.ITEM_TYPE_REQUEST_QUOTE&&(url=jbdUtils.getAjaxUrl("getSearchFilter","requestquotes")),url=url+"&_c="+10*Math.random()+"&reload=1",fetch(url,{headers:{"Cache-Control":"no-cache, no-store, must-revalidate",Pragma:"no-cache",Expires:0}}).then(function(res){if(res.status>=400)throw new Error("Server responded with error!");return res.json()}).then(function(response){_this2.setFilterData(response)},function(err){_this2.setState({err:err,isLoading:!1})})}},{key:"componentDidMount",value:function(){this.fetchData()}},{key:"setFilterData",value:function(response){var searchFilter=null;if(null!=response.data.searchFilter)for(var key in searchFilter=[],response.data.searchFilter)if(response.data.searchFilter.hasOwnProperty(key)){var row=[];for(var keyj in response.data.searchFilter[key])row[keyj]=response.data.searchFilter[key][keyj];searchFilter[key]=row}this.setState({radius:response.data.radius,location:response.data.location,searchFilter:searchFilter,category:response.data.category,categoryId:void 0!==response.data.categoryId?response.data.categoryId:null,categorySearch:void 0!==response.data.categorySearch?response.data.categorySearch:null,selectedCategories:response.data.selectedCategories,selectedParams:response.data.selectedParams,filterMonths:void 0!==response.data.filterMonths?response.data.filterMonths:null,startDate:void 0!==response.data.startDate?response.data.startDate:null,endDate:void 0!==response.data.endDate?response.data.endDate:null,onlyLocal:void 0!==response.data.onlyLocal?response.data.onlyLocal:null,searchKeyword:void 0!==response.data.searchKeyword?response.data.searchKeyword:null,customAttributesValues:void 0!==response.data.customAttributesValues?response.data.customAttributesValues:null,zipCode:void 0!==response.data.zipCode?response.data.zipCode:null,isLoading:!1}),jbdUtils.moveMap(),jbdUtils.getProperty("move-search-filter")}},{key:"render",value:function(){return this.state.isLoading?React.createElement(Loading,null):React.createElement("div",null,1==this.props.searchFilterType?React.createElement(SearchFilterHorizontal,{fetchData:this.fetchData,searchKeyword:this.state.searchKeyword,radius:this.state.radius,location:this.state.location,searchFilter:this.state.searchFilter,category:this.state.category,categorySearch:this.state.categorySearch,categoryId:this.state.categoryId,selectedCategories:this.state.selectedCategories,selectedParams:this.state.selectedParams,customAttributesValues:this.state.customAttributesValues,zipCode:this.state.zipCode,itemType:this.props.itemType,startDate:this.state.startDate,endDate:this.state.endDate,onlyLocal:this.state.onlyLocal}):null,3==this.props.searchFilterType&&1==this.props.itemType&&React.createElement(SearchFilterHorizontalCat,{searchKeyword:this.state.searchKeyword,radius:this.state.radius,location:this.state.location,searchFilter:this.state.searchFilter,category:this.state.category,categorySearch:this.state.categorySearch,categoryId:this.state.categoryId,selectedCategories:this.state.selectedCategories,selectedParams:this.state.selectedParams,customAttributesValues:this.state.customAttributesValues,zipCode:this.state.zipCode,itemType:this.props.itemType}),1==this.props.showSearchFilterParams?React.createElement(SearchFilterParams,{searchKeyword:this.state.searchKeyword,radius:this.state.radius,location:this.state.location,searchFilter:this.state.searchFilter,filterType:this.props.searchFilterType,category:this.state.category,categorySearch:this.state.categorySearch,categoryId:this.state.categoryId,selectedCategories:this.state.selectedCategories,selectedParams:this.state.selectedParams,customAttributesValues:this.state.customAttributesValues,zipCode:this.state.zipCode,itemType:this.props.itemType,startDate:this.state.startDate,endDate:this.state.endDate,onlyLocal:this.state.onlyLocal}):null,2==this.props.searchFilterType?React.createElement(SearchFilterVertical,{filterType:this.props.searchFilterType,radius:this.state.radius,location:this.state.location,searchFilter:this.state.searchFilter,category:this.state.category,categorySearch:this.state.categorySearch,categoryId:this.state.categoryId,selectedCategories:this.state.selectedCategories,selectedParams:this.state.selectedParams,filterMonths:this.state.filterMonths,startDate:this.state.startDate,itemType:this.props.itemType}):null)}}]),SearchFilter}(React.Component);function _typeof(obj){"@babel/helpers - typeof";return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj})(obj)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Constructor}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),superClass&&_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){return(_setPrototypeOf=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o})(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function(){var result,Super=_getPrototypeOf(Derived);if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else result=Super.apply(this,arguments);return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){return!call||"object"!==_typeof(call)&&"function"!=typeof call?_assertThisInitialized(self):call}function _assertThisInitialized(self){if(void 0===self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return self}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(o){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(o){return o.__proto__||Object.getPrototypeOf(o)})(o)}var Loading=function(_React$Component){_inherits(Loading,_React$Component);var _super=_createSuper(Loading);function Loading(props){return _classCallCheck(this,Loading),_super.call(this,props)}return _createClass(Loading,[{key:"render",value:function(){var loaderUrl=jbdUtils.getProperty("assetsUrl")+"images/loading-search.gif";return React.createElement("div",{className:"search-loading"},React.createElement("img",{src:loaderUrl,alt:"loading..."}))}}]),Loading}(React.Component);