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