!function(){"use strict";function e(e,s){e.state("mail",{url:"/Mail",abstract:!0,views:{message:{template:""}},resolve:{stateAccounts:t}}).state("mail.account",{url:"/:accountId",abstract:!0,template:'',resolve:{stateAccount:o}}).state("mail.account.mailbox",{url:"/:mailboxId",abstract:!0,template:'',resolve:{stateMailbox:r}}).state("mail.account.mailbox.newMessage",{url:"/new",views:{"message@":{template:"",controller:"MessageEditorControllerPopup"}},resolve:{stateMessage:n}}).state("mail.account.mailbox.message",{url:"/:messageId",views:{"message@":{templateUrl:"UIxMailViewTemplate",controller:"MessageController",controllerAs:"viewer"}},resolve:{stateMessage:a}}).state("mail.account.mailbox.message.edit",{url:"/edit",views:{"message@":{templateUrl:"UIxMailEditor",controller:"MessageEditorController",controllerAs:"editor"}},resolve:{stateContent:l}}).state("mail.account.mailbox.message.action",{url:"/{actionName:(?:reply|replyall|forward)}",views:{message:{templateUrl:"UIxMailEditor",controller:"MessageEditorController",controllerAs:"editor"}}}),s.otherwise("/Mail/0/folderINBOX/new")}function t(e,t,o){var r,n=[];return e&&e.opener&&e.opener.$mailboxController?(r=e.opener.$mailboxController.accounts,t.when(r)):o.$findAll().then(function(e){return angular.forEach(e,function(e,t){var o=e.$getMailboxes();0===t?n.push(o.then(function(t){return e})):n.push(e)}),t.all(n)})}function o(e,t){return _.find(t,function(t){return t.id==e.accountId})}function r(e,t,o,r,n,a){var l,s,i=n(o.mailboxId);return s=function(e){var t=_.find(e,function(e){return e.path==i});return t||angular.forEach(e,function(e){!t&&e.children&&e.children.length>0&&(t=s(e.children))}),t},l=s(r.$mailboxes),l?(l.$topIndex=0,l.selectFolder(),l):e.reject("Mailbox doesn't exist")}function n(e,t){var o,r=e.search();return r&&(o=_.find(_.keys(r),function(e){return/^mailto:/i.test(e)})),t.$newMessage({mailto:o})}function a(e,t,o,r,n,a){var l,s;return window&&window.opener&&window.opener.$messageController&&window.opener.$messageController.message.uid==parseInt(o.messageId)?(s=new a(n.$account.id,n,window.opener.$messageController.message.$omit({privateAttributes:!0})),t.when(s)):(l={uid:o.messageId.toString()},(s=new a(n.$account.id,n,l)).$reload())}function l(e){return e.$editableContent()}function s(e,t,o){t.$on("$stateChangeError",function(t,r,n,a,l,s){o.error(s),e.close()}),t.$on("$routeChangeError",function(e,t,r,n){o.error(e,t,r,n)})}function i(e,t,o,r){t.show({hasBackdrop:!1,disableParentScroll:!1,clickOutsideToClose:!1,escapeToClose:!1,templateUrl:"UIxMailEditor",controller:"MessageEditorController",controllerAs:"editor",locals:{stateAccount:o,stateMessage:r}}).finally(function(){e.close()})}angular.module("SOGo.MailerUI",["ngCookies","ui.router","ck","angularFileUpload","SOGo.Common","SOGo.ContactsUI","SOGo.SchedulerUI","ngAnimate","SOGo.PreferencesUI"]).config(e).run(s).controller("MessageEditorControllerPopup",i),e.$inject=["$stateProvider","$urlRouterProvider"],t.$inject=["$window","$q","Account"],o.$inject=["$stateParams","stateAccounts"],r.$inject=["$q","$state","$stateParams","stateAccount","decodeUriFilter","Mailbox"],n.$inject=["$urlService","stateAccount"],a.$inject=["encodeUriFilter","$q","$stateParams","$state","stateMailbox","Message"],l.$inject=["stateMessage"],s.$inject=["$window","$rootScope","$log"],i.$inject=["$window","$mdDialog","stateAccount","stateMessage"]}();
//# sourceMappingURL=Mailer.app.popup.js.map