O.markOrUnMarkMessagesAsJunk=H,O.copySelectedMessages=I,O.moveSelectedMessages=J,O.markSelectedMessagesAsFlagged=M,O.markSelectedMessagesAsUnread=N,O.selectAll=K,O.unselectMessages=L,angular.element(a).on("beforeunload",s),b.$on("$destroy",function(){angular.element(a).off("beforeunload",s),_.forEach(R,function(a){k.deregisterHotkey(a)})}),b.$watch(function(){returnO.selectedFolder.unseenCount},function(b){varc=Q+" - ";b&&(c+="("+b+") "),c+=O.selectedFolder.name,a.document.title=c}),r(R)}functionb(a){returna[0].controller.prototype.resetScroll=function(){"messagesList"==this.$element.parent().attr("id")?this.updateSize():this.scrollTo(0)},a}a.$inject=["$window","$scope","$timeout","$q","$state","$mdDialog","$mdToast","stateAccounts","stateAccount","stateMailbox","sgHotkeys","encodeUriFilter","sgFocus","Dialog","Account","Mailbox"],angular.module("material.components.virtualRepeat").decorator("mdVirtualRepeatContainerDirective",b),b.$inject=["$delegate"],angular.module("SOGo.MailerUI").controller("MailboxController",a)}(),function(){"use strict";functiona(a,b,c,d,e,f,g,h,i,j,k,m,n,o,p,q,r,s){functiont(a){S.showingAdvancedSearch=!0,S.search.mailbox=a,f(h["gt-md"])||g("left").close()}functionu(){S.showingAdvancedSearch=!1,S.service.$virtualMode=!1,Q=S.accounts[0],R=S.searchPreviousMailbox,a.go("mail.account.mailbox",{accountId:Q.id,mailboxId:j(R.path)})}functionv(){if(o.selectedFolder.$isLoading)S.virtualMailbox.stopSearch();else{varb,c=[],d=function(a){_.forEach(a,function(a){c.push(a),a.children&&a.children.length>0&&d(a.children)})};S.virtualMailbox=newp(S.accounts[0]),o.$virtualMode||(S.searchPreviousMailbox=o.selectedFolder),o.selectedFolder=S.virtualMailbox,o.$virtualMode=!0,angular.isDefined(S.search.mailbox)?(b=S.accounts[0].$getMailboxByPath(S.search.mailbox),c.push(b),S.search.subfolders&&b.children.length&&d(b.children)):c=S.accounts[0].$flattenMailboxes(),S.virtualMailbox.setMailboxes(c),S.virtualMailbox.startSearch(S.search.match,S.search.params),a.go("mail.account.virtualMailbox",{accountId:S.accounts[0].id})}}functionw(a){returnS.currentSearchParam=a,i("advancedSearch"),!1}functionx(a){if(a.length&&S.currentSearchParam.length){varb=0,c=S.currentSearchParam;returna.startsWith("!")&&(b=1,a=a.substring(1).trim()),S.currentSearchParam="",{searchBy:c,searchInput:a,negative:b}}}functiony(a){a.$expanded=!a.$expanded,a.$flattenMailboxes({reload:!0,saveState:!0}),b(function(){angular.element(c).triggerHandler("resize")},150)}functionz(a){functionb(a,b,c,d){functione(){b.cancel()}varf=this;f.app=c,f.account=newn({id:d.id,name:d.name},(!0)),f.close=e}d.show({templateUrl:a.id+"/subscribe",controller:b,controllerAs:"subscriptions",clickOutsideToClose:!0,escapeToClose:!0,locals:{srcApp:S,srcAccount:a}}).finally(function(){a.$getMailboxes({reload:!0})}),b.$inject=["$scope","$mdDialog","srcApp","srcAccount"]}functionA(a){k.prompt(l("New folder"),l("Enter the new name of your folder :")).then(function(b){a.$newMailbox(a.id,b).then(function(){},function(a,c){k.alert(l('An error occured while creating the mailbox "%{0}".',b),l(a.error))})})}functionB(a){functionb(a,b,c,d){functione(a){returnc.$filter(a,d.delegates)}functionf(){b.hide()}functiong(a){d.$removeDelegate(a.uid).catch(function(a,b){k.alert(l("Warning"),l("An error occured please try again."))})}functionh(a){a&&d.$addDelegate(a).then(function(){i.userToAdd="",i.searchText=""},function(a){k.alert(l("Warning"),a)})}vari=this;i.users=d.delegates,i.account=d,i.userToAdd="",i.searchText="",i.userFilter=e,i.closeModal=f,i.removeUser=g,i.addUser=h}d.show({templateUrl:a.id+"/delegation",controller:b,controllerAs:"delegate",clickOutsideToClose:!0,escapeToClose:!0,locals:{User:q,account:a}}),b.$inject=["$scope","$mdDialog","User","account"]}functionC(a){S.editMode=a.path,i("mailboxName_"+a.path)}functionD(a){a.$reset(),S.editMode=!1}functionE(b,c,d){S.editMode!=d.path&&(S.editMode=!1,S.showingAdvancedSearch=!1,S.service.$virtualMode=!1,f(h["gt-md"])||g("left").close(),a.go("mail.account.mailbox",{accountId:c.id,mailboxId:j(d.path)}),b.stopPropa