var CscopeInfo=window.CscopeInfo||{};try{var isClient="undefined"!=typeof window&&window.document}catch(o){isClient=!1}try{var isLambda="undefined"!=typeof process&&!!process.env.LAMBDA_TASK_ROOT}catch(o){isLambda=!1}try{var isWebview="undefined"!=typeof Ti}catch(o){isWebview=!1}if(isWebview)log={logInfo:function(o){Ti.API.info("CScope Info: "+o)},logError:function(o){Ti.API.error("CScope Error: "+o)},logWarn:function(o){Ti.API.warn("CScope Warn: "+o)}};else var log={logInfo:function(o){console.log("CScope Info:",o)},logError:function(o){console.log("CScope Error:",o)},logWarn:function(o){console.log("CScope Warn:",o)}};!function(i){var e,n=!1,t=environmentVariables.envVariables().environment,r=i("html");function c(){log.logInfo("init page"),i(".btn-menu").on("click",function(o){r.toggleClass("menu-opened")}),i("signmeout").click(function(){alert("You have been signed out."),CscopeInfo.signOut(),window.location="./index.html"}),i("#changepassword").click(function(){window.location="./changePassword.html"+u("changePassword")}),log.logInfo("signout click init"),i("#signout").click(function(){log.logInfo("signout click"),window.confirm("Are you sure you want to sign out?")&&(CscopeInfo.signOut(),window.location="./signin.html"+u("signOut"))}),i("#deleteAccount").click(o),i("#index-help").click(function(){window.open("./help.html?p=/index.html")}),_config[t].api.invokeUrl||i("#noApiMessage").show()}function o(){window.confirm("Account deletion cannot be undone.\nAre you sure you want to delete your account and all your data?")&&(i("#loader").show(),setTimeout(a,2e3))}function a(){i("#loader").hide(),"permanently delete"!=prompt('To confirm the deletion of your account and all your data\nenter "permanently delete" below ')?window.confirm("Deletion of account cancelled."):l()}function l(){log.logInfo("deleteAccount"),i("#loader").show(),CscopeInfo.accessToken.then(function(o){i.ajax({method:"DELETE",url:_config[t].api.invokeUrl+"/user",headers:{Authorization:e},data:{AccessToken:o},contentType:"application/json",dataType:"text",success:s,error:function(o,e,n){i("#loader").hide(),window.confirm("Could not delete account.\n"+JSON.parse(o.responseText).Error.replace("Error: ","")),console.error("Error deleting account: "+e+", Details: "+n+" Response: "+o.responseText)}})}),i("#loader").hide()}function s(o,e,n){window.alert("Thank you for using cscope.info.\nYour account and data has been deleted.\nYou can rejoin cscope.info at any time.")?l():(CscopeInfo.signOut(),window.location="./signin.html")}function u(o,e){log.logInfo("Navbar packParameters");var n="";if("changePassword"==o)return n+="?paramKey=changePassword",n+="&user="+encodeURIComponent(cscopeuser.user),log.logInfo("Change Password Params "+n),n;if("signOut"==o)return n+="?paramKey=signOut",n+="&user="+encodeURIComponent(cscopeuser.user),log.logInfo("Sign Out Params "+n),n;if("report"!=o)return"invite"==o?(n+="?paramKey=invite",n+="&team="+e.team,n+="&subTeam="+e.subTeam,n+="&user="+encodeURIComponent(e.user),n+="&key="+e.key,console.log("Params to return invite "+n),n):n+="?error=NoParamKey";var t=getSelectedDevices();return log.logInfo("PackParams CheckedList "+JSON.stringify(t)),0