var slideshow_interval=null;let pricing_currentIndex=0;var slideshow_timeout=4000;var baseurl=site_url=$('base').eq(0).attr('href');var api_request_url=site_url+'web_request/';var user_csrf_token=null;var user_login_session_id=WebStorage('get','login_session_id');var user_access_code=WebStorage('get','access_code');var user_session_time_stamp=WebStorage('get','session_time_stamp');var load_groups_request=null;if(user_login_session_id!==null&&user_access_code!==null&&user_session_time_stamp!==null){$('body').addClass('d-none')}
function isLocalStorageAvailable(){var test='test';try{localStorage.setItem(test,test);localStorage.removeItem(test);return!0}catch(e){return!1}}
function isPWAInstalled(){try{const pwaStatus=localStorage.getItem('pwaInstalled');return pwaStatus==='true'}catch(error){return!1}}
$('.load_groups').on('click',function(){if(!$(this).hasClass('processing')){$(this).addClass('processing');var this_element=$(this);var group_category_id=null;if($(this).attr('category_id')!==undefined){group_category_id=$(this).attr('category_id')}
var data={'landing_page_groups':!0,'group_category_id':group_category_id};load_groups_request=$.ajax({type:'POST',url:api_request_url,data:data,async:!0,beforeSend:function(){if(load_groups_request!=null){load_groups_request.abort();load_groups_request=null}},success:function(data){}}).done(function(data){$('.landing_page .landing_page_groups').html(data);this_element.removeClass('processing');$('.landing_page .groups_categories_list > div').removeClass('active');this_element.addClass('active')}).fail(function(qXHR,textStatus,errorThrown){this_element.removeClass('processing');if(qXHR.statusText!=='abort'&&qXHR.statusText!=='canceled'){console.log('ERROR : '+errorThrown)}})}});$('.refresh_page').on('click',function(){location.reload(!0)});function WebStorage(todo,name,value){if(isLocalStorageAvailable()&&typeof(Storage)!=="undefined"){if(todo=='get'){value=localStorage.getItem(name);if(value){return value}else{return null}}else if(todo=='set'){localStorage.setItem(name,value)}else if(todo=='remove'){localStorage.removeItem(name)}else if(todo=='clear'){localStorage.clear()}}else{console.log('No Web Storage Support');return null}}
function isJSON(data){var IS_JSON=!0;try
{var json=$.parseJSON(data)}catch(err){IS_JSON=!1}
return IS_JSON}
function slideshow(){var active_slide=$('.hero_section .slideshow > ul > li.active').not(".last-active");if(active_slide.length===0){$('.hero_section .slideshow > ul > li.active').removeClass('last-active active');active_slide=$('.hero_section .slideshow > ul > li:last-child');active_slide.addClass('active')}
var next_slide=active_slide.next();if(next_slide.length===0){next_slide=$('.hero_section .slideshow > ul > li:first-child')}
active_slide.addClass('last-active');active_slide.removeClass('active last-active');next_slide.css({opacity:0.0}).addClass('active').animate({opacity:1.0,},1000,function(){});if(slideshow_interval!=null){clearTimeout(slideshow_interval)}
slideshow_interval=setTimeout("slideshow()",slideshow_timeout)}
$(window).on('load',function(){if($('.hero_section .slideshow').length>0){if($('.hero_section .slideshow > ul > li').length>1){slideshow()}else{$('.hero_section .slideshow > ul > li:first-child').addClass('active')}}});$(document).ready(function(){if(user_login_session_id!==null&&user_access_code!==null&&user_session_time_stamp!==null){var user_login_register=site_url+'?login_session_id='+user_login_session_id+'&access_code='+user_access_code;user_login_register=user_login_register+'&session_time_stamp='+user_session_time_stamp;window.location.href=user_login_register}
if($('body').hasClass('right_click_disabled')){document.addEventListener("contextmenu",(event)=>{event.preventDefault()})}
$('body').on('contextmenu','img',function(e){return!1});if(isLockdown.isLockdownEnabled()){var lockdown_stylesheet=$('<link>',{rel:'stylesheet',type:'text/css',href:baseurl+'assets/css/landing_page/lockdown_stylesheet.css'});$('head').append(lockdown_stylesheet)}});$(".landing_page").on('click',function(e){if(!$(e.target).hasClass('dropdown_button')&&$(e.target).parents('.dropdown_button').length==0){$(".dropdown_list").addClass('d-none')}});$("body").on('mouseenter','.dropdown_button',function(e){if($(window).width()>767.98){$(this).find(".dropdown_list").removeClass('d-none')}});$("body").on('click','.dropdown_button',function(e){if($(window).width()<767.98){$(this).find(".dropdown_list").removeClass('d-none')}});function membership_pricing_slider(index){var pricingTables=$('.landing_page .available_membership_packages .available_packages .pricing-table-container > .pricing-table');var pricingTableContainer=$('.landing_page .available_membership_packages .available_packages .pricing-table-container');var translateX=-index*(pricingTables.outerWidth()+10);pricingTableContainer.css('transform',`translateX(${translateX}px)`)}
$('.landing_page .available_membership_packages .available_packages>div>.header>div>.right>.previous_pricing').click(function(){if(pricing_currentIndex>0){pricing_currentIndex--;membership_pricing_slider(pricing_currentIndex)}});$('.landing_page .available_membership_packages .available_packages>div>.header>div>.right> .next_pricing').click(function(){var pricingTables=$('.landing_page .available_membership_packages .available_packages .pricing-table-container > .pricing-table');if(pricing_currentIndex<pricingTables.length-1){pricing_currentIndex++;membership_pricing_slider(pricing_currentIndex)}});$("body").on('mouseleave','.dropdown_button',function(e){if($(window).width()>767.98){$(".dropdown_list").addClass('d-none')}});$("body").on('click','.frequently_asked_questions .questions > .item',function(e){if(!$(this).hasClass('open')){$('.frequently_asked_questions .questions > .item').removeClass('open');$(this).addClass('open')}else{$('.frequently_asked_questions .questions > .item').removeClass('open')}});$("body").on('click','.api_request',function(e){if(!$(this).hasClass('processing')){$(this).addClass('processing');var form_data=output_message_field=null;if($(this).attr('form_data')!==undefined){form_data=$(this).attr('form_data');var data=new FormData($(form_data)[0])}else{var data=$(this).data()}
var element=$(this);var skip_hide_action=!1;var column='first';if(element.attr('column')!==undefined){column=element.attr('column')}
if($(this).attr('output_message_field')!==undefined){output_message_field=$(this).attr('output_message_field');$(output_message_field).hide()}
if($(this).attr('loader')!==undefined){$($(this).attr('loader')).show()}
if($(this).hasClass('change_site_color_scheme')&&$(this).data('color_scheme')!==undefined){if($(this).data('color_scheme')==='light_mode'){var css_variable_file=baseurl+'assets/css/common/css_variables.css'}else{var css_variable_file=baseurl+'assets/css/common/dark_mode_css_variables.css'}(async()=>{try{var css_file_response=await fetch(css_variable_file);if(!css_file_response.ok){console.log('CSS File load failed: '+css_file_response.statusText)}}catch(error){console.log('Error loading file:',error)}})()}
if($(this).attr('pass_send_as_user_id')!==undefined){if($('.main .chatbox > .header > .switch_user').length>0){if($('.main .chatbox > .header > .switch_user > .current_selected_user > .user_image > img').length>0){var send_as_user_id=$('.main .chatbox > .header > .switch_user > .user_id > input').val();if(send_as_user_id.length>0&&send_as_user_id!=='0'){data.send_as_user_id=send_as_user_id}}}}
if(form_data!==null){if(user_csrf_token!==null){data.append("csrf_token",user_csrf_token)}
if(user_login_session_id!==null&&user_access_code!==null&&user_session_time_stamp!==null){data.append("login_session_id",user_login_session_id);data.append("access_code",user_access_code);data.append("session_time_stamp",user_session_time_stamp)}}else{if(user_csrf_token!==null){data.csrf_token=user_csrf_token}
if(user_login_session_id!==null&&user_access_code!==null&&user_session_time_stamp!==null){data.login_session_id=user_login_session_id;data.access_code=user_access_code;data.session_time_stamp=user_session_time_stamp}}
if($(this).attr('multi_select')!==undefined){if($(this).attr('data-chat_messages')!==undefined){if($(".main .chatbox").attr('group_id')!==undefined){data.remove="group_messages"}else if($(".main .chatbox").attr('user_id')!==undefined){data.remove="private_chat_messages"}
data.message_id=new Array();$(".main .chatbox .selector.select_item > input:checked").each(function(){data.message_id.push($(this).val())})}else{var selected=new Array();$(".main .aside > .site_records > .records > .list > li > div > .selector.select_item > input:checked").each(function(){selected.push($(this).val())});data[$(this).attr('multi_select')]=selected}}
if(form_data!==null){var request_data={url:api_request_url,dataType:'text',cache:!1,contentType:!1,processData:!1,async:!0,data:data,type:'post',success:function(data){}}}else{var request_data={type:'POST',url:api_request_url,data:data,async:!0,success:function(data){}}}
$.ajax(request_data).done(function(data){if(data===''){location.reload(!0)}else if(isJSON(data)){data=$.parseJSON(data);if(data.success){if(data.close_modal!==undefined){$(data.close_modal).modal('hide')}
if(data.force_reload_aside!==undefined){$('.main .aside > .site_records > .current_record').attr('load',data.force_reload_aside);$(".main .aside > .site_records > .current_record").removeClass('loading');$(".main .aside > .site_records > .current_record > .title > div").removeClass('dropdown_button');if(data.filter_data!==undefined){$(".main .aside > .site_records > .current_record > .title").attr('filter_data',data.filter_data)}
$(".main .aside > .site_records > .current_record > .title").trigger('click')}
if(data.reload!==undefined&&$.isArray(data.reload)){if(jQuery.inArray($('.main .aside > .site_records > .current_record').attr('load'),data.reload)!==-1){$(".main .aside > .site_records > .current_record").removeClass('loading');$(".main .aside > .site_records > .current_record > .title > div").removeClass('dropdown_button');$(".main .aside > .site_records > .current_record > .title").trigger('click')}}else if(data.todo=='reload'){if(data.reload!==undefined&&$('.main .aside > .site_records > .current_record').attr('load')===data.reload){$(".main .aside > .site_records > .current_record").removeClass('loading');$(".main .aside > .site_records > .current_record > .title > div").removeClass('dropdown_button');if(data.filter_data!==undefined){$(".main .aside > .site_records > .current_record > .title").attr('filter_data',data.filter_data)}
$(".main .aside > .site_records > .current_record > .title").trigger('click')}}else if(data.todo=='refresh'){window.location.href=baseurl}else if(data.todo=='refresh_current_page'){location.reload(!0)}else if(data.todo=='consolelog'&&data.log!==undefined){console.log(data.log)}else if(data.todo=='redirect'){if(data.remove_login_session!==undefined){WebStorage('remove','login_session_id');WebStorage('remove','access_code');WebStorage('remove','session_time_stamp');WebStorage('remove','remove_login_session');setTimeout(function(){window.location.href=data.redirect},2000)}else{window.location.href=data.redirect}}else if(data.todo=='update_message_reactions'){if(data.update_data!==undefined){update_message_reactions(data.update_data)}}else if(data.todo=='remove_messages'){$(".main .chatbox > .header > .message_selection").find('input').prop('checked',!1);if(data.remove_data!==undefined){remove_messages(data.remove_data)}}else if(data.todo=='load_conversation'){if(data.reload_aside!==undefined&&$('.main .aside > .site_records > .current_record').attr('load')==='groups'){$(".main .aside > .site_records > .current_record").removeClass('loading');$('.main .aside > .site_records > .current_record').attr('disable_preloader',!0);load_aside($(".main .aside > .site_records > .current_record"));$('.main .aside > .site_records > .current_record').removeAttr('disable_preloader')}
var load_data=[];load_data[data.identifier_type]=data.identifier;load_conversation(load_data)}
if(data.info_box!==undefined){get_info(data.info_box)}
$('.main .page_column[column="'+column+'"] .confirm_box > .content > .btn.cancel').trigger('click')}else{if(data.error_message_position===undefined){if(data.error_message!==undefined&&output_message_field!==null){$(output_message_field).replace_text(data.error_message);$(output_message_field).fadeIn()}else if(data.error_message!==undefined){$('.main .page_column[column="'+column+'"] .confirm_box > .error > .message > span').replace_text(data.error_message);$('.main .page_column[column="'+column+'"] .confirm_box > .error').fadeIn();skip_hide_action=!0}}}}else{console.log('ERROR : '+data)}
if(element.attr('loader')!==undefined){$(element.attr('loader')).hide()}
element.removeClass('processing');if(element.attr('hide_window')!==undefined){$(element.attr('hide_window')).hide()}
if(element.attr('hide_element')!==undefined&&!skip_hide_action){$(element.attr('hide_element')).addClass('d-none')}}).fail(function(qXHR,textStatus,errorThrown){if(element.attr('loader')!==undefined){$(element.attr('loader')).hide()}
element.removeClass('processing');if(element.attr('hide_window')!==undefined){$(element.attr('hide_window')).hide()}
if(element.attr('hide_element')!==undefined){$(element.attr('hide_element')).addClass('d-none')}
console.log('ERROR : '+errorThrown)})}});;