!function(){"use strict";functiona(a,i){a.state("mail",{url:"/Mail",views:{mailboxes:{templateUrl:"UIxMailMainFrame",controller:"MailboxesController",controllerAs:"app"}},resolve:{stateAccounts:b}}).state("mail.account",{url:"/:accountId","abstract":!0,views:{mailbox:{template:"<ui-view/>"}},resolve:{stateAccount:c}}).state("mail.account.virtualMailbox",{url:"/virtual",views:{"mailbox@mail":{templateUrl:"UIxMailFolderTemplate",controller:"MailboxController",controllerAs:"mailbox"}},resolve:{stateMailbox:f}}).state("mail.account.virtualMailbox.message",{url:"/:mailboxId/:messageId",views:{message:{templateUrl:"UIxMailViewTemplate",controller:"MessageController",controllerAs:"viewer"}},resolve:{stateMailbox:g,stateMessages:e,stateMessage:h}}).state("mail.account.mailbox",{url:"/:mailboxId",views:{"mailbox@mail":{templateUrl:"UIxMailFolderTemplate",controller:"MailboxController",controllerAs:"mailbox"}},resolve:{stateMailbox:d,stateMessages:e}}).state("mail.account.mailbox.message",{url:"/:messageId",views:{message:{templateUrl:"UIxMailViewTemplate",controller:"MessageController",controllerAs:"viewer"}},resolve:{stateMessage:h}}),i.otherwise("/Mail")}functionb(a,b){varc=b.$findAll(mailAccounts),d=[];returnangular.forEach(c,function(a,b){varc=a.$getMailboxes();d.push(c.then(function(b){returna}))}),a.all(d)}functionc(a,b){return_.find(b,function(b){returnb.id==a.accountId})}functiond(a,b,c,d){vare,f=c(a.mailboxId);returne=function(a){varb=_.find(a,function(a){returna.path==f});returnb||angular.forEach(a,function(a){!b&&a.children&&a.children.length>0&&(b=e(a.children))}),b},d.selectedFolder&&(d.selectedFolder.$isLoading=!0),e(b.$mailboxes)}functione(a,b){returna.$virtualMode?[]:b.$filter()}functionf(a,b){returnb.$virtualMode?b.selectedFolder:a.reject("No virtual mailbox defined")}functiong(a,b,c,d){vare=c(d.mailboxId);returnb.$virtualMode?(b.selectedFolder.resetSelectedMessage(),_.find(b.selectedFolder.$mailboxes,function(a){returna.path==e})):a.reject("No virtual mailbox defined for message")}functionh(a,b,c,d,e,f){varg;return(g=_.find(e.$messages,function(a){returna.uid==parseInt(c.messageId)}))?(e.selectedMessage=parseInt(c.messageId),g.$reload()):voidd.go("mail.account.mailbox",{accountId:e.$account.id,mailboxId:b(e.path)})}functioni(a,b,c){a.$on("$stateChangeError",function(a,d,e,f,g,h){b.error(h),c.go("mail")}),a.$on("$routeChangeError",function(a,c,d,e){b.error(a,c,d,e)})}angular.module("SOGo.MailerUI",["ui.router","ck","angularFileUpload","SOGo.Common","SOGo.ContactsUI","ngAnimate","SOGo.PreferencesUI"]).config(a).run(i),a.$inject=["$stateProvider","$urlRouterProvider"],b.$inject=["$q","Account"],c.$inject=["$stateParams","stateAccounts"],d.$inject=["$stateParams","stateAccount","decodeUriFilter","Mailbox"],e.$inject=["Mailbox","stateMailbox"],f.$inject=["$q","Mailbox"],g.$inject=["$q","Mailbox","decodeUriFilter","$stateParams"],h.$inject=["Mailbox","encodeUriFilter","$stateParams","$state","stateMailbox","stateMessages"],i.$inject=["$rootScope","$log","$state"]}();