!function(){"use strict";functione(e,t){e.state("app",{url:"/addressbooks",abstract:!0,views:{addressbooks:{templateUrl:"UIxContactFoldersView",controller:"AddressBooksController",controllerAs:"app"}},resolve:{stateAddressbooks:o}}).state("app.addressbook",{url:"/:addressbookId",views:{addressbook:{templateUrl:"addressbook",controller:"AddressBookController",controllerAs:"addressbook"}},resolve:{stateAddressbook:r}}).state("app.addressbook.new",{url:"/{contactType:(?:card|list)}/new",params:{refs:{array:!0}},views:{card:{templateUrl:"UIxContactEditorTemplate",controller:"CardController",controllerAs:"editor"}},resolve:{stateCard:s}}).state("app.addressbook.card",{url:"/:cardId",abstract:!0,views:{card:{template:"<ui-view/>"}},resolve:{stateCard:n},onEnter:d,onExit:a}).state("app.addressbook.card.view",{url:"/view",views:{"card@app.addressbook":{templateUrl:"UIxContactViewTemplate",controller:"CardController",controllerAs:"editor"}}}).state("app.addressbook.card.editor",{url:"/edit",views:{"card@app.addressbook":{templateUrl:"UIxContactEditorTemplate",controller:"CardController",controllerAs:"editor"}}}),t.rules.otherwise({state:"app.addressbook",params:{addressbookId:"personal"}})}functiono(e){returne.$findAll(window.contactFolders)}functionr(e,t,o,r){vars=_.find(r.$findAll(),function(e){returne.id==o.addressbookId});returns?(deletes.selectedCard,s.$reload(),s):e.reject("Addressbook "+o.addressbookId+" not found")}functions(e,t,o){varr="v"+e.contactType,s=newo({pid:e.addressbookId,c_component:r,refs:e.refs});returnt.selectedCard=!0,s}functionn(t,o,r){returnr.$futureAddressBookData.then(function(){vare=_.find(r.$cards,function(e){returne.id==o.cardId});if(e)returne.$reload();t.go("app.addressbook")})}functiond(e,t){t.selectedCard=e.cardId}functiona(e){deleter.selectedCard}functiont(e,t,o,r){e.DebugEnabled||r.defaultErrorHandler(function(){}),o.onError({to:"app.**"},function(e){"app"==e.to().name||e.ignored()||(t.error("transition error to "+e.to().name+": "+e.error().detail),r.go("app.addressbook",{addressbookId:"personal"}))})}angular.module("SOGo.ContactsUI",["ngCookies","ui.router","angularFileUpload","ck","SOGo.Common","SOGo.PreferencesUI","SOGo.MailerUI"]).config(e).run(t),e.$inject=["$stateProvider","$urlServiceProvider"],o.$inject=["AddressBook"],r.$inject=["$q","$state","$stateParams","AddressBook"],s.$inject=["$stateParams","stateAddressbook","Card"],n.$inject=["$state","$stateParams","stateAddressbook"],d.$inject=["$stateParams","stateAddressbook"],a.$inject=["stateAddressbook"],t.$inject=["$window","$log","$transitions","$state"]}(),function(){"use strict";functione(e,d,t,c,o,a,u,i,r,s,n,h,f,p,m,g){var$,k=this,b=[];functionv(e){vart=k.selectedFolder.$selectedCardIndex();returnangular.isDefined(t)?(t--,0<k.selectedFolder.$topIndex&&k.selectedFolder.$topIndex--):(t=k.selectedFolder.$cards.length()-1,k.selectedFolder.$topIndex=k.selectedFolder.getLength()),-1<t&&k.selectCard(k.selectedFolder.$cards[t]),e.preventDefault(),t}functionC(e){vart=k.selectedFolder.$selectedCardIndex();returnangular.isDefined(t)?(t++,k.selectedFolder.$topIndex<k.selectedFolder.$cards.length&&k.selectedFolder.$topIndex++):t=0,t<k.selectedFolder.$cards.length?k.selectCard(k.selectedFolder.$cards[t]):t=-1,e.preventDefault(),t}functionw(e){vart;k.selectedFolder.hasSelectedCard()&&0<=(t=v(e))&&toggleCardSelection(e,k.selectedFolder.$cards[t])}functiony(e){vart;k.selectedFolder.hasSelectedCard()&&0<=(t=C(e))&&toggleCardSelection(e,k.selectedFolder.$cards[t])}functionF(e,t){varo,r,s,n,d,a,i;o=k.selectedFolder,d=!1,r=o.$selectedCards(),(s=_.filter(r,function(e){returne.$isCard()})).length!=r.length&&u.show(u.simple().content(l("Lists can't be moved or copied.")).position("top right").hideDelay(2e3)),s.length&&("copy"==e?(a=o.$copyCards(s,t),i=l("%{0} card(s) copied",s.length)):(a=o.$moveCards(s,t),i=l("%{0} card(s) moved",s.length),n=_.map(s,"id"),d=o.selectedCard&&0<=n.indexOf(o.selectedCard)),a.then(function(){d&&c.go("app.addressbook"),u.show(u.simple().content(i).position("top right").hideDelay(2e3))}))}$=