!function(){"use strict";function e(e,i){e.state("mail",{url:"/Mail",abstract:!0,views:{message:{template:"<ui-view/>"}},resolve:{stateAccounts:t}}).state("mail.account",{url:"/:accountId",abstract:!0,template:'<ui-view id="account"/>',resolve:{stateAccount:o}}).state("mail.account.mailbox",{url:"/:mailboxId",abstract:!0,template:'<ui-view id="mailbox"/>',resolve:{stateMailbox:r}}).state("mail.account.mailbox.newMessage",{url:"/new",views:{"message@":{template:"<ui-view/>",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"}}}),i.otherwise("/Mail/0/folderINBOX/new")}function t(e,t){var o,r=[];return window&&window.opener&&window.opener.$mailboxController?(o=window.opener.$mailboxController.accounts,e.when(o)):(o=t.$findAll(),angular.forEach(o,function(e,t){var o=e.$getMailboxes();r.push(o.then(function(t){return e}))}),e.all(r))}function o(e,t){return _.find(t,function(t){return t.id==e.accountId})}function r(e,t,o){var r,n=o(e.mailboxId);return(r=function(e){var t=_.find(e,function(e){return e.path==n});return t||angular.forEach(e,function(e){!t&&e.children&&e.children.length>0&&(t=r(e.children))}),t})(t.$mailboxes)}function n(e){return e.$newMessage()}function a(e,t,o,r,n,a){var l,i;return window&&window.opener&&window.opener.$messageController&&window.opener.$messageController.message.uid==parseInt(o.messageId)?(i=new a(n.$account.id,n,window.opener.$messageController.message.$omit({privateAttributes:!0})),t.when(i)):(l={uid:o.messageId.toString()},(i=new a(n.$account.id,n,l)).$reload())}function l(e){return e.$editableContent()}function i(e,t,o){t.$on("$stateChangeError",function(t,r,n,a,l,i){o.error(i),e.close()}),t.$on("$routeChangeError",function(e,t,r,n){o.error(e,t,r,n)})}function s(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(i).controller("MessageEditorControllerPopup",s),e.$inject=["$stateProvider","$urlRouterProvider"],t.$inject=["$q","Account"],o.$inject=["$stateParams","stateAccounts"],r.$inject=["$stateParams","stateAccount","decodeUriFilter"],n.$inject=["stateAccount"],a.$inject=["encodeUriFilter","$q","$stateParams","$state","stateMailbox","Message"],l.$inject=["stateMessage"],i.$inject=["$window","$rootScope","$log"],s.$inject=["$window","$mdDialog","stateAccount","stateMessage"]}();
//# sourceMappingURL=Mailer.app.popup.js.map