<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">//time support live chat namespace
var timelivechat = function() {
    var timer;
    var is_livechat_ended;
    var livechat_timer;
    var liveChatObject;
    var fbChatObject;
    var hiddenCssClass;

    //enable livechat button
    function enableLiveChat() {
        if (liveChatObject &amp;&amp; liveChatObject.length &gt; 0) {
            if (liveChatObject.hasClass(hiddenCssClass)) {
                liveChatObject.removeClass(hiddenCssClass);
            }
        }
    }
    //disable livechat button
    function disableLiveChat() {
        if (window.fcWidget &amp;&amp; window.fcWidget.isOpen()) {
            window.fcWidget.close();
        }

        if (fcPreChatform &amp;&amp; fcPreChatform.on_fc_pre_form_close) {
            if (document.querySelector(".chat-fc-form-outer")) {
                fcPreChatform.on_fc_pre_form_close();
            }
        }

        if (liveChatObject &amp;&amp; liveChatObject.length &gt; 0) {
            if (!liveChatObject.hasClass(hiddenCssClass)) {
                liveChatObject.addClass(hiddenCssClass);
            }
        }
    }
    //enable Facebook chat button
    function enableFBChat() {
        if (fbChatObject &amp;&amp; fbChatObject.length &gt; 0) {
            if (fbChatObject.hasClass(hiddenCssClass)) {
                fbChatObject.removeClass(hiddenCssClass);
            }
        }
    }

    function disableFBChat() {
        if (fbChatObject &amp;&amp; fbChatObject.length &gt; 0) {
            if (!fbChatObject.hasClass(hiddenCssClass)) {
                fbChatObject.addClass(hiddenCssClass);
            }
        }
    }

    //schedule next calling API timer
    function scheduleLiveChatNextIntervalChecking(start_time) {
        livechat_timer = setTimeout(function() {
            getLiveChatStatus();
        }, start_time);
        if (console) {
            console.log('next scheduled start after : ' + start_time + ' milisec');
        }
    }

    //clear scheduled calling API timer
    function stopLiveChatIntervalChecking() {
        clearTimeout(livechat_timer);
    }
    // API to get live chat status
  function getLiveChatStatus() {
    $.ajax({
      //url : '/api/getLiveChatStatus.php',
      url : '/wp-json/api/v1/getLiveChatStatus',
      type: 'GET',
      crossDomain: true,
      cache: false,
      dataType: 'json',
      success: function (response) {
        if(response.status === 'success') {
          if(response.live_chat_status === 'online') {
            is_livechat_ended = false;
            $('#facebook').hide();
            $('#livechat').show();
          }
          else {
            is_livechat_ended = true;
            $('#facebook').show();
            $('#livechat').hide();
          }
        }
        else {
          $('#facebook').show();
          $('#livechat').hide();
        }
      },
      error: function (jXHR, textStatus, errorThrown) {
        if(console) {
          console.log(jXHR.status + ' : ' + jXHR.statusText);
          console.log(jXHR);
        }
      }
    });
  }

    return {
        init: function(_liveChatObject, _fbChatObject, _hiddenCssClass) {
            livechat_status_check_interval = null;
            timer = 600000; // 600000 = 10 min
            is_livechat_ended = false;
            liveChatObject = _liveChatObject;
            fbChatObject = _fbChatObject;
            hiddenCssClass = _hiddenCssClass;
            getLiveChatStatus();
        },
        refresh: function() {
            getLiveChatStatus();
        },
        livechatend: function() {
      return is_livechat_ended;
        }
    }
}();

//resizer part
var isMobile = false;

function resizer() {
    var w = $(window).width();
    if (w &lt; 768) {
        isMobile = true;
        $('.live-chat-avatar-side.active .chat-need-help-btn-rounded').css('pointer-events', 'none');
        $('.live-chat-avatar-side .chat-btn').css('pointer-events', 'none');
        //$('.live-chat-avatar-side').toggleClass("active");
        //$('.live-chat-avatar-side').removeClass("active").addClass("closed");
        setTimeout(function() {
            $('.live-chat-avatar-side .chat-need-help-btn-rounded').css('pointer-events', 'auto');
        }, 1500);
        $(".chat-need-help-btn-rounded").on('click', function() {
            if (timelivechat) {
                timelivechat.refresh();
            }
            $('.live-chat-avatar-side.closed .chat-need-help-btn-rounded').css('pointer-events', 'auto');
            $('.live-chat-avatar-side.closed .chat-btn').css('pointer-events', 'none');
            setTimeout(function() {
                $('.live-chat-avatar-side').removeClass("closed").addClass('active');
            }, 100);
            setTimeout(function() {
                $('.live-chat-avatar-side.active .chat-btn').css('pointer-events', 'auto');
            }, 600);
        });
    } else {
        isMobile = false;
        $(".chat-need-help-btn-rounded").click(function() {
            if (timelivechat) {
                timelivechat.refresh();
            }
            $('.live-chat-avatar-side.closed .chat-need-help-btn-rounded').css('pointer-events', 'auto');
            $('.live-chat-avatar-side.closed .chat-btn').css('pointer-events', 'none');
            setTimeout(function() {
                $('.live-chat-avatar-side').removeClass("closed").addClass('active');
            }, 100);
            setTimeout(function() {
                $('.live-chat-avatar-side.active .chat-btn').css('pointer-events', 'auto');
            }, 600);
        });
    }
}

