a.$emit("calendars:list")})}functionG(){H.mode.search=!1,m.$filter(H.componentType,{value:""})}varH=this,I=[];H.component=m,H.componentType="events",H.selectedList=0,H.selectComponentType=p,H.unselectComponents=q,H.selectAll=r,H.searchMode=t,H.toggleComponentSelection=s,H.confirmDeleteSelectedComponents=u,H.openEvent=v,H.openTask=w,H.newComponent=y,H.filterpopup=A,H.filter=B,H.filteredBy=C,H.sort=D,H.sortedBy=E,H.reload=F,H.cancelSearch=G,H.mode={search:!1,multiple:0},o(I),i.ready().then(function(){vara="events";"tasksListView"==i.settings.Calendar.SelectedList&&(H.selectedList=1,a="tasks"),p(a,{reload:!0})}),a.$on("calendars:list",function(){m.$filter(H.componentType,{reload:!0})}),a.$on("calendar:dragend",z),b.$on("$destroy",function(){_.forEach(I,function(a){f.deregisterHotkey(a)})})}a.$inject=["$rootScope","$scope","$timeout","$state","$mdDialog","sgHotkeys","sgFocus","Dialog","Preferences","CalendarSettings","Calendar","Component","Alarm"],angular.module("SOGo.SchedulerUI").controller("CalendarListController",a)}(),function(){"use strict";functiona(a,b,c,d,e,f,g,h,i,j,k,m,n,o){functionp(a,b,c){returna.sortableScope.element[0]==b.element[0]}functionq(){m.saveFoldersOrder(_.flatMap(m.$findAll(),"id"))}functionr(){G.sortableMode=!G.sortableMode,G.filter.name=""}functions(){m.saveFoldersOrder()}functiont(a){i.prompt(l("New calendar"),l("Name of the Calendar")).then(function(a){varb=newm({name:a,isEditable:!0,isRemote:!1,owner:UserLogin});b.$id().then(function(){m.$add(b)})})}functionu(){functiona(a,b,c,d){vare=this,f=c.split("/"),g=f[2];e.title=l("Please identify yourself to %{0}").formatted(g),e.authenticate=function(a){!a.$valid&&a.$error.required||d.setCredentials(e.username,e.password).then(function(a){b.hide()},function(b){a.password.$setValidity("credentials",!1)})},e.cancel=function(){b.cancel()}}i.prompt(l("Subscribe to a web calendar..."),l("URL of the Calendar"),{inputType:"url"}).then(function(b){m.$addWebCalendar(b).then(function(c){angular.isObject(c)&&d.show({parent:angular.element(document.body),clickOutsideToClose:!0,escapeToClose:!0,templateUrl:"UIxWebCalendarAuthDialog",controller:a,controllerAs:"$WebCalendarAuthDialogController",locals:{url:b,calendar:c}})})}),a.$inject=["scope","$mdDialog","url","calendar"]}functionv(a){a.isSubscription?a.$delete().catch(function(b,c){i.alert(l('An error occured while deleting the calendar "%{0}".',a.name),l(b.error))}):i.confirm(l("Warning"),l('Are you sure you want to delete the calendar "%{0}"?',a.name),{ok:l("Delete")}).then(function(){a.$delete().catch(function(b,c){i.alert(l('An error occured while deleting the calendar "%{0}".',a.name),l(b.error))})})}functionw(b,c){functione(b,c,d){functione(a){varb=0===a.type.indexOf("text")||/\.(ics)$/.test(a.name);returnb||f.show({template:["<md-toast>",' <div class="md-toast-content">',' <md-icon class="md-warn md-hue-1">error_outline</md-icon>'," <span>"+l("Select an iCalendar file (.ics).")+"</span>"," </div>","</md-toast>"].join(""),position:"top right",hideDelay:3e3}),b}varh=this;h.uploader=newg({url:ApplicationBaseURL+[d.id,"import"].join("/"),autoUpload:!0,queueLimit:1,filters:[{name:e,fn:e}],onSuccessItem:function(b,d,e,g){varh;c.hide(),0===d.imported?h=l("No event was imported."):(h=l("A total of %{0} events were imported in the calendar.",d.imported),a.$emit("calendars:list")),f.show(f.simple().content(h).position("top right").hideDelay(3e3))},onErrorItem:function(a,b,c,d){f.show({template:["<md-toast>",' <div class="md-toast-content">',' <md-icon class="md-warn md-hue-1">error_outline</md-icon>'," <span>"+l("An error occurred while importing calendar.")+"</span>"," </div>","</md-toast>"].join(""),position:"top right",hideDelay:3e3})}}),h.close=function(){c.hide()}}d.show({parent:angular.element(document.body),targetEvent:b,clickOutsideToClose:!0,escapeToClose:!0,templateUrl:"UIxCalendarImportDialog",controller:e,controllerAs:"$CalendarImportDialogController",locals:{folder:c}}),e.$inject=["scope","$mdDialog","folder"]}functionx(a){_.forEach(m.$findAll(),function(b){a.id=