!function(){"use strict";functiona(a,h){a.state("app",{url:"/addressbooks","abstract":!0,views:{addressbooks:{templateUrl:"UIxContactFoldersView",controller:"AddressBooksController",controllerAs:"app"}},resolve:{stateAddressbooks:b}}).state("app.addressbook",{url:"/:addressbookId",views:{addressbook:{templateUrl:"addressbook",controller:"AddressBookController",controllerAs:"addressbook"}},resolve:{stateAddressbook:c}}).state("app.addressbook.new",{url:"/{contactType:(?:card|list)}/new",views:{card:{templateUrl:"UIxContactEditorTemplate",controller:"CardController",controllerAs:"editor"}},resolve:{stateCard:d}}).state("app.addressbook.card",{url:"/:cardId","abstract":!0,views:{card:{template:"<ui-view/>"}},resolve:{stateCard:e},onEnter:f,onExit:g}).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"}}}),h.otherwise("/addressbooks/personal")}functionb(a){returna.$findAll(window.contactFolders)}functionc(a,b,c,d){vare=_.find(d.$findAll(),function(a){returna.id==c.addressbookId});returne?(deletee.selectedCard,e.$reload(),e):a.reject("Addressbook "+c.addressbookId+" not found")}functiond(a,b,c){vard="v"+a.contactType,e=newc({pid:a.addressbookId,c_component:d});returnb.selectedCard=!0,e}functione(a,b,c){vard;return(d=_.find(c.$cards,function(a){returna.id==b.cardId}))?d.$reload():voida.go("app.addressbook")}functionf(a,b){b.selectedCard=a.cardId}functiong(a){deletec.selectedCard}functionh(a,b,c){a.$on("$stateChangeError",function(a,d,e,f,g,h){b.error(h),c.go("app.addressbook",{addressbookId:"personal"})}),a.$on("$routeChangeError",function(a,c,d,e){b.error(a,c,d,e)})}angular.module("SOGo.ContactsUI",["ngCookies","ui.router","angularFileUpload","ck","SOGo.Common","SOGo.PreferencesUI","SOGo.MailerUI"]).config(a).run(h),a.$inject=["$stateProvider","$urlRouterProvider"],b.$inject=["AddressBook"],c.$inject=["$q","$state","$stateParams","AddressBook"],d.$inject=["$stateParams","stateAddressbook","Card"],e.$inject=["$state","$stateParams","stateAddressbook"],f.$inject=["$stateParams","stateAddressbook"],g.$inject=["stateAddressbook"],h.$inject=["$rootScope","$log","$state"]}(),function(){"use strict";functiona(a,b,c,d,e,f,g,h,i,j,k,m,n,o,p,q){functionr(a){a.push(o.createHotkey({key:l("hotkey_search"),description:l("Search"),callback:H})),a.push(o.createHotkey({key:l("key_create_card"),description:l("Create a new address book card"),callback:angular.bind(M,u,"card")})),a.push(o.createHotkey({key:l("key_create_list"),description:l("Create a new list"),callback:angular.bind(M,u,"list")})),a.push(o.createHotkey({key:"space",description:l("Toggle item"),callback:t})),a.push(o.createHotkey({key:"up",description:l("View next item"),callback:w})),a.push(o.createHotkey({key:"down",description:l("View previous item"),callback:x})),a.push(o.createHotkey({key:"shift+up",description:l("Add next item to selection"),callback:y})),a.push(o.createHotkey({key:"shift+down",description:l("Add previous item to selection"),callback:z})),a.push(o.createHotkey({key:"backspace",description:l("Delete selected card or address book"),callback:A})),_.forEach(a,function(a){o.registerHotkey(a)})}functions(a){d.go("app.addressbook.card.view",{cardId:a.id})}functiont(a,b){b||(b=M.selectedFolder.$selectedCard()),b.selected=!b.selected,M.mode.multiple+=b.selected?1:-1,a.preventDefault(),a.stopPropagation()}functionu(a){d.go("app.addressbook.new",{contactType:a})}functionv(){_.forEach(M.selectedFolder.$cards,function(a){a.selected=!1}),M.mode.multiple=0}functionw(a){varb=M.selectedFolder.$selectedCardIndex();returnangular.isDefined(b)?(b--,M.selectedFolder.$topIndex>0&&M.selectedFolder.$topIndex--):(b=M.selectedFolder.$cards.length()-1,M.selectedFolder.$topIndex=M.selectedFolder.getLength()),b>-1&&s(M.selectedFolder.$cards[b]),a.preventDefault(),b}functionx(