!function(){"use strict";var r={_whatToTrace:[function(e,t){return`groupBy=substr(${e},1)`},function(e,t){return e+`=${t}*`}]},a={_whatToTrace:function(e,t,n,r){return console.debug("overSchema => level",n,"over",r),1===n&&t.length>r?e+`=${t}*&groupBy=substr(${e},${n+r+1})`:null}},v={dateTitle:["_utime","_startTime","_updateTime"],sfaTitle:["_2fDevices"]},i={home:[]};angular.module("llngSessionsExplorer",["ui.tree","ui.bootstrap","llApp"]).controller("SessionsExplorerCtrl",["$scope","$translator","$location","$q","$http",function($,t,e,n,p){var f,h;return $.links=links,$.menulinks=menulinks,$.staticPrefix=staticPrefix,$.scriptname=scriptname,$.formPrefix=formPrefix,$.availableLanguages=availableLanguages,$.waiting=!0,$.showM=!1,$.showT=!0,$.data=[],$.currentScope=null,$.currentSession=null,$.menu=i,$.searchString="",$.sfatypes={},$.translateP=t.translateP,$.translate=t.translate,$.translateTitle=function(e){return t.translateField(e,"title")},h="persistent",$.menuClick=function(e){if(e.popup)window.open(e.popup);else switch(e.action||(e.action=e.title),typeof e.action){case"function":e.action($.currentNode,$),$[e.action]();break;case"string":$[e.action]();break;default:console.warn("Unknown action type",typeof e.action)}return $.showM=!1},$.search2FA=function(e){return e&&($.searchString=""),$.currentSession=null,$.data=[],$.updateTree2("",$.data,0,0)},$.delete2FA=function(e,t){for(var n=document.querySelectorAll(".data-"+t),r=0,a=n.length;r<a;r++)n[r].remove();return $.waiting=!0,p.delete(`${scriptname}sfa/${h}/${$.currentSession.id}?type=${e}&epoch=`+t).then(function(e){return $.waiting=!1},function(e){return $.waiting=!1}),$.showT=!1},$.stoggle=function(e){var t=e.$modelValue;return 0===t.nodes.length&&$.updateTree(t.value,t.nodes,t.level,t.over,t.query,t.count),e.toggle()},$.displaySession=function(e){var t,n=function(e){var t,n,r,a,i,o,u,s,l,c,p,f,h,d,g,m,y,w=e._utime;for(l in e)(y=e[l])?("string"==typeof e&&y.match(/; /)&&(e[l]=y.split("; ")),"object"!=typeof e[l]&&("_password".match(new RegExp("\b"+l+"\b"))?e[l]="********":l.match(/^(_utime|_lastAuthnUTime|_lastSeen|notification)$/)?e[l]=$.localeDate(y):l.match(/^(_startTime|_updateTime)$/)&&(n=y.match(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/),e[l]=`${n[3]}/${n[2]}/${n[1]} à ${n[4]}:${n[5]}:`+n[6]))):delete e[l];for(i in h=[],v){for(g=[],u=0,c=(a=v[i]).length;u<c;u++){if(e[r=a[u]])if("_2fDevices"===r&&e[r]){if(0<(t=JSON.parse(e[r])).length)for(g.push({title:"2fid",value:"name",type:"type",epoch:"date"}),s=0,p=t.length;s<p;s++){for(l in d=t[s])y=d[l],"type"===l&&(m=y),"name"===l&&(f=y),"epoch"===l&&(o=y);g.push({title:"["+m+"]"+o,type:m,value:f,epoch:o,sfrow:!0})}}else e[r].toString().match(/\w+/)&&g.push({title:r,value:e[r]});delete e[r]}0<g.length&&h.push({title:`__${i}__`,nodes:g})}return{_utime:w,nodes:h}};return $.currentScope=e,t=e.$modelValue.session,p.get(scriptname+`sfa/${h}/`+t).then(function(e){return $.currentSession=n(e.data),$.currentSession.id=t}),$.showT=!1},$.localeDate=function(e){return new Date(1e3*e).toLocaleString()},$.getLanguage=function(e){return $.lang=e,$.form="white",$.init(),$.showM=!1},$.$on("$locationChangeSuccess",function(e,t,n){t=t.match(/#!?\/(\w+)/);return null!==t&&!t[1].match(/^(persistent)$/)||($.type="_session_uid"),$.init()}),f=0,$.updateTree=function(i,o,u,s,e,t){var l,c;return $.waiting=!0,c=r[$.type]||r._whatToTrace,l=c[u]($.type,i,e),25<t&&a[$.type]&&(t=a[$.type]($.type,i,u,s,e))?(s++,l=t,u-=1):s=0,p.get(scriptname+`sfa/${h}?`+l+Object.entries($.sfatypes).map(function(e){return e[1]?"&type="+e[0]:""}).join("")).then(function(e){var t,n,r,a,e=e.data;if(e.result){for(t=0,n=(a=e.values).length;t<n;t++)r=a[t],f++,r.id="node"+f,u<c.length-1&&(r.nodes=[],r.level=u+1,r.query=l,r.over=s),o.push(r);""===i&&($.total=e.total)}return $.waiting=!1},function(e){return $.waiting=!1})},$.updateTree2=function(i,o,u,s,e,t){var l,c;return $.waiting=!0,c=r[$.type]||("_updateTime"===$.type?r._startTime:r._whatToTrace),l=c[u]($.type,i,e),25<t&&a[$.type]&&(t=a[$.type]($.type,i,u,s,e))?(s++,l=t,u-=1):s=0,p.get(`${scriptname}sfa/${h}?_session_uid=${$.searchString}*&groupBy=substr(_session_uid,${$.searchString.length})`+Object.entries($.sfatypes).map(function(e){return e[1]?"&type="+e[0]:""}).join("")).then(function(e){var t,n,r,a,e=e.data;if(e.result){for(t=0,n=(a=e.values).length;t<n;t++)r=a[t],f++,r.id="node"+f,u<c.length-1&&(r.nodes=[],r.level=u+1,r.query=l,r.over=s),o.push(r);""===i&&($.total=e.total)}return $.waiting=!1},function(e){return $.waiting=!1})},$.init=function(){return $.waiting=!0,$.data=[],n.all([t.init($.lang),$.updateTree("",$.data,0,0)]).then(function(){return $.waiting=!1},function(e){return $.waiting=!1}),$.activeModule="2ndFA",$.myStyle={color:"#ffb84d"}},e=e.path().match(/^\/(\w+)/),$.type=e?e[1]:"_whatToTrace"}])}();