(function(){var e;e=angular.module("llngManager",["ui.tree","ui.bootstrap","llApp","ngCookies"]),e.controller("TreeCtrl",["$scope","$http","$location","$q","$uibModal","$translator","$cookies","$htmlParams",function(e,t,n,r,a,o,i,s){var u,l,d,c,f,p,m,g,h,w;return e.links=window.links,e.menu=s.menu,e.menulinks=window.menulinks,e.staticPrefix=window.staticPrefix,e.formPrefix=window.formPrefix,e.availableLanguages=window.availableLanguages,e.waiting=!0,e.showM=!1,e.showT=!1,e.form="home",e.currentCfg={},e.confPrefix=window.confPrefix,e.message={},e.result="",e.translateTitle=function(e){return o.translateField(e,"title")},e.translateP=o.translateP,e.translate=o.translate,e.helpUrl="start.html#configuration",e.setShowHelp=function(t){var n;return null==t&&(t=!e.showH),e.showH=t,n=new Date(Date.now()),n.setFullYear(n.getFullYear()+1),i.put("showhelp",t?"true":"false",{expires:n})},e.showH="false"!==i.get("showhelp"),null==e.showH&&e.setShowHelp(!0),g=function(t){var n,r;return n=t.status,r=t.statusLine,e.waiting=!1,403===n?e.message={title:"forbidden",message:"",items:[]}:401===n?(console.log("Authentication needed"),e.message={title:"authenticationNeeded",message:"__waitOrF5__",items:[]}):e.message=400===n?{title:"badRequest",message:r,items:[]}:n>0?{title:"badRequest",message:r,items:[]}:{title:"networkProblem",message:"",items:[]},e.showModal("message.html")},e.showModal=function(t,n){var o,i;return i=a.open({templateUrl:t,controller:"ModalInstanceCtrl",size:"lg",resolve:{elem:function(){return function(t){return e[t]}},set:function(){return function(t,n){return e[t]=n}},init:function(){return n}}}),o=r.defer(),i.result.then(function(t){return e.message={title:"",message:"",items:[]},o.resolve(t)},function(t){return e.message={title:"",message:"",items:[]},o.reject(t)}),o.promise},e.menuClick=function(t){if(t.popup)window.open(t.popup);else switch(t.action||(t.action=t.title),typeof t.action){case"function":t.action(e.currentNode,e);break;case"string":e[t.action]();break;default:console.log(typeof t.action)}return e.showM=!1},e.home=function(){return e.form="home",e.showM=!1},u=function(t){var r;if(e.message={title:"",message:"",items:[],itemsE:[],itemsNC:[],itemsW:[]},t.needConfirm&&(e.confirmNeeded=!0),t.message&&(e.message.message=t.message),t.details){for(r in t.details)"__changes__"!==r&&("__needConfirmation__"===r?(e.message.itemsNC.push({message:r,items:t.details[r]}),console.log("NeedConfirmation:",e.message.itemsNC)):"__warnings__"===r?(e.message.itemsW.push({message:r,items:t.details[r]}),console.log("Warnings:",e.message.itemsW)):(e.message.itemsE.push({message:r,items:t.details[r]}),console.log("Errors:",e.message.itemsE)));e.message.items=e.message.itemsE.concat(e.message.itemsNC.concat(e.message.itemsW))}return e.waiting=!1,1===t.result?(n.path("/confs/"),e.message.title="successfullySaved"):e.message.title="saveReport",e.showModal("message.html")},e.downloadConf=function(){return window.open(e.confPrefix+e.currentCfg.cfgNum+"?full=1")},e.save=function(){return e.showModal("save.html").then(function(){return e.waiting=!0,e.data.push({id:"cfgLog",title:"cfgLog",data:e.result?e.result:""}),t.post(window.confPrefix+"?cfgNum="+e.currentCfg.cfgNum+(e.forceSave?"&force=1":""),e.data).then(function(t){return e.data.pop(),u(t.data)},function(t){return g(t),e.data.pop()})},function(){return console.log("Saving canceled")}),e.showM=!1},e.saveRawConf=function(n){return e.waiting=!0,t.post(window.confPrefix+"/raw",n).then(function(e){return u(e.data)},g)},e.restore=function(){return e.currentNode=null,e.form="restore"},e.cancel=function(){return e.currentNode.data=null,e.getKey(e.currentNode)},p=1,e._findContainer=function(){return e._findScopeContainer().$modelValue},e._findScopeContainer=function(){var t;for(t=e.currentScope;!t.$modelValue.type.match(/Container$/);)t=t.$parentNodeScope;return t},e._findScopeByKey=function(t){var n;for(n=e.currentScope;n.$modelValue.title!==t;)n=n.$parentNodeScope;return n},e.newGrantRule=function(){var t,n;return n=e._findContainer(),t=n.nodes.length,t>0?t-1:0,n.nodes.push({id:n.id+"/n"+p++,title:"New rule",re:"Message",comment:"New rule",data:"1",type:"grant"})},e.newRule=function(){var t,n,r;return r=e._findContainer(),t=r.nodes.length,n=t>0?t-1:0,r.nodes.splice(n,0,{id:r.id+"/n"+p++,title:"New rule",re:"^/new",comment:"New rule",data:"accept",type:"rule"})},e.newPost=function(){var t;return t=e._findContainer(),t.nodes.push({id:t.id+"/n"+p++,title:"/absolute/path/to/form",data:{},type:"post"})},e.newPostVar=function(){return null==e.currentNode.data.vars&&(e.currentNode.data.vars=[]),e.currentNode.data.vars.push(["var1","$uid"])},e.newAuthChoice=function(){var t;return t=e._findContainer(),t.nodes.push({id:t.id+"/n"+p++,title:"1_Key",data:["Null","Null","Null"],type:"authChoice"}),e.execFilters(e._findScopeByKey("authParams"))},e.newHashEntry=function(){var t;return t=e._findContainer(),t.nodes.push({id:t.id+"/n"+p++,title:"new",data:"",type:"keyText"})},e.newCat=function(){var t;return t=e.currentScope,"menuApp"===t.$modelValue.type&&(t=t.$parentNodeScope),t.$modelValue.nodes.push({id:t.$modelValue.id+"/n"+p++,title:"New category",type:"menuCat",nodes:[]})},e.newApp=function(){var t;return t=e.currentScope,"menuApp"===t.$modelValue.type&&(t=t.$parentNodeScope),t.$modelValue.nodes.push({id:t.$modelValue.id+"/n"+p++,title:"New application",type:"menuApp",data:{description:"New app description",uri:"https://test.example.com/",logo:"network.png",display:"auto"}})},e.newCmbMod=function(){var t;return t=e._findContainer(),t.nodes.push({id:t.id+"/n"+p++,title:"new",type:"cmbModule",data:{type:"LDAP",for:"0",over:[]}}),e.execFilters(e._findScopeByKey("authParams"))},e.newSfExtra=function(){var t;return t=e._findContainer(),t.nodes.push({id:t.id+"/n"+p++,title:"new",type:"sfExtra",data:{type:"",rule:"",logo:"",label:"",over:[]}})},e.newSfOver=function(){var t;return t=e.currentNode.data,t.over||(t.over=[]),t.over.push(["new"+p++,""])},e.newCmbOver=function(){var t;return t=e.currentNode.data,t.over||(t.over=[]),t.over.push(["new"+p++,""])},e.newChoiceOver=function(){var t;return t=e.currentNode.data,console.log("data",t),t[5]||(t[5]=[]),t[5].push(["new"+p++,""])},e.addHost=function(){var t;return t=e.currentNode,t.data||(t.data=[]),t.data.push({k:"newHost",h:[{k:"key",v:"uid"}]})},e.addSamlAttribute=function(){var t;return t=e._findContainer(),t.nodes.push({id:t.id+"/n"+p++,title:"new",type:"samlAttribute",data:["0","New","",""]})},e.addVhost=function(){var t;return t=e.domain?"."+e.domain.data:".example.com",e.message={title:"virtualHostName",field:"hostname"},e.showModal("prompt.html",t).then(function(){var t;if(t=e.result)return e.addTemplateNode(t,"virtualHost")})},e.duplicateVhost=function(){var t;return t=e.domain?"."+e.domain.data:".example.com",e.message={title:"virtualHostName",field:"hostname"},e.showModal("prompt.html",t).then(function(){var t;return t=e.result,e.duplicateNode(t,"virtualHost",e.currentNode.title)})},e.addSamlIDP=function(){return e.newTemplateNode("samlIDPMetaDataNode","samlPartnerName","idp-example")},e.addSamlSP=function(){return e.newTemplateNode("samlSPMetaDataNode","samlPartnerName","sp-example")},e.addOidcOp=function(){return e.newTemplateNode("oidcOPMetaDataNode","oidcOPName","op-example")},e.addOidcRp=function(){return e.newTemplateNode("oidcRPMetaDataNode","oidcRPName","rp-example")},e.addCasSrv=function(){return e.newTemplateNode("casSrvMetaDataNode","casPartnerName","srv-example")},e.addCasApp=function(){return e.newTemplateNode("casAppMetaDataNode","casPartnerName","app-example")},e.newTemplateNode=function(t,n,r){return e.message={title:n,field:"name"},e.showModal("prompt.html",r).then(function(){var n;if(n=e.result)return e.addTemplateNode(n,t)})},e.addTemplateNode=function(t,n){var r,a;for(r=e.currentScope;r.$modelValue.title!==n+"s";)r=r.$parentNodeScope;return a={id:n+"s/new__"+t,title:t,type:n,nodes:templates(n,"new__"+t)},h(a.nodes),r.$modelValue.nodes.push(a),r.expand(),a},h=function(e){var t,n,r;for(r=0,t=e.length;r0&&(u=i.nodes[n],i.nodes[n]=i.nodes[n-1],i.nodes[n-1]=u),n},e.inSelect=function(t){var n,r,a,o;for(o=e.currentNode.select,a=0,n=o.length;a0?e.comment:e.re},e.filters={},e.execFilters=function(t){var n,a,o;t=t||e,o=e.filters;for(n in o)if(a=o[n],e.filters.hasOwnProperty(n))return window.filterFunctions[n](t,r,a);return!1},e.stoggle=function(e){var t;return t=e.$modelValue,c(t),e.toggle()},c=function(t){var n,r,a,o,i,s,u,l,d,c,f;for(d=["nodes","nodes_cond"],s=0,r=d.length;s