!function(){var w,e,h,m,v,y,b,k,t,x,d,C=[].indexOf||function(t){for(var e=0,o=this.length;e<o;e++)if(e in this&&this[e]===t)return e;return-1},s={},o={},T=function(t,e){return S(t,o[t]=e),Object.values(o).every(function(t){return"good"===t||"info"===t})?null!=(t=$("#newpassword").get(0))&&t.setCustomValidity(""):null!=(e=$("#newpassword").get(0))&&e.setCustomValidity(j("PE28")),O()},S=function(t,e){switch($("#"+t).removeClass("fa-times fa-check fa-spinner fa-pulse fa-info-circle fa-question-circle text-danger text-success text-info text-secondary"),$("#"+t).attr("role","status"),e){case"good":return $("#"+t).addClass("fa-check text-success");case"bad":return $("#"+t).addClass("fa-times text-danger"),$("#"+t).attr("role","alert");case"unknown":return $("#"+t).addClass("fa-question-circle text-secondary");case"waiting":return $("#"+t).addClass("fa-spinner fa-pulse text-secondary");case"info":return $("#"+t).addClass("fa-info-circle text-info")}},O=function(){var t;return null!=(t=$("#newpassword").get(0))&&t.checkValidity()&&null!=(t=$("#confirmpassword").get(0))&&t.checkValidity()?$(".ppolicy").removeClass("border-danger").addClass("border-success"):$(".ppolicy").removeClass("border-success").addClass("border-danger")},P=function(a){return $.getJSON(window.staticPrefix+"languages/"+a+".json",function(t){var e,o,n,r;for(e in s=t,o=window.datas.trOver.all)r=o[e],s[e]=r;if(window.datas.trOver[a])for(e in n=window.datas.trOver[a])r=n[e],s[e]=r;return $("[trspan]").each(function(){for(var t=$(this).attr("trspan").split(","),e=j(t.shift()),o=0,n=t.length;o<n;o++)r=t[o],e=e.replace(/%[sd]/,r);return $(this).html(e)}),$("[trmsg]").each(function(){if($(this).html(j("PE"+$(this).attr("trmsg"))),j("PE"+$(this).attr("trmsg")).match(/_hide_/))return $(this).parent().hide()}),$("[trattribute]").each(function(){for(var t,e,o=$(this).attr("trattribute").trim().split(/\s+/),n=0,r=o.length;n<r;n++)t=(e=o[n].split(":"))[0],e=e[1],t&&e&&$(this).attr(t,j(e));return!0}),$("[trplaceholder]").each(function(){var t=j($(this).attr("trplaceholder"));return $(this).attr("placeholder",t),$(this).attr("aria-label",t)}),$("[localtime]").each(function(){var t=new Date(1e3*$(this).attr("localtime"));return $(this).text(t.toLocaleString())})})},j=function(t){return s[t]||t};window.translate=j,m=function(){var n={};return $("script[type='application/init']").each(function(){var t,e,o;try{for(t in o=JSON.parse($(this).text()),e=[],o)e.push(n[t]=o[t]);return e}catch(t){return console.log("Parsing error",t),console.log("JSON",$(this).text())}}),console.log(n),n},h=function(t){t=RegExp("[?&]"+t+"=([^&]*)").exec(window.location.search);return t?decodeURIComponent(t[1].replace(/\+/g," ")):null},d="#appslist",x=function(){return t("_appsListOrder",$(d).sortable("toArray").join())},y=function(t){return e("_oidcConsents",t,function(){return $("[partner='"+t+"']").hide()},function(t,e,o){return alert(e+" "+o)})},t=function(e,o,n,r){return $.ajax({type:"GET",url:scriptname+"mysession/?gettoken",dataType:"json",error:r,success:function(t){t={token:t.token};return t[e]=o,$.ajax({type:"PUT",url:scriptname+"mysession/persistent",dataType:"json",data:t,success:n,error:r})}})},e=function(e,o,n,r){return $.ajax({type:"GET",url:scriptname+"mysession/?gettoken",dataType:"json",error:r,success:function(t){return $.ajax({type:"DELETE",url:scriptname+"mysession/persistent/"+e+"?sub="+o+"&token="+t.token,dataType:"json",success:n,error:r})}})},b=function(){var t,e,o,n,r,a,s,i,l,c,u=$(d);if(null==u||!w.appslistorder)return null;for(t=w.appslistorder.split(","),i=[],e=0,a=(n=u.sortable("toArray")).length;e<a;e++)i[c=n[e]]=c;for(r=0,s=t.length;r<s;r++)i[l=t[r]]&&(o=i[l],o=$(d+".ui-sortable").children("#"+o),l=$(d+".ui-sortable").children("#"+l),o.remove(),$(d+".ui-sortable").filter(":first").append(l));return 1},v=function(){return $.ajax({type:"POST",url:scriptname,data:{ping:1},dataType:"json",success:function(t){return null!=t.result&&1===t.result?setTimeout(v,w.pingInterval):location.reload(!0)},error:function(t,e,o){return location.reload(!0)}})},window.ping=v,k=function(t,e,o){var n=w.sameSite,r=w.cookieSecure,t=t+"="+e+"; path=/; SameSite="+n;return o&&((e=new Date).setTime(e.getTime()+864e5*o),t+="; expires="+e.toUTCString()),r&&(t+="; Secure"),document.cookie=t},w={},$(window).on("load",function(){var t,e,o,n,r,a,s,i,l,c,u,d,p,f,g;w=m(),"datas"in window&&"choicetab"in window.datas&&(w.choicetab=window.datas.choicetab),window.datas=w,$("#appslist").sortable({axis:"y",cursor:"move",opacity:.5,revert:!0,items:"> div.category",update:x}),b(),$("div.message").fadeIn("slow"),$("input[name=timezone]").val(-(new Date).getTimezoneOffset()/60),g=$("#menu").tabs({active:0}),u=$('#menu a[href="#'+w.displaytab+'"]').parent().index(),g.tabs("option","active",u=u<0?0:u),g=$("#authMenu").tabs({active:0}),u=$('#authMenu a[href="#'+w.displaytab+'"]').parent().index(),g.tabs("option","active",u=u<0?0:u),w.choicetab&&g.tabs("option","active",$('#authMenu a[href="#'+w.choicetab+'"]').parent().index()),0===$("input[autofocus]").length&&$("input[type!=hidden]:first").focus(),w.newwindow&&$("#appslist a").attr("target","_blank"),$("p.removeOther").length&&(u=$("#form").attr("action"),g=$("#form").attr("method"),console.log("method=",g),a="",$("#form input[type=hidden]")&&(console.log("Parse hidden values"),$("#form input[type=hidden]").each(function(t){return console.log(" ->",$(this).attr("name"),$(this).val()),a+="&"+$(this).attr("name")+"="+$(this).val()})),e="",u&&(console.log("action=",u),-1!==u.indexOf("?")?u.substring(0,u.indexOf("?")):e=u+"?",e+=a,a=""),u=$("p.removeOther a").attr("href")+"&method="+g+a,e&&(u+="&url="+btoa(e)),$("p.removeOther a").attr("href",u)),window.location.search&&((d=h("llnglanguage"))&&console.log("Get lang from parameter"),1===(f=h("setCookieLang")))&&console.log("Set lang cookie"),i?C.call(window.availableLanguages,i)<0&&(i=window.datas.language,d||console.log("Lang not available -> Get lang from server")):(i=window.datas.language)&&!d&&console.log("Get lang from server"),d?(C.call(window.availableLanguages,d)<0&&(console.log("Lang not available -> Get lang from server"),d=window.language),console.log("Selected lang ->",d),f&&(console.log("Set cookie lang ->",d),k("llnglanguage",d,3650)),P(d)):(console.log("Selected lang ->",i),P(i)),l="";for(s=0,c=(p=window.availableLanguages).length;s<c;s++)t=p[s],l+='<img class="langicon" src="'+window.staticPrefix+"common/"+t+'.png" title="'+t+'" alt="['+t+']"> ';return $("#languages").html(l),$(".langicon").on("click",function(){return i=$(this).attr("title"),k("llnglanguage",i,3650),P(i)}),o=function(t,e){var o=jQuery.Event("checkpassword"),t={password:t,evType:e,setResult:T};return $(document).trigger(o,t)},n=function(){var t;return null!=(t=$("#confirmpassword").get(0))&&t.value&&(null!=(t=$("#confirmpassword").get(0))?t.value:void 0)===(null!=(t=$("#newpassword").get(0))?t.value:void 0)?(null!=(t=$("#confirmpassword").get(0))&&t.setCustomValidity(""),S("samepassword-feedback","good"),O(),!0):(null!=(t=$("#confirmpassword").get(0))&&t.setCustomValidity(j("PE34")),S("samepassword-feedback","bad"),O(),!1)},null!=window.datas.ppolicy&&$("#newpassword").length&&(o(""),n(),$("#confirmpassword").keyup(function(t){n()}),$("#newpassword").keyup(function(t){o(t.target.value),n()}),$("#newpassword").focusout(function(t){o(t.target.value,"focusout"),n()})),g=function(t){return t.target.checked?($("#newpassword").off("keyup"),null!=(t=$("#newpassword").get(0))?t.setCustomValidity(""):void 0):($("#newpassword").keyup(function(t){o(t.target.value)}),o(""))},$("#newpassword").change(n),$("#confirmpassword").change(n),null!=window.datas.ppolicy&&$("#newpassword").length&&$("#reset").change(g),$(".localeDate").each(function(){var t=new Date(1e3*$(this).attr("val"));return $(this).text(t.toLocaleString())}),$(".oidcConsent").on("click",function(){return y($(this).attr("partner"))}),w.pingInterval&&0<w.pingInterval&&window.setTimeout(v,w.pingInterval),w.enablePasswordDisplay&&(r="",w.dontStorePassword?($(".toggle-password").on("mousedown touchstart",function(){return r=(r=$(this).attr("id")).replace(/^toggle_/,""),console.log("Display",r),$(this).toggleClass("fa-eye fa-eye-slash"),$("input[name="+r+"]").attr("class","form-control")}),$(".toggle-password").on("mouseup touchend",function(){if($(this).toggleClass("fa-eye fa-eye-slash"),$("input[name="+r+"]").get(0).value)return $("input[name="+r+"]").attr("class","form-control key")})):($(".toggle-password").on("mousedown touchstart",function(){return r=(r=$(this).attr("id")).replace(/^toggle_/,""),console.log("Display",r),$(this).toggleClass("fa-eye fa-eye-slash"),$("input[name="+r+"]").attr("type","text")}),$(".toggle-password").on("mouseup touchend",function(){return $(this).toggleClass("fa-eye fa-eye-slash"),$("input[name="+r+"]").attr("type","password")}))),$("#reset").change(function(){var t=$(this).prop("checked");return console.log("Reset is checked",t),!0===t?($("#ppolicy").hide(),$("#newpasswords").hide(),$("#newpassword").removeAttr("required"),$("#confirmpassword").removeAttr("required"),null!=(t=$("#confirmpassword").get(0))?t.setCustomValidity(""):void 0):($("#ppolicy").show(),$("#newpasswords").show(),$("#newpassword").attr("required",!0),$("#confirmpassword").attr("required",!0),(null!=(t=$("#confirmpassword").get(0))?t.value:void 0)===(null!=(t=$("#newpassword").get(0))?t.value:void 0)?null!=(t=$("#confirmpassword").get(0))?t.setCustomValidity(""):void 0:null!=(t=$("#confirmpassword").get(0))?t.setCustomValidity(j("PE34")):void 0)}),$("#passwordfield").on("input",function(){return $("#passwordfield").get(0).value&&w.dontStorePassword?$("#passwordfield").attr("class","form-control key"):$("#passwordfield").attr("class","form-control")}),$("#oldpassword").on("input",function(){return $("#oldpassword").get(0).value&&w.dontStorePassword?$("#oldpassword").attr("class","form-control key"):$("#oldpassword").attr("class","form-control")}),$("#newpassword").on("input",function(){return $("#newpassword").get(0).value&&w.dontStorePassword?$("#newpassword").attr("class","form-control key"):$("#newpassword").attr("class","form-control")}),$("#confirmpassword").on("input",function(){return $("#confirmpassword").get(0).value&&w.dontStorePassword?$("#confirmpassword").attr("class","form-control key"):$("#confirmpassword").attr("class","form-control")}),$(".clear-finduser-field").on("click",function(){return $(this).parent().find(":input").each(function(){return console.log("Clear search field ->",$(this).attr("name")),$(this).val("")})}),$("#closefinduserform").on("click",function(){return console.log("Clear modal"),$("#finduserForm").trigger("reset")}),$("#finduserbutton").on("click",function(t){return t.preventDefault(),document.body.style.cursor="progress",t=$("#finduserForm").serialize(),console.log("Send findUser request with parameters",t),$.ajax({type:"POST",url:portal+"finduser",dataType:"json",data:t,success:function(t){var e;if(document.body.style.cursor="default",e=t.user,console.log("Suggested spoofId=",e),$("input[name=spoofId]").each(function(){return $(this).val(e)}),t.captcha&&$("#captcha").attr("src",t.captcha),t.token)return $("#finduserToken").val(t.token),$("#token").val(t.token)},error:function(t,e,o){var n;if(document.body.style.cursor="default",o&&console.log("Error",o),(n=t?JSON.parse(t.responseText):n)&&n.error)return console.log("Returned error",n)}})}),$("#btn-back-to-top").on("click",function(){return console.log("Back to top"),document.body.scrollTop=0,document.documentElement.scrollTop=0}),$(window).on("scroll",function(){return w.scrollTop&&(document.body.scrollTop>Math.abs(w.scrollTop)||document.documentElement.scrollTop>Math.abs(w.scrollTop))?$("#btn-back-to-top").css("display","block"):$("#btn-back-to-top").css("display","none")}),$(".btn-single-submit").on("click",function(t){return!0===$(this).data("data-submitted")?(t.preventDefault(),$(this).prop("disabled",!0)):$(this).data("data-submitted",!0)}),$(document).trigger("portalLoaded"),!0})}.call(this);