var jQEngager,notify_handler,ms=Date.now(),currVersion=ms,scripts=document.getElementsByTagName("script"),index=scripts.length-1;currScript=scripts[index];var lsRepUrl=currScript.getAttribute("data-source_path"),autoReconnectInterval=5000,initVideoLoader=function(){var a=function(){var a={lsRepUrl:lsRepUrl,lang:svConfigs.smartVideoLanguage};smartVideoLocale.init(a,jQuery);var b=new comController;agentId?b.init("admin","dashboard"+agentId):b.init("admin","dashboard"),notify_handler=new notifyHandler,notify_handler.init()},b=function(){loadScript(lsRepUrl+"js/bundle.js",a)},c=function(){svConfigs.iceServers.requirePass?$.ajax({type:"POST",timeout:5e3,url:lsRepUrl+"server/script.php",data:{type:"getpassphrase"}}).done(function(a){a&&(svConfigs.iceServers.passPhrase=a,loadScript(svConfigs.appWss+"socket.io/socket.io.js",b))}).fail(function(){}):loadScript(svConfigs.appWss+"socket.io/socket.io.js",b)},d=function(){$.ajax({url:lsRepUrl+"config/config.json?v="+currVersion,type:"GET",timeout:5e3,dataType:"json",beforeSend:function(a){a&&a.overrideMimeType&&a.overrideMimeType("application/j-son;charset=UTF-8")},success:function(a){svConfigs=a,c()},error:function(a){console.log(a)}})};d()};function loadScript(a,b){var c=document.createElement("script");c.type="text/javascript",c.readyState?c.onreadystatechange=function(){("loaded"==c.readyState||"complete"==c.readyState)&&(c.onreadystatechange=null,b&&b())}:(c.onload=function(){b&&b()},c.onerror=function(){setTimeout(function(){jQEngager("#statusbar").html("Connection failed. Reconnecting..."),jQEngager("#statusbar").show(),loadScript(a,b)},autoReconnectInterval)}),c.src=a+"?v="+currVersion,document.getElementsByTagName("head")[0].appendChild(c)}var ms=Date.now();"undefined"==typeof jQuery||11>parseInt(jQuery.fn.jquery.split(".")[1])?loadScript(lsRepUrl+"js/jquery.min.js",function(){jQEngager=jQuery.noConflict(!0),jQEngager.get(lsRepUrl+"pages/version.txt?v="+ms,function(a){currVersion=a,jQEngager(document).ready(new initVideoLoader)})}):(jQEngager=jQuery,jQEngager.get(lsRepUrl+"pages/version.txt?v="+ms,function(a){currVersion=a,jQEngager(document).ready(new initVideoLoader)}));