-
Notifications
You must be signed in to change notification settings - Fork 1
/
keta.min.js
12 lines (12 loc) · 179 KB
/
keta.min.js
1
2
3
4
5
6
7
8
9
10
11
12
/**
* keta 1.11.0
* Build 2021-04-21T15:24:16.331Z
*
* Copyright Kiwigrid GmbH 2014-2021
* http://kiwigrid.github.io/keta/
*
* Licensed under MIT License
* https://raw.githubusercontent.com/kiwigrid/keta/master/LICENSE
*/
"use strict";angular.module("keta",["keta.directives.AppBar","keta.directives.DatePicker","keta.directives.ExtendedTable","keta.directives.MainMenu","keta.directives.Sidebar","keta.directives.TimeRangeSelector","keta.filters.OrderObjectBy","keta.filters.Slice","keta.filters.Unit","keta.services.AccessToken","keta.services.AppContext","keta.services.ApplicationSet","keta.services.Application","keta.services.DeviceEvent","keta.services.DevicePolling","keta.services.DeviceSetPollers","keta.services.DeviceSet","keta.services.Device","keta.services.EventBusDispatcher","keta.services.EventBusManager","keta.services.EventBus","keta.services.Logger","keta.services.TagSet","keta.services.Tag","keta.services.UserSet","keta.services.User","keta.utils.Api","keta.utils.Application","keta.utils.Common","keta.utils.Country"]),angular.module("keta.directives.AppBar",["keta.directives.Sidebar","keta.services.AccessToken","keta.services.ApplicationSet","keta.services.Device","keta.services.DeviceSet","keta.services.EventBusDispatcher","keta.services.EventBusManager","keta.services.User","keta.utils.Application","keta.utils.Common"]).constant("ketaAppBarConstants",{COMPONENT:{WORLD_SWITCHER:"worldSwitcher",MENU_BAR_TOGGLE:"menuBarToggle",NOTIFICATION_BAR_TOGGLE:"notificationBarToggle",APP_TITLE:"appTitle",USER_MENU:"userMenu",LANGUAGE_MENU:"languageMenu",ENERGY_MANAGER_MENU:"energyManagerMenu",COMPACT_MENU:"compactMenu",STATUS_LINK:"statusLink"},ROOT_APP_ID:"kiwigrid.usersettingsapp",SIZE:{XXS:"xxs",XS:"xs",SM:"sm",MD:"md",LG:"lg"},STATE:{HIDDEN:"hidden",FULL:"full",COMPACT:"compact"},TOGGLES:{USER_PROFILE:"USER_PROFILE",USER_LOGOUT:"USER_LOGOUT"},USER_ROLE:{ADMIN:"ADMIN",DEMO_USER:"DEMO_USER",FITTER:"FITTER",SERVICE:"SERVICE",SUPER_ADMIN:"SUPER_ADMIN",USER:"USER"}}).constant("ketaAppBarMessageKeys",{en_GB:{"__keta.directives.AppBar_app_title":"Application","__keta.directives.AppBar_all_apps":"All Apps","__keta.directives.AppBar_all_energy_managers":"All Energy-Managers","__keta.directives.AppBar_energy_manager":"Energy-Manager","__keta.directives.AppBar_user_logout":"Logout","__keta.directives.AppBar_user_profile":"User Account","__keta.directives.AppBar_logged_in_as":"You are temporarily logged in as","__keta.directives.AppBar_drop_access":"Drop access","__keta.directives.AppBar_status_link":"Status"},de_DE:{"__keta.directives.AppBar_app_title":"Applikation","__keta.directives.AppBar_all_apps":"Alle Apps","__keta.directives.AppBar_all_energy_managers":"Alle Energy-Manager","__keta.directives.AppBar_energy_manager":"Energy-Manager","__keta.directives.AppBar_user_logout":"Abmelden","__keta.directives.AppBar_user_profile":"Benutzerkonto","__keta.directives.AppBar_logged_in_as":"Sie sind temporär angemeldet als","__keta.directives.AppBar_drop_access":"Zugriff beenden","__keta.directives.AppBar_status_link":"Status"},es_ES:{"__keta.directives.AppBar_app_title":"Aplicación","__keta.directives.AppBar_all_apps":"Todas las aplicaciónes","__keta.directives.AppBar_all_energy_managers":"Todas las Energy-Managers","__keta.directives.AppBar_energy_manager":"Energy-Manager","__keta.directives.AppBar_user_logout":"Cerrar sesión","__keta.directives.AppBar_user_profile":"Cuenta de usuario","__keta.directives.AppBar_logged_in_as":"Has iniciado sesión temporalmente como","__keta.directives.AppBar_drop_access":"Terminar acceso","__keta.directives.AppBar_status_link":"Status"},fr_FR:{"__keta.directives.AppBar_app_title":"Application","__keta.directives.AppBar_all_apps":"Toutes les Applications","__keta.directives.AppBar_all_energy_managers":"Tous les Energy-Managers","__keta.directives.AppBar_energy_manager":"Energy-Manager","__keta.directives.AppBar_user_logout":"Se déconnecter","__keta.directives.AppBar_user_profile":"Compte d’utilisateur","__keta.directives.AppBar_logged_in_as":"Vous êtes connecté en tant que temporairement","__keta.directives.AppBar_drop_access":"Déposez accès","__keta.directives.AppBar_status_link":"Status"},nl_NL:{"__keta.directives.AppBar_app_title":"Applicatie","__keta.directives.AppBar_all_apps":"Alle applicaties","__keta.directives.AppBar_all_energy_managers":"Alle Energy-Managers","__keta.directives.AppBar_energy_manager":"Energy-Manager","__keta.directives.AppBar_user_logout":"Uitloggen","__keta.directives.AppBar_user_profile":"Gebruikers account","__keta.directives.AppBar_logged_in_as":"U bent tijdelijk aangemeld als","__keta.directives.AppBar_drop_access":"Drop toegang","__keta.directives.AppBar_status_link":"Status"},it_IT:{"__keta.directives.AppBar_app_title":"Application","__keta.directives.AppBar_all_apps":"Tutte le applicazioni","__keta.directives.AppBar_all_energy_managers":"Tutti gli Energy-Managers","__keta.directives.AppBar_energy_manager":"Energy-Manager","__keta.directives.AppBar_user_logout":"Disconnettersi","__keta.directives.AppBar_user_profile":"Account utente","__keta.directives.AppBar_logged_in_as":"Stai temporaneamente l’accesso come","__keta.directives.AppBar_drop_access":"Goccia accesso","__keta.directives.AppBar_status_link":"Status"},sv_SE:{"__keta.directives.AppBar_app_title":"Tillämpning","__keta.directives.AppBar_all_apps":"Alla tillämpningar","__keta.directives.AppBar_all_energy_managers":"Alla Energy-Managers","__keta.directives.AppBar_energy_manager":"Energy-Manager","__keta.directives.AppBar_user_logout":"Logga ut","__keta.directives.AppBar_user_profile":"Användarkonto","__keta.directives.AppBar_logged_in_as":"Du är tillfälligt inloggad som","__keta.directives.AppBar_drop_access":"Släpp åtkomst","__keta.directives.AppBar_status_link":"Status"}}).directive("ketaAppBar",function($rootScope,$window,$document,$filter,$log,ketaEventBusDispatcher,ketaEventBusManager,ketaDeviceSet,ketaApplicationSet,ketaUser,ketaAccessToken,ketaAccessTokenConstants,ketaAppBarConstants,ketaAppBarMessageKeys,ketaDeviceConstants,ketaSidebarConstants,ketaCommonUtils,ketaApplicationUtils){return{restrict:"EA",replace:!0,scope:{eventBusId:"=?",locales:"=?",cssClasses:"=?",currentLocale:"=?",fallbackLocale:"=?",labels:"=?",links:"=?",worlds:"=?",statusLink:"=?",displayModes:"=?",rootApp:"=?",toggles:"=?"},transclude:!0,templateUrl:"/components/directives/app-bar.html",link:function(scope,element){scope.user={},scope.menus={},scope.worlds=scope.worlds||[],scope.locales=scope.locales||[],scope.cssClasses=scope.cssClasses||{},scope.energyManagers=[],scope.impersonationInfo={},scope.locales=$filter("orderBy")(scope.locales,"name"),scope.eventBusId=scope.eventBusId||"kiwibus";var eventBus=ketaEventBusManager.get(scope.eventBusId),STATES=ketaAppBarConstants.STATE,SIZES=ketaAppBarConstants.SIZE;scope.MENU_ELEMENTS=ketaAppBarConstants.COMPONENT;var sizesFullState={};sizesFullState[SIZES.XXS]=STATES.FULL,sizesFullState[SIZES.XS]=STATES.FULL,sizesFullState[SIZES.SM]=STATES.FULL,sizesFullState[SIZES.MD]=STATES.FULL,sizesFullState[SIZES.LG]=STATES.FULL;var sizesDefaultState={};sizesDefaultState[SIZES.XXS]=STATES.HIDDEN,sizesDefaultState[SIZES.XS]=STATES.HIDDEN,sizesDefaultState[SIZES.SM]=STATES.COMPACT,sizesDefaultState[SIZES.MD]=STATES.COMPACT,sizesDefaultState[SIZES.LG]=STATES.FULL;var sizesHiddenState={};sizesHiddenState[SIZES.XXS]=STATES.HIDDEN,sizesHiddenState[SIZES.XS]=STATES.HIDDEN,sizesHiddenState[SIZES.SM]=STATES.HIDDEN,sizesHiddenState[SIZES.MD]=STATES.HIDDEN,sizesHiddenState[SIZES.LG]=STATES.HIDDEN;var defaultDisplayModes={};defaultDisplayModes[scope.MENU_ELEMENTS.WORLD_SWITCHER]=sizesHiddenState,defaultDisplayModes[scope.MENU_ELEMENTS.MENU_BAR_TOGGLE]=sizesFullState,defaultDisplayModes[scope.MENU_ELEMENTS.NOTIFICATION_BAR_TOGGLE]=sizesFullState,defaultDisplayModes[scope.MENU_ELEMENTS.APP_TITLE]=sizesFullState,defaultDisplayModes[scope.MENU_ELEMENTS.STATUS_LINK]=sizesFullState,defaultDisplayModes[scope.MENU_ELEMENTS.USER_MENU]=sizesDefaultState,defaultDisplayModes[scope.MENU_ELEMENTS.ENERGY_MANAGER_MENU]=sizesDefaultState,defaultDisplayModes[scope.MENU_ELEMENTS.LANGUAGE_MENU]=sizesDefaultState,defaultDisplayModes[scope.MENU_ELEMENTS.COMPACT_MENU]={},defaultDisplayModes[scope.MENU_ELEMENTS.COMPACT_MENU][SIZES.XXS]=STATES.COMPACT,defaultDisplayModes[scope.MENU_ELEMENTS.COMPACT_MENU][SIZES.XS]=STATES.COMPACT,defaultDisplayModes[scope.MENU_ELEMENTS.COMPACT_MENU][SIZES.SM]=STATES.HIDDEN,defaultDisplayModes[scope.MENU_ELEMENTS.COMPACT_MENU][SIZES.MD]=STATES.HIDDEN,defaultDisplayModes[scope.MENU_ELEMENTS.COMPACT_MENU][SIZES.LG]=STATES.HIDDEN;var scrollContainerHeight=120;scope.container=element[0];var navBars=element.find("nav"),navbarFirst=navBars[0],navbarFirstHeight=0,impersonationBar=element[0].getElementsByClassName("impersonation-bar")[0],impersonationBarHeight=0,navbarSecond=navBars[1],navbarSecondHeight=0,navbarSecondMarginBottom=0,isMenuVisible=function(menuElement){var isVisible=!1;return angular.forEach(SIZES,function(size){scope.displayModes[menuElement][size]!==STATES.HIDDEN&&(isVisible=!0)}),isVisible},setContainerHeight=function(){navbarFirstHeight=navbarFirst.offsetHeight,angular.isDefined(impersonationBar)&&(impersonationBarHeight=impersonationBar.offsetHeight),navbarSecondHeight=navbarSecond.offsetHeight,navbarSecondMarginBottom=parseInt($window.getComputedStyle(navbarSecond,null).getPropertyValue("margin-bottom"),10),scrollContainerHeight=navbarFirstHeight+impersonationBarHeight+navbarSecondHeight+navbarSecondMarginBottom},isLocaleAvailable=function(localeCode){var isAvailable=!1;return angular.forEach(scope.locales,function(availableLocale){angular.isDefined(availableLocale.code)&&availableLocale.code===localeCode&&(isAvailable=!0)}),isAvailable};scope.displayModes=function mergeObjects(customObject,defaultObject){var value,result={};for(value in customObject)value in defaultObject&&"object"==typeof customObject[value]&&null!==value?result[value]=mergeObjects(customObject[value],defaultObject[value]):result[value]=customObject[value];for(value in defaultObject)value in result||(result[value]=defaultObject[value]);return result}(scope.displayModes,defaultDisplayModes),scope.fallbackLocale=scope.fallbackLocale||"en_GB",scope.currentLocale=scope.currentLocale||scope.fallbackLocale,isLocaleAvailable(scope.currentLocale)||(scope.currentLocale=scope.fallbackLocale),scope.MESSAGE_KEY_PREFIX="__keta.directives.AppBar",scope.labels=angular.extend(ketaAppBarMessageKeys,scope.labels),scope.getLabel=function(key){return ketaCommonUtils.getLabelByLocale(key,scope.labels,scope.currentLocale)};var accessToken=ketaAccessToken.decode(ketaAccessToken.get()),defaultLinks={ALL_APPS:null,ALL_ENERGY_MANAGERS:null,APP_ROOT:null!==accessToken&&angular.isDefined(accessToken.user_id)?ketaCommonUtils.addUrlParameter("/","userId",accessToken.user_id):"/",USER_PROFILE:null,USER_LOGOUT:null};scope.TYPES={ENERGY_MANAGER:"ENERGY_MANAGER"},scope.LIMITS={ENERGY_MANAGER:3};var PREDICATES={ENERGY_MANAGER:{field:"name",reverse:!1}};scope.links=angular.isDefined(scope.links)?angular.extend(defaultLinks,scope.links):defaultLinks;var defaultToggles={};defaultToggles[ketaAppBarConstants.USER_ROLE.DEMO_USER]={},defaultToggles[ketaAppBarConstants.USER_ROLE.DEMO_USER][ketaAppBarConstants.TOGGLES.USER_PROFILE]=!1,scope.AVAILABLE_TOGGLES=ketaAppBarConstants.TOGGLES;var updateToggles=function(){if(angular.isDefined(scope.toggles)){var toggles=angular.copy(defaultToggles);angular.forEach(scope.toggles,function(userRoleToggles,userRole){angular.equals(scope.toggles[userRole],{})||(toggles[userRole]=angular.extend(toggles[userRole]||{},scope.toggles[userRole]))}),scope.toggles=toggles}else scope.toggles=angular.copy(defaultToggles)};updateToggles();var allLinkKeysAlreadySet=!0;angular.forEach(Object.keys(defaultLinks),function(linkKey){null===defaultLinks[linkKey]&&(allLinkKeysAlreadySet=!1)}),!1===allLinkKeysAlreadySet&&(scope.links.USER_LOGOUT=angular.isString(scope.links.USER_LOGOUT)?scope.links.USER_LOGOUT:"/rest/auth/logout",ketaApplicationUtils.getAppList({eventBusId:scope.eventBusId,filter:{appId:ketaAppBarConstants.ROOT_APP_ID}}).then(function(apps){var entryUri=null,name={};if(scope.rootApp=null,angular.forEach(apps,function(app){angular.isDefined(app.appId)&&app.appId===ketaAppBarConstants.ROOT_APP_ID&&angular.isDefined(app.entryUri)&&(entryUri=app.entryUri,ketaCommonUtils.doesPropertyExist(app,"meta.i18n")&&angular.forEach(Object.keys(app.meta.i18n),function(locale){angular.forEach(scope.locales,function(availableLocale){angular.isDefined(availableLocale.code)&&availableLocale.code===locale&&(name[availableLocale.code]=app.meta.i18n[locale].name)})}))}),document.createElement("a").href=entryUri,null!==entryUri&&(scope.rootApp={},scope.rootApp.link=ketaCommonUtils.addUrlParameter(entryUri,"userId",accessToken.user_id),scope.rootApp.name=name,scope.worlds.unshift({name:"User Settings App",link:scope.rootApp.link})),scope.links.ALL_APPS=angular.isString(scope.links.ALL_APPS)?scope.links.ALL_APPS:ketaCommonUtils.addUrlParameter(entryUri+"#/applications","userId",accessToken.user_id),scope.links.USER_PROFILE=angular.isString(scope.links.USER_PROFILE)?scope.links.USER_PROFILE:ketaCommonUtils.addUrlParameter(entryUri+"#/user","userId",accessToken.user_id),!angular.isString(scope.links.ALL_ENERGY_MANAGERS)){var allManagersUri=ketaCommonUtils.addUrlParameter(entryUri,"deviceClass","com.kiwigrid.devices.em.EnergyManager");scope.links.ALL_ENERGY_MANAGERS=ketaCommonUtils.addUrlParameter(allManagersUri+"#/devices","userId",accessToken.user_id)}})),scope.getClasses=function(menuName,elementType){var classes=[];return angular.isDefined(elementType)||(elementType="menu"),angular.isDefined(scope.menus[menuName])&&angular.isDefined(scope.menus[menuName].isOpen)&&scope.menus[menuName].isOpen&&classes.push("open"),angular.forEach(SIZES,function(size){var state=scope.displayModes[menuName][size];switch(elementType){case"menu":switch(state){case STATES.HIDDEN:classes.push("hidden-"+size);break;case STATES.FULL:case STATES.COMPACT:classes.push("visible-"+size)}break;case"label":state===STATES.COMPACT&&classes.push("hidden-"+size)}}),angular.isString(scope.cssClasses[menuName])&&classes.push(scope.cssClasses[menuName]),classes.join(" ")};var getDevices=function(){null!==eventBus&&angular.isDefined(scope.user.userId)&&isMenuVisible(scope.MENU_ELEMENTS.ENERGY_MANAGER_MENU)&&ketaDeviceSet.create(eventBus).filter({"deviceModel.deviceClass":{$in:[ketaDeviceConstants.CLASS.ENERGY_MANAGER]},owner:scope.user.userId}).project({tagValues:{IdName:1,SettingsNetworkMap:1}}).query().then(function(reply){if(angular.isDefined(reply.result)&&angular.isDefined(reply.result.items)){var energyManagers=[];angular.forEach(reply.result.items,function(item){var emIP=angular.isDefined(item.tagValues)&&angular.isDefined(item.tagValues.SettingsNetworkMap)&&angular.isDefined(item.tagValues.SettingsNetworkMap.value)&&angular.isDefined(item.tagValues.SettingsNetworkMap.value.ipv4)?item.tagValues.SettingsNetworkMap.value.ipv4:null;null!==emIP&&energyManagers.push({name:item.tagValues.IdName.value,link:"http://"+emIP})}),scope.energyManagers=energyManagers}})},getActiveLangEntry=function(){var activeLangEntry=scope.locales[0]||{};return angular.forEach(scope.locales,function(value){value.code===scope.currentLocale&&(activeLangEntry=value)}),activeLangEntry},readLocaleFromUserProp=function(){ketaCommonUtils.doesPropertyExist(scope.user,"properties.locale.code")&&isLocaleAvailable(scope.user.properties.locale.code)&&(scope.currentLocale=scope.user.properties.locale.code)},writeLocaleUserProp=function(localeCode){scope.user.properties=scope.user.properties||{},scope.user.properties.locale=scope.user.properties.locale||{},scope.user.properties.locale.code=localeCode;var params={userId:scope.user.userId},body={properties:scope.user.properties};ketaEventBusDispatcher.send(eventBus,"userservice",{action:"mergeUser",body:body,params:params},function(reply){ketaEventBusManager.inDebugMode()&&$log.request(["userservice",{action:"mergeUser",params:params,body:body},reply],$log.ADVANCED_FORMATTER)})},updateMenus=function(){scope.menus={},scope.menus[scope.MENU_ELEMENTS.COMPACT_MENU]={isOpen:!1},scope.menus[scope.MENU_ELEMENTS.WORLD_SWITCHER]={isOpen:!1},scope.menus[scope.MENU_ELEMENTS.ENERGY_MANAGER_MENU]={isOpen:!1},scope.menus[scope.MENU_ELEMENTS.USER_MENU]={isOpen:!1},scope.menus[scope.MENU_ELEMENTS.LANGUAGE_MENU]={isOpen:!1,activeEntry:getActiveLangEntry()}};null!==eventBus&&ketaUser.getCurrent(eventBus).then(function(reply){scope.user=reply,readLocaleFromUserProp(),getDevices()}),scope.isImpersonated=function(){var result=!1;return ketaAccessToken.isType(ketaAccessTokenConstants.SESSION_TYPE.IMPERSONATED)&&(scope.impersonationInfo={userId:ketaAccessToken.getUserId(),backUrl:ketaAccessToken.getBackUrl()},result=!0),result},scope.isEnabled=function(toggle){var enabled=!0,userRoleScores={};userRoleScores[ketaAppBarConstants.USER_ROLE.DEMO_USER]=1,userRoleScores[ketaAppBarConstants.USER_ROLE.USER]=2,userRoleScores[ketaAppBarConstants.USER_ROLE.FITTER]=3,userRoleScores[ketaAppBarConstants.USER_ROLE.SERVICE]=4,userRoleScores[ketaAppBarConstants.USER_ROLE.ADMIN]=5,userRoleScores[ketaAppBarConstants.USER_ROLE.SUPER_ADMIN]=6;var userRole=ketaAppBarConstants.USER_ROLE.DEMO_USER;return angular.isDefined(scope.user)&&angular.isDefined(scope.user.roles)&&scope.user.roles.forEach(function(role){userRoleScores[userRole]<userRoleScores[role]&&(userRole=role)}),angular.isDefined(scope.toggles[userRole])&&angular.isDefined(scope.toggles[userRole][toggle])&&(enabled=scope.toggles[userRole][toggle]),enabled},scope.order=function(type){var field=angular.isDefined(PREDICATES[type])?PREDICATES[type].field:"name";return function(item){return angular.isDefined(item[field])?item[field]:""}},scope.reverse=function(type){return!(!angular.isDefined(PREDICATES[type])||!angular.isDefined(PREDICATES[type].reverse))&&PREDICATES[type].reverse},scope.scrollOverNavbarFirst=!1,angular.element($window).bind("scroll",function(){angular.isDefined(navbarFirst)&&(this.scrollY>navbarFirstHeight+impersonationBarHeight?(scope.scrollOverNavbarFirst=!0,element.css("height",scrollContainerHeight+"px")):(scope.scrollOverNavbarFirst=!1,element.css("height","auto")),scope.menus.worldSwitcher.isOpen=!1,scope.$digest())}),scope.toggleOpenState=function(menuName){if(angular.isDefined(scope.menus[menuName])){var currentState=angular.copy(scope.menus[menuName].isOpen);scope.closeAllMenus(),currentState===scope.menus[menuName].isOpen&&(scope.menus[menuName].isOpen=!scope.menus[menuName].isOpen)}},scope.closeAllMenus=function(){scope.menus[scope.MENU_ELEMENTS.WORLD_SWITCHER].isOpen=!1,scope.menus[scope.MENU_ELEMENTS.USER_MENU].isOpen=!1,scope.menus[scope.MENU_ELEMENTS.ENERGY_MANAGER_MENU].isOpen=!1,scope.menus[scope.MENU_ELEMENTS.COMPACT_MENU].isOpen=!1,scope.menus[scope.MENU_ELEMENTS.LANGUAGE_MENU].isOpen=!1},scope.setLocale=function(locale){scope.currentLocale=locale.code,writeLocaleUserProp(locale.code),scope.menus[scope.MENU_ELEMENTS.LANGUAGE_MENU].activeEntry=locale,scope.closeAllMenus()},scope.$on("$locationChangeStart",function(){scope.closeAllMenus()}),scope.isActive=function(menuName,entry){return angular.isDefined(scope.menus[menuName])&&scope.menus[menuName].activeEntry===entry},scope.toggleSidebar=function($event,position){$event.stopPropagation(),scope.closeAllMenus(),position===ketaSidebarConstants.POSITION.LEFT?$rootScope.$broadcast(ketaSidebarConstants.EVENT.TOGGLE_SIDEBAR_LEFT):position===ketaSidebarConstants.POSITION.RIGHT&&$rootScope.$broadcast(ketaSidebarConstants.EVENT.TOGGLE_SIDEBAR_RIGHT)},$document.bind("click",function(event){var appBarHtml=element.html(),targetElementHtml=angular.element(event.target).html();-1===appBarHtml.indexOf(targetElementHtml)&&(scope.closeAllMenus(),scope.$digest())}),scope.$watch("energyManagers",function(newValue,oldValue){newValue!==oldValue&&updateMenus()}),scope.$watch("currentLocale",function(newValue,oldValue){newValue!==oldValue&&updateMenus()}),scope.$watch("toggles",function(newValue,oldValue){angular.equals(newValue,oldValue)||updateToggles()}),scope.$watch("container.offsetHeight",function(newValue,oldValue){newValue!==oldValue&&setContainerHeight()}),setContainerHeight(),updateMenus()}}}),angular.module("keta.directives.AppBar").run(function($templateCache){$templateCache.put("/components/directives/app-bar.html",'<div class="navigation-container">\t<div class="impersonation-bar" data-ng-show="isImpersonated()">\t\t<div class="container-fluid">\t\t\t<span class="glyphicon glyphicon-warning-sign"></span>\t\t\t<span>\t\t\t\t{{ getLabel(MESSAGE_KEY_PREFIX + \'_logged_in_as\') }}\t\t\t\t<strong>{{ user.givenName }} {{ user.familyName }} ({{impersonationInfo.userId}}). </strong>\t\t\t\t<a\t\t\t\t\ttarget="_self"\t\t\t\t\thref="{{impersonationInfo.backUrl}}"\t\t\t\t\ttitle="{{ getLabel(MESSAGE_KEY_PREFIX + \'_drop_access\') }}">\t\t\t\t\t{{ getLabel(MESSAGE_KEY_PREFIX + \'_drop_access\') }}\t\t\t\t</a>\t\t\t</span>\t\t</div>\t</div>\t<nav class="navbar navbar-level-1 brand-bar keta-app-bar-first-row" role="navigation">\t\t<div class="container-fluid">\t\t\t<div data-ng-transclude></div>\t\t\t<div class="dropdown pull-right"\t\t\t\tdata-ng-if="worlds.length > 0"\t\t\t\tdata-ng-class="getClasses(MENU_ELEMENTS.WORLD_SWITCHER)">\t\t\t\t<a href="" class="dropdown-toggle" data-ng-click="toggleOpenState(MENU_ELEMENTS.WORLD_SWITCHER)">\t\t\t\t\t<span class="glyphicon glyphicon-th"></span>\t\t\t\t</a>\t\t\t\t<ul class="dropdown-menu">\t\t\t\t\t<li data-ng-repeat="world in worlds">\t\t\t\t\t\t<a data-ng-href="{{ world.link }}">{{ world.name }}</a>\t\t\t\t\t</li>\t\t\t\t</ul>\t\t\t</div>\t\t</div>\t</nav>\t<nav class="navbar navbar-default navbar-level-2 keta-app-bar-second-row"\t\tdata-ng-class="{\'navbar-fixed-top\': scrollOverNavbarFirst}"\t\trole="navigation">\t\t<div class="container-fluid">\t\t\t<ul class="nav navbar-nav keta-app-bar-toggle">\t\t\t\t<li class="menu-navbar" data-ng-class="getClasses(MENU_ELEMENTS.MENU_BAR_TOGGLE)">\t\t\t\t\t<a href="" data-ng-click="toggleSidebar($event, \'left\')">\t\t\t\t\t\t<span class="glyphicon glyphicon-align-justify"></span>\t\t\t\t\t</a>\t\t\t\t</li>\t\t\t\t<li data-ng-class="getClasses(MENU_ELEMENTS.APP_TITLE)">\t\t\t\t\t<a data-ng-if="links.APP_ROOT !== null" class="application-title"\t\t\t\t\t\tdata-ng-href="{{ links.APP_ROOT }}">{{ getLabel(MESSAGE_KEY_PREFIX + \'_app_title\') }}</a>\t\t\t\t\t<span data-ng-if="links.APP_ROOT === null" class="application-title">\t\t\t\t\t\t{{ getLabel(MESSAGE_KEY_PREFIX + \'_app_title\') }}\t\t\t\t\t</span>\t\t\t\t</li>\t\t\t</ul>\t\t\t<ul class="nav navbar-nav navbar-right">\t\t\t\t<li class="dropdown keta-app-bar-user-menu" data-ng-class="getClasses(MENU_ELEMENTS.USER_MENU)">\t\t\t\t\t<a href="" data-ng-click="toggleOpenState(MENU_ELEMENTS.USER_MENU)">\t\t\t\t\t\t<span class="glyphicon glyphicon-user"></span>\t\t\t\t\t\t<span class="navbar-label" data-ng-class="getClasses(MENU_ELEMENTS.USER_MENU, \'label\')">\t\t\t\t\t\t\t{{ user.givenName }} {{ user.familyName }}\t\t\t\t\t\t</span>\t\t\t\t\t\t<span class="caret"></span>\t\t\t\t\t</a>\t\t\t\t\t<ul class="dropdown-menu dropdown-menu-right">\t\t\t\t\t\t<li data-ng-if="isEnabled(AVAILABLE_TOGGLES.USER_PROFILE) && links.USER_PROFILE">\t\t\t\t\t\t\t<a data-ng-href="{{ links.USER_PROFILE }}" data-ng-click="closeAllMenus()">\t\t\t\t\t\t\t\t{{ getLabel(MESSAGE_KEY_PREFIX + \'_user_profile\') }}\t\t\t\t\t\t\t</a>\t\t\t\t\t\t</li>\t\t\t\t\t\t<li data-ng-if="isEnabled(AVAILABLE_TOGGLES.USER_LOGOUT)">\t\t\t\t\t\t\t<a data-ng-href="{{ links.USER_LOGOUT }}" data-ng-click="closeAllMenus()">\t\t\t\t\t\t\t\t{{ getLabel(MESSAGE_KEY_PREFIX + \'_user_logout\') }}\t\t\t\t\t\t\t</a>\t\t\t\t\t\t</li>\t\t\t\t\t</ul>\t\t\t\t</li>\t\t\t\t<li class="dropdown keta-app-bar-em-menu"\t\t\t\t\tdata-ng-if="energyManagers.length > 0"\t\t\t\t\tdata-ng-class="getClasses(MENU_ELEMENTS.ENERGY_MANAGER_MENU)">\t\t\t\t\t<a href="" class="dropdown-toggle"\t\t\t\t\t\tdata-ng-click="toggleOpenState(MENU_ELEMENTS.ENERGY_MANAGER_MENU)">\t\t\t\t\t\t<span class="glyphicon glyphicon-tasks" title="Energy-Manager"></span>\t\t\t\t\t\t<span class="navbar-label"\t\t\t\t\t\t\tdata-ng-class="getClasses(MENU_ELEMENTS.ENERGY_MANAGER_MENU, \'label\')">\t\t\t\t\t\t\t{{ getLabel(MESSAGE_KEY_PREFIX + \'_energy_manager\') }}\t\t\t\t\t\t</span>\t\t\t\t\t\t<span>({{ energyManagers.length }})</span>\t\t\t\t\t\t<span class="caret"></span>\t\t\t\t\t</a>\t\t\t\t\t<ul class="dropdown-menu">\t\t\t\t\t\t<li data-ng-repeat="\t\t\t\t\t\t\tentry in energyManagers |\t\t\t\t\t\t\torderBy:order(TYPES.ENERGY_MANAGER):reverse(TYPES.ENERGY_MANAGER) |\t\t\t\t\t\t\tlimitTo:LIMITS.ENERGY_MANAGER">\t\t\t\t\t\t\t<a data-ng-href="{{ entry.link }}" data-ng-click="closeAllMenus()">\t\t\t\t\t\t\t\t{{ entry.name }}\t\t\t\t\t\t\t</a>\t\t\t\t\t\t</li>\t\t\t\t\t\t<li data-ng-if="energyManagers.length > LIMITS.ENERGY_MANAGER &&\t\t\t\t\t\t\tlinks.ALL_ENERGY_MANAGERS !== null &&\t\t\t\t\t\t\tlabels.ALL_ENERGY_MANAGERS !== null">\t\t\t\t\t\t\t<a data-ng-href="{{ links.ALL_ENERGY_MANAGERS }}" data-ng-click="closeAllMenus()">\t\t\t\t\t\t\t\t{{ getLabel(MESSAGE_KEY_PREFIX + \'_all_energy_managers\') }}\t\t\t\t\t\t\t\t({{ energyManagers.length }})\t\t\t\t\t\t\t</a>\t\t\t\t\t\t</li>\t\t\t\t\t</ul>\t\t\t\t</li>\t\t\t\t<li class="dropdown keta-app-bar-lang-menu"\t\t\t\t\tdata-ng-if="locales.length > 0"\t\t\t\t\tdata-ng-class="getClasses(MENU_ELEMENTS.LANGUAGE_MENU)">\t\t\t\t\t<a href="" class="dropdown-toggle" data-ng-click="toggleOpenState(MENU_ELEMENTS.LANGUAGE_MENU)">\t\t\t\t\t\t<span class="glyphicon glyphicon-flag"\t\t\t\t\t\t\ttitle="{{ menus.languageMenu.activeEntry.nameShort }}"></span>\t\t\t\t\t\t<span class="navbar-label" data-ng-class="getClasses(MENU_ELEMENTS.LANGUAGE_MENU, \'label\')">\t\t\t\t\t\t\t{{ menus.languageMenu.activeEntry.nameShort }}\t\t\t\t\t\t</span>\t\t\t\t\t\t<span class="caret"></span>\t\t\t\t\t</a>\t\t\t\t\t<ul class="dropdown-menu">\t\t\t\t\t\t<li data-ng-repeat="locale in locales"\t\t\t\t\t\t\tdata-ng-class="{ active: isActive(MENU_ELEMENTS.LANGUAGE_MENU, locale) }">\t\t\t\t\t\t\t<a href="" data-ng-click="setLocale(locale)">{{ locale.name }}</a>\t\t\t\t\t\t</li>\t\t\t\t\t</ul>\t\t\t\t</li>\t\t\t\t<li class="dropdown keta-app-bar-status-link"\t\t\t\t data-ng-if="!!statusLink"\t\t\t\t data-ng-class="getClasses(MENU_ELEMENTS.STATUS_LINK)">\t\t\t\t\t<a href="{{statusLink}}" target="_blank">\t\t\t\t\t\t<span class="glyphicon glyphicon-zoom-in"\t\t\t\t\t\t\t\ttitle="Status"></span>\t\t\t\t\t\t{{ getLabel(MESSAGE_KEY_PREFIX + \'_status_link\') }}\t\t\t\t\t</a>\t\t\t\t</li>\t\t\t\t<li class="dropdown keta-app-bar-compact-menu" data-ng-class="getClasses(MENU_ELEMENTS.COMPACT_MENU)">\t\t\t\t\t<a href="" data-ng-click="toggleOpenState(MENU_ELEMENTS.COMPACT_MENU)">\t\t\t\t\t\t<span class="glyphicon glyphicon-option-vertical"></span>\t\t\t\t\t</a>\t\t\t\t\t<ul class="dropdown-menu dropdown-menu-right">\t\t\t\t\t\t<li>\t\t\t\t\t\t\t<a data-ng-href="{{ links.USER_PROFILE }}" data-ng-click="closeAllMenus()">\t\t\t\t\t\t\t\t{{ getLabel(MESSAGE_KEY_PREFIX + \'_user_profile\') }}\t\t\t\t\t\t\t</a>\t\t\t\t\t\t</li>\t\t\t\t\t\t<li>\t\t\t\t\t\t\t<a data-ng-href="{{ links.USER_LOGOUT }}" data-ng-click="closeAllMenus()">\t\t\t\t\t\t\t\t{{ getLabel(MESSAGE_KEY_PREFIX + \'_user_logout\') }}\t\t\t\t\t\t\t</a>\t\t\t\t\t\t</li>\t\t\t\t\t\t<li class="divider" data-ng-if="energyManagers.length"></li>\t\t\t\t\t\t<li data-ng-repeat="\t\t\t\t\t\t\tentry in energyManagers |\t\t\t\t\t\t\torderBy:order(TYPES.ENERGY_MANAGER):reverse(TYPES.ENERGY_MANAGER) |\t\t\t\t\t\t\tlimitTo:LIMITS.ENERGY_MANAGER">\t\t\t\t\t\t\t<a data-ng-href="{{ entry.link }}" data-ng-click="closeAllMenus()">\t\t\t\t\t\t\t\t{{ entry.name }}\t\t\t\t\t\t\t</a>\t\t\t\t\t\t</li>\t\t\t\t\t\t<li data-ng-if="energyManagers.length > LIMITS.ENERGY_MANAGER">\t\t\t\t\t\t\t<a data-ng-href="{{ links.ALL_ENERGY_MANAGERS }}" data-ng-click="closeAllMenus()">\t\t\t\t\t\t\t\t{{ getLabel(MESSAGE_KEY_PREFIX + \'_all_energy_managers\') }}\t\t\t\t\t\t\t\t({{ energyManagers.length }})\t\t\t\t\t\t\t</a>\t\t\t\t\t\t</li>\t\t\t\t\t\t<li class="divider" data-ng-if="locales"></li>\t\t\t\t\t\t<li data-ng-repeat="entry in locales"\t\t\t\t\t\t\tdata-ng-class="{ active: isActive(MENU_ELEMENTS.LANGUAGE_MENU, entry) }">\t\t\t\t\t\t\t<a href="" data-ng-click="setLocale(entry)">{{ entry.name }}</a>\t\t\t\t\t\t</li>\t\t\t\t\t</ul>\t\t\t\t</li>\t\t\t\t<li class="keta-app-bar-notification-menu"\t\t\t\t\tdata-ng-class="getClasses(MENU_ELEMENTS.NOTIFICATION_BAR_TOGGLE)">\t\t\t\t\t<a href="" id="toggleSidebarButton" data-ng-click="toggleSidebar($event, \'right\')">\t\t\t\t\t\t<span class="glyphicon glyphicon-bell"\t\t\t\t\t\t\ttitle="{{ getLabel(MESSAGE_KEY_PREFIX + \'_notifications\') }}"></span>\t\t\t\t\t\t<span data-ng-if="notifications.length > 0" class="badge">{{notifications.length}}</span>\t\t\t\t\t</a>\t\t\t\t</li>\t\t\t</ul>\t\t</div>\t</nav>\t<div class="nav-backdrop"></div></div>')}),angular.module("keta.directives.DatePicker",["moment"]).constant("ketaDatePickerConstants",{CSS_CLASSES:{CURRENT_DATE:"current-date",OUT_OF_BOUNDS:"out-of-bounds",OUT_OF_BOUNDS_AFTER:"out-of-bounds-after",OUT_OF_BOUNDS_BEFORE:"out-of-bounds-before",OUT_OF_MONTH:"out-of-month",SELECTED_DATE:"selected-date-single"},DAY:{SUNDAY:0,MONDAY:1,TUESDAY:2,WEDNESDAY:3,THURSDAY:4,FRIDAY:5,SATURDAY:6},DISPLAY_MODE:{DAY:"day",MONTH:"month",YEAR:"year"},EVENT:{SELECT:"keta.directives.DatePicker.Event.Selected"}}).constant("ketaDatePickerMessageKeys",{en_GB:{"__keta.directives.DatePicker_select":"Select","__keta.directives.DatePicker_selection":"Selection","__keta.directives.DatePicker_today":"Today","__keta.directives.DatePicker_week":"Week","__keta.directives.DatePicker_weekday_sunday":"Sunday","__keta.directives.DatePicker_weekday_sunday_short":"Sun","__keta.directives.DatePicker_weekday_monday":"Monday","__keta.directives.DatePicker_weekday_monday_short":"Mon","__keta.directives.DatePicker_weekday_tuesday":"Tuesday","__keta.directives.DatePicker_weekday_tuesday_short":"Tue","__keta.directives.DatePicker_weekday_wednesday":"Wednesday","__keta.directives.DatePicker_weekday_wednesday_short":"Wed","__keta.directives.DatePicker_weekday_thursday":"Thursday","__keta.directives.DatePicker_weekday_thursday_short":"Thu","__keta.directives.DatePicker_weekday_friday":"Friday","__keta.directives.DatePicker_weekday_friday_short":"Fri","__keta.directives.DatePicker_weekday_saturday":"Saturday","__keta.directives.DatePicker_weekday_saturday_short":"Sat","__keta.directives.DatePicker_week_number":"Week Number","__keta.directives.DatePicker_week_number_short":"Wn"},de_DE:{"__keta.directives.DatePicker_select":"Auswählen","__keta.directives.DatePicker_selection":"Auswahl","__keta.directives.DatePicker_today":"Heute","__keta.directives.DatePicker_week":"Woche","__keta.directives.DatePicker_weekday_sunday":"Sonntag","__keta.directives.DatePicker_weekday_sunday_short":"So","__keta.directives.DatePicker_weekday_monday":"Montag","__keta.directives.DatePicker_weekday_monday_short":"Mo","__keta.directives.DatePicker_weekday_tuesday":"Dienstag","__keta.directives.DatePicker_weekday_tuesday_short":"Di","__keta.directives.DatePicker_weekday_wednesday":"Mittwoch","__keta.directives.DatePicker_weekday_wednesday_short":"Mi","__keta.directives.DatePicker_weekday_thursday":"Donnerstag","__keta.directives.DatePicker_weekday_thursday_short":"Do","__keta.directives.DatePicker_weekday_friday":"Freitag","__keta.directives.DatePicker_weekday_friday_short":"Fr","__keta.directives.DatePicker_weekday_saturday":"Samstag","__keta.directives.DatePicker_weekday_saturday_short":"Sa","__keta.directives.DatePicker_week_number":"Kalenderwoche","__keta.directives.DatePicker_week_number_short":"KW"},es_ES:{"__keta.directives.DatePicker_select":"Seleccione","__keta.directives.DatePicker_selection":"Espécimen","__keta.directives.DatePicker_today":"Hoy","__keta.directives.DatePicker_week":"Semana","__keta.directives.DatePicker_weekday_sunday":"Domingo","__keta.directives.DatePicker_weekday_sunday_short":"Do","__keta.directives.DatePicker_weekday_monday":"Lunes","__keta.directives.DatePicker_weekday_monday_short":"Lu","__keta.directives.DatePicker_weekday_tuesday":"Martes","__keta.directives.DatePicker_weekday_tuesday_short":"Ma","__keta.directives.DatePicker_weekday_wednesday":"Miércoles","__keta.directives.DatePicker_weekday_wednesday_short":"Mi","__keta.directives.DatePicker_weekday_thursday":"Jueves","__keta.directives.DatePicker_weekday_thursday_short":"Ju","__keta.directives.DatePicker_weekday_friday":"Viernes","__keta.directives.DatePicker_weekday_friday_short":"Vi","__keta.directives.DatePicker_weekday_saturday":"Sábado","__keta.directives.DatePicker_weekday_saturday_short":"Sá","__keta.directives.DatePicker_week_number":"Número de semana","__keta.directives.DatePicker_week_number_short":"CS"},fr_FR:{"__keta.directives.DatePicker_select":"Choisir","__keta.directives.DatePicker_selection":"Sélection","__keta.directives.DatePicker_today":"Aujourd’hui","__keta.directives.DatePicker_week":"Semaine","__keta.directives.DatePicker_weekday_sunday":"Dimanche","__keta.directives.DatePicker_weekday_sunday_short":"Dim","__keta.directives.DatePicker_weekday_monday":"Lundi","__keta.directives.DatePicker_weekday_monday_short":"Lun","__keta.directives.DatePicker_weekday_tuesday":"Mardi","__keta.directives.DatePicker_weekday_tuesday_short":"Mar","__keta.directives.DatePicker_weekday_wednesday":"Mercredi","__keta.directives.DatePicker_weekday_wednesday_short":"Mer","__keta.directives.DatePicker_weekday_thursday":"Jeudi","__keta.directives.DatePicker_weekday_thursday_short":"Jeu","__keta.directives.DatePicker_weekday_friday":"Vendredi","__keta.directives.DatePicker_weekday_friday_short":"Ven","__keta.directives.DatePicker_weekday_saturday":"Samedi","__keta.directives.DatePicker_weekday_saturday_short":"Sam","__keta.directives.DatePicker_week_number":"Numéro de la semaine","__keta.directives.DatePicker_week_number_short":"Sem."},nl_NL:{"__keta.directives.DatePicker_select":"Kiezen","__keta.directives.DatePicker_selection":"Selectie","__keta.directives.DatePicker_today":"Vandaag","__keta.directives.DatePicker_week":"Week","__keta.directives.DatePicker_weekday_sunday":"Zondag","__keta.directives.DatePicker_weekday_sunday_short":"Zo","__keta.directives.DatePicker_weekday_monday":"Maandag","__keta.directives.DatePicker_weekday_monday_short":"Ma","__keta.directives.DatePicker_weekday_tuesday":"Dinsdag","__keta.directives.DatePicker_weekday_tuesday_short":"Di","__keta.directives.DatePicker_weekday_wednesday":"Woensdag","__keta.directives.DatePicker_weekday_wednesday_short":"Wo","__keta.directives.DatePicker_weekday_thursday":"Donderdag","__keta.directives.DatePicker_weekday_thursday_short":"Do","__keta.directives.DatePicker_weekday_friday":"Vrijdag","__keta.directives.DatePicker_weekday_friday_short":"Vr","__keta.directives.DatePicker_weekday_saturday":"Zaterdag","__keta.directives.DatePicker_weekday_saturday_short":"Za","__keta.directives.DatePicker_week_number":"Weeknummer","__keta.directives.DatePicker_week_number_short":"Wn"},it_IT:{"__keta.directives.DatePicker_select":"Scegliere","__keta.directives.DatePicker_selection":"Selezione","__keta.directives.DatePicker_today":"Oggi","__keta.directives.DatePicker_week":"Settimana","__keta.directives.DatePicker_weekday_sunday":"Domenica","__keta.directives.DatePicker_weekday_sunday_short":"Dom.","__keta.directives.DatePicker_weekday_monday":"Lunedì","__keta.directives.DatePicker_weekday_monday_short":"Lun.","__keta.directives.DatePicker_weekday_tuesday":"Martedì","__keta.directives.DatePicker_weekday_tuesday_short":"Mar.","__keta.directives.DatePicker_weekday_wednesday":"Mercoledì","__keta.directives.DatePicker_weekday_wednesday_short":"Mer.","__keta.directives.DatePicker_weekday_thursday":"Giovedì","__keta.directives.DatePicker_weekday_thursday_short":"Gio.","__keta.directives.DatePicker_weekday_friday":"Venerdì","__keta.directives.DatePicker_weekday_friday_short":"Ven.","__keta.directives.DatePicker_weekday_saturday":"Sabato","__keta.directives.DatePicker_weekday_saturday_short":"Sab.","__keta.directives.DatePicker_week_number":"Numero della settimana","__keta.directives.DatePicker_week_number_short":"Set."},sv_SE:{"__keta.directives.DatePicker_select":"Välj","__keta.directives.DatePicker_selection":"Val","__keta.directives.DatePicker_today":"I dag","__keta.directives.DatePicker_week":"Vecka","__keta.directives.DatePicker_weekday_sunday":"Söndag","__keta.directives.DatePicker_weekday_sunday_short":"Sö","__keta.directives.DatePicker_weekday_monday":"Måndag","__keta.directives.DatePicker_weekday_monday_short":"Må","__keta.directives.DatePicker_weekday_tuesday":"Tisdag","__keta.directives.DatePicker_weekday_tuesday_short":"Ti","__keta.directives.DatePicker_weekday_wednesday":"Onsdag","__keta.directives.DatePicker_weekday_wednesday_short":"On","__keta.directives.DatePicker_weekday_thursday":"Torsdag","__keta.directives.DatePicker_weekday_thursday_short":"To","__keta.directives.DatePicker_weekday_friday":"Fredag","__keta.directives.DatePicker_weekday_friday_short":"Fr","__keta.directives.DatePicker_weekday_saturday":"Lördag","__keta.directives.DatePicker_weekday_saturday_short":"Lö","__keta.directives.DatePicker_week_number":"Vecka","__keta.directives.DatePicker_week_number_short":"V"}}).directive("ketaDatePicker",function($filter,ketaDatePickerConstants,ketaDatePickerMessageKeys,moment){return{restrict:"EA",replace:!0,require:"ngModel",scope:{cssClasses:"=?",currentLocale:"=?",displayMode:"=?",displayValue:"=?",elementIdentifier:"=?",enableDisplayModeSwitch:"=?",firstDayOfWeek:"=?",labels:"=?",maximum:"=?",minimum:"=?",model:"=ngModel",showPager:"=?",showJumpToSelectionButton:"=?",showJumpToTodayButton:"=?",showSelectButton:"=?",showWeekNumbers:"=?",yearsAfter:"=?",yearsBefore:"=?"},templateUrl:"/components/directives/date-picker.html",link:function(scope){scope.DISPLAY_MODE_DAY=ketaDatePickerConstants.DISPLAY_MODE.DAY,scope.DISPLAY_MODE_MONTH=ketaDatePickerConstants.DISPLAY_MODE.MONTH,scope.DISPLAY_MODE_YEAR=ketaDatePickerConstants.DISPLAY_MODE.YEAR;var today=new Date;today.setHours(0,0,0,0),scope.model=angular.isDate(scope.model)?new Date(scope.model.setHours(0,0,0,0)):today,scope.cssClasses=angular.isObject(scope.cssClasses)?angular.extend(ketaDatePickerConstants.CSS_CLASSES,scope.cssClasses):ketaDatePickerConstants.CSS_CLASSES,scope.currentLocale=angular.isString(scope.currentLocale)?scope.currentLocale:"en_GB",scope.displayMode=scope.displayMode||scope.DISPLAY_MODE_DAY,scope.displayValue=angular.isDate(scope.displayValue)?new Date(scope.displayValue.setHours(0,0,0,0)):angular.copy(scope.model),scope.elementIdentifier=angular.isDefined(scope.elementIdentifier)?scope.elementIdentifier:null,scope.enableDisplayModeSwitch=!angular.isDefined(scope.enableDisplayModeSwitch)||scope.enableDisplayModeSwitch,scope.firstDayOfWeek=scope.firstDayOfWeek||ketaDatePickerConstants.DAY.SUNDAY,scope.MESSAGE_KEY_PREFIX="__keta.directives.DatePicker",scope.labels=angular.isObject(scope.labels)?angular.extend(ketaDatePickerMessageKeys,scope.labels):ketaDatePickerMessageKeys,scope.currentLabels=angular.isDefined(ketaDatePickerMessageKeys[scope.currentLocale.substr(0,5)])?ketaDatePickerMessageKeys[scope.currentLocale.substr(0,5)]:ketaDatePickerMessageKeys.en_GB,scope.maximum=angular.isDate(scope.maximum)?new Date(scope.maximum.setHours(0,0,0,0)):null,scope.minimum=angular.isDate(scope.minimum)?new Date(scope.minimum.setHours(0,0,0,0)):null,scope.showPager=!angular.isDefined(scope.showPager)||scope.showPager,scope.showJumpToSelectionButton=!!angular.isDefined(scope.showJumpToSelectionButton)&&scope.showJumpToSelectionButton,scope.showJumpToTodayButton=!!angular.isDefined(scope.showJumpToTodayButton)&&scope.showJumpToTodayButton,scope.showSelectButton=!!angular.isDefined(scope.showSelectButton)&&scope.showSelectButton,scope.showWeekNumbers=!angular.isDefined(scope.showWeekNumbers)||scope.showWeekNumbers,scope.yearsBefore=scope.yearsBefore||7,scope.yearsAfter=scope.yearsAfter||4,scope.weekDays=[],scope.days=[],scope.months=[],scope.years=[];var getWeekDays=function(){for(var weekDays=[],weekDayLabels=[scope.currentLabels[scope.MESSAGE_KEY_PREFIX+"_weekday_sunday_short"],scope.currentLabels[scope.MESSAGE_KEY_PREFIX+"_weekday_monday_short"],scope.currentLabels[scope.MESSAGE_KEY_PREFIX+"_weekday_tuesday_short"],scope.currentLabels[scope.MESSAGE_KEY_PREFIX+"_weekday_wednesday_short"],scope.currentLabels[scope.MESSAGE_KEY_PREFIX+"_weekday_thursday_short"],scope.currentLabels[scope.MESSAGE_KEY_PREFIX+"_weekday_friday_short"],scope.currentLabels[scope.MESSAGE_KEY_PREFIX+"_weekday_saturday_short"]],start=scope.firstDayOfWeek;weekDays.length<7;)weekDays.push(weekDayLabels[start]),start++,start%=7;scope.weekDays=weekDays},getDays=function(){var firstOfCurrentMonth=moment(scope.displayValue.getTime()).startOf("month").hours(0).minutes(0).seconds(0).milliseconds(0),firstOfCurrentMonthWeekDay=firstOfCurrentMonth.day(),lastOfCurrentMonth=moment(firstOfCurrentMonth).add(1,"months").subtract(1,"days"),lastOfCurrentMonthWeekDay=lastOfCurrentMonth.day(),days=[],i=0;for(firstOfCurrentMonthWeekDay<scope.firstDayOfWeek&&(firstOfCurrentMonthWeekDay+=7),i=firstOfCurrentMonthWeekDay-scope.firstDayOfWeek;i>0;i--){var prependedDay=moment(firstOfCurrentMonth).subtract(i,"days");days.push(prependedDay.toDate())}var monthDays=moment(lastOfCurrentMonth).date();for(i=0;i<monthDays;i++){var monthDay=moment(firstOfCurrentMonth).add(i,"days");days.push(monthDay.toDate())}lastOfCurrentMonthWeekDay<scope.firstDayOfWeek&&(lastOfCurrentMonthWeekDay+=7);var daysToAppend=7-(lastOfCurrentMonthWeekDay-scope.firstDayOfWeek)-1;for(i=1;i<=daysToAppend;i++){var appendedDay=moment(lastOfCurrentMonth).add(i,"days");days.push(appendedDay.toDate())}var chunks=[],chunk=[];angular.forEach(days,function(day,index){chunk.push(day),(index+1)%7==0&&(chunks.push(chunk),chunk=[])}),scope.days=chunks},getMonths=function(){for(var months=[],monthsChunked=[],now=moment(scope.displayValue).date(1).hour(0).minute(0).second(0).millisecond(0).toDate(),i=0;i<12;i++)now.setMonth(i),months.push(angular.copy(now));var chunk=[];angular.forEach(months,function(month,index){chunk.push(month),(index+1)%3==0&&(monthsChunked.push(chunk),chunk=[])}),scope.months=monthsChunked},getYears=function(){for(var years=[],yearsChunked=[],now=moment(scope.displayValue).month(0).date(1).hour(0).minute(0).second(0).millisecond(0).toDate(),currentYear=parseInt($filter("date")(now,"yyyy"),10),yearStart=currentYear-scope.yearsBefore,yearEnd=currentYear+scope.yearsAfter,i=yearStart;i<=yearEnd;i++)now.setFullYear(i),years.push(angular.copy(now));var chunk=[];angular.forEach(years,function(year,index){chunk.push(year),(index+1)%3==0&&(yearsChunked.push(chunk),chunk=[])}),scope.years=yearsChunked},getLocaleISO=function(date,length){return(date.getFullYear()+"-"+("00"+(date.getMonth()+1)).slice(-2)+"-"+("00"+date.getDate()).slice(-2)).substr(0,length)};scope.isOutOfBounds=function(date){var outOfBounds=!1,isoDateLength=10;scope.displayMode===scope.DISPLAY_MODE_MONTH&&(isoDateLength=7),scope.displayMode===scope.DISPLAY_MODE_YEAR&&(isoDateLength=4);var dateISO=getLocaleISO(date,isoDateLength);return null!==scope.minimum&&dateISO<getLocaleISO(scope.minimum,isoDateLength)&&(outOfBounds=!0),null!==scope.maximum&&dateISO>getLocaleISO(scope.maximum,isoDateLength)&&(outOfBounds=!0),outOfBounds},scope.getDateClasses=function(date){var classes=[],td=new Date((new Date).setHours(0,0,0,0)),current=scope.displayValue,isoDateLength=10;scope.displayMode===scope.DISPLAY_MODE_MONTH&&(isoDateLength=7),scope.displayMode===scope.DISPLAY_MODE_YEAR&&(isoDateLength=4);var selectedDateISO=getLocaleISO(scope.model,isoDateLength),dateISO=getLocaleISO(date,isoDateLength),todayISO=getLocaleISO(td,isoDateLength);return scope.displayMode===scope.DISPLAY_MODE_DAY&&date.getMonth()!==current.getMonth()&&classes.push(scope.cssClasses.OUT_OF_MONTH),scope.isOutOfBounds(date)&&(classes.push(scope.cssClasses.OUT_OF_BOUNDS),null!==scope.minimum&&dateISO<getLocaleISO(scope.minimum,isoDateLength)&&classes.push(scope.cssClasses.OUT_OF_BOUNDS_BEFORE),null!==scope.maximum&&dateISO>getLocaleISO(scope.maximum,isoDateLength)&&classes.push(scope.cssClasses.OUT_OF_BOUNDS_AFTER)),dateISO===todayISO&&classes.push(scope.cssClasses.CURRENT_DATE),null!==selectedDateISO&&dateISO===selectedDateISO&&classes.push(scope.cssClasses.SELECTED_DATE),classes.join(" ")},scope.getYearRange=function(){var year=parseInt($filter("date")(scope.displayValue,"yyyy"),10);return year-scope.yearsBefore+" – "+(year+scope.yearsAfter)};var update=function(){scope.currentLabels=angular.isDefined(ketaDatePickerMessageKeys[scope.currentLocale.substr(0,5)])?ketaDatePickerMessageKeys[scope.currentLocale.substr(0,5)]:ketaDatePickerMessageKeys.en_GB,getWeekDays(),scope.displayMode===scope.DISPLAY_MODE_MONTH?getMonths():scope.displayMode===scope.DISPLAY_MODE_YEAR?getYears():getDays()};update();var move=function(direction){scope.displayMode===scope.DISPLAY_MODE_MONTH?scope.displayValue=moment(scope.displayValue).add(direction,"years").toDate():scope.displayMode===scope.DISPLAY_MODE_YEAR?scope.displayValue=moment(scope.displayValue).add(direction*(scope.yearsBefore+scope.yearsAfter+1),"years").toDate():scope.displayValue=moment(scope.displayValue).add(direction,"months").toDate(),update()};scope.prev=function(){move(-1)},scope.next=function(){move(1)},scope.submit=function(){scope.$emit(ketaDatePickerConstants.EVENT.SELECT,{id:scope.elementIdentifier,model:scope.model})},scope.select=function(date){scope.isOutOfBounds(date)||(scope.model=date,scope.submit())},scope.goToSelection=function(){scope.displayValue=angular.copy(scope.model)},scope.goToToday=function(){var td=new Date;td.setHours(0,0,0,0),scope.displayValue=td},scope.setDisplayMode=function(mode){scope.displayMode=mode,update()},scope.setView=function(date,displayMode){scope.isOutOfBounds(date)||(scope.displayValue=angular.copy(date),scope.displayMode=displayMode)},scope.$watch("currentLocale",function(newValue,oldValue){newValue!==oldValue&&angular.isString(newValue)&&update()}),scope.$watch("displayMode",function(newValue,oldValue){newValue!==oldValue&&update()}),scope.$watch("displayValue",function(newValue,oldValue){newValue!==oldValue&&angular.isDate(newValue)&&update()}),scope.$watch("firstDayOfWeek",function(newValue,oldValue){newValue!==oldValue&&update()}),scope.$watch("yearsAfter",function(newValue,oldValue){newValue!==oldValue&&update()}),scope.$watch("yearsBefore",function(newValue,oldValue){newValue!==oldValue&&update()})}}}),angular.module("keta.directives.DatePicker").run(function($templateCache){$templateCache.put("/components/directives/date-picker.html",'<div class="keta-date-picker">\t<ul class="pager pager-navigation" data-ng-if="showPager">\t\t<li class="previous">\t\t\t<a href="" data-ng-click="prev()"><span aria-hidden="true">←</span></a>\t\t</li>\t\t<li class="text-center" data-ng-if="displayMode === DISPLAY_MODE_DAY">\t\t\t<a href=""\t\t\t\tdata-ng-if="enableDisplayModeSwitch"\t\t\t\tdata-ng-click="setDisplayMode(DISPLAY_MODE_MONTH)">{{ displayValue | date:\'MMMM yyyy\' }}</a>\t\t\t<a data-ng-if="!enableDisplayModeSwitch">{{ displayValue | date:\'MMMM yyyy\' }}</a>\t\t</li>\t\t<li class="text-center" data-ng-if="displayMode === DISPLAY_MODE_MONTH">\t\t\t<a href=""\t\t\t\tdata-ng-if="enableDisplayModeSwitch"\t\t\t\tdata-ng-click="setDisplayMode(DISPLAY_MODE_YEAR)">{{ displayValue | date:\'yyyy\' }}</a>\t\t\t<a data-ng-if="!enableDisplayModeSwitch">{{ displayValue | date:\'yyyy\' }}</a>\t\t</li>\t\t<li class="text-center" data-ng-if="displayMode === DISPLAY_MODE_YEAR">\t\t\t<div class="pager-link">{{ getYearRange() }}</div>\t\t</li>\t\t<li class="next">\t\t\t<a href="" data-ng-click="next()"><span aria-hidden="true">→</span></a>\t\t</li>\t</ul>\t\x3c!-- days --\x3e\t<table class="calendar calendar-day" data-ng-if="displayMode === DISPLAY_MODE_DAY">\t\t<tr>\t\t\t<td data-ng-if="showWeekNumbers">\t\t\t\t<a class="weekday">{{ currentLabels[MESSAGE_KEY_PREFIX + \'_week_number_short\'] }}</a>\t\t\t</td>\t\t\t<td data-ng-repeat="day in weekDays">\t\t\t\t<a class="weekday">{{ day }}</a>\t\t\t</td>\t\t</tr>\t\t<tr data-ng-repeat="week in days">\t\t\t<td data-ng-if="showWeekNumbers">\t\t\t\t<a class="week-number">{{ week[0] | date:\'w\' }}</a>\t\t\t</td>\t\t\t<td data-ng-repeat="day in week">\t\t\t\t<a href=""\t\t\t\t\tdata-ng-click="select(day)"\t\t\t\t\tdata-ng-class="getDateClasses(day)">{{ day | date:\'d\' }}</a>\t\t\t</td>\t\t</tr>\t</table>\t\x3c!-- months --\x3e\t<table class="calendar calendar-month" data-ng-if="displayMode === DISPLAY_MODE_MONTH">\t\t<tr data-ng-repeat="row in months">\t\t\t<td data-ng-repeat="month in row">\t\t\t\t<a href=""\t\t\t\t\tdata-ng-click="setView(month, DISPLAY_MODE_DAY)"\t\t\t\t\tdata-ng-class="getDateClasses(month)">{{ month | date:\'MMM\' }}</a>\t\t\t</td>\t\t</tr>\t</table>\t\x3c!-- years --\x3e\t<table class="calendar calendar-year" data-ng-if="displayMode === DISPLAY_MODE_YEAR">\t\t<tr data-ng-repeat="row in years">\t\t\t<td data-ng-repeat="year in row">\t\t\t\t<a href=""\t\t\t\t\tdata-ng-click="setView(year, DISPLAY_MODE_MONTH)"\t\t\t\t\tdata-ng-class="getDateClasses(year)">{{ year | date:\'yyyy\' }}</a>\t\t\t</td>\t\t</tr>\t</table>\t<ul class="pager pager-quick-links"\t\tdata-ng-if="showJumpToSelectionButton || showJumpToTodayButton || showSelectButton">\t\t<li class="text-center">\t\t\t<a href="" data-ng-if="showJumpToTodayButton"\t\t\t\tdata-ng-click="goToToday()">{{ currentLabels[MESSAGE_KEY_PREFIX + \'_today\'] }}</a>\t\t\t<a href="" data-ng-if="showJumpToSelectionButton"\t\t\t\tdata-ng-click="goToSelection()">{{ currentLabels[MESSAGE_KEY_PREFIX + \'_selection\'] }}</a>\t\t\t<a href="" data-ng-if="showSelectButton"\t\t\t\tdata-ng-click="submit()">{{ currentLabels[MESSAGE_KEY_PREFIX + \'_select\'] }}</a>\t\t</li>\t</ul></div>')}),angular.module("keta.directives.ExtendedTable",["ngSanitize","keta.filters.OrderObjectBy","keta.filters.Slice","keta.filters.Unit","keta.utils.Common"]).constant("ketaExtendedTableConstants",{COMPONENT:{TABLE:"table",FILTER:"filter",SELECTOR:"selector",PAGER:"pager"},OPERATIONS_MODE:{DATA:"data",VIEW:"view"},PAGER:{TOTAL:"total",LIMIT:"limit",OFFSET:"offset"},ACTION_LIST_TYPE:{LINK:"link",ACTION:"action"}}).constant("ketaExtendedTableMessageKeys",{en_GB:{"__keta.directives.ExtendedTable_search":"Search","__keta.directives.ExtendedTable_add_column":"Add column","__keta.directives.ExtendedTable_remove_column":"Remove column","__keta.directives.ExtendedTable_sort":"Sort","__keta.directives.ExtendedTable_no_entries":"No entries","__keta.directives.ExtendedTable_of":"of"},de_DE:{"__keta.directives.ExtendedTable_search":"Suche","__keta.directives.ExtendedTable_add_column":"Spalte hinzufügen","__keta.directives.ExtendedTable_remove_column":"Spalte entfernen","__keta.directives.ExtendedTable_sort":"Sortieren","__keta.directives.ExtendedTable_no_entries":"Keine Einträge","__keta.directives.ExtendedTable_of":"von"},es_ES:{"__keta.directives.ExtendedTable_search":"Búsqueda","__keta.directives.ExtendedTable_add_column":"Añadir columna","__keta.directives.ExtendedTable_remove_column":"Eliminar columna","__keta.directives.ExtendedTable_sort":"Clasificación","__keta.directives.ExtendedTable_no_entries":"No hay entradas","__keta.directives.ExtendedTable_of":"antes de"},fr_FR:{"__keta.directives.ExtendedTable_search":"Recherche","__keta.directives.ExtendedTable_add_column":"Ajouter colonne","__keta.directives.ExtendedTable_remove_column":"Retirer la colonne","__keta.directives.ExtendedTable_sort":"Trier","__keta.directives.ExtendedTable_no_entries":"Pas d’entrées","__keta.directives.ExtendedTable_of":"de"},nl_NL:{"__keta.directives.ExtendedTable_search":"Zoeken","__keta.directives.ExtendedTable_add_column":"Kolom toevoegen","__keta.directives.ExtendedTable_remove_column":"Kolom verwijderen","__keta.directives.ExtendedTable_sort":"Soort","__keta.directives.ExtendedTable_no_entries":"Geen data","__keta.directives.ExtendedTable_of":"van"},it_IT:{"__keta.directives.ExtendedTable_search":"Ricerca","__keta.directives.ExtendedTable_add_column":"Aggiungi colonna","__keta.directives.ExtendedTable_remove_column":"Rimuovere colonna","__keta.directives.ExtendedTable_sort":"Ordinare","__keta.directives.ExtendedTable_no_entries":"Nessuna voce","__keta.directives.ExtendedTable_of":"di"},sv_SE:{"__keta.directives.ExtendedTable_search":"Sök","__keta.directives.ExtendedTable_add_column":"Lägg till en kolumn","__keta.directives.ExtendedTable_remove_column":"Ta bort kolumnen","__keta.directives.ExtendedTable_sort":"Sortera","__keta.directives.ExtendedTable_no_entries":"Inga inlägg","__keta.directives.ExtendedTable_of":"av"}}).directive("ketaExtendedTable",function($compile,$filter,ketaExtendedTableConstants,ketaExtendedTableMessageKeys,ketaCommonUtils){return{restrict:"EA",replace:!0,scope:{rows:"=",currentLocale:"=?",labels:"=?",disabledComponents:"=?",switchableColumns:"=?",groupByProperty:"=?",orderByProperty:"=?",visibleColumns:"=?",headerLabelCallback:"=?",operationsMode:"=?",rowSortEnabled:"=?",rowSortCriteria:"=?",rowSortOrderAscending:"=?",unsortableColumns:"=?",actionList:"=?",cellRenderer:"=?",columnClassCallback:"=?",rowClassCallback:"=?",tableClassCallback:"=?",searchInputWidthClasses:"=?",selectorWidthClasses:"=?",pager:"=?",search:"=?",searchWaitMs:"=?",searchResults:"=?",selectionResults:"=?",selectionEnabled:"=?"},templateUrl:"/components/directives/extended-table.html",link:function(scope){scope.rows=angular.isDefined(scope.rows)&&angular.isArray(scope.rows)?scope.rows:[],scope.currentLocale=scope.currentLocale||"en_GB",scope.MESSAGE_KEY_PREFIX="__keta.directives.ExtendedTable",scope.labels=angular.extend(ketaExtendedTableMessageKeys,scope.labels),scope.getLabel=function(key){return ketaCommonUtils.getLabelByLocale(key,scope.labels,scope.currentLocale)},scope.headers=angular.isDefined(scope.rows)&&angular.isDefined(scope.rows[0])?scope.rows[0]:{},scope.disabledComponents=scope.disabledComponents||[scope.COMPONENTS_FILTER,scope.COMPONENTS_SELECTOR,scope.COMPONENTS_PAGER],scope.switchableColumns=scope.switchableColumns||[],scope.resetSelectedColumn(),scope.groupByProperty=scope.groupByProperty||null,scope.orderByProperty=scope.orderByProperty||"",scope.visibleColumns=scope.visibleColumns||(angular.isDefined(scope.rows)&&angular.isDefined(scope.rows[0])?Object.keys(scope.rows[0]):[]),scope.unsortableColumns=scope.unsortableColumns||[],scope.headerLabelCallback=scope.headerLabelCallback||function(column){return column},scope.operationsMode=scope.operationsMode||scope.OPERATIONS_MODE_VIEW,scope.rowSortEnabled=!!angular.isDefined(scope.rowSortEnabled)&&scope.rowSortEnabled,scope.rowSortCriteria=scope.rowSortCriteria||(angular.isDefined(scope.rows)&&angular.isDefined(scope.rows[0])?Object.keys(scope.rows[0])[0]:null),scope.rowSortOrderAscending=!angular.isDefined(scope.rowSortOrderAscending)||scope.rowSortOrderAscending,scope.actionList=scope.actionList||[],scope.cellRenderer=scope.cellRenderer||function(row,column){return angular.isDefined(row[column])?row[column]:null},scope.columnClassCallback=scope.columnClassCallback||function(){return""},scope.rowClassCallback=scope.rowClassCallback||function(){return""},scope.tableClassCallback=scope.tableClassCallback||function(){return["table-striped"]},scope.searchInputWidthClasses=scope.searchInputWidthClasses||"col-xs-12 col-sm-4",scope.selectorWidthClasses=scope.selectorWidthClasses||"col-xs-12 col-sm-8 col-md-8 col-lg-8";var defaultPager={};defaultPager[scope.PAGER_TOTAL]=scope.rows.length,defaultPager[scope.PAGER_LIMIT]=scope.rows.length,defaultPager[scope.PAGER_OFFSET]=0,scope.pager=angular.extend(defaultPager,scope.pager),scope.resetPager(),scope.search=scope.search||null,scope.searchWaitMs=angular.isNumber(scope.searchWaitMs)?scope.searchWaitMs:0,scope.searchResults=scope.searchResults||scope.rows,scope.selectionEnabled=scope.selectionEnabled||!1,scope.selectionResults=scope.selectionResults||[]},controller:function($scope){$scope.COMPONENTS_FILTER=ketaExtendedTableConstants.COMPONENT.FILTER,$scope.COMPONENTS_SELECTOR=ketaExtendedTableConstants.COMPONENT.SELECTOR,$scope.COMPONENTS_TABLE=ketaExtendedTableConstants.COMPONENT.TABLE,$scope.COMPONENTS_PAGER=ketaExtendedTableConstants.COMPONENT.PAGER,$scope.OPERATIONS_MODE_DATA=ketaExtendedTableConstants.OPERATIONS_MODE.DATA,$scope.OPERATIONS_MODE_VIEW=ketaExtendedTableConstants.OPERATIONS_MODE.VIEW,$scope.PAGER_TOTAL=ketaExtendedTableConstants.PAGER.TOTAL,$scope.PAGER_LIMIT=ketaExtendedTableConstants.PAGER.LIMIT,$scope.PAGER_OFFSET=ketaExtendedTableConstants.PAGER.OFFSET,$scope.ACTION_LIST_TYPE_LINK=ketaExtendedTableConstants.ACTION_LIST_TYPE.LINK,$scope.ACTION_LIST_TYPE_ACTION=ketaExtendedTableConstants.ACTION_LIST_TYPE.ACTION,$scope.pages=[],$scope.currentPage=0,$scope.selectedColumn=null;var fillAllKeys=function(objects){var keys=[];return angular.forEach(objects,function(obj){angular.forEach(obj,function(value,key){angular.isDefined(obj)&&-1===keys.indexOf(key)&&keys.push(key)})}),angular.forEach(objects,function(obj){angular.forEach(keys,function(key){angular.isDefined(obj)&&(obj[key]=angular.isDefined(obj[key])?obj[key]:null)})}),objects},update=function(){angular.isDefined($scope.rows)&&angular.isDefined($scope.rows[0])?($scope.rows=fillAllKeys($scope.rows),$scope.headers=$scope.rows[0],$scope.operationsMode===$scope.OPERATIONS_MODE_VIEW&&angular.equals($scope.visibleColumns,[])&&($scope.visibleColumns=Object.keys($scope.rows[0])),null===$scope.rowSortCriteria&&($scope.rowSortCriteria=Object.keys($scope.rows[0])[0])):($scope.headers={},$scope.operationsMode===$scope.OPERATIONS_MODE_VIEW&&($scope.visibleColumns=[]),$scope.rowSortCriteria=null)},inArray=function(array,element){var found=!1;return angular.forEach(array,function(item){item===element&&(found=!0)}),found},resetSelection=function(){$scope.selectionResults=[]};$scope.rows=fillAllKeys($scope.rows),$scope.resetPager=function(){var rowsLength=$scope.rows.length;if(null!==$scope.search&&($scope.searchResults=$filter("filter")($scope.rows,$scope.searchIn),rowsLength=$scope.searchResults.length),$scope.operationsMode===$scope.OPERATIONS_MODE_VIEW&&($scope.pager[$scope.PAGER_TOTAL]=rowsLength,0===$scope.pager[$scope.PAGER_LIMIT]&&($scope.pager[$scope.PAGER_LIMIT]=rowsLength),$scope.pager[$scope.PAGER_OFFSET]>rowsLength-1&&($scope.pager[$scope.PAGER_OFFSET]=0)),angular.isNumber($scope.pager[$scope.PAGER_TOTAL])&&angular.isNumber($scope.pager[$scope.PAGER_LIMIT])){$scope.pages=[];for(var numOfPages=Math.ceil($scope.pager[$scope.PAGER_TOTAL]/$scope.pager[$scope.PAGER_LIMIT]),i=0;i<numOfPages;i++)$scope.pages.push(i+1)}angular.isNumber($scope.pager[$scope.PAGER_LIMIT])&&angular.isNumber($scope.pager[$scope.PAGER_OFFSET])&&($scope.currentPage=Math.floor($scope.pager[$scope.PAGER_OFFSET]/$scope.pager[$scope.PAGER_LIMIT])+1)},$scope.resetSelectedColumn=function(){var possibleColumns=$filter("filter")($scope.switchableColumns,function(column){return!inArray($scope.visibleColumns,column.id)}),stillPossible=!1;angular.forEach(possibleColumns,function(column){column.id===$scope.selectedColumn&&(stillPossible=!0)}),stillPossible||(possibleColumns=$filter("orderBy")(possibleColumns,$scope.orderByProperty),$scope.selectedColumn=angular.isDefined(possibleColumns[0])?possibleColumns[0].id:null)},$scope.showActionListItem=function(item,row){var show=!0;return angular.isFunction(item.display)&&(show=item.display(row)),show},$scope.$watch("rows",function(newValue,oldValue){null!==newValue&&newValue!==oldValue&&(update(),$scope.resetPager(),resetSelection())},!0),$scope.$watch("pager",function(newValue,oldValue){null!==newValue&&newValue!==oldValue&&($scope.resetPager(),resetSelection())},!0),$scope.$watch("search",function(newValue,oldValue){null!==newValue&&newValue!==oldValue&&($scope.resetPager(),resetSelection())}),$scope.$watch("switchableColumns",function(newValue,oldValue){null!==newValue&&newValue!==oldValue&&$scope.resetSelectedColumn()},!0),$scope.getTableClasses=function(){var configuredClasses=$scope.tableClassCallback();return configuredClasses.push("table"),configuredClasses.push("form-group"),configuredClasses.join(" ")},$scope.isDisabled=function(key){return inArray($scope.disabledComponents,key)},$scope.isSwitchable=function(key){var switchable=!1;return angular.forEach($scope.switchableColumns,function(column){column.id===key&&(switchable=!0)}),switchable},$scope.isSortCriteria=function(key){return null!==$scope.rowSortCriteria&&key===$scope.rowSortCriteria},$scope.isSortable=function(column){return-1===$scope.unsortableColumns.indexOf(column)},$scope.sortBy=function(column){$scope.rowSortEnabled&&null!==$scope.headerLabelCallback(column)&&""!==$scope.headerLabelCallback(column)&&($scope.rowSortCriteria===column?$scope.rowSortOrderAscending=!$scope.rowSortOrderAscending:$scope.rowSortCriteria=column)},$scope.searchIn=function(row){return!angular.isDefined($scope.search)||null===$scope.search||""===$scope.search||$scope.visibleColumns.some(function(column){if(angular.isDefined(row[column])&&null!==row[column]){if(angular.isObject(row[column])&&!angular.isArray(row[column])){var deepMatch=!1;return angular.forEach(row[column],function(prop){-1!==String(prop).toLowerCase().indexOf($scope.search.toLowerCase())&&(deepMatch=!0)}),deepMatch}if(-1!==String(row[column]).toLowerCase().indexOf($scope.search.toLowerCase()))return!0}})},$scope.filterColumns=function(column){return!inArray($scope.visibleColumns,column.id)},$scope.addColumn=function(column){$scope.visibleColumns.push(column),$scope.resetSelectedColumn()},$scope.removeColumn=function(column){var columns=[];angular.forEach($scope.visibleColumns,function(col){col!==column&&columns.push(col)}),$scope.visibleColumns=columns,$scope.resetSelectedColumn()},$scope.selectRow=function(row){if(!$scope.selectionEnabled)return!1;for(var isSelected=!1,i=0;i<$scope.selectionResults.length;i++)if(angular.equals(row,$scope.selectionResults[i])){isSelected=!0,$scope.selectionResults.splice(i,1);break}isSelected||$scope.selectionResults.push(row)},$scope.isSelected=function(row){if(!$scope.selectionEnabled)return!1;for(var isSelected=!1,i=0;i<$scope.selectionResults.length;i++)if(angular.equals(row,$scope.selectionResults[i])){isSelected=!0;break}return isSelected},$scope.goToPage=function(page){page>0&&page<=$scope.pages.length&&($scope.pager[$scope.PAGER_OFFSET]=$scope.pager[$scope.PAGER_LIMIT]*(page-1),$scope.resetPager())};var resetPagerInputIfNecessary=function(currentPage){var pageAsNumber=parseInt(currentPage,10),newPage=pageAsNumber;!angular.isNumber(pageAsNumber)||isNaN(pageAsNumber)||pageAsNumber<=0?newPage=1:pageAsNumber>$scope.pages.length&&(newPage=$scope.pages.length),$scope.goToPage(newPage)};$scope.checkPagerInput=function(currentPage,$event){switch($event.type){case"keypress":13===$event.keyCode&&resetPagerInputIfNecessary(currentPage);break;case"blur":resetPagerInputIfNecessary(currentPage)}}}}}),angular.module("keta.directives.ExtendedTable").run(function($templateCache){$templateCache.put("/components/directives/extended-table.html",'<div data-ng-class="{\t\'keta-extended-table\': true}">\t<div class="row" data-ng-show="!isDisabled(COMPONENTS_FILTER) || !isDisabled(COMPONENTS_SELECTOR)">\t\t<div data-ng-class="::searchInputWidthClasses">\t\t\t\x3c!-- FILTER --\x3e\t\t\t<div data-ng-show="!isDisabled(COMPONENTS_FILTER)">\t\t\t\t<div class="form-group form-inline">\t\t\t\t\t<div class="input-group col-xs-12">\t\t\t\t\t\t<input type="search" class="form-control"\t\t\t\t\t\t\tplaceholder="{{ getLabel(MESSAGE_KEY_PREFIX + \'_search\') }}"\t\t\t\t\t\t\tdata-ng-model="search"\t\t\t\t\t\t\tdata-ng-model-options="{ updateOn: \'default blur\', debounce: {\'default\': searchWaitMs, \'blur\': 0} }"\t\t\t\t\t\t>\t\t\t\t\t\t<span class="input-group-btn">\t\t\t\t\t\t\t<button class="btn btn-default btn-addon" type="button">\t\t\t\t\t\t\t\t<i class="glyphicon glyphicon-search"></i>\t\t\t\t\t\t\t</button>\t\t\t\t\t\t</span>\t\t\t\t\t</div>\t\t\t\t</div>\t\t\t</div>\t\t</div>\t\t<div data-ng-class="::selectorWidthClasses">\t\t\t\x3c!-- SELECTOR --\x3e\t\t\t<div data-ng-show="!isDisabled(COMPONENTS_SELECTOR) && selectedColumn !== null" class="form-horizontal">\t\t\t\t<div class="form-group">\t\t\t\t\t<label for="columnSelector"\t\t\t\t\t\tclass="col-xs-12 col-sm-5 col-lg-6 control-label">{{ getLabel(MESSAGE_KEY_PREFIX + \'_add_column\') }}</label>\t\t\t\t\t<div class="col-xs-12 col-sm-7 col-lg-6 input-group">\t\t\t\t\t\t<select id="columnSelector"\t\t\t\t\t\t\tclass="form-control"\t\t\t\t\t\t\tdata-ng-if="groupByProperty !== null"\t\t\t\t\t\t\tdata-ng-model="$parent.selectedColumn"\t\t\t\t\t\t\tdata-ng-options="\t\t\t\t\t\t\t\tcolumn.id as headerLabelCallback(column.id)\t\t\t\t\t\t\t\t\tgroup by {{groupByProperty}} for column in switchableColumns |\t\t\t\t\t\t\t\tfilter:filterColumns |\t\t\t\t\t\t\t\torderBy:orderByProperty">\t\t\t\t\t\t</select>\t\t\t\t\t\t<select id="columnSelector"\t\t\t\t\t\t\tclass="form-control"\t\t\t\t\t\t\tdata-ng-if="groupByProperty === null"\t\t\t\t\t\t\tdata-ng-model="$parent.selectedColumn"\t\t\t\t\t\t\tdata-ng-options="\t\t\t\t\t\t\t\tcolumn.id as headerLabelCallback(column.id) for column in switchableColumns |\t\t\t\t\t\t\t\tfilter:filterColumns |\t\t\t\t\t\t\t\torderBy:orderByProperty">\t\t\t\t\t\t</select>\t\t\t\t\t\t<span class="input-group-btn">\t\t\t\t\t\t\t<button type="button" class="btn btn-primary"\t\t\t\t\t\t\t\tdata-ng-click="addColumn(selectedColumn)">\t\t\t\t\t\t\t\t<i class="glyphicon glyphicon-plus"></i>\t\t\t\t\t\t\t</button>\t\t\t\t\t\t</span>\t\t\t\t\t</div>\t\t\t\t</div>\t\t\t</div>\t\t</div>\t</div>\t\x3c!-- TABLE --\x3e\t<div class="row" data-ng-show="!isDisabled(COMPONENTS_TABLE)">\t\t<div class="col-xs-12">\t\t\t<div class="table-responsive table-data">\t\t\t\t<table data-ng-class="getTableClasses()">\t\t\t\t\t<thead>\t\t\t\t\t\t<tr class="{{rowClassCallback(null, true)}}">\t\t\t\t\t\t\t<th class="{{columnClassCallback(headers, column, true)}}"\t\t\t\t\t\t\t\tdata-ng-repeat="column in headers | ketaOrderObjectBy:visibleColumns:true"\t\t\t\t\t\t\t\tdata-ng-if="rowSortEnabled"\t\t\t\t\t\t\t\tdata-ng-class="{\t\t\t\t\t\t\t\t\tsort: isSortCriteria(column),\t\t\t\t\t\t\t\t\tsortable: isSortable(column)}">\t\t\t\t\t\t\t\t<span data-ng-if="\t\t\t\t\t\t\t\t\t!isSortable(column) &&\t\t\t\t\t\t\t\t\theaderLabelCallback(column)">{{headerLabelCallback(column)}}</span>\t\t\t\t\t\t\t\t<a class="header" title="{{ getLabel(MESSAGE_KEY_PREFIX + \'_sort\') }}"\t\t\t\t\t\t\t\t\tdata-ng-if="\t\t\t\t\t\t\t\t\t\tisSortable(column) &&\t\t\t\t\t\t\t\t\t\theaderLabelCallback(column)"\t\t\t\t\t\t\t\t\tdata-ng-click="sortBy(column)">{{headerLabelCallback(column)}}</a>\t\t\t\t\t\t\t\t<a class="sort" title="{{ getLabel(MESSAGE_KEY_PREFIX + \'_sort\') }}"\t\t\t\t\t\t\t\t\tdata-ng-if="\t\t\t\t\t\t\t\t\t\tisSortCriteria(column) &&\t\t\t\t\t\t\t\t\t\trowSortOrderAscending &&\t\t\t\t\t\t\t\t\t\tisSortable(column) &&\t\t\t\t\t\t\t\t\t\theaderLabelCallback(column)"\t\t\t\t\t\t\t\t\tdata-ng-click="sortBy(column)"><span\t\t\t\t\t\t\t\t\tclass="glyphicon glyphicon-sort-by-alphabet"></span></a>\t\t\t\t\t\t\t\t<a class="sort" title="{{ getLabel(MESSAGE_KEY_PREFIX + \'_sort\') }}"\t\t\t\t\t\t\t\t data-ng-if="\t\t\t\t\t\t\t\t\t isSortCriteria(column) &&\t\t\t\t\t\t\t\t\t !rowSortOrderAscending &&\t\t\t\t\t\t\t\t\t isSortable(column) &&\t\t\t\t\t\t\t\t\t headerLabelCallback(column)"\t\t\t\t\t\t\t\t data-ng-click="sortBy(column)"><span\t\t\t\t\t\t\t\t\tclass="glyphicon glyphicon-sort-by-alphabet-alt"></span></a>\t\t\t\t\t\t\t\t<a class="unsort" title="{{ getLabel(MESSAGE_KEY_PREFIX + \'_sort\') }}"\t\t\t\t\t\t\t\t\tdata-ng-if="\t\t\t\t\t\t\t\t\t\t!isSortCriteria(column) &&\t\t\t\t\t\t\t\t\t\tisSortable(column) &&\t\t\t\t\t\t\t\t\t\theaderLabelCallback(column)"\t\t\t\t\t\t\t\t\tdata-ng-click="sortBy(column)"><span\t\t\t\t\t\t\t\t\tclass="glyphicon glyphicon-sort"></span></a>\t\t\t\t\t\t\t\t<a class="operation" title="{{ getLabel(MESSAGE_KEY_PREFIX + \'_remove_column\') }}"\t\t\t\t\t\t\t\t\tdata-ng-if="\t\t\t\t\t\t\t\t\t\tisSwitchable(column) &&\t\t\t\t\t\t\t\t\t\theaderLabelCallback(column)"\t\t\t\t\t\t\t\t\tdata-ng-click="removeColumn(column)"><span\t\t\t\t\t\t\t\t\tclass="glyphicon glyphicon-minus-sign"></span></a>\t\t\t\t\t\t\t</th>\t\t\t\t\t\t\t<th class="{{columnClassCallback(headers, column, true)}}"\t\t\t\t\t\t\t\tdata-ng-repeat="column in headers | ketaOrderObjectBy:visibleColumns:true"\t\t\t\t\t\t\t\tdata-ng-if="!rowSortEnabled">\t\t\t\t\t\t\t\t{{headerLabelCallback(column)}}\t\t\t\t\t\t\t\t<a class="operation" data-ng-if="isSwitchable(column)"\t\t\t\t\t\t\t\t\tdata-ng-click="removeColumn(column)">\t\t\t\t\t\t\t\t\t<span class="glyphicon glyphicon-minus-sign"></span>\t\t\t\t\t\t\t\t</a>\t\t\t\t\t\t\t</th>\t\t\t\t\t\t\t<th data-ng-if="actionList.length"\t\t\t\t\t\t\t\tclass="{{columnClassCallback(headers, \'actions\', true)}}">\t\t\t\t\t\t\t\t{{headerLabelCallback(\'actions\')}}\t\t\t\t\t\t\t</th>\t\t\t\t\t\t</tr>\t\t\t\t\t</thead>\t\t\t\t\t<tbody>\t\t\t\t\t\t\x3c!-- operationsMode: data --\x3e\t\t\t\t\t\t<tr data-ng-if="operationsMode === OPERATIONS_MODE_DATA"\t\t\t\t\t\t\tdata-ng-repeat="row in rows" data-ng-click="selectRow(row)"\t\t\t\t\t\t\tdata-ng-class="{\'active\' : isSelected(row)}"\t\t\t\t\t\t\tclass="{{rowClassCallback(row, false)}}">\t\t\t\t\t\t\t<td data-ng-repeat="column in row | ketaOrderObjectBy:visibleColumns:true"\t\t\t\t\t\t\t\tclass="{{columnClassCallback(row, column, false)}}">\t\t\t\t\t\t\t\t<span data-ng-bind-html="cellRenderer(row, column)"></span>\t\t\t\t\t\t\t</td>\t\t\t\t\t\t\t<td data-ng-if="row && actionList.length"\t\t\t\t\t\t\t\tclass="{{columnClassCallback(row, \'actions\', false)}}">\t\t\t\t\t\t\t\t<div class="btn-group" role="group">\t\t\t\t\t\t\t\t\t<span data-ng-repeat="item in actionList"\t\t\t\t\t\t\t\t\t\tdata-ng-if="showActionListItem(item, row)">\t\t\t\t\t\t\t\t\t\t<a class="btn btn-link"\t\t\t\t\t\t\t\t\t\t\tdata-ng-href="{{item.getLink(row)}}"\t\t\t\t\t\t\t\t\t\t\tdata-ng-attr-target="{{item.target ? item.target : undefined}}"\t\t\t\t\t\t\t\t\t\t\tdata-ng-if="!item.type || item.type === ACTION_LIST_TYPE_LINK"\t\t\t\t\t\t\t\t\t\t\ttitle="{{item.getLabel()}}"><span\t\t\t\t\t\t\t\t\t\t\tclass="{{item.icon}}" aria-hidden="true"></span><span\t\t\t\t\t\t\t\t\t\t\tdata-ng-if="item.getTitle()">{{item.getTitle()}}</span></a>\t\t\t\t\t\t\t\t\t\t<a class="btn btn-link" href=""\t\t\t\t\t\t\t\t\t\t\tdata-ng-click="item.runAction(row)"\t\t\t\t\t\t\t\t\t\t\tdata-ng-if="item.type === ACTION_LIST_TYPE_ACTION"\t\t\t\t\t\t\t\t\t\t\ttitle="{{item.getLabel()}}"><span\t\t\t\t\t\t\t\t\t\t\tclass="{{item.icon}}" aria-hidden="true"></span><span\t\t\t\t\t\t\t\t\t\t\tdata-ng-if="item.getTitle()">{{item.getTitle()}}</span></a>\t\t\t\t\t\t\t\t\t</span>\t\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t</td>\t\t\t\t\t\t</tr>\t\t\t\t\t\t\x3c!-- operationsMode: view --\x3e\t\t\t\t\t\t<tr data-ng-if="operationsMode === OPERATIONS_MODE_VIEW"\t\t\t\t\t\t\tdata-ng-repeat="\t\t\t\t\t\t\t\trow in rows |\t\t\t\t\t\t\t\tfilter:searchIn |\t\t\t\t\t\t\t\torderBy:rowSortCriteria:!rowSortOrderAscending |\t\t\t\t\t\t\t\tketaSlice:pager[PAGER_OFFSET]:pager[PAGER_LIMIT]"\t\t\t\t\t\t\tdata-ng-class="{\'active\' : isSelected(row)}"\t\t\t\t\t\t\tdata-ng-click="selectRow(row)"\t\t\t\t\t\t\tclass="{{rowClassCallback(row, false)}}">\t\t\t\t\t\t\t<td data-ng-repeat="column in row | ketaOrderObjectBy:visibleColumns:true"\t\t\t\t\t\t\t\tclass="{{columnClassCallback(row, column, false)}}">\t\t\t\t\t\t\t\t<span data-ng-bind-html="cellRenderer(row, column)"></span>\t\t\t\t\t\t\t</td>\t\t\t\t\t\t\t<td data-ng-if="row && actionList.length"\t\t\t\t\t\t\t\tclass="{{columnClassCallback(row, \'actions\', false)}}">\t\t\t\t\t\t\t\t<div class="btn-group" role="group">\t\t\t\t\t\t\t\t\t<span data-ng-repeat="item in actionList"\t\t\t\t\t\t\t\t\t\tdata-ng-if="showActionListItem(item, row)">\t\t\t\t\t\t\t\t\t\t<a class="btn btn-link"\t\t\t\t\t\t\t\t\t\t\tdata-ng-href="{{item.getLink(row)}}"\t\t\t\t\t\t\t\t\t\t\tdata-ng-attr-target="{{item.target ? item.target : undefined}}"\t\t\t\t\t\t\t\t\t\t\tdata-ng-if="!item.type || item.type === ACTION_LIST_TYPE_LINK"\t\t\t\t\t\t\t\t\t\t\ttitle="{{item.getLabel()}}"><span\t\t\t\t\t\t\t\t\t\t\tclass="{{item.icon}}" aria-hidden="true"></span><span\t\t\t\t\t\t\t\t\t\t\tdata-ng-if="item.getTitle()">{{item.getTitle()}}</span></a>\t\t\t\t\t\t\t\t\t\t<a class="btn btn-link" href=""\t\t\t\t\t\t\t\t\t\t\tdata-ng-click="item.runAction(row)"\t\t\t\t\t\t\t\t\t\t\tdata-ng-if="item.type === ACTION_LIST_TYPE_ACTION"\t\t\t\t\t\t\t\t\t\t\ttitle="{{item.getLabel()}}"><span\t\t\t\t\t\t\t\t\t\t\tclass="{{item.icon}}" aria-hidden="true"></span><span\t\t\t\t\t\t\t\t\t\t\tdata-ng-if="item.getTitle()">{{item.getTitle()}}</span></a>\t\t\t\t\t\t\t\t\t</span>\t\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t</td>\t\t\t\t\t\t</tr>\t\t\t\t\t\t<tr data-ng-if="\t\t\t\t\t\t\toperationsMode === OPERATIONS_MODE_VIEW &&\t\t\t\t\t\t\t(rows |\t\t\t\t\t\t\t\tfilter:searchIn |\t\t\t\t\t\t\t\torderBy:rowSortCriteria:!rowSortOrderAscending |\t\t\t\t\t\t\t\tketaSlice:pager[PAGER_OFFSET]:pager[PAGER_LIMIT]).length === 0">\t\t\t\t\t\t\t<td colspan="{{(rows[0] | ketaOrderObjectBy:visibleColumns:true).length + 1}}">\t\t\t\t\t\t\t\t{{ getLabel(MESSAGE_KEY_PREFIX + \'_no_entries\') }}\t\t\t\t\t\t\t</td>\t\t\t\t\t\t</tr>\t\t\t\t\t</tbody>\t\t\t\t</table>\t\t\t</div>\t\t</div>\t</div>\t\x3c!-- PAGER --\x3e\t<div class="row" data-ng-show="!isDisabled(COMPONENTS_PAGER) && pager !== null && pages.length > 1">\t\t<div class="col-xs-12">\t\t\t<div class="pager max-width">\t\t\t\t<div class="input-group">\t\t\t\t\t<div class="pager-buttons input-group-btn">\t\t\t\t\t\t<button type="button" class="btn btn-default" data-ng-click="goToPage(currentPage - 1)">\t\t\t\t\t\t\t<i class="glyphicon glyphicon-chevron-left"></i>\t\t\t\t\t\t</button>\t\t\t\t\t</div>\t\t\t\t\t<input type="text" class="form-control pager-input"\t\t\t\t\t\tdata-ng-model="currentPage"\t\t\t\t\t\tdata-ng-keypress="checkPagerInput(currentPage, $event)"\t\t\t\t\t\tdata-ng-blur="checkPagerInput(currentPage, $event)">\t\t\t\t\t<span class="input-group-addon">\t\t\t\t\t\t{{ getLabel(MESSAGE_KEY_PREFIX + \'_of\') }} {{pages.length}}\t\t\t\t\t</span>\t\t\t\t\t<div class="pager-buttons input-group-btn">\t\t\t\t\t\t<button type="button" class="btn btn-default" data-ng-click="goToPage(currentPage + 1)">\t\t\t\t\t\t\t<i class="glyphicon glyphicon-chevron-right"></i>\t\t\t\t\t\t</button>\t\t\t\t\t</div>\t\t\t\t</div>\t\t\t</div>\t\t</div>\t</div></div>')}),angular.module("keta.directives.MainMenu",[]).directive("ketaMainMenu",function($location,$rootScope){return{restrict:"EA",replace:!0,scope:{configuration:"=",titleCallback:"=?"},templateUrl:"/components/directives/main-menu.html",link:function(scope){scope.titleCallback=scope.titleCallback||function(){return""};var checkPaths=function(currentMenuLevelParts,locationLevelParts,activeFlag){for(var i=1;i<currentMenuLevelParts.length;i++)currentMenuLevelParts[i]!==locationLevelParts[i]&&(activeFlag=!1);return activeFlag};scope.isActive=function(menuEntry){var currentMenuLevelParts=menuEntry.link.split("/"),locationLevelParts=$location.path().split("/"),isActive=!0;return!(angular.isArray(menuEntry.items)&&menuEntry.items.length>0)&&(isActive=checkPaths(currentMenuLevelParts,locationLevelParts,isActive))},scope.isActiveParent=function(menuEntry){var currentMenuLevelParts=menuEntry.link.split("/"),locationLevelParts=$location.path().split("/"),isActiveParent=!1;return angular.isArray(menuEntry.items)&&menuEntry.items.length>0&&(isActiveParent=checkPaths(currentMenuLevelParts,locationLevelParts,isActiveParent=!0)),isActiveParent},scope.checkExpand=function(menuEntry,$event){var menuLink=menuEntry.link;angular.isString(menuLink)&&"#"===menuLink.substr(0,1)&&(menuLink=angular.copy(menuLink.substr(1,menuLink.length-1))),$location.url()===menuLink&&angular.isDefined(scope.configuration.toggleBroadcast)&&($event.stopPropagation(),$rootScope.$broadcast(scope.configuration.toggleBroadcast)),angular.isArray(menuEntry.items)&&menuEntry.items.length>0&&($event.preventDefault(),angular.isUndefined(menuEntry.expanded)||!1===menuEntry.expanded?menuEntry.expanded=!0:menuEntry.expanded=!menuEntry.expanded)}}}}),angular.module("keta.directives.MainMenu").run(function($templateCache){$templateCache.put("/components/directives/main-menu.html",'<div>\t<div data-ng-if="titleCallback()" class="sidebar-title">\t\t<span>{{ titleCallback() }}</span>\t</div>\t<ul class="nav nav-pills nav-stacked keta-main-menu">\t\t<li data-ng-repeat="entry in configuration.items"\t\t\tdata-ng-class="{\t\t\t\t\'active\': isActive(entry),\t\t\t\t\'active-parent\': isActiveParent(entry)\t\t\t}">\t\t\t<a data-ng-href="{{ entry.link }}" data-ng-click="checkExpand(entry, $event)"\t\t\t title="{{ entry.name }}">\t\t\t\t<span class="{{ entry.icon }}"></span>\t\t\t\t<span class="list-item">{{ entry.name }}</span>\t\t\t\t<span class="expander glyphicon"\t\t\t\t\tdata-ng-if="entry.items"\t\t\t\t\tdata-ng-class="{ \'glyphicon-minus\': entry.expanded, \'glyphicon-plus\': !entry.expanded }">\t\t\t\t</span>\t\t\t</a>\t\t\t<ul class="nav nav-pills nav-stacked expanded nav-sub-level" data-ng-if="entry.expanded">\t\t\t\t<li data-ng-repeat="entryLevel2 in entry.items"\t\t\t\t\tdata-ng-class="{\t\t\t\t\t\t\'active\': isActive(entryLevel2),\t\t\t\t\t\t\'active-parent\': isActiveParent(entryLevel2)\t\t\t\t\t}">\t\t\t\t\t<a data-ng-href="{{ entryLevel2.link }}" data-ng-click="checkExpand(entryLevel2, $event)">\t\t\t\t\t\t<span data-ng-if="entryLevel2.icon" class="{{ entryLevel2.icon }}"></span>\t\t\t\t\t\t<span>{{ entryLevel2.name }}</span>\t\t\t\t\t\t<span class="expander glyphicon"\t\t\t\t\t\t\tdata-ng-if="entryLevel2.items"\t\t\t\t\t\t\tdata-ng-class="{ \'glyphicon-minus\': entryLevel2.expanded, \'glyphicon-plus\': !entryLevel2.expanded }">\t\t\t\t\t\t</span>\t\t\t\t\t</a>\t\t\t\t\t<ul class="nav nav-pills nav-stacked expanded nav-sub-level" data-ng-if="entryLevel2.expanded">\t\t\t\t\t\t<li data-ng-repeat="entryLevel3 in entryLevel2.items"\t\t\t\t\t\t\tdata-ng-class="{ \'active\': isActive(entryLevel3) }">\t\t\t\t\t\t\t<a data-ng-href="{{ entryLevel3.link }}">\t\t\t\t\t\t\t\t<span data-ng-if="entryLevel3.icon" class="{{ entryLevel3.icon }}"></span>\t\t\t\t\t\t\t\t<span>{{ entryLevel3.name }}</span>\t\t\t\t\t\t\t</a>\t\t\t\t\t\t</li>\t\t\t\t\t</ul>\t\t\t\t</li>\t\t\t</ul>\t\t</li>\t</ul></div>')}),angular.module("keta.directives.Sidebar",[]).constant("ketaSidebarConstants",{POSITION:{LEFT:"left",RIGHT:"right"},CSS:{OFFCANVAS:"offcanvas",BRAND_BAR:"brand-bar"},OFFSET:{TOGGLE_AREA:5,TRANSCLUDE:15},EVENT:{TOGGLE_SIDEBAR_LEFT:"TOGGLE_SIDEBAR_LEFT",TOGGLE_SIDEBAR_RIGHT:"TOGGLE_SIDEBAR_RIGHT"}}).directive("ketaSidebar",function($document,ketaSidebarConstants){return{restrict:"EA",replace:!0,scope:{configuration:"="},templateUrl:"/components/directives/sidebar.html",transclude:!0,link:function(scope,element){scope.configuration.position=angular.isDefined(scope.configuration.position)?scope.configuration.position:ketaSidebarConstants.POSITION.LEFT,scope.showToggleArea=angular.isDefined(scope.configuration.label),scope.toggleAreaTop=0,scope.transcludeTop=0;var bodyElem=angular.element(document).find("body");scope.toggleSideBar=function(){bodyElem.toggleClass(ketaSidebarConstants.CSS.OFFCANVAS+"-"+scope.configuration.position)},scope.$on("$locationChangeStart",function(){bodyElem.removeClass(ketaSidebarConstants.CSS.OFFCANVAS+"-"+scope.configuration.position)});var toggleBodyClass=function(position){scope.configuration.position===position&&bodyElem.toggleClass(ketaSidebarConstants.CSS.OFFCANVAS+"-"+scope.configuration.position)};if(scope.$on(ketaSidebarConstants.EVENT.TOGGLE_SIDEBAR_LEFT,function(){toggleBodyClass(ketaSidebarConstants.POSITION.LEFT)}),scope.$on(ketaSidebarConstants.EVENT.TOGGLE_SIDEBAR_RIGHT,function(){toggleBodyClass(ketaSidebarConstants.POSITION.RIGHT)}),scope.showToggleArea){var brandBarElem=bodyElem[0].getElementsByClassName(ketaSidebarConstants.CSS.BRAND_BAR),brandBarHeight=angular.isDefined(brandBarElem[0])?brandBarElem[0].clientHeight:0;scope.toggleAreaTop=brandBarHeight+ketaSidebarConstants.OFFSET.TOGGLE_AREA,scope.transcludeTop=ketaSidebarConstants.OFFSET.TRANSCLUDE}$document.bind("click",function(event){if(bodyElem.hasClass(ketaSidebarConstants.CSS.OFFCANVAS+"-"+scope.configuration.position)){var sideBarHtml=element.html(),targetElementHtml=angular.element(event.target).html();if(-1!==sideBarHtml.indexOf(targetElementHtml)&&0!==targetElementHtml.length)return;scope.toggleSideBar()}})}}}),angular.module("keta.directives.Sidebar").run(function($templateCache){$templateCache.put("/components/directives/sidebar.html",'<div class="sidebar-offcanvas sidebar-{{configuration.position}} keta-sidebar">\t<div class="sidebar-inner">\t\t\t\t\x3c!-- extended navigation --\x3e\t\t<ul class="nav nav-pills nav-stacked nav-extended nav-extended-toggle"\t\t\tdata-ng-if="showToggleArea" data-ng-style="{marginTop: toggleAreaTop + \'px\'}">\t\t\t<li>\t\t\t\t<a href="" data-ng-click="toggleSideBar()">\t\t\t\t\t<span class="glyphicon glyphicon-align-justify"></span>\t\t\t\t\t<span>{{ configuration.label }}</span>\t\t\t\t</a>\t\t\t</li>\t\t</ul>\t\t\t\t\x3c!-- compact navigation --\x3e\t\t<ul class="nav nav-pills nav-stacked nav-compact nav-compact-toggle"\t\t\tdata-ng-if="showToggleArea">\t\t\t<li>\t\t\t\t<a href="" data-ng-click="toggleSideBar()">\t\t\t\t\t<span class="glyphicon glyphicon-align-justify"></span>\t\t\t\t</a>\t\t\t</li>\t\t</ul>\t\t\t\t\x3c!-- transcluded content --\x3e\t\t<div data-ng-transclude class="sidebar-transclude" data-ng-style="{marginTop: transcludeTop + \'px\'}"></div>\t\t\t</div></div>')}),angular.module("keta.directives.TimeRangeSelector",["moment"]).constant("ketaTimeRangeSelectorConstants",{CSS_CLASSES:{CURRENT_DATE:"current-date",OUT_OF_BOUNDS:"out-of-bounds",OUT_OF_BOUNDS_AFTER:"out-of-bounds-after",OUT_OF_BOUNDS_BEFORE:"out-of-bounds-before",OUT_OF_MONTH:"out-of-month",SELECTED_DATE:"selected-date",SELECTED_DATE_FROM:"selected-date-from",SELECTED_DATE_TO:"selected-date-to"},DAY:{SUNDAY:0,MONDAY:1,TUESDAY:2,WEDNESDAY:3,THURSDAY:4,FRIDAY:5,SATURDAY:6},DISPLAY_MODE:{DAY:"day",MONTH:"month",YEAR:"year"},EVENT:{SELECT:"keta.directives.TimeRangeSelector.Event.Selected"}}).constant("ketaTimeRangeSelectorMessageKeys",{en_GB:{"__keta.directives.TimeRangeSelector_display_mode_days":"Days","__keta.directives.TimeRangeSelector_display_mode_months":"Months","__keta.directives.TimeRangeSelector_display_mode_years":"Years","__keta.directives.TimeRangeSelector_select":"Select","__keta.directives.TimeRangeSelector_selection":"Selection","__keta.directives.TimeRangeSelector_today":"Today","__keta.directives.TimeRangeSelector_week":"Week","__keta.directives.TimeRangeSelector_weekday_sunday":"Sunday","__keta.directives.TimeRangeSelector_weekday_sunday_short":"Sun","__keta.directives.TimeRangeSelector_weekday_monday":"Monday","__keta.directives.TimeRangeSelector_weekday_monday_short":"Mon","__keta.directives.TimeRangeSelector_weekday_tuesday":"Tuesday","__keta.directives.TimeRangeSelector_weekday_tuesday_short":"Tue","__keta.directives.TimeRangeSelector_weekday_wednesday":"Wednesday","__keta.directives.TimeRangeSelector_weekday_wednesday_short":"Wed","__keta.directives.TimeRangeSelector_weekday_thursday":"Thursday","__keta.directives.TimeRangeSelector_weekday_thursday_short":"Thu","__keta.directives.TimeRangeSelector_weekday_friday":"Friday","__keta.directives.TimeRangeSelector_weekday_friday_short":"Fri","__keta.directives.TimeRangeSelector_weekday_saturday":"Saturday","__keta.directives.TimeRangeSelector_weekday_saturday_short":"Sat","__keta.directives.TimeRangeSelector_week_number":"Week Number","__keta.directives.TimeRangeSelector_week_number_short":"Wn"},de_DE:{"__keta.directives.TimeRangeSelector_display_mode_days":"Tage","__keta.directives.TimeRangeSelector_display_mode_months":"Monate","__keta.directives.TimeRangeSelector_display_mode_years":"Jahre","__keta.directives.TimeRangeSelector_select":"Auswählen","__keta.directives.TimeRangeSelector_selection":"Auswahl","__keta.directives.TimeRangeSelector_today":"Heute","__keta.directives.TimeRangeSelector_week":"Woche","__keta.directives.TimeRangeSelector_weekday_sunday":"Sonntag","__keta.directives.TimeRangeSelector_weekday_sunday_short":"So","__keta.directives.TimeRangeSelector_weekday_monday":"Montag","__keta.directives.TimeRangeSelector_weekday_monday_short":"Mo","__keta.directives.TimeRangeSelector_weekday_tuesday":"Dienstag","__keta.directives.TimeRangeSelector_weekday_tuesday_short":"Di","__keta.directives.TimeRangeSelector_weekday_wednesday":"Mittwoch","__keta.directives.TimeRangeSelector_weekday_wednesday_short":"Mi","__keta.directives.TimeRangeSelector_weekday_thursday":"Donnerstag","__keta.directives.TimeRangeSelector_weekday_thursday_short":"Do","__keta.directives.TimeRangeSelector_weekday_friday":"Freitag","__keta.directives.TimeRangeSelector_weekday_friday_short":"Fr","__keta.directives.TimeRangeSelector_weekday_saturday":"Samstag","__keta.directives.TimeRangeSelector_weekday_saturday_short":"Sa","__keta.directives.TimeRangeSelector_week_number":"Kalenderwoche","__keta.directives.TimeRangeSelector_week_number_short":"KW"},fr_FR:{"__keta.directives.TimeRangeSelector_display_mode_days":"Journées","__keta.directives.TimeRangeSelector_display_mode_months":"Mois","__keta.directives.TimeRangeSelector_display_mode_years":"Années","__keta.directives.TimeRangeSelector_select":"Choisir","__keta.directives.TimeRangeSelector_selection":"Sélection","__keta.directives.TimeRangeSelector_today":"Aujourd’hui","__keta.directives.TimeRangeSelector_week":"Semaine","__keta.directives.TimeRangeSelector_weekday_sunday":"Dimanche","__keta.directives.TimeRangeSelector_weekday_sunday_short":"Dim","__keta.directives.TimeRangeSelector_weekday_monday":"Lundi","__keta.directives.TimeRangeSelector_weekday_monday_short":"Lun","__keta.directives.TimeRangeSelector_weekday_tuesday":"Mardi","__keta.directives.TimeRangeSelector_weekday_tuesday_short":"Mar","__keta.directives.TimeRangeSelector_weekday_wednesday":"Mercredi","__keta.directives.TimeRangeSelector_weekday_wednesday_short":"Mer","__keta.directives.TimeRangeSelector_weekday_thursday":"Jeudi","__keta.directives.TimeRangeSelector_weekday_thursday_short":"Jeu","__keta.directives.TimeRangeSelector_weekday_friday":"Vendredi","__keta.directives.TimeRangeSelector_weekday_friday_short":"Ven","__keta.directives.TimeRangeSelector_weekday_saturday":"Samedi","__keta.directives.TimeRangeSelector_weekday_saturday_short":"Sam","__keta.directives.TimeRangeSelector_week_number":"Numéro de la semaine","__keta.directives.TimeRangeSelector_week_number_short":"Sem."},nl_NL:{"__keta.directives.TimeRangeSelector_display_mode_days":"Dagen","__keta.directives.TimeRangeSelector_display_mode_months":"Maanden","__keta.directives.TimeRangeSelector_display_mode_years":"Jaren","__keta.directives.TimeRangeSelector_select":"Kiezen","__keta.directives.TimeRangeSelector_selection":"Selectie","__keta.directives.TimeRangeSelector_today":"Vandaag","__keta.directives.TimeRangeSelector_week":"Week","__keta.directives.TimeRangeSelector_weekday_sunday":"Zondag","__keta.directives.TimeRangeSelector_weekday_sunday_short":"Zo","__keta.directives.TimeRangeSelector_weekday_monday":"Maandag","__keta.directives.TimeRangeSelector_weekday_monday_short":"Ma","__keta.directives.TimeRangeSelector_weekday_tuesday":"Dinsdag","__keta.directives.TimeRangeSelector_weekday_tuesday_short":"Di","__keta.directives.TimeRangeSelector_weekday_wednesday":"Woensdag","__keta.directives.TimeRangeSelector_weekday_wednesday_short":"Wo","__keta.directives.TimeRangeSelector_weekday_thursday":"Donderdag","__keta.directives.TimeRangeSelector_weekday_thursday_short":"Do","__keta.directives.TimeRangeSelector_weekday_friday":"Vrijdag","__keta.directives.TimeRangeSelector_weekday_friday_short":"Vr","__keta.directives.TimeRangeSelector_weekday_saturday":"Zaterdag","__keta.directives.TimeRangeSelector_weekday_saturday_short":"Za","__keta.directives.TimeRangeSelector_week_number":"Weeknummer","__keta.directives.TimeRangeSelector_week_number_short":"Wn"},it_IT:{"__keta.directives.TimeRangeSelector_display_mode_days":"Giorni","__keta.directives.TimeRangeSelector_display_mode_months":"Mesi","__keta.directives.TimeRangeSelector_display_mode_years":"Anni","__keta.directives.TimeRangeSelector_select":"Scegliere","__keta.directives.TimeRangeSelector_selection":"Selezione","__keta.directives.TimeRangeSelector_today":"Oggi","__keta.directives.TimeRangeSelector_week":"Settimana","__keta.directives.TimeRangeSelector_weekday_sunday":"Domenica","__keta.directives.TimeRangeSelector_weekday_sunday_short":"Dom.","__keta.directives.TimeRangeSelector_weekday_monday":"Lunedì","__keta.directives.TimeRangeSelector_weekday_monday_short":"Lun.","__keta.directives.TimeRangeSelector_weekday_tuesday":"Martedì","__keta.directives.TimeRangeSelector_weekday_tuesday_short":"Mar.","__keta.directives.TimeRangeSelector_weekday_wednesday":"Mercoledì","__keta.directives.TimeRangeSelector_weekday_wednesday_short":"Mer.","__keta.directives.TimeRangeSelector_weekday_thursday":"Giovedì","__keta.directives.TimeRangeSelector_weekday_thursday_short":"Gio.","__keta.directives.TimeRangeSelector_weekday_friday":"Venerdì","__keta.directives.TimeRangeSelector_weekday_friday_short":"Ven.","__keta.directives.TimeRangeSelector_weekday_saturday":"Sabato","__keta.directives.TimeRangeSelector_weekday_saturday_short":"Sab.","__keta.directives.TimeRangeSelector_week_number":"Numero della settimana","__keta.directives.TimeRangeSelector_week_number_short":"Set."}}).directive("ketaTimeRangeSelector",function($filter,ketaTimeRangeSelectorConstants,ketaTimeRangeSelectorMessageKeys,moment){return{restrict:"EA",replace:!0,require:"ngModel",scope:{cssClasses:"=?",currentLocale:"=?",displayMode:"=?",displayValue:"=?",elementIdentifier:"=?",enableDisplayModeSwitch:"=?",enableWeekSelection:"=?",firstClick:"=?",firstDayOfWeek:"=?",labels:"=?",maximum:"=?",maxRangeLength:"=?",minimum:"=?",minRangeLength:"=?",model:"=ngModel",showDisplayModeSwitcher:"=?",showPager:"=?",showJumpToSelectionButton:"=?",showJumpToTodayButton:"=?",showSelectButton:"=?",showWeekNumbers:"=?",yearsAfter:"=?",yearsBefore:"=?"},templateUrl:"/components/directives/time-range-selector.html",link:function(scope){scope.DISPLAY_MODE_DAY=ketaTimeRangeSelectorConstants.DISPLAY_MODE.DAY,scope.DISPLAY_MODE_MONTH=ketaTimeRangeSelectorConstants.DISPLAY_MODE.MONTH,scope.DISPLAY_MODE_YEAR=ketaTimeRangeSelectorConstants.DISPLAY_MODE.YEAR;var today=new Date;today.setHours(0,0,0,0);var defaultModel={from:null,to:null};scope.firstClick=!0,scope.model=angular.isDefined(scope.model.from)&&angular.isDate(scope.model.from)&&angular.isDefined(scope.model.to)&&angular.isDate(scope.model.to)?scope.model:defaultModel,null!==scope.model.from&&(scope.model.from.setHours(0,0,0,0),scope.firstClick=!1),null!==scope.model.to&&(scope.model.to.setHours(0,0,0,0),scope.firstClick=!0),scope.cssClasses=angular.isObject(scope.cssClasses)?angular.extend(ketaTimeRangeSelectorConstants.CSS_CLASSES,scope.cssClasses):ketaTimeRangeSelectorConstants.CSS_CLASSES,scope.currentLocale=angular.isString(scope.currentLocale)?scope.currentLocale:"en_GB",scope.displayMode=scope.displayMode||scope.DISPLAY_MODE_DAY,scope.displayValue=angular.isDate(scope.displayValue)?new Date(scope.displayValue.setHours(0,0,0,0)):angular.copy(scope.model.from),null===scope.displayValue&&(scope.displayValue=today),scope.elementIdentifier=angular.isDefined(scope.elementIdentifier)?scope.elementIdentifier:null,scope.enableDisplayModeSwitch=!!angular.isDefined(scope.enableDisplayModeSwitch)&&scope.enableDisplayModeSwitch,scope.enableWeekSelection=!angular.isDefined(scope.enableWeekSelection)||scope.enableWeekSelection,scope.firstDayOfWeek=scope.firstDayOfWeek||ketaTimeRangeSelectorConstants.DAY.SUNDAY,scope.MESSAGE_KEY_PREFIX="__keta.directives.TimeRangeSelector",scope.labels=angular.isObject(scope.labels)?angular.extend(ketaTimeRangeSelectorMessageKeys,scope.labels):ketaTimeRangeSelectorMessageKeys,scope.currentLabels=angular.isDefined(ketaTimeRangeSelectorMessageKeys[scope.currentLocale.substr(0,5)])?ketaTimeRangeSelectorMessageKeys[scope.currentLocale.substr(0,5)]:ketaTimeRangeSelectorMessageKeys.en_GB,scope.maximum=angular.isDate(scope.maximum)?new Date(scope.maximum.setHours(0,0,0,0)):null,scope.maxRangeLength=angular.isNumber(scope.maxRangeLength)?Math.max(0,Math.round(scope.maxRangeLength)):0,scope.minimum=angular.isDate(scope.minimum)?new Date(scope.minimum.setHours(0,0,0,0)):null,scope.minRangeLength=angular.isNumber(scope.minRangeLength)?Math.max(0,Math.round(scope.minRangeLength)):0,scope.showDisplayModeSwitcher=!angular.isDefined(scope.showDisplayModeSwitcher)||scope.showDisplayModeSwitcher,scope.showPager=!angular.isDefined(scope.showPager)||scope.showPager,scope.showJumpToSelectionButton=!!angular.isDefined(scope.showJumpToSelectionButton)&&scope.showJumpToSelectionButton,scope.showJumpToTodayButton=!!angular.isDefined(scope.showJumpToTodayButton)&&scope.showJumpToTodayButton,scope.showSelectButton=!!angular.isDefined(scope.showSelectButton)&&scope.showSelectButton,scope.showWeekNumbers=!angular.isDefined(scope.showWeekNumbers)||scope.showWeekNumbers,scope.yearsBefore=scope.yearsBefore||7,scope.yearsAfter=scope.yearsAfter||4,scope.weekDays=[],scope.days=[],scope.months=[],scope.years=[];var getWeekDays=function(){for(var weekDays=[],weekDayLabels=[scope.currentLabels[scope.MESSAGE_KEY_PREFIX+"_weekday_sunday_short"],scope.currentLabels[scope.MESSAGE_KEY_PREFIX+"_weekday_monday_short"],scope.currentLabels[scope.MESSAGE_KEY_PREFIX+"_weekday_tuesday_short"],scope.currentLabels[scope.MESSAGE_KEY_PREFIX+"_weekday_wednesday_short"],scope.currentLabels[scope.MESSAGE_KEY_PREFIX+"_weekday_thursday_short"],scope.currentLabels[scope.MESSAGE_KEY_PREFIX+"_weekday_friday_short"],scope.currentLabels[scope.MESSAGE_KEY_PREFIX+"_weekday_saturday_short"]],start=scope.firstDayOfWeek;weekDays.length<7;)weekDays.push(weekDayLabels[start]),start++,start%=7;scope.weekDays=weekDays},getDays=function(){var firstOfCurrentMonth=moment(scope.displayValue.getTime()).startOf("month").hours(0).minutes(0).seconds(0).milliseconds(0),firstOfCurrentMonthWeekDay=firstOfCurrentMonth.day(),lastOfCurrentMonth=moment(firstOfCurrentMonth).add(1,"months").subtract(1,"days"),lastOfCurrentMonthWeekDay=lastOfCurrentMonth.day(),days=[],i=0;for(firstOfCurrentMonthWeekDay<scope.firstDayOfWeek&&(firstOfCurrentMonthWeekDay+=7),i=firstOfCurrentMonthWeekDay-scope.firstDayOfWeek;i>0;i--){var prependedDay=moment(firstOfCurrentMonth).subtract(i,"days");days.push(prependedDay.toDate())}var monthDays=moment(lastOfCurrentMonth).date();for(i=0;i<monthDays;i++){var monthDay=moment(firstOfCurrentMonth).add(i,"days");days.push(monthDay.toDate())}lastOfCurrentMonthWeekDay<scope.firstDayOfWeek&&(lastOfCurrentMonthWeekDay+=7);var daysToAppend=7-(lastOfCurrentMonthWeekDay-scope.firstDayOfWeek)-1;for(i=1;i<=daysToAppend;i++){var appendedDay=moment(lastOfCurrentMonth).add(i,"days");days.push(appendedDay.toDate())}var chunks=[],chunk=[];angular.forEach(days,function(day,index){chunk.push(day),(index+1)%7==0&&(chunks.push(chunk),chunk=[])}),scope.days=chunks},getMonths=function(){for(var months=[],monthsChunked=[],now=moment(scope.displayValue).date(1).hour(0).minute(0).second(0).millisecond(0).toDate(),i=0;i<12;i++)now.setMonth(i),months.push(angular.copy(now));var chunk=[];angular.forEach(months,function(month,index){chunk.push(month),(index+1)%3==0&&(monthsChunked.push(chunk),chunk=[])}),scope.months=monthsChunked},getYears=function(){var years=[],yearsChunked=[],now=moment(new Date).month(0).date(1).hour(0).minute(0).second(0).millisecond(0).toDate(),currentYear=parseInt($filter("date")(now,"yyyy"),10),yearStart=currentYear-scope.yearsBefore,yearEnd=currentYear+scope.yearsAfter,viewYear=parseInt($filter("date")(scope.displayValue,"yyyy"),10),range=scope.yearsBefore+scope.yearsAfter+1;if(viewYear<yearStart)for(;viewYear<yearStart;)yearStart-=range,yearEnd-=range;if(viewYear>yearEnd)for(;viewYear>yearEnd;)yearStart+=range,yearEnd+=range;for(var i=yearStart;i<=yearEnd;i++)now.setFullYear(i),years.push(angular.copy(now));var chunk=[];angular.forEach(years,function(year,index){chunk.push(year),(index+1)%3==0&&(yearsChunked.push(chunk),chunk=[])}),scope.years=yearsChunked},getLocaleISO=function(date,length){return(date.getFullYear()+"-"+("00"+(date.getMonth()+1)).slice(-2)+"-"+("00"+date.getDate()).slice(-2)).substr(0,length)};scope.isOutOfBounds=function(date){var outOfBounds=!1,dateISO=getLocaleISO(date,10);return null!==scope.minimum&&dateISO<getLocaleISO(scope.minimum,10)&&(outOfBounds=!0),null!==scope.maximum&&dateISO>getLocaleISO(scope.maximum,10)&&(outOfBounds=!0),outOfBounds},scope.getDateClasses=function(date){var classes=[],td=new Date((new Date).setHours(0,0,0,0)),current=scope.displayValue,isoDateLength=10,outOfBoundDates=[getLocaleISO(date,10),getLocaleISO(date,10)];scope.displayMode===scope.DISPLAY_MODE_MONTH&&(isoDateLength=7,outOfBoundDates=[getLocaleISO(moment(date).clone().startOf("month").toDate(),10),getLocaleISO(moment(date).clone().endOf("month").toDate(),10)]),scope.displayMode===scope.DISPLAY_MODE_YEAR&&(isoDateLength=4,outOfBoundDates=[getLocaleISO(moment(date).clone().startOf("year").toDate(),10),getLocaleISO(moment(date).clone().endOf("year").toDate(),10)]);var selectedDateFromISO=null!==scope.model.from?getLocaleISO(scope.model.from,isoDateLength):null,selectedDateToISO=null!==scope.model.to?getLocaleISO(scope.model.to,isoDateLength):null,dateISO=getLocaleISO(date,isoDateLength),todayISO=getLocaleISO(td,isoDateLength);if(scope.displayMode===scope.DISPLAY_MODE_DAY&&date.getMonth()!==current.getMonth()&&classes.push(scope.cssClasses.OUT_OF_MONTH),null!==scope.minimum){var minimumISO=getLocaleISO(scope.minimum,10);outOfBoundDates[0]<minimumISO&&outOfBoundDates[1]<minimumISO&&(classes.push(scope.cssClasses.OUT_OF_BOUNDS),classes.push(scope.cssClasses.OUT_OF_BOUNDS_BEFORE))}if(null!==scope.maximum){var maximumISO=getLocaleISO(scope.maximum,10);outOfBoundDates[0]>maximumISO&&outOfBoundDates[1]>maximumISO&&(classes.push(scope.cssClasses.OUT_OF_BOUNDS),classes.push(scope.cssClasses.OUT_OF_BOUNDS_AFTER))}return dateISO===todayISO&&classes.push(scope.cssClasses.CURRENT_DATE),null!==selectedDateFromISO&&null!==selectedDateToISO&&dateISO>=selectedDateFromISO&&dateISO<=selectedDateToISO&&classes.push(scope.cssClasses.SELECTED_DATE),null!==selectedDateFromISO&&dateISO===selectedDateFromISO&&classes.push(scope.cssClasses.SELECTED_DATE_FROM),null!==selectedDateToISO&&dateISO===selectedDateToISO&&classes.push(scope.cssClasses.SELECTED_DATE_TO),classes.join(" ")},scope.getYearRange=function(){var year=parseInt($filter("date")(scope.displayValue,"yyyy"),10);return year-scope.yearsBefore+" – "+(year+scope.yearsAfter)};var update=function(){scope.currentLabels=angular.isDefined(ketaTimeRangeSelectorMessageKeys[scope.currentLocale.substr(0,5)])?ketaTimeRangeSelectorMessageKeys[scope.currentLocale.substr(0,5)]:ketaTimeRangeSelectorMessageKeys.en_GB,getWeekDays(),scope.displayMode===scope.DISPLAY_MODE_MONTH?getMonths():scope.displayMode===scope.DISPLAY_MODE_YEAR?getYears():getDays()};update();var move=function(direction){scope.displayMode===scope.DISPLAY_MODE_MONTH?scope.displayValue=moment(scope.displayValue).add(direction,"years").toDate():scope.displayMode===scope.DISPLAY_MODE_YEAR?scope.displayValue=moment(scope.displayValue).add(direction*(scope.yearsBefore+scope.yearsAfter+1),"years").toDate():scope.displayValue=moment(scope.displayValue).add(direction,"months").toDate(),update()};scope.prev=function(){move(-1)},scope.next=function(){move(1)};var getDisplayModeDate=function(date,mode,from){return mode===ketaTimeRangeSelectorConstants.DISPLAY_MODE.MONTH?from?date:moment(date).endOf("month").hour(0).minute(0).second(0).millisecond(0).toDate():mode===ketaTimeRangeSelectorConstants.DISPLAY_MODE.YEAR?from?date:moment(date).endOf("year").hour(0).minute(0).second(0).millisecond(0).toDate():angular.copy(date)},applyBoundaries=function(from,to,min,max){var range={from:from,to:to};return null!==min&&range.from<min&&(range.from=min),null!==max&&range.to>max&&(range.to=max),range},applyRangeLength=function(from,to,min,max){var range={from:from,to:to},days=moment(to).diff(moment(from),"days");return 0!==max&&days>=max&&(range.to=moment(from).add(max-1,"days").toDate()),0!==min&&days<=min&&(range.to=moment(from).add(min-1,"days").toDate()),range};scope.setDisplayMode=function(mode){mode!==scope.displayMode&&(scope.model={from:null,to:null},scope.firstClick=!0,scope.displayMode=mode,update())},scope.selectWeek=function(date){var firstOfWeek=moment(date).hour(0).minute(0).second(0).millisecond(0).toDate(),lastOfWeek=moment(firstOfWeek).add(6,"days").hour(0).minute(0).second(0).millisecond(0).toDate();!scope.isOutOfBounds(firstOfWeek)&&!scope.isOutOfBounds(lastOfWeek)&&(0===scope.minRangeLength||scope.minRangeLength<=7)&&(0===scope.maxRangeLength||scope.maxRangeLength>=7)&&scope.enableWeekSelection&&(scope.model.from=getDisplayModeDate(firstOfWeek,scope.displayMode,!0),scope.model.to=getDisplayModeDate(lastOfWeek,scope.displayMode,!1),scope.firstClick=!0)},scope.select=function(date){scope.isOutOfBounds(date)||(scope.firstClick?(scope.model.from=getDisplayModeDate(date,scope.displayMode,!0),scope.model.to=null,scope.firstClick=!1):date.getTime()<scope.model.from.getTime()?(scope.model.from=getDisplayModeDate(date,scope.displayMode,!0),scope.model.to=null,scope.firstClick=!1):(scope.model.to=getDisplayModeDate(date,scope.displayMode,!1),scope.firstClick=!0),scope.model=applyRangeLength(scope.model.from,scope.model.to,scope.minRangeLength,scope.maxRangeLength),scope.model=applyBoundaries(scope.model.from,scope.model.to,scope.minimum,scope.maximum),scope.displayValue=scope.firstClick?angular.copy(scope.model.to):angular.copy(scope.model.from))},scope.goToSelection=function(){null!==scope.model.from&&(scope.displayValue=angular.copy(scope.model.from))},scope.goToToday=function(){var td=new Date;td.setHours(0,0,0,0),scope.displayValue=td},scope.submit=function(){scope.isSelectionInvalid()||(null===scope.model.to&&(scope.model.to=getDisplayModeDate(scope.model.from,scope.displayMode,!1)),scope.$emit(ketaTimeRangeSelectorConstants.EVENT.SELECT,{id:scope.elementIdentifier,model:scope.model}))},scope.isSelectionInvalid=function(){return null===scope.model.from},scope.$watch("currentLocale",function(newValue,oldValue){newValue!==oldValue&&angular.isString(newValue)&&update()}),scope.$watch("displayMode",function(newValue,oldValue){newValue!==oldValue&&update()}),scope.$watch("displayValue",function(newValue,oldValue){newValue!==oldValue&&angular.isDate(newValue)&&update()}),scope.$watch("firstDayOfWeek",function(newValue,oldValue){newValue!==oldValue&&update()}),scope.$watch("maximum",function(newValue,oldValue){newValue!==oldValue&&(scope.model=applyBoundaries(scope.model.from,scope.model.to,scope.mininum,newValue))}),scope.$watch("minimum",function(newValue,oldValue){newValue!==oldValue&&(scope.model=applyBoundaries(scope.model.from,scope.model.to,newValue,scope.maximum))}),scope.$watch("maxRangeLength",function(newValue,oldValue){newValue!==oldValue&&(scope.model=applyRangeLength(scope.model.from,scope.model.to,scope.minRangeLength,newValue))}),scope.$watch("minRangeLength",function(newValue,oldValue){newValue!==oldValue&&(scope.model=applyRangeLength(scope.model.from,scope.model.to,newValue,scope.maxRangeLength))}),scope.$watch("yearsAfter",function(newValue,oldValue){newValue!==oldValue&&update()}),scope.$watch("yearsBefore",function(newValue,oldValue){newValue!==oldValue&&update()})}}}),angular.module("keta.directives.TimeRangeSelector").run(function($templateCache){$templateCache.put("/components/directives/time-range-selector.html",'<div class="keta-time-range-selector">\t\x3c!-- view mode --\x3e\t<p class="text-center display-mode-switcher" data-ng-if="showDisplayModeSwitcher">\t\t<strong data-ng-if="displayMode === DISPLAY_MODE_DAY">{{ currentLabels[MESSAGE_KEY_PREFIX + \'_display_mode_days\'] }}</strong>\t\t<a href="" data-ng-if="displayMode !== DISPLAY_MODE_DAY"\t\t\tdata-ng-click="setDisplayMode(DISPLAY_MODE_DAY)">{{ currentLabels[MESSAGE_KEY_PREFIX + \'_display_mode_days\'] }}</a> |\t\t<strong data-ng-if="displayMode === DISPLAY_MODE_MONTH">{{ currentLabels[MESSAGE_KEY_PREFIX + \'_display_mode_months\'] }}</strong>\t\t<a href="" data-ng-if="displayMode !== DISPLAY_MODE_MONTH"\t\t\tdata-ng-click="setDisplayMode(DISPLAY_MODE_MONTH)">{{ currentLabels[MESSAGE_KEY_PREFIX + \'_display_mode_months\'] }}</a> |\t\t<strong data-ng-if="displayMode === DISPLAY_MODE_YEAR">{{ currentLabels[MESSAGE_KEY_PREFIX + \'_display_mode_years\'] }}</strong>\t\t<a href="" data-ng-if="displayMode !== DISPLAY_MODE_YEAR"\t\t\tdata-ng-click="setDisplayMode(DISPLAY_MODE_YEAR)">{{ currentLabels[MESSAGE_KEY_PREFIX + \'_display_mode_years\'] }}</a>\t</p>\t\x3c!-- pager --\x3e\t<ul class="pager pager-navigation" data-ng-if="showPager">\t\t<li class="previous">\t\t\t<a href="" data-ng-click="prev()"><span aria-hidden="true">←</span></a>\t\t</li>\t\t<li class="text-center" data-ng-if="displayMode === DISPLAY_MODE_DAY">\t\t\t<a href=""\t\t\t\tdata-ng-if="enableDisplayModeSwitch"\t\t\t\tdata-ng-click="setDisplayMode(DISPLAY_MODE_MONTH)">{{ displayValue | date:\'MMMM yyyy\' }}</a>\t\t\t<a data-ng-if="!enableDisplayModeSwitch">{{ displayValue | date:\'MMMM yyyy\' }}</a>\t\t</li>\t\t<li class="text-center" data-ng-if="displayMode === DISPLAY_MODE_MONTH">\t\t\t<a href=""\t\t\t\tdata-ng-if="enableDisplayModeSwitch"\t\t\t\tdata-ng-click="setDisplayMode(DISPLAY_MODE_YEAR)">{{ displayValue | date:\'yyyy\' }}</a>\t\t\t<a data-ng-if="!enableDisplayModeSwitch">{{ displayValue | date:\'yyyy\' }}</a>\t\t</li>\t\t<li class="text-center" data-ng-if="displayMode === DISPLAY_MODE_YEAR">\t\t\t<div class="pager-link">{{ getYearRange() }}</div>\t\t</li>\t\t<li class="next">\t\t\t<a href="" data-ng-click="next()"><span aria-hidden="true">→</span></a>\t\t</li>\t</ul>\t\x3c!-- days --\x3e\t<table class="calendar calendar-day" data-ng-if="displayMode === DISPLAY_MODE_DAY">\t\t<tr>\t\t\t<td data-ng-if="showWeekNumbers">\t\t\t\t<a class="weekday">{{ currentLabels[MESSAGE_KEY_PREFIX + \'_week_number_short\'] }}</a>\t\t\t</td>\t\t\t<td data-ng-repeat="day in weekDays">\t\t\t\t<a class="weekday">{{ day }}</a>\t\t\t</td>\t\t</tr>\t\t<tr data-ng-repeat="week in days">\t\t\t<td data-ng-if="showWeekNumbers">\t\t\t\t<a class="week-number" data-ng-click="selectWeek(week[0])">{{ week[0] | date:\'w\' }}</a>\t\t\t</td>\t\t\t<td data-ng-repeat="day in week">\t\t\t\t<a href=""\t\t\t\t\tdata-ng-click="select(day)"\t\t\t\t\tdata-ng-class="getDateClasses(day)">{{ day | date:\'d\' }}</a>\t\t\t</td>\t\t</tr>\t</table>\t\x3c!-- months --\x3e\t<table class="calendar calendar-month" data-ng-if="displayMode === DISPLAY_MODE_MONTH">\t\t<tr data-ng-repeat="row in months">\t\t\t<td data-ng-repeat="month in row">\t\t\t\t<a href=""\t\t\t\t\tdata-ng-click="select(month)"\t\t\t\t\tdata-ng-class="getDateClasses(month)">{{ month | date:\'MMM\' }}</a>\t\t\t</td>\t\t</tr>\t</table>\t\x3c!-- years --\x3e\t<table class="calendar calendar-year" data-ng-if="displayMode === DISPLAY_MODE_YEAR">\t\t<tr data-ng-repeat="row in years">\t\t\t<td data-ng-repeat="year in row">\t\t\t\t<a href=""\t\t\t\t\tdata-ng-click="select(year)"\t\t\t\t\tdata-ng-class="getDateClasses(year)">{{ year | date:\'yyyy\' }}</a>\t\t\t</td>\t\t</tr>\t</table>\t\x3c!-- quick links --\x3e\t<ul class="pager pager-quick-links"\t\tdata-ng-if="showJumpToSelectionButton || showJumpToTodayButton || showSelectButton">\t\t<li>\t\t\t<a href="" data-ng-if="showJumpToTodayButton"\t\t\t\tdata-ng-click="goToToday()">{{ currentLabels[MESSAGE_KEY_PREFIX + \'_today\'] }}</a>\t\t</li>\t\t<li>\t\t\t<a href="" data-ng-if="showJumpToSelectionButton"\t\t\t\tdata-ng-click="goToSelection()">{{ currentLabels[MESSAGE_KEY_PREFIX + \'_selection\'] }}</a>\t\t</li>\t\t<li data-ng-class="{\'disabled\': isSelectionInvalid()}">\t\t\t<a href="" data-ng-if="showSelectButton"\t\t\t\tdata-ng-click="submit()">{{ currentLabels[MESSAGE_KEY_PREFIX + \'_select\'] }}</a>\t\t</li>\t</ul></div>')}),angular.module("keta.filters.OrderObjectBy",[]).filter("ketaOrderObjectBy",function(){return function(input,order,returnKey){if(!angular.isObject(input))return input;returnKey=returnKey||!1;var fields=[];angular.isDefined(order)&&null!==order?fields=order:angular.forEach(input,function(value,key){0!==key.indexOf("$")&&fields.push(key)});var sorted=[];return angular.forEach(fields,function(field){angular.isDefined(input[field])&&sorted.push(returnKey?field:input[field])}),sorted}}),angular.module("keta.filters.Slice",[]).filter("ketaSlice",function(){return function(arr,offset,limit){return angular.isDefined(arr)&&angular.isArray(arr)||(arr=[]),angular.isDefined(offset)&&angular.isNumber(offset)||(offset=0),angular.isDefined(limit)&&angular.isNumber(limit)||(limit=arr.length),arr.slice(offset,offset+limit)}}),angular.module("keta.filters.Unit",["keta.services.Tag"]).filter("ketaUnit",function($filter,ketaTagConstants){var unitFilter=function(input,configuration){if(!angular.isNumber(input))return input;var precision=0,precisionRanges=[],precisionExcludeIntegers=!1,precisionExclude=[],unit="",isBytes=!1,separate=!1,separated={numberFormatted:null,numberRaw:null,unit:null};angular.isDefined(configuration)&&(precision=angular.isNumber(configuration.precision)?configuration.precision:precision,precisionRanges=angular.isArray(configuration.precisionRanges)?configuration.precisionRanges:precisionRanges,precisionExcludeIntegers=angular.isDefined(configuration.precisionExcludeIntegers)?configuration.precisionExcludeIntegers:precisionExcludeIntegers,precisionExclude=angular.isArray(configuration.precisionExclude)?configuration.precisionExclude:precisionExclude,unit=angular.isDefined(configuration.unit)?configuration.unit:unit,isBytes=angular.isDefined(configuration.isBytes)?configuration.isBytes:isBytes,separate=angular.isDefined(configuration.separate)?configuration.separate:separate);var excludeFromPrecision=precisionExcludeIntegers;excludeFromPrecision||(excludeFromPrecision=-1!==precisionExclude.indexOf(input)),angular.forEach(precisionRanges,function(range){var matching=!0;angular.isDefined(range.min)&&input<range.min&&(matching=!1),angular.isDefined(range.max)&&input>=range.max&&(matching=!1),angular.isDefined(range.min)||angular.isDefined(range.max)||(matching=!1),matching&&angular.isNumber(range.precision)&&(precision=range.precision)}),0===input&&excludeFromPrecision&&(precision=0);var sizes=isBytes?["Bytes","KB","MB","GB","TB"]:["","k","M","G","T"];if(unit===ketaTagConstants.UNIT.EURO||unit===ketaTagConstants.UNIT.KILOMETER||unit===ketaTagConstants.UNIT.DOLLAR||unit===ketaTagConstants.UNIT.POUND)return separate?(separated.numberFormatted=$filter("number")(input,precision),separated.numberRaw=input,separated.unit=unit,separated):$filter("number")(input,precision)+" "+unit;var multiplicator=input<0?-1:1;if((input*=multiplicator)>=1){var i=parseInt(Math.floor(Math.log(input)/Math.log(isBytes?1024:1e3)),10),siInput=input/Math.pow(isBytes?1024:1e3,i)*multiplicator,siInputFixed=excludeFromPrecision?siInput:Number(siInput.toFixed(precision));siInputFixed>=1e3&&(i++,siInputFixed/=1e3);var inputPieces=String(siInputFixed).split(/\./),inputsCurrentPrecision=inputPieces.length>1?inputPieces[1].length:0;separated.numberFormatted=excludeFromPrecision?$filter("number")(siInputFixed,inputsCurrentPrecision):$filter("number")(siInputFixed,precision),separated.numberRaw=siInputFixed,separated.unit=sizes[i]+unit,input=separated.numberFormatted+(""!==sizes[i]?" "+sizes[i]:"")}else separated.numberFormatted=$filter("number")(input,precision),separated.numberRaw=Number(input.toFixed(precision)),separated.unit=unit,input=separated.numberFormatted;return isBytes||""===unit||(input+=-1===input.indexOf(" ")?" "+unit:unit),separate?separated:input};return unitFilter.$stateful=!0,unitFilter}),angular.module("keta.services.AccessToken",["keta.services.AppContext"]).constant("ketaAccessTokenConstants",{SESSION_TYPE:{NORMAL:"normal",IMPERSONATED:"impersonated"},JWT_REGULAR_EXPRESSION:new RegExp("^(\\w+)\\.(\\w+)\\.([\0-]+)$")}).factory("ketaAccessToken",function($http,$q,ketaAppContext,ketaAccessTokenConstants){var isKeycloak=ketaAppContext.get("common.keycloak"),keycloak=isKeycloak?window.auth.authz:{},accessToken=isKeycloak?keycloak.token:ketaAppContext.get("oauth.accessToken"),decodedAccessToken=null,refreshPromise=null,refreshInProgress=!1,Base64={keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",decode:function(input){var chr1,chr2,chr3,enc2,enc3,enc4,output="",i=0;for(input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");i<input.length;)chr1=this.keyStr.indexOf(input.charAt(i++))<<2|(enc2=this.keyStr.indexOf(input.charAt(i++)))>>4,chr2=(15&enc2)<<4|(enc3=this.keyStr.indexOf(input.charAt(i++)))>>2,chr3=(3&enc3)<<6|(enc4=this.keyStr.indexOf(input.charAt(i++))),output+=String.fromCharCode(chr1),64!==enc3&&(output+=String.fromCharCode(chr2)),64!==enc4&&(output+=String.fromCharCode(chr3));return Base64.utf8Decode(output)},encode:function(input){var chr1,chr2,chr3,enc1,enc2,enc3,enc4,output="",i=0;for(input=Base64.utf8Encode(input);i<input.length;)enc1=(chr1=input.charCodeAt(i++))>>2,enc2=(3&chr1)<<4|(chr2=input.charCodeAt(i++))>>4,enc3=(15&chr2)<<2|(chr3=input.charCodeAt(i++))>>6,enc4=63&chr3,isNaN(chr2)?enc3=enc4=64:isNaN(chr3)&&(enc4=64),output=output+this.keyStr.charAt(enc1)+this.keyStr.charAt(enc2)+this.keyStr.charAt(enc3)+this.keyStr.charAt(enc4);return output},utf8Decode:function(utfText){for(var string="",i=0,c=0,c2=0,c3=0;i<utfText.length;)(c=utfText.charCodeAt(i))<128?(string+=String.fromCharCode(c),i++):c>191&&c<224?(c2=utfText.charCodeAt(i+1),string+=String.fromCharCode((31&c)<<6|63&c2),i+=2):(c2=utfText.charCodeAt(i+1),c3=utfText.charCodeAt(i+2),string+=String.fromCharCode((15&c)<<12|(63&c2)<<6|63&c3),i+=3);return string},utf8Encode:function(string){string=string.replace(/\r\n/g,"\n");for(var utfText="",n=0;n<string.length;n++){var c=string.charCodeAt(n);c<128?utfText+=String.fromCharCode(c):c>127&&c<2048?(utfText+=String.fromCharCode(c>>6|192),utfText+=String.fromCharCode(63&c|128)):(utfText+=String.fromCharCode(c>>12|224),utfText+=String.fromCharCode(c>>6&63|128),utfText+=String.fromCharCode(63&c|128))}return utfText}},getProperty=function(property){return null!==decodedAccessToken&&angular.isDefined(decodedAccessToken[property])?decodedAccessToken[property]:null},api={get:function(decoded){return null!==accessToken&&null===decodedAccessToken&&(decodedAccessToken=api.decode(accessToken)),angular.isDefined(decoded)&&!0===decoded?decodedAccessToken:accessToken},set:function(token){angular.isDefined(token)&&angular.isString(token)&&(accessToken=token,decodedAccessToken=api.decode(token))},decode:function(token){var props={};try{var decoded;if(ketaAccessTokenConstants.JWT_REGULAR_EXPRESSION.test(token)){var payload=token.split(".")[1];decoded=Base64.decode(payload)}else-1!==(decoded=Base64.decode(token)).indexOf("}.")&&(decoded=decoded.substr(0,decoded.indexOf("}.")+1));props=JSON.parse(decoded)}catch(e){return null}return props},encode:function(props){return Base64.encode(JSON.stringify(props))},refresh:function(){if(null===refreshPromise||!refreshInProgress){refreshPromise=$q.defer(),refreshInProgress=!0;var refreshUrl=ketaAppContext.get("oauth.refreshTokenPath")||"/refreshAccessToken";(isKeycloak?keycloak.updateToken():$http({method:"GET",url:refreshUrl})).then(function(response){refreshPromise.resolve(response),refreshInProgress=!1},function(){refreshPromise.reject("Could not refresh access token"),refreshInProgress=!1})}return refreshPromise.promise},hasPermission:function(permission){var has=!1,decoded=api.get(!0);return null!==decoded&&angular.isArray(decoded.scope)&&(has=-1!==decoded.scope.indexOf(permission)),has},isType:function(type){var decoded=api.get(!0);return null!==decoded&&angular.isDefined(decoded.session)&&angular.isDefined(decoded.session.type)&&decoded.session.type===type},getBackUrl:function(){var backUrl=null;if(api.isType(ketaAccessTokenConstants.SESSION_TYPE.IMPERSONATED)){var decoded=api.get(!0);null!==decoded&&angular.isDefined(decoded.session)&&angular.isDefined(decoded.session.backUrl)&&(backUrl=decoded.session.backUrl)}return backUrl},getUserId:function(){return getProperty("user_id")},getChannel:function(){return getProperty("channel")}};return api}),angular.module("keta.services.AppContext",[]).provider("ketaAppContext",function(){var appContext=angular.isDefined(window.appContext)?window.appContext:{};this.get=function(key){for(var obj=appContext,i=0,l=(key=key.split(".")).length;i<l;i++){if(!angular.isDefined(obj[key[i]]))return null;obj=obj[key[i]]}return obj},this.$get=function(){return{get:this.get}}}),angular.module("keta.services.ApplicationSet",["keta.services.Application"]).provider("ketaApplicationSet",function(){this.$get=function($q,$rootScope,$log,ketaApplication,ketaEventBusDispatcher,ketaEventBusManager){var ApplicationSetInstance=function(givenEventBus){var that=this,eventBus=givenEventBus,params={};that.filter=function(filter){return params.filter=filter,that},that.project=function(projection){return params.projection=projection,that},that.sort=function(sorting){return params.sorting=sorting,that},that.paginate=function(pagination){return angular.isDefined(pagination)?(params.offset=angular.isDefined(pagination.offset)?pagination.offset:0,params.limit=angular.isDefined(pagination.limit)?pagination.limit:50):(params.offset=0,params.limit=50),that},that.query=function(){var deferred=$q.defer();return ketaEventBusDispatcher.send(eventBus,"appservice",{action:"getAppsInfo",params:params},function(reply){reply?(reply.params=params,reply.code===ketaEventBusDispatcher.RESPONSE_CODE_OK?(angular.isDefined(reply.result)&&angular.isDefined(reply.result.items)&&angular.forEach(reply.result.items,function(item,index){reply.result.items[index]=ketaApplication.create(eventBus,item)}),ketaEventBusManager.inDebugMode()&&$log.request(["appservice",{action:"getAppsInfo",params:params},reply],$log.ADVANCED_FORMATTER),deferred.resolve(reply),$rootScope.$digest()):deferred.reject(reply)):deferred.reject("Something bad happened. Got no reply.")}),deferred.promise}};return{create:function(eventBus){return new ApplicationSetInstance(eventBus)},indexOf:function(set,application){var index=-1;return angular.isDefined(set.result)&&angular.isDefined(set.result.items)&&angular.forEach(set.result.items,function(item,key){item.appId===application.appId&&(index=key)}),index},length:function(set){return angular.isDefined(set.result)&&angular.isDefined(set.result.items)&&angular.isArray(set.result.items)?set.result.items.length:0},get:function(set,index){return angular.isDefined(set.result)&&angular.isDefined(set.result.items)&&angular.isDefined(set.result.items[index])?set.result.items[index]:null},getAll:function(set){return angular.isDefined(set.result)&&angular.isDefined(set.result.items)?set.result.items:[]}}}}),angular.module("keta.services.Application",["keta.services.EventBusDispatcher","keta.services.EventBusManager","keta.services.Logger"]).provider("ketaApplication",function(){this.$get=function(){var ApplicationInstance=function(givenEventBus,properties){var that=this;angular.forEach(properties,function(value,key){that[key]=value,angular.isDefined(that.$pristine)||(that.$pristine={}),that.$pristine[key]=angular.copy(value)})};return{create:function(eventBus,properties){return new ApplicationInstance(eventBus,properties)}}}}),angular.module("keta.services.DeviceEvent",[]).provider("ketaDeviceEvent",function(){this.$get=function(){var DeviceEventInstance=function(givenType,givenDevice){var that=this,type=givenType;that.getType=function(){return type};var device=givenDevice;that.getDevice=function(){return device}};return{CREATED:"CREATED",UPDATED:"UPDATED",DELETED:"DELETED",create:function(type,device){return new DeviceEventInstance(type,device)}}}}),angular.module("keta.services.DevicePolling",[]).service("ketaDevicePolling",function($interval,$log,$q,ketaEventBusDispatcher,ketaEventBusManager,ketaDeviceEvent,ketaDeviceSetPollers){var isValid=function(queryReply){return queryReply&&queryReply.code===ketaEventBusDispatcher.RESPONSE_CODE_OK&&angular.isDefined(queryReply.result)&&angular.isDefined(queryReply.result.items)},logFetchQueryReply=function(queryParameters,reply){$log.request(["deviceservice",{action:"getDevices",params:queryParameters},reply],$log.ADVANCED_FORMATTER)},fetchDevices=function(eventBus,queryParameters){var deferred=$q.defer();return ketaEventBusDispatcher.send(eventBus,"deviceservice",{action:"getDevices",params:queryParameters},function(reply){isValid(reply)?(ketaEventBusManager.inDebugMode()&&logFetchQueryReply(reply),deferred.resolve(reply)):logFetchQueryReply(reply)}),deferred.promise},compareGuids=function(thisDevice,thatDevice){return thisDevice.guid<thatDevice.guid?-1:thisDevice.guid>thatDevice.guid?1:0},emitDeletionEvent=function(device,receiver){receiver(ketaDeviceEvent.create(ketaDeviceEvent.DELETED,device))},emitCreationEvent=function(device,receiver){receiver(ketaDeviceEvent.create(ketaDeviceEvent.CREATED,device))},emitUpdateEvent=function(device,receiver){receiver(ketaDeviceEvent.create(ketaDeviceEvent.UPDATED,device))},compareDeviceLists=function(currentDevices,fetchedDevices,changeEventProcessor){for(var c=0,f=0;c<currentDevices.length&&f<fetchedDevices.length;)currentDevices[c].guid<fetchedDevices[f].guid?(emitDeletionEvent(currentDevices[c],changeEventProcessor),c++):currentDevices[c].guid>fetchedDevices[f].guid?(emitCreationEvent(fetchedDevices[f],changeEventProcessor),f++):angular.equals(currentDevices[c],fetchedDevices[f])?(c++,f++):(emitUpdateEvent(fetchedDevices[f],changeEventProcessor),c++,f++);for(;c<currentDevices.length;c++)emitDeletionEvent(currentDevices[c],changeEventProcessor);for(;f<fetchedDevices.length;f++)emitCreationEvent(fetchedDevices[f],changeEventProcessor)};this.pollDevices=function(eventBus,queryParameters,changeEventProcessor,intervalSeconds){intervalSeconds=intervalSeconds||15;var currentDevices;fetchDevices(eventBus,queryParameters).then(function(reply){currentDevices=reply.result.items.sort(compareGuids)});var poller=$interval(function(){fetchDevices(eventBus,queryParameters).then(function(reply){var fetchedDevices=reply.result.items.sort(compareGuids);currentDevices&&compareDeviceLists(currentDevices,fetchedDevices,changeEventProcessor),currentDevices=fetchedDevices})},1e3*intervalSeconds);ketaDeviceSetPollers.add(poller)};var emitTagValues=function(changeEvent,receiver){if(changeEvent.getType()===ketaDeviceEvent.CREATED||changeEvent.getType()===ketaDeviceEvent.UPDATED){var tagValuesObject=changeEvent.getDevice().tagValues;receiver(Object.keys(tagValuesObject).map(function(tagName){return tagValuesObject[tagName]}))}};this.pollTagValues=function(eventBus,queryParameters,tagValuesProcessor,intervalSeconds){this.pollDevices(eventBus,queryParameters,function(changeEvent){emitTagValues(changeEvent,tagValuesProcessor)},intervalSeconds)}}),angular.module("keta.services.DeviceSetPollers",[]).service("ketaDeviceSetPollers",function($interval){var pollerPromises=[];this.add=function(pollerPromise){pollerPromises.push(pollerPromise)},this.stopAndRemoveAll=function(){for(;pollerPromises.length;)$interval.cancel(pollerPromises.pop())}}),angular.module("keta.services.DeviceSet",["keta.services.Device","keta.services.DeviceEvent","keta.services.DevicePolling"]).provider("ketaDeviceSet",function(){this.$get=function($q,$rootScope,$log,$interval,ketaDevice,ketaDeviceEvent,ketaDevicePolling,ketaEventBusDispatcher,ketaEventBusManager){var api,DeviceSetInstance=function(givenEventBus){var that=this,eventBus=givenEventBus,params={},registerListener=!1,set={};that.filter=function(filter){return params.filter=filter,that},that.project=function(projection){return params.projection=projection,that},that.sort=function(sorting){return params.sorting=sorting,that},that.paginate=function(pagination){return angular.isDefined(pagination)?(params.offset=angular.isDefined(pagination.offset)?pagination.offset:0,params.limit=angular.isDefined(pagination.limit)?pagination.limit:50):(params.offset=0,params.limit=50),that},that.live=function(){return registerListener=!0,that};var fetchDevices=function(replyProcessor){ketaEventBusDispatcher.send(eventBus,"deviceservice",{action:"getDevices",params:params},replyProcessor)},logFetchQueryReply=function(reply){$log.request(["deviceservice",{action:"getDevices",params:params},reply],$log.ADVANCED_FORMATTER)},storeAndReturnFetchedDevices=function(queryReply,deferredResult){queryReply?(queryReply.params=params,queryReply.code===ketaEventBusDispatcher.RESPONSE_CODE_OK?(angular.isDefined(queryReply.result)&&angular.isDefined(queryReply.result.items)?(angular.forEach(queryReply.result.items,function(item,index){queryReply.result.items[index]=ketaDevice.create(eventBus,item)}),set=queryReply):set={},ketaEventBusManager.inDebugMode()&&logFetchQueryReply(queryReply),deferredResult.resolve(queryReply),$rootScope.$digest()):deferredResult.reject(queryReply)):deferredResult.reject("Something bad happened. Got no reply.")};that.query=function(){registerListener&&ketaDevicePolling.pollDevices(eventBus,params,function(changeEvent){api.sync(set,changeEvent,eventBus)});var deferred=$q.defer();return fetchDevices(function(reply){storeAndReturnFetchedDevices(reply,deferred)}),deferred.promise}};return api={create:function(eventBus){return new DeviceSetInstance(eventBus)},indexOf:function(set,device){var index=-1;return angular.isDefined(set.result)&&angular.isDefined(set.result.items)&&angular.forEach(set.result.items,function(item,key){item.guid===device.guid&&(index=key)}),index},length:function(set){return angular.isDefined(set.result)&&angular.isDefined(set.result.items)&&angular.isArray(set.result.items)?set.result.items.length:0},get:function(set,index){return angular.isDefined(set.result)&&angular.isDefined(set.result.items)&&angular.isDefined(set.result.items[index])?set.result.items[index]:null},getAll:function(set){return angular.isDefined(set.result)&&angular.isDefined(set.result.items)?set.result.items:[]},sync:function(set,event,eventBus){var modified=!1,device=ketaDevice.create(eventBus,event.getDevice());if(event.getType()===ketaDeviceEvent.CREATED)set.result.items.push(device),modified=!0;else if(event.getType()===ketaDeviceEvent.DELETED)set.result.items.splice(api.indexOf(set,device),1),modified=!0;else if(event.getType()===ketaDeviceEvent.UPDATED){var index=api.indexOf(set,device);-1!==index&&(angular.extend(api.get(set,index),device),modified=!0)}modified&&!$rootScope.$$phase&&$rootScope.$apply()}}}}),angular.module("keta.services.Device",["keta.services.EventBusDispatcher","keta.services.EventBusManager","keta.services.Logger"]).constant("ketaDeviceConstants",{STATE:{OK:"OK",ERROR:"ERROR",FATAL:"FATAL"},CLASS:{ENERGY_MANAGER:"com.kiwigrid.devices.em.EnergyManager",LOCATION:"com.kiwigrid.devices.location.Location",PV_PLANT:"com.kiwigrid.devices.pvplant.PVPlant"},ICON:{"com.kiwigrid.devices.batteryconverter.BatteryConverter":"kiwigrid-device-icon-battery-converter","com.kiwigrid.devices.plug.Plug":"kiwigrid-device-icon-plug","com.kiwigrid.devices.powermeter.PowerMeter":"kiwigrid-device-icon-plug","com.kiwigrid.devices.windturbine.WindTurbine":"kiwigrid-device-icon-wind-turbine","com.kiwigrid.devices.sensor.TemperatureSensor":"kiwigrid-device-icon-temperature-sensor","com.kiwigrid.devices.inverter.Inverter":"kiwigrid-device-icon-inverter","com.kiwigrid.devices.heatpump.HeatPump":"kiwigrid-device-icon-smart-heat-pump","com.kiwigrid.devices.microchp.MicroChpSystem":"kiwigrid-device-icon-micro-combined-heat-pump","com.kiwigrid.devices.ripplecontrolreceiver.RippleControlReceiver":"kiwigrid-device-icon-ripple-control-receiver","com.kiwigrid.devices.smartheatpumps.SmartHeatPumps":"kiwigrid-device-icon-smart-heat-pump","com.kiwigrid.devices.pvplant.PVPlant":"kiwigrid-device-icon-pv-plant"}}).provider("ketaDevice",function(){this.$get=function($q,$log,ketaEventBusDispatcher,ketaEventBusManager){var DeviceInstance=function(givenEventBus,properties){var that=this,eventBus=givenEventBus;angular.forEach(properties,function(value,key){that[key]=value,angular.isDefined(that.$pristine)||(that.$pristine={}),that.$pristine[key]=angular.copy(value)});var sendMessage=function(message){var deferred=$q.defer();return ketaEventBusDispatcher.send(eventBus,"deviceservice",message,function(reply){ketaEventBusManager.inDebugMode()&&$log.request(["deviceservice",message,reply],$log.ADVANCED_FORMATTER),reply.code===ketaEventBusDispatcher.RESPONSE_CODE_OK?deferred.resolve(reply):deferred.reject(reply)}),deferred.promise},returnRejectedPromise=function(message){var deferred=$q.defer();return deferred.reject(message),deferred.promise};that.$update=function(){var changes={tagValues:{}};if(angular.forEach(that.tagValues,function(tagValue,tagName){angular.isDefined(that.$pristine.tagValues[tagName])&&angular.equals(that.tagValues[tagName].value,that.$pristine.tagValues[tagName].value)||(changes.tagValues[tagName]={},changes.tagValues[tagName].value=tagValue.value,changes.tagValues[tagName].oca=tagValue.oca)}),Object.keys(changes.tagValues).length){var deferred=$q.defer();return sendMessage({action:"mergeDevice",params:{deviceId:that.guid},body:changes}).then(function(reply){angular.isDefined(reply.result)&&angular.isDefined(reply.result.value)&&angular.isDefined(reply.result.value.tagValues)&&angular.forEach(reply.result.value.tagValues,function(tag){angular.isDefined(reply.result.value.failedTagValues)&&angular.isDefined(reply.result.value.failedTagValues[tag.tagName])||(that.tagValues[tag.tagName]=tag,that.$pristine.tagValues[tag.tagName]=angular.copy(that.tagValues[tag.tagName]))}),deferred.resolve(reply)},function(reply){deferred.reject(reply)}),deferred.promise}return returnRejectedPromise("No changes found")},that.$delete=function(){return sendMessage({action:"deleteDevice",params:{deviceId:that.guid}})},that.$reset=function(){angular.forEach(that,function(value,key){angular.isFunction(value)||"$pristine"===key||delete that[key]}),angular.forEach(that.$pristine,function(value,key){that[key]=angular.copy(value)})}};return{create:function(eventBus,properties){return new DeviceInstance(eventBus,properties)}}}}),angular.module("keta.services.EventBusDispatcher",["keta.services.AccessToken","keta.services.DeviceSetPollers"]).provider("ketaEventBusDispatcher",function(){this.$get=function($window,$timeout,ketaAccessToken,ketaDeviceSetPollers){var waitForOpen=function(eventBus,replied,success,error){var timeout=null;if(replied&&(timeout=$timeout(function(){error()},1e3*eventBus.getConfig().requestTimeout)),1!==eventBus.getInstance().readyState()){var onopen=null;angular.isFunction(eventBus.getInstance().onopen)&&(onopen=eventBus.getInstance().onopen),eventBus.getInstance().onopen=function(){angular.isFunction(onopen)&&onopen(),null!==timeout&&$timeout.cancel(timeout),success()}}else $timeout.cancel(timeout),success()},api={STATE_CONNECTING:0,STATE_OPEN:1,STATE_CLOSING:2,STATE_CLOSED:3,RESPONSE_CODE_OK:200,RESPONSE_CODE_NO_CONTENT:204,RESPONSE_MESSAGE_OK:"OK",RESPONSE_CODE_BAD_REQUEST:400,RESPONSE_MESSAGE_BAD_REQUEST:"Bad Request",RESPONSE_CODE_UNAUTHORIZED:401,RESPONSE_MESSAGE_UNAUTHORIZED:"Unauthorized",RESPONSE_CODE_NOT_FOUND:404,RESPONSE_MESSAGE_NOT_FOUND:"Not Found",RESPONSE_CODE_REQUEST_TIMEOUT:408,RESPONSE_MESSAGE_REQUEST_TIMEOUT:"Request Time-out",RESPONSE_CODE_AUTHENTICATION_TIMEOUT:419,RESPONSE_MESSAGE_AUTHENTICATION_TIMEOUT:"Authentication Timeout",RESPONSE_CODE_INTERNAL_SERVER_ERROR:500,RESPONSE_MESSAGE_INTERNAL_SERVER_ERROR:"Internal Server Error",RESPONSE_CODE_SERVICE_UNAVAILABLE:503,RESPONSE_MESSAGE_SERVICE_UNAVAILABLE:"Service Unavailable",send:function(eventBus,address,message,replyHandler){"unregisterAllListeners"!==message.action&&"unregisterAllDeviceSetListeners"!==message.action||ketaDeviceSetPollers.stopAndRemoveAll(),message.accessToken=ketaAccessToken.get();var handler=function(reply){reply&&reply.code===api.RESPONSE_CODE_AUTHENTICATION_TIMEOUT?ketaAccessToken.refresh().then(function(response){angular.isDefined(response.data)&&angular.isDefined(response.data.accessToken)?(ketaAccessToken.set(response.data.accessToken),api.send(eventBus,address,message,replyHandler)):angular.isDefined(response.access_token)?(ketaAccessToken.set(response.access_token),api.send(eventBus,address,message,replyHandler)):$window.location.reload()},function(){$window.location.reload()}):angular.isFunction(replyHandler)&&replyHandler(reply||{code:408,message:"Request Time-out"})},callReplyHandler=function(reply){angular.isFunction(replyHandler)&&replyHandler(reply)};eventBus.inOfflineMode()||(null!==eventBus.getInstance()?waitForOpen(eventBus,!0,function(){eventBus.getInstance().send(address,message,handler)},function(){callReplyHandler({code:408,message:"Request Time-out"})}):callReplyHandler({code:500,message:"Internal Server Error"}))},publish:function(eventBus,address,message){message.accessToken=ketaAccessToken.get(),waitForOpen(eventBus,!1,function(){eventBus.getInstance().publish(address,message)})},registerHandler:function(eventBus,address,handler){waitForOpen(eventBus,!1,function(){eventBus.getInstance().registerHandler(address,handler)})},unregisterHandler:function(eventBus,address,handler){waitForOpen(eventBus,!1,function(){eventBus.getInstance().unregisterHandler(address,handler)})},close:function(eventBus){eventBus.getInstance().close()},readyState:function(eventBus){return eventBus.getInstance().readyState()},generateUUID:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a,b){return b=16*Math.random(),("y"===a?3&b|8:0|b).toString(16)})}};return api}}),angular.module("keta.services.EventBusManager",[]).provider("ketaEventBusManager",function(){var that=this,eventBuses={},debug=!1;this.add=function(eventBus){return eventBuses[eventBus.getConfig().id]=eventBus,that},this.remove=function(eventBus){return angular.isDefined(eventBuses[eventBus.getConfig().id])&&delete eventBuses[eventBus.getConfig().id],that},this.removeAll=function(){return eventBuses={},that},this.get=function(eventBusId){return angular.isDefined(eventBuses[eventBusId])?eventBuses[eventBusId]:null},this.getAll=function(){return eventBuses},this.enableDebug=function(){debug=!0},this.disableDebug=function(){debug=!1},this.inDebugMode=function(){return!0===debug},this.$get=function(){return{add:this.add,remove:this.remove,removeAll:this.removeAll,get:this.get,getAll:this.getAll,enableDebug:this.enableDebug,disableDebug:this.disableDebug,inDebugMode:this.inDebugMode}}}),angular.module("keta.services.EventBus",[]).provider("ketaEventBus",function(){var KetaEventBus=function(givenConfig){var DEFAULT_CONFIG={id:"kiwibus",url:"https://localhost:10443/kiwibus",reconnect:!0,reconnectTimeout:5,requestTimeout:10,offlineMode:!1};this.getDefaultConfig=function(){return DEFAULT_CONFIG};var config=angular.extend({},DEFAULT_CONFIG,givenConfig);this.getConfig=function(){return config};var eb=null;this.getInstance=function(){return!1!==config.url?eb:null},this.inOfflineMode=function(){return config.offlineMode};var init=function(){!1!==config.url&&((eb="undefined"!=typeof vertx&&vertx.EventBus?new vertx.EventBus(config.url):new EventBus(config.url)).onclose=function(){config.reconnect&&window.setTimeout(function(){init()},1e3*config.reconnectTimeout)})};init()};this.create=function(config){return new KetaEventBus(config)},this.$get=function(){}}),angular.module("keta.services.Logger",["keta.services.AppContext"]).config(function($provide,ketaAppContextProvider){$provide.decorator("$log",function($delegate){$delegate.LOG_LEVEL_LOG=1,$delegate.LOG_LEVEL_DEBUG=2,$delegate.LOG_LEVEL_INFO=4,$delegate.LOG_LEVEL_WARN=8,$delegate.LOG_LEVEL_ERROR=16;var decorateLogger=function(originalFn,bitValue){return function(){var args=Array.prototype.slice.call(arguments);null!==ketaAppContextProvider.get("common.logLevel")&&0!==ketaAppContextProvider.get("common.logLevel")&&(ketaAppContextProvider.get("common.logLevel")&bitValue)!==bitValue||originalFn.apply(null,args)}};return angular.forEach(["log","debug","info","warn","error"],function(o){var bitValue=$delegate["LOG_LEVEL_"+o.toUpperCase()];$delegate[o]=decorateLogger($delegate[o],bitValue),$delegate[o].logs=[]}),$delegate.ADVANCED_FORMATTER=function(messages){angular.isArray(messages)||(messages=[messages]);var output="%c["+(new Date).toISOString()+"]\n%c";angular.forEach(messages,function(message){output+=JSON.stringify(message,null,"\t")+"\n"}),$delegate.log(output,"color:#acbf2f;font-weight:bold;","color:#333;font-weight:normal;")},$delegate.request=function(messages,formatter){angular.isDefined(formatter)&&angular.isFunction(formatter)?formatter(messages):$delegate.log(messages)},$delegate.event=function(messages,formatter){$delegate.request(messages,formatter)},$delegate})}),angular.module("keta.services.TagSet",["keta.services.Tag"]).provider("ketaTagSet",function(){this.$get=function(){var TagSetInstance=function(){var that=this,tags=[],tagsAsHierarchy={};that.getTags=function(){return tags},that.getTagsAsHierarchy=function(){return tagsAsHierarchy},that.add=function(tag){return angular.isDefined(tagsAsHierarchy[tag.getGuid()])&&angular.isDefined(tagsAsHierarchy[tag.getGuid()][tag.getName()])||(angular.isDefined(tagsAsHierarchy[tag.getGuid()])||(tagsAsHierarchy[tag.getGuid()]={}),tagsAsHierarchy[tag.getGuid()][tag.getName()]=tag,tags.push(tag)),that},that.remove=function(tag){return angular.isDefined(tagsAsHierarchy[tag.getGuid()][tag.getName()])&&(delete tagsAsHierarchy[tag.getGuid()][tag.getName()],0===Object.keys(tagsAsHierarchy[tag.getGuid()]).length&&delete tagsAsHierarchy[tag.getGuid()],tags.splice(tags.indexOf(tag),1)),that}};return{create:function(){return new TagSetInstance}}}}),angular.module("keta.services.Tag",[]).constant("ketaTagConstants",{UNIT:{WATTS:"W",WATTHOURS:"Wh",PERCENT:"%",EURO:"€",DOLLAR:"$",POUND:"£",KILOMETER:"km"}}).provider("ketaTag",function(){this.$get=function(){var TagInstance=function(properties){var guid=angular.isDefined(properties.guid)?properties.guid:null;this.getGuid=function(){return guid};var name=angular.isDefined(properties.name)?properties.name:null;this.getName=function(){return name};var sampleRate=angular.isDefined(properties.sampleRate)&&properties.sampleRate>=5?properties.sampleRate:null;this.getSampleRate=function(){return sampleRate}};return{create:function(properties){return new TagInstance(properties)}}}}),angular.module("keta.services.UserSet",["keta.services.User"]).provider("ketaUserSet",function(){this.$get=function($q,$rootScope,$log,ketaUser,ketaEventBusDispatcher,ketaEventBusManager){var UserSetInstance=function(givenEventBus){var that=this,eventBus=givenEventBus,params={};that.filter=function(filter){return params.filter=filter,that},that.project=function(projection){return params.projection=projection,that},that.sort=function(sorting){return params.sorting=sorting,that},that.paginate=function(pagination){return angular.isDefined(pagination)?(params.offset=angular.isDefined(pagination.offset)?pagination.offset:0,params.limit=angular.isDefined(pagination.limit)?pagination.limit:50):(params.offset=0,params.limit=50),that},that.query=function(){var deferred=$q.defer();return ketaEventBusDispatcher.send(eventBus,"userservice",{action:"getUsers",params:params},function(reply){reply?(reply.params=params,reply.code===ketaEventBusDispatcher.RESPONSE_CODE_OK?(angular.isDefined(reply.result)&&angular.isDefined(reply.result.items)&&angular.forEach(reply.result.items,function(item,index){reply.result.items[index]=ketaUser.create(eventBus,item)}),ketaEventBusManager.inDebugMode()&&$log.request(["userservice",{action:"getUsers",params:params},reply],$log.ADVANCED_FORMATTER),deferred.resolve(reply),$rootScope.$digest()):deferred.reject(reply)):deferred.reject("Something bad happened. Got no reply.")}),deferred.promise}};return{create:function(eventBus){return new UserSetInstance(eventBus)},indexOf:function(set,user){var index=-1;return angular.isDefined(set.result)&&angular.isDefined(set.result.items)&&angular.forEach(set.result.items,function(item,key){item.userId===user.userId&&(index=key)}),index},length:function(set){return angular.isDefined(set.result)&&angular.isDefined(set.result.items)&&angular.isArray(set.result.items)?set.result.items.length:0},get:function(set,index){return angular.isDefined(set.result)&&angular.isDefined(set.result.items)&&angular.isDefined(set.result.items[index])?set.result.items[index]:null},getAll:function(set){return angular.isDefined(set.result)&&angular.isDefined(set.result.items)?set.result.items:[]}}}}),angular.module("keta.services.User",["keta.services.EventBusDispatcher","keta.services.EventBusManager","keta.services.Logger"]).provider("ketaUser",function(){this.$get=function($q,$log,ketaEventBusDispatcher,ketaEventBusManager){var sendMessage=function(eventBus,message){var deferred=$q.defer();return ketaEventBusDispatcher.send(eventBus,"userservice",message,function(reply){ketaEventBusManager.inDebugMode()&&$log.request(["userservice",message,reply],$log.ADVANCED_FORMATTER),angular.isUndefined(reply.code)||reply.code>=ketaEventBusDispatcher.RESPONSE_CODE_BAD_REQUEST?deferred.reject(reply):deferred.resolve(reply)}),deferred.promise},returnRejectedPromise=function(message){var deferred=$q.defer();return deferred.reject(message),deferred.promise},UserInstance=function(givenEventBus,properties){var that=this,eventBus=givenEventBus;angular.forEach(properties,function(value,key){that[key]=value,angular.isDefined(that.$pristine)||(that.$pristine={}),that.$pristine[key]=angular.copy(value)}),that.$create=function(){var cleanedUser={};for(var el in that)that.hasOwnProperty(el)&&!angular.isFunction(that[el])&&"$pristine"!==el&&(cleanedUser[el]=angular.copy(that[el]));return sendMessage(eventBus,{action:"createUser",params:{userId:cleanedUser.userId},body:cleanedUser})},that.$update=function(){var cleanedUser=angular.copy(that),cleanedUserOriginal=angular.copy(that.$pristine);delete cleanedUser.$pristine,delete cleanedUser.$create,delete cleanedUser.$update,delete cleanedUser.$delete,delete cleanedUser.$reset;var changes={};if(angular.forEach(cleanedUser,function(value,key){"properties"===key?!angular.isDefined(cleanedUserOriginal.properties)||null===cleanedUserOriginal.properties||angular.equals(cleanedUserOriginal.properties,{})?changes.properties=value:angular.forEach(value,function(propValue,propKey){angular.isDefined(cleanedUserOriginal.properties[propKey])&&angular.equals(cleanedUser.properties[propKey],cleanedUserOriginal.properties[propKey])||(angular.isDefined(changes.properties)||(changes.properties={}),changes.properties[propKey]=propValue)}):angular.equals(cleanedUser[key],cleanedUserOriginal[key])||(changes[key]=value)}),Object.keys(changes).length){var deferred=$q.defer();return sendMessage(eventBus,{action:"mergeUser",params:{userId:that.userId},body:changes}).then(function(reply){that.$pristine={},angular.forEach(that,function(value,key){angular.isFunction(that[key])||(that.$pristine[key]=angular.copy(that[key]))}),deferred.resolve(reply)},function(reply){deferred.reject(reply)}),deferred.promise}return returnRejectedPromise("No changes found")},that.$delete=function(){return sendMessage(eventBus,{action:"deleteUser",params:{userId:that.userId}})},that.$reset=function(){angular.forEach(that,function(value,key){angular.isFunction(value)||"$pristine"===key||delete that[key]}),angular.forEach(that.$pristine,function(value,key){that[key]=angular.copy(value)})}};return{create:function(eventBus,properties){return new UserInstance(eventBus,properties)},getChannel:function(eventBus,channelId){var deferred=$q.defer();return sendMessage(eventBus,{action:"getChannel",params:{channelId:channelId}}).then(function(reply){deferred.resolve(reply)},function(reply){deferred.reject(reply)}),deferred.promise},getCurrent:function(eventBus){var deferred=$q.defer();return sendMessage(eventBus,{action:"getCurrentUser"}).then(function(reply){deferred.resolve(new UserInstance(eventBus,reply.result))},function(reply){deferred.reject(reply)}),deferred.promise}}}}),angular.module("keta.utils.Api",[]).constant("ketaApiUtilsConstants",{OPERATORS:{OR:"$or",AND:"$and",LIKE:"$like"},REGEX:{QUERY_DIVIDER:new RegExp('(".*?"|[^" ]+)+(?= *| *$)',"g"),KEY_DIVIDER:new RegExp('(".*?"|[^":]+)+(?= *| *$)',"g"),QUOTES:new RegExp('"',"g")},CHARS:{QUERY_DIVIDER:":",LIKE_EXTENDER:"*"},NUMBERS:{MAX_COMPONENTS_LENGTH:2}}).factory("ketaApiUtils",function(ketaApiUtilsConstants){var factory={},isBlankObject=function(obj){var propertyCount=0;return angular.forEach(obj,function(){propertyCount++}),0===propertyCount},cleanUpQuery=function(query){return query.replace(ketaApiUtilsConstants.CHARS.QUERY_DIVIDER+ketaApiUtilsConstants.CHARS.QUERY_DIVIDER,ketaApiUtilsConstants.CHARS.QUERY_DIVIDER+'"'+ketaApiUtilsConstants.CHARS.QUERY_DIVIDER)+'"'},getQueryComponents=function(query){var components=(query=cleanUpQuery(query)).match(ketaApiUtilsConstants.REGEX.KEY_DIVIDER),key=components[0].replace(ketaApiUtilsConstants.REGEX.QUOTES,""),value=angular.isDefined(components[1])?components[1].replace(ketaApiUtilsConstants.REGEX.QUOTES,""):null;if(components.length>ketaApiUtilsConstants.NUMBERS.MAX_COMPONENTS_LENGTH){var extendedValues=components.slice(ketaApiUtilsConstants.NUMBERS.MAX_COMPONENTS_LENGTH,components.length);angular.forEach(extendedValues,function(extendedValue){value+=ketaApiUtilsConstants.CHARS.QUERY_DIVIDER+extendedValue.replace(ketaApiUtilsConstants.REGEX.QUOTES,"")})}return{key:key,value:value}},getLikeSearchParam=function(searchString){var likeSearchParam=[];return likeSearchParam[ketaApiUtilsConstants.OPERATORS.LIKE]=ketaApiUtilsConstants.CHARS.LIKE_EXTENDER+searchString+ketaApiUtilsConstants.CHARS.LIKE_EXTENDER,angular.extend({},likeSearchParam)},getCriteriaParams=function(filterString,criteriaMapping){var filters=[];return angular.forEach(criteriaMapping,function(criterion,key){angular.forEach(criteriaMapping,function(comparisonCriterion,comparisonKey){criterion===comparisonCriterion&&key!==comparisonKey&&delete criteriaMapping[comparisonKey]});var container=[];container[criterion]=getLikeSearchParam(filterString),container=angular.extend({},container),filters.push(container)}),filters},mergeParams=function(acrossParams,transformedParams){var params={};return isBlankObject(acrossParams)||isBlankObject(transformedParams)?isBlankObject(acrossParams)?isBlankObject(transformedParams)||(params=angular.extend({},transformedParams)):params=angular.extend({},acrossParams):params[ketaApiUtilsConstants.OPERATORS.AND]=[angular.extend({},acrossParams),angular.extend({},transformedParams)],params};return factory.getFilterParams=function(filterString,criteriaMapping){var params={};if(angular.isString(filterString)&&angular.isObject(criteriaMapping)&&null!==filterString){var transformedFilter=[],transformedParams={},acrossParams={},queries=filterString.match(ketaApiUtilsConstants.REGEX.QUERY_DIVIDER);angular.forEach(queries,function(query){var FilterContainer=[],queryComponents=getQueryComponents(query);null!==queryComponents.value?(angular.isDefined(criteriaMapping[queryComponents.key])&&(queryComponents.key=criteriaMapping[queryComponents.key]),FilterContainer[queryComponents.key]=getLikeSearchParam(queryComponents.value),FilterContainer=angular.extend({},FilterContainer),transformedFilter.push(FilterContainer)):isBlankObject(acrossParams)?acrossParams[ketaApiUtilsConstants.OPERATORS.OR]=getCriteriaParams(queryComponents.key,criteriaMapping):acrossParams[ketaApiUtilsConstants.OPERATORS.OR]=acrossParams[ketaApiUtilsConstants.OPERATORS.OR].concat(getCriteriaParams(queryComponents.key,criteriaMapping))}),transformedFilter.length>1?transformedParams[ketaApiUtilsConstants.OPERATORS.AND]=transformedFilter:transformedParams=angular.extend({},transformedFilter[0]),params=mergeParams(acrossParams,transformedParams)}return params},factory}),angular.module("keta.utils.Application",["keta.services.ApplicationSet","keta.utils.Common"]).constant("ketaApplicationUtilsConstants",{ASSET_MEDIA_TYPE:{APPICON:"APPICON",FAVICON:"FAVICON",SCREENSHOT:"SCREENSHOT",TOUCHICON:"TOUCHICON",VIDEO:"VIDEO"},AUTHOR_TYPE:{DEVELOPER:"DEVELOPER",SELLER:"SELLER"}}).factory("ketaApplicationUtils",function($q,ketaApplicationSet,ketaEventBusManager,ketaCommonUtils,ketaApplicationUtilsConstants){var deferred={getAppList:null};return{getAppList:function(options){var DEFAULT_OPTIONS={eventBusId:"kiwibus",forceRefresh:!1,filter:{},excludeAppIds:{}},usedOptions=angular.extend({},DEFAULT_OPTIONS,options||{});return null!==deferred.getAppList&&!0!==usedOptions.forceRefresh||(deferred.getAppList=$q.defer(),ketaApplicationSet.create(ketaEventBusManager.get(usedOptions.eventBusId)).filter(usedOptions.filter).query().then(function(reply){if(angular.isDefined(reply.result)&&angular.isDefined(reply.result.items)){var filteredApps=[];angular.forEach(reply.result.items,function(app){(angular.isDefined(app.appId)&&angular.isDefined(app.visible)&&!0===app.visible&&!angular.isDefined(usedOptions.excludeAppIds[app.appId])||!1===usedOptions.excludeAppIds[app.appId]&&angular.isString(app.entryUri)&&""!==app.entryUri&&ketaCommonUtils.doesPropertyExist(app,"meta.i18n.en.name"))&&filteredApps.push(app)}),deferred.getAppList.resolve(filteredApps)}else deferred.getAppList.reject("Something bad happened. Got no reply.")},function(){deferred.getAppList.reject("Could not load application information.")})),deferred.getAppList.promise},getAppName:function(app,uiLocale){return ketaCommonUtils.doesPropertyExist(app,"meta.i18n")?ketaCommonUtils.getLabelByLocale("name",app.meta.i18n,uiLocale):null},getAppIcon:function(app,language){var appIcon=null,mediaSource=ketaCommonUtils.doesPropertyExist(app,"meta.i18n")&&angular.isDefined(app.meta.i18n[language])&&angular.isDefined(app.meta.i18n[language].media)?app.meta.i18n[language].media:null;if(null===mediaSource){var languageShort=angular.isDefined(language)?language.substr(0,2):"en";mediaSource=ketaCommonUtils.doesPropertyExist(app,"meta.i18n")&&angular.isDefined(app.meta.i18n[languageShort])&&angular.isDefined(app.meta.i18n[languageShort].media)?app.meta.i18n[languageShort].media:null}if(null===mediaSource&&ketaCommonUtils.doesPropertyExist(app,"meta.i18n.en.media")&&(mediaSource=app.meta.i18n.en.media),angular.isDefined(app.entryUri)){var link=document.createElement("a");link.href=app.entryUri;var params=app.entryUri.split("?")[1];params=params?"?"+params:"";var linkProtocol=link.protocol+(":"===link.protocol[link.protocol.length-1]?"//":"://"),linkPort=""!==link.port&&"0"!==link.port?":"+link.port:"",linkOrigin=angular.isDefined(link.origin)?link.origin:linkProtocol+link.hostname+linkPort;angular.forEach(mediaSource,function(media){angular.isDefined(media.type)&&media.type===ketaApplicationUtilsConstants.ASSET_MEDIA_TYPE.APPICON&&angular.isDefined(media.src)&&(appIcon="/"!==linkOrigin[linkOrigin.length-1]&&"/"!==media.src[0]?linkOrigin+"/"+media.src:linkOrigin+media.src,appIcon+=params)})}return appIcon},getAppAuthor:function(app,type){var appAuthor=null;return type=angular.isDefined(type)?type:ketaApplicationUtilsConstants.AUTHOR_TYPE.SELLER,ketaCommonUtils.doesPropertyExist(app,"meta.authors")&&(angular.forEach(app.meta.authors,function(author){author.type===type&&(appAuthor=author.name)}),null===appAuthor&&(appAuthor=app.meta.authors[0].name)),appAuthor}}}),angular.module("keta.utils.Common",[]).factory("ketaCommonUtils",function(){var factory={};return factory.doesPropertyExist=function(obj,prop){for(var parts=prop.split("."),i=0,l=parts.length;i<l;i++){var part=parts[i];if(!(angular.isObject(obj)&&part in obj))return!1;obj=obj[part]}return!0},factory.getLabelByLocale=function(key,labels,currentLocale){var label=null,shortLocale=angular.isString(currentLocale)&¤tLocale.length>=2?currentLocale.substr(0,2):"";return angular.isObject(labels[currentLocale])&&angular.isDefined(labels[currentLocale][key])?label=labels[currentLocale][key]:angular.isObject(labels[shortLocale])&&angular.isDefined(labels[shortLocale][key])?label=labels[shortLocale][key]:angular.isObject(labels.en)&&angular.isDefined(labels.en[key])&&(label=labels.en[key]),label},factory.addUrlParameter=function(uri,param,value){if(!angular.isString(uri))return uri;var val=new RegExp("(\\?|\\&)"+param+"=.*?(?=(&|$))"),parts=uri.toString().split("#"),url=parts[0],hash=parts[1]||!1,queryString=/\?.+$/,newURL=url;return newURL=val.test(url)?url.replace(val,"$1"+param+"="+value):url+(queryString.test(url)?"&":"?")+param+"="+value,hash&&(newURL+="#"+hash),newURL},factory}),angular.module("keta.utils.Country",[]).constant("ketaCountryUtilsMessageKeys",{de_DE:{AF:"Afghanistan",EG:"Ägypten",AX:"Åland-Inseln",AL:"Albanien",DZ:"Algerien",UM:"Amerikanisch-Ozeanien",AS:"Amerikanisch-Samoa",VI:"Amerikanische Jungferninseln",AD:"Andorra",AO:"Angola",AI:"Anguilla",AQ:"Antarktis",AG:"Antigua und Barbuda",GQ:"Äquatorialguinea",AR:"Argentinien",AM:"Armenien",AW:"Aruba",AC:"Ascension",AZ:"Aserbaidschan",ET:"Äthiopien",AU:"Australien",BS:"Bahamas",BH:"Bahrain",BD:"Bangladesch",BB:"Barbados",BY:"Belarus",BE:"Belgien",BZ:"Belize",BJ:"Benin",BM:"Bermuda",BT:"Bhutan",BO:"Bolivien",BA:"Bosnien und Herzegowina",BW:"Botsuana",BR:"Brasilien",VG:"Britische Jungferninseln",IO:"Britisches Territorium im Indischen Ozean",BN:"Brunei Darussalam",BG:"Bulgarien",BF:"Burkina Faso",BI:"Burundi",EA:"Ceuta und Melilla",CL:"Chile",CN:"China",CK:"Cookinseln",CR:"Costa Rica",CI:"Côte d’Ivoire",CW:"Curaçao",DK:"Dänemark",KP:"Demokratische Volksrepublik Korea",DE:"Deutschland",DG:"Diego Garcia",DM:"Dominica",DO:"Dominikanische Republik",DJ:"Dschibuti",EC:"Ecuador",SV:"El Salvador",ER:"Eritrea",EE:"Estland",FK:"Falklandinseln",FO:"Färöer",FJ:"Fidschi",FI:"Finnland",FR:"Frankreich",GF:"Französisch-Guayana",PF:"Französisch-Polynesien",TF:"Französische Süd- und Antarktisgebiete",GA:"Gabun",GM:"Gambia",GE:"Georgien",GH:"Ghana",GI:"Gibraltar",GD:"Grenada",GR:"Griechenland",GL:"Grönland",GP:"Guadeloupe",GU:"Guam",GT:"Guatemala",GG:"Guernsey",GN:"Guinea",GW:"Guinea-Bissau",GY:"Guyana",HT:"Haiti",HN:"Honduras",IN:"Indien",ID:"Indonesien",IQ:"Irak",IR:"Iran",IE:"Irland",IS:"Island",IM:"Isle of Man",IL:"Israel",IT:"Italien",JM:"Jamaika",JP:"Japan",YE:"Jemen",JE:"Jersey",JO:"Jordanien",KY:"Kaimaninseln",KH:"Kambodscha",CM:"Kamerun",CA:"Kanada",IC:"Kanarische Inseln",CV:"Kap Verde",BQ:"Karibische Niederlande",KZ:"Kasachstan",QA:"Katar",KE:"Kenia",KG:"Kirgisistan",KI:"Kiribati",CC:"Kokosinseln",CO:"Kolumbien",KM:"Komoren",CG:"Kongo-Brazzaville",CD:"Kongo-Kinshasa",XK:"Kosovo",HR:"Kroatien",CU:"Kuba",KW:"Kuwait",LA:"Laos",LS:"Lesotho",LV:"Lettland",LB:"Libanon",LR:"Liberia",LY:"Libyen",LI:"Liechtenstein",LT:"Litauen",LU:"Luxemburg",MG:"Madagaskar",MW:"Malawi",MY:"Malaysia",MV:"Malediven",ML:"Mali",MT:"Malta",MA:"Marokko",MH:"Marshallinseln",MQ:"Martinique",MR:"Mauretanien",MU:"Mauritius",YT:"Mayotte",MK:"Mazedonien",MX:"Mexiko",FM:"Mikronesien",MC:"Monaco",MN:"Mongolei",ME:"Montenegro",MS:"Montserrat",MZ:"Mosambik",MM:"Myanmar",NA:"Namibia",NR:"Nauru",NP:"Nepal",NC:"Neukaledonien",NZ:"Neuseeland",NI:"Nicaragua",NL:"Niederlande",NE:"Niger",NG:"Nigeria",NU:"Niue",MP:"Nördliche Marianen",NF:"Norfolkinsel",NO:"Norwegen",OM:"Oman",AT:"Österreich",PK:"Pakistan",PS:"Palästinensische Autonomiegebiete",PW:"Palau",PA:"Panama",PG:"Papua-Neuguinea",PY:"Paraguay",PE:"Peru",PH:"Philippinen",PN:"Pitcairninseln",PL:"Polen",PT:"Portugal",PR:"Puerto Rico",KR:"Republik Korea",MD:"Republik Moldau",RE:"Réunion",RW:"Ruanda",RO:"Rumänien",RU:"Russische Föderation",SB:"Salomonen",ZM:"Sambia",WS:"Samoa",SM:"San Marino",ST:"São Tomé und Príncipe",SA:"Saudi-Arabien",SE:"Schweden",CH:"Schweiz",SN:"Senegal",RS:"Serbien",SC:"Seychellen",SL:"Sierra Leone",ZW:"Simbabwe",SG:"Singapur",SX:"Sint Maarten",SK:"Slowakei",SI:"Slowenien",SO:"Somalia",MO:"Sonderverwaltungsregion Macau",HK:"Sonderverwaltungszone Hongkong",ES:"Spanien",LK:"Sri Lanka",BL:"St. Barthélemy",SH:"St. Helena",KN:"St. Kitts und Nevis",LC:"St. Lucia",MF:"St. Martin",PM:"St. Pierre und Miquelon",VC:"St. Vincent und die Grenadinen",ZA:"Südafrika",SD:"Sudan",GS:"Südgeorgien und die Südlichen Sandwichinseln",SS:"Südsudan",SR:"Suriname",SJ:"Svalbard und Jan Mayen",SZ:"Swasiland",SY:"Syrien",TJ:"Tadschikistan",TW:"Taiwan",TZ:"Tansania",TH:"Thailand",TL:"Timor-Leste",TG:"Togo",TK:"Tokelau",TO:"Tonga",TT:"Trinidad und Tobago",TA:"Tristan da Cunha",TD:"Tschad",CZ:"Tschechische Republik",TN:"Tunesien",TR:"Türkei",TM:"Turkmenistan",TC:"Turks- und Caicosinseln",TV:"Tuvalu",UG:"Uganda",UA:"Ukraine",HU:"Ungarn",UY:"Uruguay",UZ:"Usbekistan",VU:"Vanuatu",VA:"Vatikanstadt",VE:"Venezuela",AE:"Vereinigte Arabische Emirate",US:"Vereinigte Staaten",GB:"Vereinigtes Königreich",VN:"Vietnam",WF:"Wallis und Futuna",CX:"Weihnachtsinsel",EH:"Westsahara",CF:"Zentralafrikanische Republik",CY:"Zypern"},en_GB:{AF:"Afghanistan",AX:"Åland Islands",AL:"Albania",DZ:"Algeria",AS:"American Samoa",AD:"Andorra",AO:"Angola",AI:"Anguilla",AQ:"Antarctica",AG:"Antigua and Barbuda",AR:"Argentina",AM:"Armenia",AW:"Aruba",AC:"Ascension Island",AU:"Australia",AT:"Austria",AZ:"Azerbaijan",BS:"Bahamas",BH:"Bahrain",BD:"Bangladesh",BB:"Barbados",BY:"Belarus",BE:"Belgium",BZ:"Belize",BJ:"Benin",BM:"Bermuda",BT:"Bhutan",BO:"Bolivia",BA:"Bosnia and Herzegovina",BW:"Botswana",BR:"Brazil",IO:"British Indian Ocean Territory",VG:"British Virgin Islands",BN:"Brunei",BG:"Bulgaria",BF:"Burkina Faso",BI:"Burundi",KH:"Cambodia",CM:"Cameroon",CA:"Canada",IC:"Canary Islands",CV:"Cape Verde",BQ:"Caribbean Netherlands",KY:"Cayman Islands",CF:"Central African Republic",EA:"Ceuta and Melilla",TD:"Chad",CL:"Chile",CN:"China",CX:"Christmas Island",CC:"Cocos (Keeling) Islands",CO:"Colombia",KM:"Comoros",CG:"Congo - Brazzaville",CD:"Congo - Kinshasa",CK:"Cook Islands",CR:"Costa Rica",CI:"Côte d’Ivoire",HR:"Croatia",CU:"Cuba",CW:"Curaçao",CY:"Cyprus",CZ:"Czech Republic",DK:"Denmark",DG:"Diego Garcia",DJ:"Djibouti",DM:"Dominica",DO:"Dominican Republic",EC:"Ecuador",EG:"Egypt",SV:"El Salvador",GQ:"Equatorial Guinea",ER:"Eritrea",EE:"Estonia",ET:"Ethiopia",FK:"Falkland Islands",FO:"Faroe Islands",FJ:"Fiji",FI:"Finland",FR:"France",GF:"French Guiana",PF:"French Polynesia",TF:"French Southern Territories",GA:"Gabon",GM:"Gambia",GE:"Georgia",DE:"Germany",GH:"Ghana",GI:"Gibraltar",GR:"Greece",GL:"Greenland",GD:"Grenada",GP:"Guadeloupe",GU:"Guam",GT:"Guatemala",GG:"Guernsey",GN:"Guinea",GW:"Guinea-Bissau",GY:"Guyana",HT:"Haiti",HN:"Honduras",HK:"Hong Kong SAR China",HU:"Hungary",IS:"Iceland",IN:"India",ID:"Indonesia",IR:"Iran",IQ:"Iraq",IE:"Ireland",IM:"Isle of Man",IL:"Israel",IT:"Italy",JM:"Jamaica",JP:"Japan",JE:"Jersey",JO:"Jordan",KZ:"Kazakhstan",KE:"Kenya",KI:"Kiribati",XK:"Kosovo",KW:"Kuwait",KG:"Kyrgyzstan",LA:"Laos",LV:"Latvia",LB:"Lebanon",LS:"Lesotho",LR:"Liberia",LY:"Libya",LI:"Liechtenstein",LT:"Lithuania",LU:"Luxembourg",MO:"Macau SAR China",MK:"Macedonia",MG:"Madagascar",MW:"Malawi",MY:"Malaysia",MV:"Maldives",ML:"Mali",MT:"Malta",MH:"Marshall Islands",MQ:"Martinique",MR:"Mauritania",MU:"Mauritius",YT:"Mayotte",MX:"Mexico",FM:"Micronesia",MD:"Moldova",MC:"Monaco",MN:"Mongolia",ME:"Montenegro",MS:"Montserrat",MA:"Morocco",MZ:"Mozambique",MM:"Myanmar (Burma)",NA:"Namibia",NR:"Nauru",NP:"Nepal",NL:"Netherlands",NC:"New Caledonia",NZ:"New Zealand",NI:"Nicaragua",NE:"Niger",NG:"Nigeria",NU:"Niue",NF:"Norfolk Island",KP:"North Korea",MP:"Northern Mariana Islands",NO:"Norway",OM:"Oman",PK:"Pakistan",PW:"Palau",PS:"Palestinian Territories",PA:"Panama",PG:"Papua New Guinea",PY:"Paraguay",PE:"Peru",PH:"Philippines",PN:"Pitcairn Islands",PL:"Poland",PT:"Portugal",PR:"Puerto Rico",QA:"Qatar",RE:"Réunion",RO:"Romania",RU:"Russia",RW:"Rwanda",BL:"Saint Barthélemy",SH:"Saint Helena",KN:"Saint Kitts and Nevis",LC:"Saint Lucia",MF:"Saint Martin",PM:"Saint Pierre and Miquelon",WS:"Samoa",SM:"San Marino",ST:"São Tomé and Príncipe",SA:"Saudi Arabia",SN:"Senegal",RS:"Serbia",SC:"Seychelles",SL:"Sierra Leone",SG:"Singapore",SX:"Sint Maarten",SK:"Slovakia",SI:"Slovenia",SB:"Solomon Islands",SO:"Somalia",ZA:"South Africa",GS:"South Georgia & South Sandwich Islands",KR:"South Korea",SS:"South Sudan",ES:"Spain",LK:"Sri Lanka",VC:"St. Vincent & Grenadines",SD:"Sudan",SR:"Suriname",SJ:"Svalbard and Jan Mayen",SZ:"Swaziland",SE:"Sweden",CH:"Switzerland",SY:"Syria",TW:"Taiwan",TJ:"Tajikistan",TZ:"Tanzania",TH:"Thailand",TL:"Timor-Leste",TG:"Togo",TK:"Tokelau",TO:"Tonga",TT:"Trinidad and Tobago",TA:"Tristan da Cunha",TN:"Tunisia",TR:"Turkey",TM:"Turkmenistan",TC:"Turks and Caicos Islands",TV:"Tuvalu",UM:"U.S. Outlying Islands",VI:"U.S. Virgin Islands",UG:"Uganda",UA:"Ukraine",AE:"United Arab Emirates",GB:"United Kingdom",US:"United States",UY:"Uruguay",UZ:"Uzbekistan",VU:"Vanuatu",VA:"Vatican City",VE:"Venezuela",VN:"Vietnam",WF:"Wallis and Futuna",EH:"Western Sahara",YE:"Yemen",ZM:"Zambia",ZW:"Zimbabwe"},es_ES:{AF:"Afganistán",AL:"Albania",DE:"Alemania",AD:"Andorra",AO:"Angola",AI:"Anguila",AQ:"Antártida",AG:"Antigua y Barbuda",SA:"Arabia Saudí",DZ:"Argelia",AR:"Argentina",AM:"Armenia",AW:"Aruba",AU:"Australia",AT:"Austria",AZ:"Azerbaiyán",BS:"Bahamas",BD:"Bangladés",BB:"Barbados",BH:"Baréin",BE:"Bélgica",BZ:"Belice",BJ:"Benín",BM:"Bermudas",BY:"Bielorrusia",BO:"Bolivia",BA:"Bosnia-Herzegovina",BW:"Botsuana",BR:"Brasil",BN:"Brunéi",BG:"Bulgaria",BF:"Burkina Faso",BI:"Burundi",BT:"Bután",CV:"Cabo Verde",KH:"Camboya",CM:"Camerún",CA:"Canadá",BQ:"Caribe neerlandés",QA:"Catar",EA:"Ceuta y Melilla",TD:"Chad",CL:"Chile",CN:"China",CY:"Chipre",VA:"Ciudad del Vaticano",CO:"Colombia",KM:"Comoras",KP:"Corea del Norte",KR:"Corea del Sur",CI:"Costa de Marfil",CR:"Costa Rica",HR:"Croacia",CU:"Cuba",CW:"Curazao",DG:"Diego García",DK:"Dinamarca",DM:"Dominica",EC:"Ecuador",EG:"Egipto",SV:"El Salvador",AE:"Emiratos Árabes Unidos",ER:"Eritrea",SK:"Eslovaquia",SI:"Eslovenia",ES:"España",US:"Estados Unidos",EE:"Estonia",ET:"Etiopía",PH:"Filipinas",FI:"Finlandia",FJ:"Fiyi",FR:"Francia",GA:"Gabón",GM:"Gambia",GE:"Georgia",GH:"Ghana",GI:"Gibraltar",GD:"Granada",GR:"Grecia",GL:"Groenlandia",GP:"Guadalupe",GU:"Guam",GT:"Guatemala",GF:"Guayana Francesa",GG:"Guernesey",GN:"Guinea",GQ:"Guinea Ecuatorial",GW:"Guinea-Bisáu",GY:"Guyana",HT:"Haití",HN:"Honduras",HU:"Hungría",IN:"India",ID:"Indonesia",IR:"Irán",IQ:"Iraq",IE:"Irlanda",CX:"Isla Christmas",AC:"Isla de la Ascensión",IM:"Isla de Man",NU:"Isla Niue",NF:"Isla Norfolk",IS:"Islandia",AX:"Islas Åland",KY:"Islas Caimán",IC:"islas Canarias",CC:"Islas Cocos",CK:"Islas Cook",FO:"Islas Feroe",GS:"Islas Georgia del Sur y Sandwich del Sur",FK:"Islas Malvinas",MP:"Islas Marianas del Norte",MH:"Islas Marshall",UM:"Islas menores alejadas de EE. UU.",PN:"Islas Pitcairn",SB:"Islas Salomón",TC:"Islas Turcas y Caicos",VG:"Islas Vírgenes Británicas",VI:"Islas Vírgenes de EE. UU.",IL:"Israel",IT:"Italia",JM:"Jamaica",JP:"Japón",JE:"Jersey",JO:"Jordania",KZ:"Kazajistán",KE:"Kenia",KG:"Kirguistán",KI:"Kiribati",XK:"Kosovo",KW:"Kuwait",LA:"Laos",LS:"Lesoto",LV:"Letonia",LB:"Líbano",LR:"Liberia",LY:"Libia",LI:"Liechtenstein",LT:"Lituania",LU:"Luxemburgo",MK:"Macedonia",MG:"Madagascar",MY:"Malasia",MW:"Malaui",MV:"Maldivas",ML:"Mali",MT:"Malta",MA:"Marruecos",MQ:"Martinica",MU:"Mauricio",MR:"Mauritania",YT:"Mayotte",MX:"México",FM:"Micronesia",MD:"Moldavia",MC:"Mónaco",MN:"Mongolia",ME:"Montenegro",MS:"Montserrat",MZ:"Mozambique",MM:"Myanmar (Birmania)",NA:"Namibia",NR:"Nauru",NP:"Nepal",NI:"Nicaragua",NE:"Níger",NG:"Nigeria",NO:"Noruega",NC:"Nueva Caledonia",NZ:"Nueva Zelanda",OM:"Omán",NL:"Países Bajos",PK:"Pakistán",PW:"Palau",PA:"Panamá",PG:"Papúa Nueva Guinea",PY:"Paraguay",PE:"Perú",PF:"Polinesia Francesa",PL:"Polonia",PT:"Portugal",PR:"Puerto Rico",HK:"RAE de Hong Kong (China)",MO:"RAE de Macao (China)",GB:"Reino Unido",CF:"República Centroafricana",CZ:"República Checa",CG:"República del Congo",CD:"República Democrática del Congo",DO:"República Dominicana",RE:"Reunión",RW:"Ruanda",RO:"Rumanía",RU:"Rusia",EH:"Sáhara Occidental",WS:"Samoa",AS:"Samoa Americana",BL:"San Bartolomé",KN:"San Cristóbal y Nieves",SM:"San Marino",MF:"San Martín",PM:"San Pedro y Miquelón",VC:"San Vicente y las Granadinas",SH:"Santa Elena",LC:"Santa Lucía",ST:"Santo Tomé y Príncipe",SN:"Senegal",RS:"Serbia",SC:"Seychelles",SL:"Sierra Leona",SG:"Singapur",SX:"Sint Maarten",SY:"Siria",SO:"Somalia",LK:"Sri Lanka",SZ:"Suazilandia",ZA:"Sudáfrica",SD:"Sudán",SS:"Sudán del Sur",SE:"Suecia",CH:"Suiza",SR:"Surinam",SJ:"Svalbard y Jan Mayen",TH:"Tailandia",TW:"Taiwán",TZ:"Tanzania",TJ:"Tayikistán",IO:"Territorio Británico del Océano Índico",TF:"Territorios Australes Franceses",PS:"Territorios Palestinos",TL:"Timor Oriental",TG:"Togo",TK:"Tokelau",TO:"Tonga",TT:"Trinidad y Tobago",TA:"Tristán da Cunha",TN:"Túnez",TM:"Turkmenistán",TR:"Turquía",TV:"Tuvalu",UA:"Ucrania",UG:"Uganda",UY:"Uruguay",UZ:"Uzbekistán",VU:"Vanuatu",VE:"Venezuela",VN:"Vietnam",WF:"Wallis y Futuna",YE:"Yemen",DJ:"Yibuti",ZM:"Zambia",ZW:"Zimbabue"},fr_FR:{AF:"Afghanistan",ZA:"Afrique du Sud",AL:"Albanie",DZ:"Algérie",DE:"Allemagne",AD:"Andorre",AO:"Angola",AI:"Anguilla",AQ:"Antarctique",AG:"Antigua-et-Barbuda",SA:"Arabie saoudite",AR:"Argentine",AM:"Arménie",AW:"Aruba",AU:"Australie",AT:"Autriche",AZ:"Azerbaïdjan",BS:"Bahamas",BH:"Bahreïn",BD:"Bangladesh",BB:"Barbade",BE:"Belgique",BZ:"Belize",BJ:"Bénin",BM:"Bermudes",BT:"Bhoutan",BY:"Biélorussie",BO:"Bolivie",BA:"Bosnie-Herzégovine",BW:"Botswana",BR:"Brésil",BN:"Brunéi Darussalam",BG:"Bulgarie",BF:"Burkina Faso",BI:"Burundi",KH:"Cambodge",CM:"Cameroun",CA:"Canada",CV:"Cap-Vert",EA:"Ceuta et Melilla",CL:"Chili",CN:"Chine",CY:"Chypre",CO:"Colombie",KM:"Comores",CG:"Congo-Brazzaville",CD:"Congo-Kinshasa",KP:"Corée du Nord",KR:"Corée du Sud",CR:"Costa Rica",CI:"Côte d’Ivoire",HR:"Croatie",CU:"Cuba",CW:"Curaçao",DK:"Danemark",DG:"Diego Garcia",DJ:"Djibouti",DM:"Dominique",EG:"Égypte",SV:"El Salvador",AE:"Émirats arabes unis",EC:"Équateur",ER:"Érythrée",ES:"Espagne",EE:"Estonie",VA:"État de la Cité du Vatican",FM:"États fédérés de Micronésie",US:"États-Unis",ET:"Éthiopie",FJ:"Fidji",FI:"Finlande",FR:"France",GA:"Gabon",GM:"Gambie",GE:"Géorgie",GH:"Ghana",GI:"Gibraltar",GR:"Grèce",GD:"Grenade",GL:"Groenland",GP:"Guadeloupe",GU:"Guam",GT:"Guatemala",GG:"Guernesey",GN:"Guinée",GQ:"Guinée équatoriale",GW:"Guinée-Bissau",GY:"Guyana",GF:"Guyane française",HT:"Haïti",HN:"Honduras",HU:"Hongrie",CX:"Île Christmas",AC:"Île de l’Ascension",IM:"Île de Man",NF:"Île Norfolk",AX:"Îles Åland",KY:"Îles Caïmans",IC:"Îles Canaries",CC:"Îles Cocos",CK:"Îles Cook",FO:"Îles Féroé",GS:"Îles Géorgie du Sud et Sandwich du Sud",FK:"Îles Malouines",MP:"Îles Mariannes du Nord",MH:"Îles Marshall",UM:"Îles mineures éloignées des États-Unis",SB:"Îles Salomon",TC:"Îles Turques-et-Caïques",VG:"Îles Vierges britanniques",VI:"Îles Vierges des États-Unis",IN:"Inde",ID:"Indonésie",IQ:"Irak",IR:"Iran",IE:"Irlande",IS:"Islande",IL:"Israël",IT:"Italie",JM:"Jamaïque",JP:"Japon",JE:"Jersey",JO:"Jordanie",KZ:"Kazakhstan",KE:"Kenya",KG:"Kirghizistan",KI:"Kiribati",XK:"Kosovo",KW:"Koweït",RE:"La Réunion",LA:"Laos",LS:"Lesotho",LV:"Lettonie",LB:"Liban",LR:"Libéria",LY:"Libye",LI:"Liechtenstein",LT:"Lituanie",LU:"Luxembourg",MK:"Macédoine",MG:"Madagascar",MY:"Malaisie",MW:"Malawi",MV:"Maldives",ML:"Mali",MT:"Malte",MA:"Maroc",MQ:"Martinique",MU:"Maurice",MR:"Mauritanie",YT:"Mayotte",MX:"Mexique",MD:"Moldavie",MC:"Monaco",MN:"Mongolie",ME:"Monténégro",MS:"Montserrat",MZ:"Mozambique",MM:"Myanmar",NA:"Namibie",NR:"Nauru",NP:"Népal",NI:"Nicaragua",NE:"Niger",NG:"Nigéria",NU:"Niue",NO:"Norvège",NC:"Nouvelle-Calédonie",NZ:"Nouvelle-Zélande",OM:"Oman",UG:"Ouganda",UZ:"Ouzbékistan",PK:"Pakistan",PW:"Palaos",PA:"Panama",PG:"Papouasie-Nouvelle-Guinée",PY:"Paraguay",NL:"Pays-Bas",BQ:"Pays-Bas caribéens",PE:"Pérou",PH:"Philippines",PN:"Pitcairn",PL:"Pologne",PF:"Polynésie française",PR:"Porto Rico",PT:"Portugal",QA:"Qatar",HK:"R.A.S. chinoise de Hong Kong",MO:"R.A.S. chinoise de Macao",CF:"République centrafricaine",DO:"République dominicaine",CZ:"République tchèque",RO:"Roumanie",GB:"Royaume-Uni",RU:"Russie",RW:"Rwanda",EH:"Sahara occidental",BL:"Saint-Barthélemy",KN:"Saint-Christophe-et-Niévès",SM:"Saint-Marin",MF:"Saint-Martin (partie française)",SX:"Saint-Martin (partie néerlandaise)",PM:"Saint-Pierre-et-Miquelon",VC:"Saint-Vincent-et-les-Grenadines",SH:"Sainte-Hélène",LC:"Sainte-Lucie",WS:"Samoa",AS:"Samoa américaines",ST:"Sao Tomé-et-Principe",SN:"Sénégal",RS:"Serbie",SC:"Seychelles",SL:"Sierra Leone",SG:"Singapour",SK:"Slovaquie",SI:"Slovénie",SO:"Somalie",SD:"Soudan",SS:"Soudan du Sud",LK:"Sri Lanka",SE:"Suède",CH:"Suisse",SR:"Suriname",SJ:"Svalbard et Jan Mayen",SZ:"Swaziland",SY:"Syrie",TJ:"Tadjikistan",TW:"Taïwan",TZ:"Tanzanie",TD:"Tchad",TF:"Terres australes françaises",IO:"Territoire britannique de l’océan Indien",PS:"Territoires palestiniens",TH:"Thaïlande",TL:"Timor oriental",TG:"Togo",TK:"Tokelau",TO:"Tonga",TT:"Trinité-et-Tobago",TA:"Tristan da Cunha",TN:"Tunisie",TM:"Turkménistan",TR:"Turquie",TV:"Tuvalu",UA:"Ukraine",UY:"Uruguay",VU:"Vanuatu",VE:"Venezuela",VN:"Vietnam",WF:"Wallis-et-Futuna",YE:"Yémen",ZM:"Zambie",ZW:"Zimbabwe"},it_IT:{AF:"Afghanistan",AL:"Albania",DZ:"Algeria",AD:"Andorra",AO:"Angola",AI:"Anguilla",AQ:"Antartide",AG:"Antigua e Barbuda",SA:"Arabia Saudita",AR:"Argentina",AM:"Armenia",AW:"Aruba",AU:"Australia",AT:"Austria",AZ:"Azerbaigian",BS:"Bahamas",BH:"Bahrein",BD:"Bangladesh",BB:"Barbados",BE:"Belgio",BZ:"Belize",BJ:"Benin",BM:"Bermuda",BT:"Bhutan",BY:"Bielorussia",BO:"Bolivia",BA:"Bosnia-Erzegovina",BW:"Botswana",BR:"Brasile",BN:"Brunei",BG:"Bulgaria",BF:"Burkina Faso",BI:"Burundi",KH:"Cambogia",CM:"Camerun",CA:"Canada",CV:"Capo Verde",BQ:"Caraibi Olandesi",EA:"Ceuta e Melilla",TD:"Ciad",CL:"Cile",CN:"Cina",CY:"Cipro",VA:"Città del Vaticano",CO:"Colombia",KM:"Comore",CD:"Congo - Kinshasa",CG:"Congo-Brazzaville",KP:"Corea del Nord",KR:"Corea del Sud",CI:"Costa d’Avorio",CR:"Costa Rica",HR:"Croazia",CU:"Cuba",CW:"Curaçao",DK:"Danimarca",DG:"Diego Garcia",DM:"Dominica",EC:"Ecuador",EG:"Egitto",SV:"El Salvador",AE:"Emirati Arabi Uniti",ER:"Eritrea",EE:"Estonia",ET:"Etiopia",RU:"Federazione Russa",FJ:"Figi",PH:"Filippine",FI:"Finlandia",FR:"Francia",GA:"Gabon",GM:"Gambia",GE:"Georgia",GS:"Georgia del Sud e isole Sandwich meridionali",DE:"Germania",GH:"Ghana",JM:"Giamaica",JP:"Giappone",GI:"Gibilterra",DJ:"Gibuti",JO:"Giordania",GR:"Grecia",GD:"Grenada",GL:"Groenlandia",GP:"Guadalupa",GU:"Guam",GT:"Guatemala",GG:"Guernsey",GF:"Guiana Francese",GN:"Guinea",GQ:"Guinea Equatoriale",GW:"Guinea-Bissau",GY:"Guyana",HT:"Haiti",HN:"Honduras",IN:"India",ID:"Indonesia",IR:"Iran",IQ:"Iraq",IE:"Irlanda",IS:"Islanda",AC:"Isola di Ascensione",CX:"Isola di Christmas",IM:"Isola di Man",NF:"Isola Norfolk",AX:"Isole Aland",IC:"Isole Canarie",KY:"Isole Cayman",CC:"Isole Cocos",CK:"Isole Cook",FK:"Isole Falkland",FO:"Isole Faroe",MP:"Isole Marianne Settentrionali",MH:"Isole Marshall",UM:"Isole minori lontane dagli USA",PN:"Isole Pitcairn",SB:"Isole Solomon",TC:"Isole Turks e Caicos",VI:"Isole Vergini Americane",VG:"Isole Vergini Britanniche",IL:"Israele",IT:"Italia",JE:"Jersey",KZ:"Kazakistan",KE:"Kenya",KG:"Kirghizistan",KI:"Kiribati",XK:"Kosovo",KW:"Kuwait",LA:"Laos",LS:"Lesotho",LV:"Lettonia",LB:"Libano",LR:"Liberia",LY:"Libia",LI:"Liechtenstein",LT:"Lituania",LU:"Lussemburgo",MG:"Madagascar",MW:"Malawi",MV:"Maldive",MY:"Malesia",ML:"Mali",MT:"Malta",MA:"Marocco",MQ:"Martinica",MR:"Mauritania",MU:"Mauritius",YT:"Mayotte",MX:"Messico",FM:"Micronesia",MD:"Moldavia",MC:"Monaco",MN:"Mongolia",ME:"Montenegro",MS:"Montserrat",MZ:"Mozambico",MM:"Myanmar (Birmania)",NA:"Namibia",NR:"Nauru",NP:"Nepal",NI:"Nicaragua",NE:"Niger",NG:"Nigeria",NU:"Niue",NO:"Norvegia",NC:"Nuova Caledonia",NZ:"Nuova Zelanda",OM:"Oman",NL:"Paesi Bassi",PK:"Pakistan",PW:"Palau",PA:"Panamá",PG:"Papua Nuova Guinea",PY:"Paraguay",PE:"Perù",PF:"Polinesia Francese",PL:"Polonia",PT:"Portogallo",PR:"Portorico",QA:"Qatar",HK:"RAS di Hong Kong",MO:"RAS di Macao",GB:"Regno Unito",CZ:"Repubblica Ceca",CF:"Repubblica Centrafricana",MK:"Repubblica di Macedonia",DO:"Repubblica Dominicana",RE:"Réunion",RO:"Romania",RW:"Ruanda",EH:"Sahara Occidentale",KN:"Saint Kitts e Nevis",LC:"Saint Lucia",MF:"Saint Martin",PM:"Saint Pierre e Miquelon",VC:"Saint Vincent e Grenadines",BL:"Saint-Barthélemy",WS:"Samoa",AS:"Samoa Americane",SM:"San Marino",SH:"Sant’Elena",ST:"São Tomé e Príncipe",SN:"Senegal",RS:"Serbia",SC:"Seychelles",SL:"Sierra Leone",SG:"Singapore",SX:"Sint Maarten",SY:"Siria",SK:"Slovacchia",SI:"Slovenia",SO:"Somalia",ES:"Spagna",LK:"Sri Lanka",US:"Stati Uniti",ZA:"Sudafrica",SD:"Sudan",SS:"Sudan del Sud",SR:"Suriname",SJ:"Svalbard e Jan Mayen",SE:"Svezia",CH:"Svizzera",SZ:"Swaziland",TJ:"Tagikistan",TH:"Tailandia",TW:"Taiwan",TZ:"Tanzania",TF:"Territori australi francesi",PS:"Territori palestinesi",IO:"Territorio Britannico dell’Oceano Indiano",TL:"Timor Est",TG:"Togo",TK:"Tokelau",TO:"Tonga",TT:"Trinidad e Tobago",TA:"Tristan da Cunha",TN:"Tunisia",TR:"Turchia",TM:"Turkmenistan",TV:"Tuvalu",UA:"Ucraina",UG:"Uganda",HU:"Ungheria",UY:"Uruguay",UZ:"Uzbekistan",VU:"Vanuatu",VE:"Venezuela",VN:"Vietnam",WF:"Wallis e Futuna",YE:"Yemen",ZM:"Zambia",ZW:"Zimbabwe"},nl_NL:{AF:"Afghanistan",AX:"Åland",AL:"Albanië",DZ:"Algerije",AS:"Amerikaans-Samoa",VI:"Amerikaanse Maagdeneilanden",AD:"Andorra",AO:"Angola",AI:"Anguilla",AQ:"Antarctica",AG:"Antigua en Barbuda",AR:"Argentinië",AM:"Armenië",AW:"Aruba",AC:"Ascension",AU:"Australië",AZ:"Azerbeidzjan",BS:"Bahama’s",BH:"Bahrein",BD:"Bangladesh",BB:"Barbados",BE:"België",BZ:"Belize",BJ:"Benin",BM:"Bermuda",BT:"Bhutan",BO:"Bolivia",BA:"Bosnië en Herzegovina",BW:"Botswana",BR:"Brazilië",IO:"Britse Gebieden in de Indische Oceaan",VG:"Britse Maagdeneilanden",BN:"Brunei",BG:"Bulgarije",BF:"Burkina Faso",BI:"Burundi",KH:"Cambodja",CA:"Canada",IC:"Canarische Eilanden",BQ:"Caribisch Nederland",KY:"Caymaneilanden",CF:"Centraal-Afrikaanse Republiek",EA:"Ceuta en Melilla",CL:"Chili",CN:"China",CX:"Christmaseiland",CC:"Cocoseilanden",CO:"Colombia",KM:"Comoren",CG:"Congo-Brazzaville",CD:"Congo-Kinshasa",CK:"Cookeilanden",CR:"Costa Rica",CU:"Cuba",CW:"Curaçao",CY:"Cyprus",DK:"Denemarken",DG:"Diego Garcia",DJ:"Djibouti",DM:"Dominica",DO:"Dominicaanse Republiek",DE:"Duitsland",EC:"Ecuador",EG:"Egypte",SV:"El Salvador",GQ:"Equatoriaal-Guinea",ER:"Eritrea",EE:"Estland",ET:"Ethiopië",FO:"Faeröer",FK:"Falklandeilanden",FJ:"Fiji",PH:"Filipijnen",FI:"Finland",FR:"Frankrijk",GF:"Frans-Guyana",PF:"Frans-Polynesië",TF:"Franse Gebieden in de zuidelijke Indische Oceaan",GA:"Gabon",GM:"Gambia",GE:"Georgië",GH:"Ghana",GI:"Gibraltar",GD:"Grenada",GR:"Griekenland",GL:"Groenland",GP:"Guadeloupe",GU:"Guam",GT:"Guatemala",GG:"Guernsey",GN:"Guinee",GW:"Guinee-Bissau",GY:"Guyana",HT:"Haïti",HN:"Honduras",HU:"Hongarije",HK:"Hongkong SAR van China",IE:"Ierland",IS:"IJsland",IN:"India",ID:"Indonesië",IQ:"Irak",IR:"Iran",IM:"Isle of Man",IL:"Israël",IT:"Italië",CI:"Ivoorkust",JM:"Jamaica",JP:"Japan",YE:"Jemen",JE:"Jersey",JO:"Jordanië",CV:"Kaapverdië",CM:"Kameroen",KZ:"Kazachstan",KE:"Kenia",KG:"Kirgizië",KI:"Kiribati",UM:"Kleine afgelegen eilanden van de Verenigde Staten",KW:"Koeweit",XK:"Kosovo",HR:"Kroatië",LA:"Laos",LS:"Lesotho",LV:"Letland",LB:"Libanon",LR:"Liberia",LY:"Libië",LI:"Liechtenstein",LT:"Litouwen",LU:"Luxemburg",MO:"Macau SAR van China",MK:"Macedonië",MG:"Madagaskar",MW:"Malawi",MV:"Maldiven",MY:"Maleisië",ML:"Mali",MT:"Malta",MA:"Marokko",MH:"Marshalleilanden",MQ:"Martinique",MR:"Mauritanië",MU:"Mauritius",YT:"Mayotte",MX:"Mexico",FM:"Micronesia",MD:"Moldavië",MC:"Monaco",MN:"Mongolië",ME:"Montenegro",MS:"Montserrat",MZ:"Mozambique",MM:"Myanmar (Birma)",NA:"Namibië",NR:"Nauru",NL:"Nederland",NP:"Nepal",NI:"Nicaragua",NC:"Nieuw-Caledonië",NZ:"Nieuw-Zeeland",NE:"Niger",NG:"Nigeria",NU:"Niue",KP:"Noord-Korea",MP:"Noordelijke Marianen",NO:"Noorwegen",NF:"Norfolk",UG:"Oeganda",UA:"Oekraïne",UZ:"Oezbekistan",OM:"Oman",TL:"Oost-Timor",AT:"Oostenrijk",PK:"Pakistan",PW:"Palau",PS:"Palestijnse gebieden",PA:"Panama",PG:"Papoea-Nieuw-Guinea",PY:"Paraguay",PE:"Peru",PN:"Pitcairneilanden",PL:"Polen",PT:"Portugal",PR:"Puerto Rico",QA:"Qatar",RE:"Réunion",RO:"Roemenië",RU:"Rusland",RW:"Rwanda",KN:"Saint Kitts en Nevis",LC:"Saint Lucia",VC:"Saint Vincent en de Grenadines",BL:"Saint-Barthélemy",MF:"Saint-Martin",PM:"Saint-Pierre en Miquelon",SB:"Salomonseilanden",WS:"Samoa",SM:"San Marino",ST:"Sao Tomé en Principe",SA:"Saoedi-Arabië",SN:"Senegal",RS:"Servië",SC:"Seychellen",SL:"Sierra Leone",SG:"Singapore",SH:"Sint-Helena",SX:"Sint-Maarten",SI:"Slovenië",SK:"Slowakije",SD:"Soedan",SO:"Somalië",ES:"Spanje",SJ:"Spitsbergen en Jan Mayen",LK:"Sri Lanka",SR:"Suriname",SZ:"Swaziland",SY:"Syrië",TJ:"Tadzjikistan",TW:"Taiwan",TZ:"Tanzania",TH:"Thailand",TG:"Togo",TK:"Tokelau",TO:"Tonga",TT:"Trinidad en Tobago",TA:"Tristan da Cunha",TD:"Tsjaad",CZ:"Tsjechië",TN:"Tunesië",TR:"Turkije",TM:"Turkmenistan",TC:"Turks- en Caicoseilanden",TV:"Tuvalu",UY:"Uruguay",VU:"Vanuatu",VA:"Vaticaanstad",VE:"Venezuela",GB:"Verenigd Koninkrijk",AE:"Verenigde Arabische Emiraten",US:"Verenigde Staten",VN:"Vietnam",WF:"Wallis en Futuna",EH:"Westelijke Sahara",BY:"Wit-Rusland",ZM:"Zambia",ZW:"Zimbabwe",ZA:"Zuid-Afrika",GS:"Zuid-Georgia en Zuidelijke Sandwicheilanden",KR:"Zuid-Korea",SS:"Zuid-Soedan",SE:"Zweden",CH:"Zwitserland"},sv_SE:{AC:"Ascension",AD:"Andorra",AE:"Förenade Arabemiraten",AF:"Afghanistan",AG:"Antigua och Barbuda",AI:"Anguilla",AL:"Albanien",AM:"Armenien",AO:"Angola",AQ:"Antarktis",AR:"Argentina",AS:"Amerikanska Samoa",AT:"Österrike",AU:"Australien",AW:"Aruba",AX:"Åland",AZ:"Azerbajdzjan",BA:"Bosnien och Hercegovina",BB:"Barbados",BD:"Bangladesh",BE:"Belgien",BF:"Burkina Faso",BG:"Bulgarien",BH:"Bahrain",BI:"Burundi",BJ:"Benin",BL:"St Barthélemy",BM:"Bermuda",BN:"Brunei",BO:"Bolivia",BQ:"Karibiska Nederländerna",BR:"Brasilien",BS:"Bahamas",BT:"Bhutan",BW:"Botswana",BY:"Vitryssland",BZ:"Belize",CA:"Kanada",CC:"Kokosöarna",CD:"Kongo-Kinshasa",CF:"Centralafrikanska republiken",CG:"Kongo-Brazzaville",CH:"Schweiz",CI:"Elfenbenskusten",CK:"Cooköarna",CL:"Chile",CM:"Kamerun",CN:"Kina",CO:"Colombia",CR:"Costa Rica",CU:"Kuba",CV:"Kap Verde",CW:"Curaçao",CX:"Julön",CY:"Cypern",CZ:"Tjeckien",DE:"Tyskland",DG:"Diego Garcia",DJ:"Djibouti",DK:"Danmark",DM:"Dominica",DO:"Dominikanska republiken",DZ:"Algeriet",EA:"Ceuta och Melilla",EC:"Ecuador",EE:"Estland",EG:"Egypten",EH:"Västsahara",ER:"Eritrea",ES:"Spanien",ET:"Etiopien",FI:"Finland",FJ:"Fiji",FK:"Falklandsöarna",FM:"Mikronesien",FO:"Färöarna",FR:"Frankrike",GA:"Gabon",GB:"Storbritannien",GD:"Grenada",GE:"Georgien",GF:"Franska Guyana",GG:"Guernsey",GH:"Ghana",GI:"Gibraltar",GL:"Grönland",GM:"Gambia",GN:"Guinea",GP:"Guadeloupe",GQ:"Ekvatorialguinea",GR:"Grekland",GS:"Sydgeorgien och Sydsandwichöarna",GT:"Guatemala",GU:"Guam",GW:"Guinea-Bissau",GY:"Guyana",HK:"Hongkong (S.A.R. Kina)",HN:"Honduras",HR:"Kroatien",HT:"Haiti",HU:"Ungern",IC:"Kanarieöarna",ID:"Indonesien",IE:"Irland",IL:"Israel",IM:"Isle of Man",IN:"Indien",IO:"Brittiska territoriet i Indiska oceanen",IQ:"Irak",IR:"Iran",IS:"Island",IT:"Italien",JE:"Jersey",JM:"Jamaica",JO:"Jordanien",JP:"Japan",KE:"Kenya",KG:"Kirgizistan",KH:"Kambodja",KI:"Kiribati",KM:"Komorerna",KN:"St Kitts och Nevis",KP:"Nordkorea",KR:"Sydkorea",KW:"Kuwait",KY:"Caymanöarna",KZ:"Kazakstan",LA:"Laos",LB:"Libanon",LC:"St Lucia",LI:"Liechtenstein",LK:"Sri Lanka",LR:"Liberia",LS:"Lesotho",LT:"Litauen",LU:"Luxemburg",LV:"Lettland",LY:"Libyen",MA:"Marocko",MC:"Monaco",MD:"Moldavien",ME:"Montenegro",MF:"St Martin",MG:"Madagaskar",MH:"Marshallöarna",MK:"Makedonien",ML:"Mali",MM:"Myanmar (Burma)",MN:"Mongoliet",MO:"Macao (S.A.R. Kina)",MP:"Nordmarianerna",MQ:"Martinique",MR:"Mauretanien",MS:"Montserrat",MT:"Malta",MU:"Mauritius",MV:"Maldiverna",MW:"Malawi",MX:"Mexiko",MY:"Malaysia",MZ:"Moçambique",NA:"Namibia",NC:"Nya Kaledonien",NE:"Niger",NF:"Norfolkön",NG:"Nigeria",NI:"Nicaragua",NL:"Nederländerna",NO:"Norge",NP:"Nepal",NR:"Nauru",NU:"Niue",NZ:"Nya Zeeland",OM:"Oman",PA:"Panama",PE:"Peru",PF:"Franska Polynesien",PG:"Papua Nya Guinea",PH:"Filippinerna",PK:"Pakistan",PL:"Polen",PM:"St Pierre och Miquelon",PN:"Pitcairnöarna",PR:"Puerto Rico",PS:"Palestinska territorierna",PT:"Portugal",PW:"Palau",PY:"Paraguay",QA:"Qatar",RE:"Réunion",RO:"Rumänien",RS:"Serbien",RU:"Ryssland",RW:"Rwanda",SA:"Saudiarabien",SB:"Salomonöarna",SC:"Seychellerna",SD:"Sudan",SE:"Sverige",SG:"Singapore",SH:"St Helena",SI:"Slovenien",SJ:"Svalbard och Jan Mayen",SK:"Slovakien",SL:"Sierra Leone",SM:"San Marino",SN:"Senegal",SO:"Somalia",SR:"Surinam",SS:"Sydsudan",ST:"São Tomé och Príncipe",SV:"El Salvador",SX:"Sint Maarten",SY:"Syrien",SZ:"Swaziland",TA:"Tristan da Cunha",TC:"Turks- och Caicosöarna",TD:"Tchad",TF:"Franska sydterritorierna",TG:"Togo",TH:"Thailand",TJ:"Tadzjikistan",TK:"Tokelau",TL:"Östtimor",TM:"Turkmenistan",TN:"Tunisien",TO:"Tonga",TR:"Turkiet",TT:"Trinidad och Tobago",TV:"Tuvalu",TW:"Taiwan",TZ:"Tanzania",UA:"Ukraina",UG:"Uganda",UM:"USAs yttre öar",US:"USA",UY:"Uruguay",UZ:"Uzbekistan",VA:"Vatikanstaten",VC:"St Vincent och Grenadinerna",VE:"Venezuela",VG:"Brittiska Jungfruöarna",VI:"Amerikanska Jungfruöarna",VN:"Vietnam",VU:"Vanuatu",WF:"Wallis- och Futunaöarna",WS:"Samoa",XK:"Kosovo",YE:"Jemen",YT:"Mayotte",ZA:"Sydafrika",ZM:"Zambia",ZW:"Zimbabwe"}}).factory("ketaCountryUtils",function(ketaCountryUtilsMessageKeys){var factory={};return factory.getCountryList=function(currentLocale,accessor){var countries=[],shortLocale=angular.isString(currentLocale)&¤tLocale.length>=5?currentLocale.substr(0,5):"";return angular.isObject(ketaCountryUtilsMessageKeys[currentLocale])||(currentLocale=angular.isObject(ketaCountryUtilsMessageKeys[shortLocale])?shortLocale:"en_GB"),angular.forEach(ketaCountryUtilsMessageKeys[currentLocale],function(countryName,countryIsoCode){countries.push(angular.isFunction(accessor)?accessor(countryName,countryIsoCode):{key:countryIsoCode,value:countryName})}),countries},factory});
//# sourceMappingURL=keta.min.js.map