function formInputBlur(e) {
    e = e || window.domLoadEventFired;
    $(".pre-fc-field input").one("click", function() {
        //alert( "This will be displayed only once." );
        $(this).mousedown().parents('.pre-fc-field').addClass('focused');
        $(this).off(event);
    });
    e.preventDefault();
    $('.pre-fc-field input').focus(function() {
        $(this).mousedown().parents('.pre-fc-field').addClass('focused');
    });
    $('.pre-fc-field input').blur(function() {
        var inputValue = $(this).val();
        if (inputValue == "") {
            $(this).parents('.pre-fc-field').removeClass('filled');
            $(this).parents('.pre-fc-field').removeClass('focused');
        } else {
            $(this).parents('.pre-fc-field').addClass('filled');
        }
    });
}

function changeAvatar(e) {
    e = e || window.event;
    e.preventDefault();
    $(".avatar-img-rounded, .avatar-img.active, .speech-rounded, .speech-bubble, .icon-swap-avatar-url").toggleClass("show");
}

function closePreChat(e) {
    e = e || window.event;
    $(".avatar").hide();
    $(".live-chat-avatar-side").removeClass("opened").addClass("closed");
    $('.chat-need-help-btn-rounded').removeClass("close").addClass("open");
}

$('#status_link').css('opacity' , '0.5');
$('#status_link').css('pointer-events' , 'none');
// $(document).ready(function() {
$(window).on('load', function() {
    $('#status_link').css('opacity' , '1');
    $('#status_link').css('pointer-events' , 'auto');
    function updateButtonBasedOnChatState() {
        if ($('.live-chat-avatar-side').hasClass('closed')) {
            $('.chat-need-help-btn-rounded').removeClass("close").addClass("open");
        } 
        if ($('.live-chat-avatar-side').hasClass('active')) {
            $('.chat-need-help-btn-rounded').removeClass("open").addClass("close");
        }
        if ($('.live-chat-avatar-side').hasClass('closed') &amp;&amp; $('.fc_frame').hasClass('fc_open')) {
            $('.chat-need-help-btn-rounded').removeClass("open").addClass("close");
        }  
    }
    updateButtonBasedOnChatState();

    $(window).scroll(function() {
        updateButtonBasedOnChatState();
    });
    
    $(".chat-need-help-btn-rounded .open-chat").on('click', function() {
        //console.log('opennnn');
        if ($('.live-chat-avatar-side').hasClass('active')) {
            $('.live-chat-avatar-side').removeClass('active').addClass('closed');
        } else {
            $('.live-chat-avatar-side').removeClass('closed').addClass('active');
        }
        updateButtonBasedOnChatState();
    });
   
    $(".chat-need-help-btn-rounded .close-chat").on('click', function() {
        //console.log('closeeee');
        $('.live-chat-avatar-side').addClass('closed').removeClass('active');
        $('.chat-need-help-btn-rounded').removeClass("close").addClass("open");
       
        if ($('.live-chat-avatar-side').hasClass('closed') &amp;&amp; $('.fc_frame').hasClass('fc_open')) {
            //$('.title-close-btn').trigger('click');
            setTimeout(() =&gt; {
                $('.live-chat-avatar-side').addClass('closed').removeClass('active');
                fcPreChatform.on_fc_pre_form_close();closePreChat(event);
            }, 100);
        }
        return false;
    });

    $("#livechat").on('click', function() {
        //console.log("chat vf me");
        setTimeout(function() {
            $('#fc_frame').css('visibility' , 'hidden');
        }, 500);
        if ($('.chat-fc-form').length &gt; 0) {
            $('.chat-fc-form')[0].reset();
            $('.pre-fc-error').hide();
            $('.pre-fc-field').removeClass('focused filled');
        } 
    });

    function initializeChatWidget() {
        window.fcWidget.on("widget:closed", function(resp) {
            //console.log("Widget was closed", resp);
            setTimeout(() =&gt; {
                $('.chat-need-help-btn-rounded').removeClass("close").addClass("open");
            }, 500);
            
        });
    }
    
    if (window.fcWidget) {
        initializeChatWidget();
    } else {
        window.fcAsyncInit = function() {
            fcWidget.init({
            });
            setTimeout(() =&gt; {
                initializeChatWidget(); 
            }, 100);
        };
    }
    

    
    $(document).on('click', function(event) {
        // Proceed only if the specific conditions are not met
        if (!$('.live-chat-avatar-side').hasClass('closed') &amp;&amp; !$('.fc_frame').hasClass('fc_open')) {
            // Targets
            var liveChatAvatarSide = $('.live-chat-avatar-side.active');
            var chatNeedHelpBtn = $('.chat-need-help-btn-rounded.close');
    
            // Check if the click was outside the specified elements
            if (!liveChatAvatarSide.is(event.target) &amp;&amp; liveChatAvatarSide.has(event.target).length === 0 &amp;&amp;
                !chatNeedHelpBtn.is(event.target) &amp;&amp; chatNeedHelpBtn.has(event.target).length === 0) {
                
                // Perform class swaps
                chatNeedHelpBtn.removeClass('close').addClass('open');
                liveChatAvatarSide.removeClass('active').addClass('closed');
            }
        }
    });
    
    // Add click event listeners to prevent closing when interacting directly with the targeted divs
    $('.live-chat-avatar-side.active, .chat-need-help-btn-rounded.close').on('click', function(event) {
        event.stopPropagation();
    });
    
    

});





$("#lcv2").on('click', function() {
    $(this).toggleClass("active");
});

$(".close-chat-intro").on('click', function() {
    $('.live-chat-avatar-side.active .chat-need-help-btn-rounded').css('pointer-events', 'none');
    $('.live-chat-avatar-side .chat-btn').css('pointer-events', 'none');
    $('.live-chat-avatar-side').removeClass("active");
    $('.live-chat-avatar-side').addClass("closed");
    setTimeout(function() {
        $('.live-chat-avatar-side .chat-need-help-btn-rounded').css('pointer-events', 'auto');
    }, 1500);
});

$(".chat-with-me").on('click', function() {
    if (timelivechat) {
        timelivechat.refresh();
    }
    //$('.live-chat-avatar-side').removeClass("active").addClass('opened');
	$('.live-chat-avatar-side').removeClass("opened active").addClass('closed');
//     setTimeout(function() {
//         $('.live-chat-avatar-side').removeClass("opened active").addClass('closed');
//     }, 2000);
    //$(".live-chat-avatar-side").addClass("opened");
    $(".avatar").show();
    if (!!openWidget) {
        openWidget();
    }
	setTimeout(function() {
        $('#fc_frame').css('visibility' , 'hidden');
    }, 500);
    $('.chat-need-help-btn-rounded').removeClass("open").addClass("close");
});

$("#facebook.chat-btn").on('click', function() {
    if (timelivechat) {
        timelivechat.refresh();
    }
});

$('.site-footer__icon.chat-with-me').unbind( "click" ).on('click', function() {
  if (timelivechat) {
        timelivechat.refresh();

        if(timelivechat.livechatend()) {
            var fbUrl = $('#facebook.chat-btn').attr('href');
            if(fbUrl) {
                fbUrl = 'https://m.me/TIMEinternet';
            }
            window.open(fbUrl, '_blank').focus();
        } else {
      $('.live-chat-avatar-side.closed .chat-need-help-btn-rounded').css('pointer-events', 'auto');
            $('.live-chat-avatar-side.closed .chat-btn').css('pointer-events', 'none');
            setTimeout(function() {
                $('.live-chat-avatar-side').removeClass("closed").addClass('active');
            }, 100);
            setTimeout(function() {
                $('.live-chat-avatar-side.active .chat-btn').css('pointer-events', 'auto');
            }, 600);
            if($('#livechat') &amp;&amp; $('#livechat').length &gt; 0) {
                $('#livechat').click();
            }
        }
    }
});

$(".lcv2.docked").bind('DOMSubtreeModified', function(e) {});

if ($("#fc_frame.fc_open").length) {
    if (console) {
        console.log('#fc_frame.fc_open: yes');
    }
}

$(window).on('load', function() {
    resizer();
});

$(document).ready(function() {
	// setTimeout(function(){ 
	// 	$('.live-chat-avatar-side').removeClass("closed").addClass('active');
	// 	$('.live-chat-avatar-side .chat-btn').css('pointer-events', 'auto');
	// }, 2000);
//    if(!localStorage.getItem('pageLoadedBefore')) {
// 	   setTimeout(function(){ 
// 		   $('.live-chat-avatar-side').removeClass("closed").addClass('active');
// 		   $('.live-chat-avatar-side .chat-btn').css('pointer-events', 'auto');
// 	   }, 4000);
// 	   localStorage.setItem('pageLoadedBefore', true);
//    }
});

$(document).ready(function() {
    // initialize timelivechat
    timelivechat.init($('.chat-bubble-black span#livechat'), $('.chat-bubble-black a#facebook'), 'hide_me');
    var position = $(window).scrollTop();
    // should start at 0
    //if (position == 0) {
    //    $('.live-chat-avatar-side').addClass('closed').removeClass('active');
    //    $('.live-chat-avatar-side .chat-btn').css('pointer-events', 'none');
    //}

    $(window).scroll(function() {
        var scroll = $(window).scrollTop();
        if (scroll &gt; 100) {
            $('.live-chat-avatar-side').addClass('closed').removeClass('active');
            $('.live-chat-avatar-side .chat-btn').css('pointer-events', 'none');
        } 
// 		else if (scroll &lt;= 100) {
//             setTimeout(function() {
//                 $('.live-chat-avatar-side').removeClass("closed").addClass('active');
//                 $('.live-chat-avatar-side .chat-btn').css('pointer-events', 'auto');
//             }, 60000);
//         }
//         position = scroll;

    });
});


</pre></body></html>